Skip to content

feat: shared reference handling for mutable types, v0.23.0#46

Merged
keithdv merged 1 commit intomainfrom
feat/shared-reference-handling
Mar 21, 2026
Merged

feat: shared reference handling for mutable types, v0.23.0#46
keithdv merged 1 commit intomainfrom
feat/shared-reference-handling

Conversation

@keithdv
Copy link
Contributor

@keithdv keithdv commented Mar 21, 2026

Summary

  • Restores $id/$ref reference tracking for mutable reference types (Dictionary, List, plain classes with default constructors) via NeatooPreserveReferenceHandler
  • Records (value objects with parameterized constructors) bypass reference handling via RecordBypassConverterFactory — correct DDD behavior, not a limitation
  • Both paths share the same NeatooReferenceResolver instance for cross-type reference identity
  • New appendix documentation (docs/appendix/record-reference-handling.md) explaining the DDD rationale and STJ limitation

Test plan

  • Phase 1 exploration tests (6 scenarios) — reproduce STJ behavior
  • Phase 2 acceptance tests (5 scenarios) — shared Dictionary, circular refs, cross-type, record+mutable mixed, record round-trip
  • All existing tests pass unchanged (490 unit + 498 integration + 42 design per framework)
  • InterfaceFactory_NonNeatooType_NoRefMetadata passes unchanged
  • Both net9.0 and net10.0 verified

🤖 Generated with Claude Code

Restores $id/$ref reference tracking for mutable reference types (Dictionary, List,
plain classes) while keeping records safe from STJ's parameterized-constructor limitation.

Two new components:
- NeatooPreserveReferenceHandler: bridges STJ built-in converters to NeatooReferenceResolver.Current
- RecordBypassConverterFactory: claims parameterized-constructor types, delegates to inner
  options without ReferenceHandler (DDD: records are value objects, identity doesn't matter)

Both paths share the same NeatooReferenceResolver instance for cross-type reference identity.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@keithdv keithdv merged commit 096ce3b into main Mar 21, 2026
2 checks passed
@keithdv keithdv deleted the feat/shared-reference-handling branch March 21, 2026 19:47
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