Repository navigation
fix: accept shared objects in boolean object guards - #454
Conversation
The boolean object guard now removes each object from its reference map when the branch finishes, so only the active recursion path is tracked. An object shared by sibling properties is no longer reported as a circular reference, matching validate() and validateAll(). Closes #449 Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019BJENnU8SXcDH2Tcx5EWE4
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #454 +/- ##
=======================================
Coverage 98.45% 98.46%
=======================================
Files 52 52
Lines 3049 3055 +6
Branches 327 327
=======================================
+ Hits 3002 3008 +6
Misses 46 46
Partials 1 1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
gjbkz
left a comment
There was a problem hiding this comment.
Reviewed commit c06fd0e050765e68a1ef1595f8f27d9cf36f9c26. No actionable issues found in this change.
Removing each object from refs in a finally block restricts tracking to the active recursion path, allowing shared acyclic children while retaining the existing exception for actual cycles. The added coverage exercises exact/open shapes and nested shared references. I also checked a shared object against distinct constraints.
Validation: the complete source unit-test suite passed locally on this reviewed version, and the GitHub Actions test workflow for this commit completed successfully. The latest head is unchanged from the locally tested version.
Requested by Kei · project thread
Before:
isPair({ left: person, right: person })threwCircularReference: T.left -> T.rightwhen the same object appeared under two sibling properties, whilevalidate()andvalidateAll()accepted it.After: shared, acyclic objects pass the boolean guard, matching structured validation. Real cycles still throw
CircularReference.How: the object guard now removes the object from its reference map in a
finallyblock once the branch is done, so the map only holds the active recursion path, as the diagnosis path already does. Tests cover exact and open object checkers, a shared object checked against two different shapes, nesting, and a real cycle reached through a shared object; the shared-object test fails onmainand passes here.Closes #449
🤖 Generated with Claude Code
https://claude.ai/code/session_019BJENnU8SXcDH2Tcx5EWE4
Generated by Claude Code