Merge remote-tracking branch 'origin/main' into feat/persistent-workspace-investigation-runs

# Conflicts:
#	README.md
#	scripts/verify-package.mjs
#	src/cli.ts
#	src/domain/errors.ts
#	src/server/registerInvestigationTools.ts
#	tests/errors.test.ts
This commit is contained in:
morluto
2026-07-14 04:28:14 +08:00
91 changed files with 4402 additions and 711 deletions
+34 -9
View File
@@ -37,7 +37,7 @@ describe("analysis error projection", () => {
);
});
it("exhaustively projects stable tags without causes or local paths", () => {
it("projects every typed failure without internal details", () => {
const secretCause = new Error("secret-token");
const byTag = {
AnalysisProtocolError: new AnalysisProtocolError("protocol failed"),
@@ -103,17 +103,42 @@ describe("analysis error projection", () => {
} satisfies Readonly<Record<AnalysisErrorTag, AnalysisError>>;
const errors = Object.values(byTag);
const projected = errors.map(projectAnalysisError);
expect(new Set(projected.map(({ tag }) => tag)).size).toBe(errors.length);
expect(projected).toHaveLength(24);
expect(JSON.stringify(projected)).not.toContain("secret-token");
expect(JSON.stringify(projected)).not.toContain("/secret/local/path");
const serialized = JSON.stringify(projected);
for (const hidden of [
"secret-token",
"/secret/local/path",
"fixture",
"overview",
"AnalysisCapabilityUnavailableError",
"main.js",
"declaredSha256",
])
expect(serialized).not.toContain(hidden);
expect(
projected.find(({ tag }) => tag === "HopperTimeoutError"),
).toMatchObject({ details: { timeoutMs: 100 } });
expect(
projected.find(({ tag }) => tag === "ProviderAdapterError"),
projectAnalysisError(byTag.AnalysisCapabilityUnavailableError),
).toMatchObject({
details: { providerId: "fixture", operation: "overview" },
category: "unsupported_provider",
});
expect(
projectAnalysisError(
new ArtifactOperationError("inventory_artifact", "integrity", {
logicalPath: "main.js",
declaredSha256: "a".repeat(64),
calculatedSha256: "b".repeat(64),
unpacked: true,
}),
),
).toMatchObject({
category: "integrity_mismatch",
});
expect(projected.every(({ message }) => message.length > 0)).toBe(true);
expect(
projected.every(({ message }) =>
/try again|run `rea doctor`|current target|when ready|smaller request|smaller artifact|fresh copy|re-import|reduce|inline evidence|configured evidence directory|evidence file|allow overwrite|refresh the current state|reported setting|call open_binary|supported file|review capture policy/u.test(
message,
),
),
).toBe(true);
});
});