Repository navigation
fix(captures): name the violated HAR schema constraint - #2708
Merged
Merged
Conversation
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]>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Contributor
|
3 tasks done
2 tasks done
2 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
rea inspect-web-network-capture <capture.har> haron a HAR that is missing a required field (herelog.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
createHarValidatornow 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
verboseoff, 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 existinginstancePathissue path is unchanged.Validation
src/browser/history/HarCapture.test.tsasserts the property-naming message for a HAR missinglog.version.npm run test:focusedon all 19 test files touchingdecodeHarCapture/inspect_web_network_capture: 211 passed, 4 skipped.npm run check:fastpasses.🤖 Generated with Claude Code