Skip to content

fix(snapshot): reject non-object format markers (#746) - #747

Merged
kstonekuan merged 1 commit into
Hebbian-Robotics:mainfrom
harsh21234i:fix/746-verify-snapshot-json-root
Oct 29, 2026
Merged

kstonekuan merged 1 commit into
Hebbian-Robotics:mainfrom
harsh21234i:fix/746-verify-snapshot-json-root

Conversation

@harsh21234i

@harsh21234i harsh21234i commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Reject non-object values in the top-level format.json before accessing its fields.
  • Return a clear invalid-input error and exit code 2 instead of an AttributeError traceback.
  • Add regression coverage for null, arrays, strings, and numbers.

Why

Valid JSON does not necessarily contain a valid snapshot marker. Previously, a non-object root caused hflow verify snapshot to crash with an unhandled exception.

Validation

  • uv run pytest -q -n 4 — 2,615 passed, 8 skipped
  • uv run pytest -q tests/test_snapshot_verify.py — 41 passed
  • uv run ruff check — passed
  • uv run ruff format --check — passed
  • uv run ty check — passed

Closes #746


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.

@greptile-apps

greptile-apps Bot commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Low impact] The PR appears safe to merge.

Summary

Rejects non-object roots in format.json before accessing marker fields.

  • Snapshot verification rejects non-object format markers cleanly.

Reviews (1) · Last reviewed commit: "fix(snapshot): reject non-object format ..." · Reviewed by Greptile

@kstonekuan kstonekuan left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the fix. Ruff, ty, the snapshot regressions, and both Python CI jobs pass. Merging.

@kstonekuan
kstonekuan merged commit d02af6f into Hebbian-Robotics:main Oct 29, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: verify snapshot crashes when format.json contains a non-object JSON value

2 participants