v0.35.3.2 docs(designs): MERGE_PHANTOMS retrospective + future-implementation guide#1109
Open
garrytan wants to merge 1 commit into
Open
v0.35.3.2 docs(designs): MERGE_PHANTOMS retrospective + future-implementation guide#1109garrytan wants to merge 1 commit into
garrytan wants to merge 1 commit into
Conversation
… guide A 482-line design retrospective on the `gbrain merge-phantoms` operator command that was built and then stripped from closed PR #1010 after 30 rounds of codex review. The doc captures everything a future implementer needs to pick the work up cleanly: - Problem statement: what a phantom is, why they exist, why the fix motivated D7 of the eng-review. - What the command was supposed to do, and what was actually built. - The 30-round codex cascade table: every finding (4 P1 + ~40 P2), each fix, each fix-of-fix. The pattern is clear: defensive checks defending the wrong shape. - The meta-insight: the fence is the v0.32.2 system of record. A destructive cleanup command that mutates fence + DB independently has to re-implement reconciliation logic that already lives in the extract_facts cycle phase. That duplication is the bug farm. - Three alternative-design speculations: Alpha (report-only command, manual remediation), Beta (hook into extract_facts cycle — recommended, ~150 lines), Gamma (canonical_of column for first- class phantom support). - Regression checklist extracted from the codex iteration: real fence markers, MAX_SEARCH_LIMIT clamping, stale compiled_truth, embedding driver shape variance, source resolution chain, bi-directional fence drift, etc. The next implementer treats these as a test-coverage backlog. - Lessons learned for the next destructive cleanup command in the codebase: do the design work BEFORE the implementation; resist bolting follow-ups onto a fix PR; codex catches drift, but only the human can name when an abstraction itself is wrong. The closed PR #1010 commits remain available in git history as the worked example of every gotcha. Read them as a regression checklist; do not refactor them into the next attempt. Plan: ~/.claude/plans/mossy-popping-crown.md. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
482-line design retrospective on the
gbrain merge-phantomsoperator command that was built and then stripped from closed PR #1010 after 30 rounds of codex review.The fence-and-cleanup work itself is captured (and superseded) by PR #1085. This PR exists to preserve the institutional knowledge of what went wrong in the cleanup-command attempt so the next implementer doesn't repeat it.
What's in the doc
extract_facts. That duplication IS the bug farm.extract_factscycle phase. Recommended. Reuses every drift-handling pathway that's already battle-tested.canonical_ofcolumn for first-class phantom support. Also unlocks general alias support.Why this is its own PR
The closed PR #1010 commits are still in git history as the worked example of every gotcha. Treat them as a regression checklist; don't refactor them into the next attempt. PR #1085 supersedes the resolver+stub-guard+backstop fix layers with a structurally cleaner implementation. The merge-phantoms cleanup remains unfinished work — this doc is the bridge from "30 rounds of bug-farm iteration" to "next implementer ships Option Beta cleanly."
Test plan
bun run verifyclean.bun run typecheckclean.🤖 Generated with Claude Code