Reverse engineer anything with agents, from app behavior down to native binaries.
TypeScript agent-skillsai-agentsbinary-analysisclaude-codeclicodexcordisdecompilerdeveloper-toolsdshdsh-pluginghidrahopperllmmcpmodel-context-protocolreareverse-engineeringstatic-analysistouhou
fix(captures): name the violated HAR schema constraint (#2708)
Kaoru0822b69d20a300db
diff --git a/src/browser/history/HarCapture.test.ts b/src/browser/history/HarCapture.test.tsindex 9614384cc..b931fda06 100644--- a/src/browser/history/HarCapture.test.ts+++ b/src/browser/history/HarCapture.test.ts@@ -162,6 +162,19 @@ it("rejects identical duplicate core fields before schema validation", () => {expect(() => decodeHarCapture(text, [])).toThrow("duplicate");});+it("names the violated HAR schema constraint without restating capture values", () => {+ expect(() =>+ decodeHarCapture(+ JSON.stringify({+ log: { creator: { name: "x", version: "1" }, entries: [] },+ }),+ [],+ ),+ ).toThrow(+ "HAR schema validation failed: required (must have required property 'version').",+ );+});+it("preserves prototype-named producer members through the capture boundary", () => {const text = JSON.stringify(historicalHar()).replace('"cache":{}',diff --git a/src/browser/history/HarSchema.ts b/src/browser/history/HarSchema.tsindex 069377f8a..add8c301e 100644--- a/src/browser/history/HarSchema.ts+++ b/src/browser/history/HarSchema.ts@@ -23,9 +23,13 @@ export const createHarValidator = (): ((value: unknown) => void) => {allowMitmproxyAbsentPostData(value);if (!validate(value)) {const error = validate.errors?.[0];+ // AJV messages name the violated constraint, such as the missing+ // property, without restating any captured value.throw new CaptureFormatError("format",- `HAR schema validation failed: ${error?.keyword ?? "unknown constraint"}.`,+ error === undefined+ ? "HAR schema validation failed: unknown constraint."+ : `HAR schema validation failed: ${error.keyword} (${error.message ?? "no detail"}).`,error?.instancePath ?? "",);}