Skip to content

fix(captures): name the violated HAR schema constraint - #2708

Merged
morluto merged 2 commits into
mainfrom
fix/har-schema-failure-detail
Oct 13, 2026
Merged

morluto merged 2 commits into
mainfrom
fix/har-schema-failure-detail

Conversation

@kaoru0822-kitauji

Copy link
Copy Markdown
Collaborator

Problem

rea inspect-web-network-capture <capture.har> har on a HAR that is missing a required field (here log.version) returned:

{"path":["capture_path","/log"],"reason":"invalid_format","message":"HAR schema validation failed: required."}

The message gives the AJV keyword (required) but not which property is required, so the caller can't fix the capture without validating it again with another tool.

Fix

createHarValidator now appends AJV's own constraint message:

{"path":["capture_path","/log"],"reason":"invalid_format","message":"HAR schema validation failed: required (must have required property 'version')."}

AJV messages describe the schema constraint: the missing property name, the expected type, a format or pattern from the pinned schema. With verbose off, as it is here, they never include instance data, so this adds no captured values to the error. The keyword stays as the message prefix, and the existing instancePath issue path is unchanged.

Validation

  • New unit test in src/browser/history/HarCapture.test.ts asserts the property-naming message for a HAR missing log.version.
  • npm run test:focused on all 19 test files touching decodeHarCapture / inspect_web_network_capture: 211 passed, 4 skipped.
  • npm run check:fast passes.
  • Manual CLI check: output before and after is shown above.

🤖 Generated with Claude Code

HAR validation reported only the AJV keyword, so a capture missing
`log.version` failed with "HAR schema validation failed: required." and
the caller could not tell which property to supply. Include AJV's
constraint message, which names the missing property, expected type, or
pattern without restating captured values.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-13T08:23:20.481871Z 65362c5 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@greptile-apps

greptile-apps Bot commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

[Low impact] The PR appears safe to merge; no actionable issue was found.

Summary

The PR adds AJV's constraint message to HAR validation errors, so callers can identify a missing property. It keeps the existing keyword prefix and issue path.

  • HAR schema errors now say which rule the capture breaks.

Reviews (1) · Last reviewed commit: "Merge remote-tracking branch 'origin/mai..." · Reviewed by Greptile

@morluto
morluto merged commit b69d20a into main Oct 13, 2026
3 checks passed
@morluto
morluto deleted the fix/har-schema-failure-detail branch October 13, 2026 08:22
@morluto morluto mentioned this pull request Oct 13, 2026
3 tasks done
@morluto morluto added bug Something isn't working area: runtime Process capture and runtime observation labels Oct 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: runtime Process capture and runtime observation bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants