Skip to content

Add cycle detection to the encoder#33

Merged
ajg merged 3 commits intomasterfrom
v1.7.1
Feb 18, 2026
Merged

Add cycle detection to the encoder#33
ajg merged 3 commits intomasterfrom
v1.7.1

Conversation

@ajg
Copy link
Owner

@ajg ajg commented Feb 18, 2026

Summary

  • Thread a seen pointer set through encoding functions to detect self-referential pointers and maps, returning an error instead of stack overflow
  • Backtracking (add/remove from seen) correctly handles DAGs without false positives
  • Remove the now-resolved "Limitations" section from the README

Test plan

  • TestEncode_Cycle covers self-referential struct pointer, self-referential map, and non-cyclic DAG
  • All existing tests pass (go test ./...)

Silvio and others added 3 commits February 18, 2026 16:04
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Thread a seen-pointer set through encoding functions so that
self-referential pointers and maps are detected and returned as
errors instead of causing a stack overflow.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Circular values are now detected and reported as errors, so the
limitation no longer applies.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@ajg ajg merged commit 20113a6 into master Feb 18, 2026
7 checks passed
@ajg ajg deleted the v1.7.1 branch February 18, 2026 16:30
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.

1 participant

Comments