Skip to content

armgit / rea

Public Imported from GitHub
0

Reverse engineer anything with agents, from app behavior down to native binaries.

test(evidence): cover workflow question whitespace normalization (#1739)

林桉b2da21abe11a
diff --git a/src/application/WorkflowEvidence.test.ts b/src/application/WorkflowEvidence.test.ts
index 5ca63d15e..dab61a79c 100644
--- a/src/application/WorkflowEvidence.test.ts
+++ b/src/application/WorkflowEvidence.test.ts
@@ -46,6 +46,63 @@ describe("workflow residual question retention", () => {
]);
});
+ it.each([
+ ["spaces", " Which boundary? "],
+ ["line feed and tab", "\nWhich boundary?\t"],
+ ["byte order mark", "\uFEFFWhich boundary?\uFEFF"],
+ ])(
+ "normalizes edge whitespace from %s without changing workflow Evidence",
+ (_, question) => {
+ const records = new InvestigationRecords();
+ const result = { residual_unknowns: [question] };
+ const evidence = createWorkflowEvidence({
+ target: undefined,
+ operation: "inspect_native_api",
+ parameters: {},
+ result,
+ upstreamProfile: undefined,
+ });
+
+ expect(records.recordEvidence(evidence).ok).toBe(true);
+ expect(
+ recordWorkflowUnknowns({
+ name: "inspect_native_api",
+ result,
+ evidenceId: evidence.evidence_id,
+ recordUnknown: (unknown) => records.recordUnknown(unknown),
+ }).ok,
+ ).toBe(true);
+ expect(records.listUnknowns()).toMatchObject([
+ { question: "Which boundary?" },
+ ]);
+ expect(evidence.normalized_result).toEqual(result);
+ },
+ );
+
+ it("rejects questions that are empty after whitespace normalization", () => {
+ const records = new InvestigationRecords();
+ const result = { residual_unknowns: [" \n\t "] };
+ const evidence = createWorkflowEvidence({
+ target: undefined,
+ operation: "inspect_native_api",
+ parameters: {},
+ result,
+ upstreamProfile: undefined,
+ });
+
+ expect(records.recordEvidence(evidence).ok).toBe(true);
+ expect(
+ recordWorkflowUnknowns({
+ name: "inspect_native_api",
+ result,
+ evidenceId: evidence.evidence_id,
+ recordUnknown: (unknown) => records.recordUnknown(unknown),
+ }).ok,
+ ).toBe(false);
+ expect(records.listUnknowns()).toEqual([]);
+ expect(evidence.normalized_result).toEqual(result);
+ });
+
it("preserves registry failures rather than presenting a completed workflow", () => {
const error = new UnknownRegistryError("limit");
expect(