mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-11-23 04:54:00 +01:00
test(runner): distinguish Pi blank transport from form support
Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
1 parent
bb00c85b69
commit
72ded17946
2 files changed
+24
-2
No files matched your search
@@ -8,7 +8,14 @@ name. Titles and select labels admit at most 1,000 UTF-16 code units, matching
|
||||
the canonical question contract. Invalid owned arguments fail before a UI promise;
|
||||
unsupported external UI requests emit an explicit error notice and stop the session.
|
||||
The editor draft requires the shared `initialText` normalization and editable UI
|
||||
roundtrip. These repairs change the native closure and require fresh qualification;
|
||||
roundtrip. Blank initial drafts are valid, but accepted empty or whitespace-only
|
||||
input/editor answers are not currently representable: the canonical required-text
|
||||
form prevents submission with a required-answer message, and its response
|
||||
validator rejects blank text. Making
|
||||
Pi fields optional alone would still drop those answers; no adapter fallback
|
||||
invents an empty response. The transport distinguishes empty accept from cancel,
|
||||
but that direct bridge property is not full Product support. A future explicit
|
||||
canonical empty-text opt-in would need matching persisted-response and UI checks. These repairs change the native closure and require fresh qualification;
|
||||
no v7 paid Product or Runner proof exists yet. The canonical
|
||||
[v7 declaration](../../packages/paperclip-runner/test-fixtures/pi-acp/profile-v7-identity.json)
|
||||
binds the exact wrapper, helper, extension and three target closures.
|
||||
|
||||
@@ -69,7 +69,7 @@ describe("Pi ACP bridge", () => {
|
||||
expect(f.process.sendExtensionUiResponse).toHaveBeenCalledExactlyOnceWith({ id: "q1", ...expected });
|
||||
});
|
||||
|
||||
it("retains blank editor prefill and distinguishes an accepted empty string from cancellation", async () => {
|
||||
it("transport preserves blank editor prefill and empty accept independently of canonical required validation", async () => {
|
||||
const f = fixture(); f.connection.unstable_createElicitation.mockResolvedValue({ action: "accept", content: { answer: "" } });
|
||||
await f.bridge.handle({ id: "blank", method: "editor", title: "Draft", prefill: "" });
|
||||
expect(f.connection.unstable_createElicitation.mock.calls[0]![0]).toMatchObject({ requestedSchema: { properties: { answer: { default: "" } } } });
|
||||
@@ -79,6 +79,21 @@ describe("Pi ACP bridge", () => {
|
||||
expect(f.process.sendExtensionUiResponse).toHaveBeenLastCalledWith({ id: "dismissed", cancelled: true });
|
||||
});
|
||||
|
||||
it.each(["input", "editor"])("documents canonical %s blank-answer rejection without inventing an empty accept", async method => {
|
||||
const f = fixture();
|
||||
f.connection.unstable_createElicitation.mockImplementation(async request => {
|
||||
const normalized = normalizeAcpFormElicitation(request)!;
|
||||
const question = normalized.questionSet.questions[0]!;
|
||||
expect(question.required).toBe(true);
|
||||
for (const text of ["", " \n\t"]) {
|
||||
expect(() => normalized.accept({ schema: "paperclip.question_response.v1", answers: { [question.id]: { text } } })).toThrow("is required");
|
||||
}
|
||||
return normalized.accept({ schema: "paperclip.question_response.v1", answers: { [question.id]: { text: "\nAccepted text\n" } } });
|
||||
});
|
||||
await f.bridge.handle({ id: "canonical", method, title: "Draft", prefill: "" });
|
||||
expect(f.process.sendExtensionUiResponse).toHaveBeenCalledExactlyOnceWith({ id: "canonical", value: "\nAccepted text\n" });
|
||||
});
|
||||
|
||||
it.each(["a".repeat(1000), "界".repeat(1000), "🌒".repeat(500)])("passes the canonical character limit through the real form normalizer", async (label) => {
|
||||
const f = fixture();
|
||||
f.connection.unstable_createElicitation.mockImplementation(async request => {
|
||||
|
||||
Reference in new issue
Block a user