refactor(subtreevalidation): remove redundant orphanage; rely on sequential revalidation#978
Conversation
|
🤖 Claude Code Review Status: Complete No issues found. This PR successfully removes the redundant orphanage mechanism with clean refactoring and comprehensive documentation updates. Review Summary: Correctness: The removal is well-justified. The PR description clearly documents that three independent mechanisms already guarantee parent-before-child resolution:
Code Quality:
Documentation Accuracy:
Testing:
Compatibility:
The refactoring is minimal, focused, and safe. |
Benchmark Comparison ReportBaseline: Current: Summary
All benchmark results (sec/op)
Threshold: >10% with p < 0.05 | Generated: 2026-05-28 14:02 UTC |
|
Thanks for the review. Triage of the medium/minor findings: Stale orphanage references in Test coverage of the Kafka-failure path. Took the suggestion to confirm existing coverage rather than add a new bespoke test:
Verification disclosure. Test plan in the PR description ran
|
|


Summary
Remove the
Orphanagemechanism fromservices/subtreevalidationend to end — type, callers, settings, tests, and docs. Net diff: 15 files, +45 / -1632.Cross-subtree parent ordering in the block path is already handled by
validateMissingSubtreesWithOrderedRetry(Phase-3 ordered sequential revalidation). The function's own contract states: "One ordered pass is therefore sufficient; any remaining failure is a real validation error, not an ordering artefact."processOrphansran after Phase-3, so it was a redundant trailing sweep.Why
Review of the current code identified three independent mechanisms that already guarantee parent-before-child resolution without the orphanage:
processTransactionsInLevels— driven bymissingParentErrors, not the orphanage. Hands cross-batch parents to the sequential pass.Additional smells supporting redundancy:
errorsFoundstill triggered a failure return); the only re-bless (processOrphans) was never called there.FSM == RUNNING, so it was inactive during initial sync — exactly when out-of-order is most likely — yet sync works.Kafka-path missing-parent behavior is intentionally unchanged (subtree still fails; block path remains the backstop).
Test Plan
go build ./...go vet -tags testtxmetacache ./services/subtreevalidation/... ./settings/...— cleango test -race -tags testtxmetacache ./services/subtreevalidation/...— pass (~162s)go test -race ./settings/...— pass (~1.8s)golangci-lint run ./services/subtreevalidation/... ./settings/...— only pre-existingpreallocfindings in untouched test filesTestProcessTransactionsInLevels/MissingParentErrorscontinues to pass, now asserting the deferral instead of orphanage membershipNotes for operators
settings.conf/ env vars namingsubtreevalidation_orphanageTimeoutorsubtreevalidation_orphanageMaxSizewill be silently ignored — no startup break."added N to orphanage"log line should switch to"deferred to sequential revalidation".Closes #4641