[PR #2708] [MERGED] fix(captures): name the violated HAR schema constraint #5331

Closed
opened 2026-10-31 01:05:48 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/2708
Author: @kaoru0822-kitauji
Created: 10/13/2026
Status: ✅ Merged
Merged: 10/13/2026
Merged by: @morluto

Base: main ← Head: fix/har-schema-failure-detail


📝 Commits (2)

  • 7bc6853 fix(captures): name the violated HAR schema constraint
  • 65362c5 Merge remote-tracking branch 'origin/main' into fix/har-schema-failure-detail

📊 Changes

2 files changed (+18 additions, -1 deletions)

View changed files

📝 src/browser/history/HarCapture.test.ts (+13 -0)
📝 src/browser/history/HarSchema.ts (+5 -1)

📄 Description

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


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/morluto/rea/pull/2708 **Author:** [@kaoru0822-kitauji](https://github.com/kaoru0822-kitauji) **Created:** 10/13/2026 **Status:** ✅ Merged **Merged:** 10/13/2026 **Merged by:** [@morluto](https://github.com/morluto) **Base:** `main` ← **Head:** `fix/har-schema-failure-detail` --- ### 📝 Commits (2) - [`7bc6853`](https://github.com/morluto/rea/commit/7bc6853bbba4bdcf306e5d960fbdd83f404ffac0) fix(captures): name the violated HAR schema constraint - [`65362c5`](https://github.com/morluto/rea/commit/65362c542fe156ac7751ff58aae24f9ff9bb643c) Merge remote-tracking branch 'origin/main' into fix/har-schema-failure-detail ### 📊 Changes **2 files changed** (+18 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `src/browser/history/HarCapture.test.ts` (+13 -0) 📝 `src/browser/history/HarSchema.ts` (+5 -1) </details> ### 📄 Description ## Problem `rea inspect-web-network-capture <capture.har> har` on a HAR that is missing a required field (here `log.version`) returned: ```json {"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: ```json {"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](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-31 01:05:48 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
morluto/rea#5331
No description provided.