Repository navigation
fix(rename-prefix): --repair keeps each issue's suffix when its destination is free - #8473
Conversation
|
This PR has been added to the review queue. Track progress: https://factory.gascity.com/city/maintainer-city/runs/gcg--9223372036829686944 |
|
Triage: |
bee-ghosttrack
left a comment
There was a problem hiding this comment.
Requesting changes at a3dc7d3. The suffix-keeping planner, the collision fallback, the dry-run/real-run agreement and --mint-only all hold (every credited test passes in my hand in all three tiers, and the six mutants I ran on the planner, the re-point loop, the text rewrite and the mint-only write are each killed), but two things regress against main and one claim in the body is not in the PR.
-
cmd/bd/rename_prefix.go:458:strings.HasPrefix(id, targetPrefix+"-")counts every row whose source prefix EXTENDS the target with a hyphen as already on target. Reproduced with the headbdand the merge-basebdon the same embedded rig:beads-a1bplusbeads-vscode-1(an allowed, explicit id), thenbd rename-prefix beads --repair --dry-run. Main plansbeads-vscode-1 -> beads-f7de9c58; the head plans "Would repair 0 issues", the real run prints "Successfully consolidated 2 prefixes into beads, 0 issues repaired", and the database is then stuck: a plainrename-prefixrefuses on multiple prefixes and--repairis a no-op forever. The case is pinned on purpose (rename_prefix_rewrite_test.go:424,beads-vscode-1under targetbeadswants "") to protect custom target ids likekb-adr-0001, but the trade is silent. A row whose longest known prefix (declared inallowed_prefixes, or detected) is a longer source prefix should still be renamed, or the run should refuse and name the rows it left under a second detected prefix instead of printing success. -
cmd/bd/rename_prefix.go:770-773: the source-renamed branch classifies the edge withIsExternalDepTarget(was, dep.DependsOnID), butdep.DependsOnIDis the CURRENT target, which storage has already re-pointed for same-prefix edges (UpdateIssueIDInDependenciesInTx). So every edge that was same-prefix before the repair and has both ends renamed (every parent-child edge of a kept family, everytaxdb-a -> taxdb-bblocks edge) reads as "was cross-prefix" (taxdb-avskb-b) and is removed and re-added.AddDependencyInTxstampsUTC_TIMESTAMP()and the actor, socreated_atandcreated_byof those edges are reset to the repair (shown in the hand check: the kept family's parent-child edge carries the repair time on the head and the child's create time on main), the journal gets a remove/add pair per edge, and a failure between the remove and the add drops the edge, since the loop is not in a transaction. Classify against the original target instead (mapdep.DependsOnIDback through the old-id map before askingIsExternalDepTarget), and add an assertion on edgecreated_attoTestRepairPrefixesKeepsDottedChildren, which is why no credited test caught it. -
Credit: the body says #6621 by @rjgeng "is credited, not ported", but no commit trailer, CHANGELOG bullet or doc names @rjgeng or #6621, and the issue reporter @cpliakas is not named either. The CHANGELOG convention is there to copy ("reported and first fixed by @NahumLitvin in #7794", "#6080, reported by @dmcp718"). Please make the
--repairbullet read "(#6591, reported by @cpliakas; suffix preservation first proposed by @rjgeng in #6621)".
What I ran at the head, in my hand:
CGO_ENABLED=1 go test -count=1 -tags gms_pure_go ./cmd/bd -run '^(TestPlanPrefixRepair|TestPlanPrefixRepairKnownPrefixes|TestRepairRetiredLookupFindsTheDecoratedBackend|TestRewriteIssueID_.*|TestRejectProtectedConfigKey|TestCommandTreeGolden|TestCommandHelpGolden)$' -v # all PASS, TestPlanPrefixRepair 14/14 subtests
CGO_ENABLED=1 BEADS_TEST_DOLT_SERVER=local BEADS_TEST_REQUIRE_DOLT_CONTAINER=1 BEADS_TEST_SKIP= go test -count=1 -p 1 -tags integration ./cmd/bd -run '^(TestRepairPrefixesKeepsSuffixes|TestRepairPrefixesRepointsEdgesOntoUnrenamedTargetRows|TestRepairPrefixesKeepsSuffixesWithoutCollision|TestRepairPrefixesKeepsDottedChildren|TestRepairPrefixesCollisionReRootsTree|TestRepairPrefixesSplitsByKnownPrefix|TestRepairPrefixesDryRunMatchesRealRun|TestRepairMultiplePrefixes|TestRepairPrefixesRetargetsBeadGates|TestRenameFailureLeavesBeadGatesPending)$' -v # 10/10 PASS
BEADS_TEST_EMBEDDED_DOLT=1 go test -count=1 -p 1 -tags integration ./cmd/bd -run '^TestEmbeddedRenamePrefixEdgeCases$' -v # 6/6 subtests PASS
go build ./..., CGO_ENABLED=0 go build ./..., go vet ./cmd/bd/ and gofmt are clean; the hand check of the body's AC-1/AC-2 scenario (taxdb-u6ch with a child, cre-db-c2a, kb-hand, an edge cre-db-c2a -> taxdb-u6ch) gives kb-u6ch, kb-u6ch.1, kb-c2a and the re-pointed edge on the head, and hash ids on main; --mint-only then mints kb2-* roots, kb-u6ch.2 children and accepts an explicit kb-zzzz. CI: 29 pass, 13 skipping.
Non-blocking, pre-existing (main behaves the same): text references in rows that are NOT renamed (an unchanged target-prefix row that mentions taxdb-u6ch.1) are never rewritten, since the rewrite runs only over the planned renames, and comment bodies are not touched either; the help text and the new CHANGELOG bullet both promise that "text references follow the renames". Worth a follow-up issue or a softer sentence.
…ps a refused edge Review fixes for #8473, iterations 1 to 3. - The re-point guard judged an edge on its source's old ID and its target's new ID, so every edge inside a renamed family (parent-child, blocks between two taxdb rows, a legacy close gate) looked cross-prefix and was removed and re-added. The re-add stamped the repair's actor and time on the edge, and its hierarchy check refused a close gate, which deleted the gate and stopped the run before issue_prefix was set. The guard now compares both ends' IDs from before the repair, so an edge storage already re-pointed in place stays as it is. - An edge the repair does re-point now moves in one transaction, so a re-add storage refuses (an edge stored across prefixes never went through the hierarchy check) rolls its removal back. The run reports the edge, in text and as unrepointed_edges under --json, goes on to the next edge and sets issue_prefix. On a SQL server each edge gets its own Dolt commit, as the store-level writes it replaces did; on an embedded store it gets none, so the post-run auto-commit still takes the whole repair, issue_prefix included (a commit per edge there skipped it and left the config row uncommitted). - Parent-child edges are re-pointed first, then every other edge, so each blocking re-add is checked against the re-pointed hierarchy. In source-ID order alone a re-add was checked against a partly re-pointed graph whose ancestry and cycle walks stop at old IDs that no longer exist: a grandchild blocked by its own grandparent landed unreported when it sorted first, and an epic's close gate on its child across prefixes landed while the child's parent-child edge was refused instead. - A blocking edge without which storage would accept a parent-child edge it refused for a cycle is left as it was and reported. An epic's close gate on a child already on the target prefix is stored across prefixes, where blocked state never reads it; once the epic is renamed it names two live issues, and the cycle walk, which reads every column, refused the child's parent-child edge through it. Re-added, the gate then landed where it blocks the epic while the child stayed detached. Before each blocking edge moves, a transaction that always rolls back removes it and retries each parent-child move refused for a cycle; one that lands keeps the edge where it was. - Only storage refusing an edge (a cycle, a block on the issue's own ancestor or descendant, an edge onto itself, a second type for one pair, a missing endpoint) is reported and stepped over. Any other failure (a commit whose outcome is unknown, a lost connection) stops the run before issue_prefix, and the error names the edges refused before it; it was reported as a refusal, so an edge that had moved read as left as it was. - The refusal report no longer says a refused edge does not affect readiness. A database older than the dependency-target split, or a bd rename, keeps edges between two prefixes in the issue column, where a refused blocks edge still blocks. The guard cannot see the column, so such an edge is re-added too: the --repair help, the CHANGELOG and the advanced reference now say a re-pointed edge records the repair's actor and time. Re-pointing only rows in the external column, in place, needs an issueops primitive for its own PR, stacked below this one. - After --mint-only the config names the new prefix while every issue may still carry the old one. bd rename-prefix <new>, and the --repair the --mint-only warning advises, now rename those issues instead of refusing <new> as the current prefix; only rows already on <new> make it a no-op. - --mint-only now says, on stderr, in its help, the CHANGELOG and the reference docs, that a dependency between an old-prefix and a new-prefix issue does not block: storage classifies an edge by the part of each ID before its first hyphen and ignores allowed_prefixes, and blocked state never reads such an edge. Making the classifier honor issue_prefix and allowed_prefixes is an issueops change for its own PR, stacked below this one. - The CHANGELOG, the --repair help and the advanced reference now say a repair rewrites text references only inside the renamed issues, the scope the design set. - planPrefixRepair is split into family grouping, the claim of wanted roots and hash-root allocation, and repairPrefixes' dry-run report and text rewrite move to their own functions, with no change in behavior. - TestRepairMultiplePrefixesPreservesSuffix and TestRepairMultiplePrefixesFallsBackOnCollision come from #6621 by Rongjun GENG, the first fix for GH#6591, and now run against this planner. TestRepairPrefixesLeavesEdgesStorageAlreadyMoved and TestRepairPrefixesKeepsAnEdgeStorageRefusesToRepoint (Dolt lane) and the embedded repair_repoints_cross_prefix_edges subtest each fail on the mutant they pin: the old guard; aborting on a refusal; removing and re-adding outside one transaction; a Dolt commit per edge on an embedded store. So do the Dolt-lane TestRepairPrefixesRepointsTheHierarchyFirst (re-pointing in source-ID order alone; its two close gates on a child or grandchild already on the target prefix fail with no probe, and with a probe that commits instead of rolling back), TestRepairPrefixesStopsOnAFailureThatIsNotARefusal (every error counted as a refusal), TestRepairPrefixesReportsARefusedIssueColumnEdgeAsLeftAsItWas (the old readiness claim) and TestRepairPrefixesKeepsAnEdgeThatWouldCloseACycle (a legacy cycle across prefixes; it, the close-gate shapes and the unit TestIsDependencyRefusal fail with the cycle arm dropped from the refusal classifier), and the embedded mint_only_then_repair_renames subtest (the old same-prefix refusal). Derived-From: pr6621/cef05ddbbc7efcbbe8de31270ef6e7a64b6bb19d Co-authored-by: Rongjun GENG <rj.geng@gmail.com> Agent-Signature: claude-code-claude-opus-5-5-max on behalf of Julian Knutsen Co-Authored-By: Claude <noreply@anthropic.com>
This comment has been minimized.
This comment has been minimized.
Factory review complete: waiting on maintainer approvalPR #8473 is ready for merge approval: #8473 What it does: Review: attempt 4 approves, scorecard 975/1000 (threshold 850), required changes: none, review coverage identical. Review TL;DR:
Pre-merge human item: #6621 (rjgeng) is still open and approved. This PR carries the Co-authored-by credit and the ported tests, but no maintainer note has been posted on #6621 yet. The draft is in mail gcg--9223372036829659296. Please post it, or ask for it to be posted, when you approve. Fixes applied: 13 commits, ending at 8f24615 (fix: --repair leaves already-moved edges alone and keeps a refused edge). CI: pass. Both required checks passed (PR, Docs). Bazel Farm was skipped. Merge path: the original PR #8473 (same-repo branch fix/bd-quj8ug), reviewed head 8f24615. Reviewed head: |
bee-ghosttrack
left a comment
There was a problem hiding this comment.
Requesting changes at 8f24615 (bee, r1237), narrowed to two of the three items from a3dc7d3. The edge re-pointing (item 2) is fixed and well proven; what is left is the CHANGELOG credit as asked, and item 1, which the body now documents but the command still reports as a success.
Range-diff a3dc7d3 -> 8f24615: all twelve earlier commits =, one new commit, 8f24615 (nine files, 1242+/179-): rename_prefix.go, a new rename_prefix_repair_test.go, the embedded and rewrite tests, the CHANGELOG, the command-tree golden, docs/reference/advanced.md, configuration.md and the skill page. No credited test was removed; nine test functions were added.
Item 2, fixed. repairedDependencyTarget judges an edge on both ends' pre-repair IDs (wasTarget through oldID), so an edge storage already re-pointed in place is left alone; each move is one transaction (repointDependency / moveDependencyInTx), so a refused re-add rolls its removal back; parent-child edges move first; a refusal is kept and reported (text and unrepointed_edges), and isDependencyRefusal separates a refusal from a write failure, which still ends the run. Base leg: with the head's rename_prefix_repair_test.go and rename_prefix_embedded_test.go over a3dc7d3's production (rename_prefix_rewrite_test.go kept at the base, since TestIsDependencyRefusal needs the new symbol), TestRepairPrefixesLeavesEdgesStorageAlreadyMoved, KeepsAnEdgeStorageRefusesToRepoint, KeepsAnEdgeThatWouldCloseACycle, RepointsTheHierarchyFirst, ReportsARefusedIssueColumnEdgeAsLeftAsItWas and StopsOnAFailureThatIsNotARefusal all FAIL, and the two #6621 tests pass on both; at 8f24615 all pass. The embedded mint_only_then_repair_renames subtest covers the --repair-after---mint-only change.
Item 3, half done. 8f24615 carries Co-authored-by: Rongjun GENG and Derived-From: pr6621/..., and rename_prefix_repair_test.go:206 says where its two tests come from; thank you. The CHANGELOG --repair bullet still ends in a bare (#6591): neither @cpliakas, who opened #6591, nor @rjgeng / #6621 is named there, and the CHANGELOG is the user-facing credit. The ask as written: make it "(#6591, reported by @cpliakas; suffix preservation first proposed by @rjgeng in #6621)".
Item 1, unchanged in code. groupRepairFamilies still tests strings.HasPrefix(id, targetPrefix+"-") (rename_prefix.go:527), and rename_prefix_rewrite_test.go:426 still pins beads-vscode-1 under known beads-vscode to "" for target beads. The PR body now states it as a limitation ("A declared prefix can only lengthen a split"), which is a fair design call for kb-adr-0001, but it answers neither half of what I asked. bd rename-prefix beads --repair on beads-a1b + beads-vscode-1 still prints "Successfully consolidated 2 prefixes into beads, 0 issues repaired" and leaves the database on two prefixes with no further move available. Either closes it: rename a row whose longest known prefix extends the target, or have the run name the rows it left under a second known prefix instead of reporting success (a warning line like the --mint-only one is enough, plus the same sentence in the CHANGELOG bullet and the help, which still say "issues already on the target prefix ... are left alone" without saying that a declared longer prefix counts as on target).
What I ran at 8f24615 (pinned worktree, -count=1, dolt 2.6.0):
go build ./... ; CGO_ENABLED=0 go build ./... ; go vet ./cmd/bd/ ; gofmt -l # clean
CGO_ENABLED=1 go test -tags gms_pure_go ./cmd/bd -run '^(TestPlanPrefixRepair|TestPlanPrefixRepairKnownPrefixes|TestRepairRetiredLookupFindsTheDecoratedBackend|TestRewriteIssueID_.*|TestRejectProtectedConfigKey|TestCommandTreeGolden|TestCommandHelpGolden|TestIsDependencyRefusal)$' # PASS
CGO_ENABLED=1 BEADS_TEST_DOLT_SERVER=local BEADS_TEST_REQUIRE_DOLT_CONTAINER=1 BEADS_TEST_SKIP= go test -p 1 -tags integration ./cmd/bd -run '^(TestRepairPrefixes.*|TestRepairMultiplePrefixes.*)$' # 17/17 PASS
BEADS_TEST_EMBEDDED_DOLT=1 go test -p 1 -tags integration ./cmd/bd -run '^TestEmbeddedRenamePrefix.*$' # 3/3 PASS, 12 subtests
CI: attempt 1 of run 43556146945 went red in the embedded Dolt tier on TestEmbeddedCompactAbortsDivergentReplay (shard 41 of 50, which holds the Compact, DuplicateConcurrent and VersionedHistory tests, none touched here); attempt 2 is green and CI Gate / Required is green at 8f24615. Nothing in this PR reaches compaction, so I read it as the flake it looks like, but whoever owns that test may want the attempt-1 log.
Non-blocking, as before: text references in unrenamed rows and in comment bodies are not rewritten (pre-existing, main behaves the same); the new help sentence "Text references are rewritten only inside the renamed issues" is the right word for it.
|
Approved by @julianknutsen in the maintainer console, for review workflow |
|
Approval from @julianknutsen relayed to review workflow |
…nation is free Repair used to mint a content hash for every off-prefix issue. It now plans every rename up front: IDs already under the target prefix stay, every other ID keeps its suffix under the target prefix, and a family (an old root plus its dotted children) whose wanted root is held by a live target ID or an earlier source family moves whole to a hash root. Agent-Signature: claude-code-claude-opus-5-5-unknown-reasoning on behalf of Julian Knutsen Co-Authored-By: Claude <noreply@anthropic.com> (cherry picked from commit 0ad51b5) Ported-From: opus/0ad51b525af2a0f3c9c00e89b1fb19ee2ade687a AC: AC-1
The repair plan maps each old root, virtual roots of orphan children included, and rewrites text through that root map, so a reference to taxdb-5su1.13 keeps its .13 tail. This pins the dotted-family behaviour the AC-1 planner introduced. Agent-Signature: claude-code-claude-opus-5-5-unknown-reasoning on behalf of Julian Knutsen Co-Authored-By: Claude <noreply@anthropic.com> (cherry picked from commit 0f43cc8) Ported-From: opus/0f43cc813e098cda9051a25f871b8c977228b3b6 AC: AC-2
…red roots and reports it The repair plan now probes every wanted root and member destination through the stores' optional RetiredIssueIDs seam (under the CLI's decorators, as the import dry run does) and treats a retired destination like a live one: the whole family moves to a hash root with its dotted paths intact. Hash roots are checked against live, claimed, rejected and retired IDs, allocation is bounded at 100 attempts, and a lookup error fails the plan before anything is written. Every fallback is reported with its old, wanted and assigned root, the reason (exists, claimed, retired) and the conflicting ID. Under --json the repair writes exactly one object, for a dry run and a real run alike, with the complete renames and collisions and a dry_run field; text progress is suppressed. Agent-Signature: claude-code-claude-opus-5-5-unknown-reasoning on behalf of Julian Knutsen Co-Authored-By: Claude <noreply@anthropic.com> (cherry picked from commit 77ca69a) Ported-From: opus/77ca69a9d06f214c1245c55d3753e58faa58e9c7 AC: AC-3
…idated families Storage keeps an edge between two different prefixes as a reference into another repository (issueops.IsExternalDepTarget), so renaming its target never re-points it: after a repair, kb-hand -> cre-db-c2a still named cre-db-c2a. Once the renames land, each edge that still names a renamed issue's old ID is re-added against the new one, which now shares the source's prefix and is stored as an ordinary edge. References to issues outside the store are left alone. Agent-Signature: claude-code-claude-opus-5-5-unknown-reasoning on behalf of Julian Knutsen Co-Authored-By: Claude <noreply@anthropic.com> (cherry picked from commit b88ab55) Ported-From: opus/b88ab55a09f9772e78764210470a55a5fb2d8217 AC: AC-1
…ed prefixes Repair now reads issue_prefix and allowed_prefixes and adds the prefixes it detected, so a multi-hyphen family such as cre-db-wxyz maps to kb-wxyz instead of the heuristic's kb-db-wxyz. IDs already on the target prefix, like kb-adr-0001, stay as they are. Agent-Signature: claude-code-claude-opus-5-5-unknown-reasoning on behalf of Julian Knutsen Co-Authored-By: Claude <noreply@anthropic.com> (cherry picked from commit 3422309) Ported-From: opus/342230956cfbd36fc3a784b1ac5a344201711190 AC: AC-4
… run does Pins that a dry run against unchanged inputs writes nothing, and that its JSON renames and collisions equal the real run's, whose mapping is what the store then holds. Agent-Signature: claude-code-claude-opus-5-5-unknown-reasoning on behalf of Julian Knutsen Co-Authored-By: Claude <noreply@anthropic.com> (cherry picked from commit f4f0692) Ported-From: opus/f4f06929bc43e947c0e24c9052d8b09624f143bf AC: AC-5
…ues only bd rename-prefix <new> --mint-only sets issue_prefix and keeps the old prefix valid through allowed_prefixes, without enumerating or rewriting any issue. Existing IDs and text stay as they are, new roots mint under the new prefix, and children of existing issues can still be created. A stderr warning names a config.yaml issue-prefix that would override the change, and the issue_prefix protected-key hint now lists the option. Agent-Signature: claude-code-claude-opus-5-5-unknown-reasoning on behalf of Julian Knutsen Co-Authored-By: Claude <noreply@anthropic.com> (cherry picked from commit 635ca13) Ported-From: opus/635ca13dfbeeda6b81f3430051d820db8a733f7c AC: AC-6
A mint-only dry run reports the issue_prefix change and the allowed_prefixes entry it would add, in text or as one JSON object, and writes nothing. --mint-only with --repair fails before opening the store. Agent-Signature: claude-code-claude-opus-5-5-unknown-reasoning on behalf of Julian Knutsen Co-Authored-By: Claude <noreply@anthropic.com> (cherry picked from commit 5ea6a3b) Ported-From: opus/5ea6a3b0eaad3bb43d1a531b7fc381e632712d30 AC: AC-7
Help text, the plugin command guide, the configuration reference and the CHANGELOG describe how --repair now keeps suffixes and reports family moves, and how --mint-only changes the prefix for new issues only. The generated CLI reference is pinned to v1.3.4 (docs/cli-docs.pin), so it is left for the release bump. Agent-Signature: claude-code-claude-opus-5-5-unknown-reasoning on behalf of Julian Knutsen Co-Authored-By: Claude <noreply@anthropic.com> (cherry picked from commit fa96ece) Ported-From: opus/fa96eced8f5acc1875d0feaefd21e80f4758bd3e AC: -
…e target prefix An edge from an off-prefix issue to a target-prefix row (taxdb-x -> kb-hand) is stored in the external column. Renaming its source to kb-x left it there, and blocked state reads only the issue column, so kb-x no longer showed as blocked by kb-hand. Repair now re-adds every edge that the source's rename turned from cross-prefix into same-prefix, so it is stored as an ordinary issue edge. Agent-Signature: claude-code-claude-opus-5-5-unknown-reasoning on behalf of Julian Knutsen Co-Authored-By: Claude <noreply@anthropic.com> AC: AC-1 Derived-From: opus/b88ab55a09f9772e78764210470a55a5fb2d8217
…lit cases Port glm's planner table onto planPrefixRepair: free suffixes with a retained custom target ID, a live root, a child-only target namespace, an earlier family's claim, a retired member destination, a retired hash candidate skipped after a natural destination is reserved, and the known-prefix, heuristic and all-letter suffix splits. Add the case glm's member-keyed claims missed: an orphan family's virtual root claims kb-x, so a later taxdb-x falls back with reason claimed instead of becoming a false parent of kb-x.3. Agent-Signature: claude-code-claude-opus-5-5-unknown-reasoning on behalf of Julian Knutsen Co-Authored-By: Claude <noreply@anthropic.com> AC: AC-3 Derived-From: glm/1d5354991e01, glm/85d0a6ec941d, opus/77ca69a9d06f214c1245c55d3753e58faa58e9c7
… in the advanced reference The advanced reference still described --repair only as "consolidates them". It now says each issue keeps its suffix, that a family whose destination is taken moves whole to a generated root with the collision reported, how to preview the complete plan (--dry-run --json), and points at --mint-only for changing only the prefix new issues get. docs/cli-reference/rename-prefix.md is not regenerated: the generated CLI reference is pinned to the v1.3.4 release (docs/cli-docs.pin), so a copy generated from this branch would fail the CLI docs drift check and publish flags the release lacks. The release bump regenerates it. Agent-Signature: claude-code-claude-opus-5-5-unknown-reasoning on behalf of Julian Knutsen Co-Authored-By: Claude <noreply@anthropic.com> AC: AC-6 Derived-From: glm/f474174711605a203669622a4b214806eaaa549e, opus/fa96eced8f5acc1875d0feaefd21e80f4758bd3e
…ps a refused edge Review fixes for #8473, iterations 1 to 3. - The re-point guard judged an edge on its source's old ID and its target's new ID, so every edge inside a renamed family (parent-child, blocks between two taxdb rows, a legacy close gate) looked cross-prefix and was removed and re-added. The re-add stamped the repair's actor and time on the edge, and its hierarchy check refused a close gate, which deleted the gate and stopped the run before issue_prefix was set. The guard now compares both ends' IDs from before the repair, so an edge storage already re-pointed in place stays as it is. - An edge the repair does re-point now moves in one transaction, so a re-add storage refuses (an edge stored across prefixes never went through the hierarchy check) rolls its removal back. The run reports the edge, in text and as unrepointed_edges under --json, goes on to the next edge and sets issue_prefix. On a SQL server each edge gets its own Dolt commit, as the store-level writes it replaces did; on an embedded store it gets none, so the post-run auto-commit still takes the whole repair, issue_prefix included (a commit per edge there skipped it and left the config row uncommitted). - Parent-child edges are re-pointed first, then every other edge, so each blocking re-add is checked against the re-pointed hierarchy. In source-ID order alone a re-add was checked against a partly re-pointed graph whose ancestry and cycle walks stop at old IDs that no longer exist: a grandchild blocked by its own grandparent landed unreported when it sorted first, and an epic's close gate on its child across prefixes landed while the child's parent-child edge was refused instead. - A blocking edge without which storage would accept a parent-child edge it refused for a cycle is left as it was and reported. An epic's close gate on a child already on the target prefix is stored across prefixes, where blocked state never reads it; once the epic is renamed it names two live issues, and the cycle walk, which reads every column, refused the child's parent-child edge through it. Re-added, the gate then landed where it blocks the epic while the child stayed detached. Before each blocking edge moves, a transaction that always rolls back removes it and retries each parent-child move refused for a cycle; one that lands keeps the edge where it was. - Only storage refusing an edge (a cycle, a block on the issue's own ancestor or descendant, an edge onto itself, a second type for one pair, a missing endpoint) is reported and stepped over. Any other failure (a commit whose outcome is unknown, a lost connection) stops the run before issue_prefix, and the error names the edges refused before it; it was reported as a refusal, so an edge that had moved read as left as it was. - The refusal report no longer says a refused edge does not affect readiness. A database older than the dependency-target split, or a bd rename, keeps edges between two prefixes in the issue column, where a refused blocks edge still blocks. The guard cannot see the column, so such an edge is re-added too: the --repair help, the CHANGELOG and the advanced reference now say a re-pointed edge records the repair's actor and time. Re-pointing only rows in the external column, in place, needs an issueops primitive for its own PR, stacked below this one. - After --mint-only the config names the new prefix while every issue may still carry the old one. bd rename-prefix <new>, and the --repair the --mint-only warning advises, now rename those issues instead of refusing <new> as the current prefix; only rows already on <new> make it a no-op. - --mint-only now says, on stderr, in its help, the CHANGELOG and the reference docs, that a dependency between an old-prefix and a new-prefix issue does not block: storage classifies an edge by the part of each ID before its first hyphen and ignores allowed_prefixes, and blocked state never reads such an edge. Making the classifier honor issue_prefix and allowed_prefixes is an issueops change for its own PR, stacked below this one. - The CHANGELOG, the --repair help and the advanced reference now say a repair rewrites text references only inside the renamed issues, the scope the design set. - planPrefixRepair is split into family grouping, the claim of wanted roots and hash-root allocation, and repairPrefixes' dry-run report and text rewrite move to their own functions, with no change in behavior. - TestRepairMultiplePrefixesPreservesSuffix and TestRepairMultiplePrefixesFallsBackOnCollision come from #6621 by Rongjun GENG, the first fix for GH#6591, and now run against this planner. TestRepairPrefixesLeavesEdgesStorageAlreadyMoved and TestRepairPrefixesKeepsAnEdgeStorageRefusesToRepoint (Dolt lane) and the embedded repair_repoints_cross_prefix_edges subtest each fail on the mutant they pin: the old guard; aborting on a refusal; removing and re-adding outside one transaction; a Dolt commit per edge on an embedded store. So do the Dolt-lane TestRepairPrefixesRepointsTheHierarchyFirst (re-pointing in source-ID order alone; its two close gates on a child or grandchild already on the target prefix fail with no probe, and with a probe that commits instead of rolling back), TestRepairPrefixesStopsOnAFailureThatIsNotARefusal (every error counted as a refusal), TestRepairPrefixesReportsARefusedIssueColumnEdgeAsLeftAsItWas (the old readiness claim) and TestRepairPrefixesKeepsAnEdgeThatWouldCloseACycle (a legacy cycle across prefixes; it, the close-gate shapes and the unit TestIsDependencyRefusal fail with the cycle arm dropped from the refusal classifier), and the embedded mint_only_then_repair_renames subtest (the old same-prefix refusal). Derived-From: pr6621/cef05ddbbc7efcbbe8de31270ef6e7a64b6bb19d Co-authored-by: Rongjun GENG <rj.geng@gmail.com> Agent-Signature: claude-code-claude-opus-5-5-max on behalf of Julian Knutsen Co-Authored-By: Claude <noreply@anthropic.com>
8f24615 to
01a97c8
Compare
Maintainer Adoption ReviewThanks for the contribution, @rjgeng, and thanks to @cpliakas for reporting #6591! This PR makes This PR was reviewed and adopted with maintainer fixes pushed directly to the PR branch. Original PR ReviewDecision: block (pass 1), then request_changes (passes 2 and 3), resolved to approve (pass 4). Specific gaps fixed:
bee-ghosttrack's review at Review findings addressed:
Non-blocking follow-ups (shared for visibility — NOT completed in this PR): Filed as follow-up beads:
Not filed (below the follow-up bar):
Maintainer Changes
Final Review StatusReady for the merge queue: final head CI: https://github.com/gastownhall/beads/actions/runs/44343767152 Review Iterations4 review passes. Pass 1 blocked on the silent supersession of #6621 and three major re-pointing findings, and passes 2 and 3 asked for the re-pointing order and the legacy close gate; each was fixed by amending the one maintainer commit. Pass 4 approved with no code change. A maintainer approved the reviewed head, and finalize rebased it onto main (CHANGELOG-only conflicts) before the handoff. Adopted via |
Summary
Both candidates agree: repair loses suffixes and no mint-only path exists. Preserve suffixes by default, re-root dotted families only on collision, and report fallbacks. Add
rename-prefix --mint-only, preserving old-parent usability throughallowed_prefixes. Retain family/retirement checks but reject family-size ordering and extra capability rows.The maintainer review commit on top fixes how
--repairre-points dependencies, lets the--repairthat--mint-onlyadvises finish the switch, and states the--mint-onlydependency limit; see Changes after the checkpoint pipeline.Acceptance criteria
Grades are the judge's, per candidate: glm, opus, and contributor PR #6621.
taxdb-u6ch,cre-db-c2a, andkb-handwith free destinations, whenbd rename-prefix kb --repairsucceeds, then the first two becomekb-u6chandkb-c2a, data and relationships survive,kb-handkeeps its ID, andissue_prefixiskb.taxdb-5su1, childtaxdb-5su1.13, orphancre-db-nwb.3, and a renamed row referencing both children, when repair tokbruns without collisions, then the children becomekb-5su1.13andkb-nwb.3, the parent-child dependency still resolves, and both text references point at the resulting IDs.kbsucceeds, then that whole family uses one unique non-retired hash root with dotted paths intact and every fallback reports the old, wanted and assigned root and collision reason.cre-dbfamily containingcre-db-a1bandcre-db-wxyz, plus custom target IDkb-adr-0001, when repair tokbruns, then the source IDs becomekb-a1bandkb-wxyzand the target ID is unchanged.issue_prefix=taxdb, parenttaxdb-u6ch, and other issue families, whenbd rename-prefix kb --mint-onlysucceeds, then existing IDs/text remain unchanged, future root issues mint askb-*, and a new child undertaxdb-u6chcan still be created with its original dotted prefix.--dry-runor incompatible--repair, then dry-run reports planned config changes without writes and the incompatible invocation fails without writes.Prior art: #6621
Contributor PR #6621 by rjgeng (Rongjun GENG), opened 2026-09-19 for the same issue, was the first fix for #6591:
--repairkeeps each issue's suffix and mints a hash ID only when that ID is taken. This PR replaces it instead of building on it:computeRepairRenames). When a parent's new ID is taken and the parent moves to a hash ID, its dotted child still keeps its suffix under the old root, so it lands under whichever issue holds that root. Here a whole family (the root and its dotted descendants, orphan children included) moves to one root, and a root that is live, claimed by an earlier family or retired sends the family to a hash root together.issue_prefix,allowed_prefixesand the prefixes found on the rows rather than by the heuristic alone, retired IDs are checked before anything is written, and dependencies stored across the old prefixes are re-pointed.--mint-onlydoes that; fix(rename-prefix): preserve suffix on --repair instead of always hashing #6621 does not cover it.Credit: #6621's two real-store tests,
TestRepairMultiplePrefixesPreservesSuffixandTestRepairMultiplePrefixesFallsBackOnCollision, are carried incmd/bd/rename_prefix_repair_test.goand pass against this planner. The cases of itsTestComputeRepairRenames_*tests (suffixes kept with a dotted child, a fallback when the ID is live, a fallback within one batch) are subtests ofTestPlanPrefixRepairhere. The maintainer review commit credits Rongjun GENG as co-author.Changes after the checkpoint pipeline
One maintainer review commit, amended after review iterations 1 to 3:
--repairmust leave alone. The re-point guard compared an edge's source by its old ID with its target by its new ID, so every edge inside a renamed family (a parent-child edge,blocksbetween twotaxdb-*rows, a close gate an epic holds on its own child) looked cross-prefix and was removed and re-added. The re-add stamped the repair's actor and time on the edge, and its hierarchy check refused a legacy close gate, which deleted the gate and stopped the run beforeissue_prefixwas set. The guard now compares both ends' IDs from before the repair, so an edge storage already re-pointed in place stays as it is.unrepointed_edgesunder--json, goes on to the next edge and setsissue_prefix. On a SQL server each edge gets its own Dolt commit, as the store-level writes it replaces did; on an embedded store the command's post-run commit takes the whole repair,issue_prefixincluded.issue_prefixis set, and the error names the edges refused before it. Counted as a refusal, an edge that had in fact moved was reported as left as it was.blocksedge there still blocks. The--repairhelp, the CHANGELOG and the advanced reference now also say a re-pointed edge records the repair's actor and time.--repairafter--mint-only.--mint-onlysetsissue_prefixto the new prefix while every issue may still carry the old one, and bothbd rename-prefix kband thebd rename-prefix kb --repairits warning advises refusedkbas the current prefix until akb-*issue existed. They now rename the old-prefix issues; only issues already onkbmake the command a no-op.--mint-onlystates its dependency limit on stderr, in its help, in the CHANGELOG and in the reference docs (see Limitations).--repairhelp and the advanced reference now say a repair rewrites text references only inside the renamed issues, the scope the design set.planPrefixRepairis split into family grouping, the claim of wanted roots and hash-root allocation, and the dry-run report and text rewrite ofrepairPrefixesmove to their own functions, with no change in behavior: theTestPlanPrefixRepair*tables and the repair tests pass unchanged.New tests, each failing on the mutant it pins:
TestRepairPrefixesLeavesEdgesStorageAlreadyMoved(the old guard),TestRepairPrefixesKeepsAnEdgeStorageRefusesToRepoint(aborting on a refusal; removing and re-adding outside one transaction),TestRepairPrefixesRepointsTheHierarchyFirst(re-pointing in source-ID order alone, in its first two shapes; no probe, or a probe that commits instead of rolling back, in its close gates on a child or grandchild already on the target prefix),TestRepairPrefixesStopsOnAFailureThatIsNotARefusal(every error counted as a refusal),TestRepairPrefixesReportsARefusedIssueColumnEdgeAsLeftAsItWas(the old readiness claim) andTestRepairPrefixesKeepsAnEdgeThatWouldCloseACycle(a legacy cycle across prefixes; the refusal classifier without its cycle arm, which the close-gate shapes and the unitTestIsDependencyRefusalalso catch).repair_repoints_cross_prefix_edges(a Dolt commit per edge on an embedded store, which leftissue_prefixuncommitted) andmint_only_then_repair_renames(the old same-prefix refusal).At the review commit as reviewed, before the final base refresh,
//cmd/bd:bd_testpassed as a whole under--config=ci(7955 tests), its rename-prefix tests passed on the Dolt lane (77), the embedded rename-prefix tests passed (13), and so did the five doc guards that read the CHANGELOG and the advanced reference.Limitations
--mint-onlyleaves dependencies between the two prefixes non-blocking. Storage classifies an edge by the part of each ID before its first hyphen and does not readallowed_prefixes, so an edge between ataxdb-*and akb-*issue is stored as a reference to another repository, whichbd readynever reads. A laterbd rename-prefix kb --repairconsolidates the prefixes and re-points those edges. Making the classifier treatissue_prefixandallowed_prefixesas local is a storage change for its own PR.bd rename, keeps such edges as local ones, which gate readiness.cmd/bdcannot see which column holds an edge, so the repair removes and re-adds these too: they take the repair's actor and time, and one that storage refuses to re-add stays exactly as it was (ablocksedge still blocks). Re-pointing only the edges stored as references into another repository, in place and keeping their provenance, needs an issueops primitive for its own PR, stacked below this one.--repairdoes not rename keeps the old IDs, as do comments and close reasons, which neither rename path rewrites.cre-dbunder targetcre(orbeads-vscodeunderbeads) is never consolidated, and a prefix detected on the rows (taxdb-adr) outranks a shorter declared one (taxdb).How this was built
design.pair(anthropic-opus, moonshot-kimi, xai-grok, zhipu-glm).bazel-test //cmd/bd:bd_test --test_filter='^(TestRepairPrefixesKeepsSuffixes|TestRepairPrefixesRepointsEdgesOntoUnrenamedTargetRows|TestRepairPrefixesKeepsSuffixesWithoutCollision|TestRepairPrefixesKeepsDottedChildren|TestRepairPrefixesCollisionReRootsTree|TestRepairPrefixesSplitsByKnownPrefix|TestRepairPrefixesDryRunMatchesRealRun|TestPlanPrefixRepair|TestPlanPrefixRepairKnownPrefixes|TestRepairRetiredLookupFindsTheDecoratedBackend|TestRepairMultiplePrefixes|TestRepairPrefixesRetargetsBeadGates|TestRenameFailureLeavesBeadGatesPending|TestRejectProtectedConfigKey|TestRewriteIssueID_.*|TestCommandTreeGolden|TestCommandHelpGolden)$' --test_env=BEADS_TEST_SKIP= --test_env=BEADS_TEST_DOLT_SERVER=local --test_env=BEADS_TEST_REQUIRE_DOLT_CONTAINER=1 && bazel-test //cmd/bd:bd_embedded_test --config=embedded --test_sharding_strategy=disabled --test_arg='-test.run=^TestEmbeddedRenamePrefixEdgeCases$' --test_arg=-test.skip=→ pass.Judge rationale: Both candidates passed the independent run. The triage repro fails to build on both because generateRepairHashID/issueSort were removed, which is not evidence. Opus is the base because its planner reserves root namespaces (fixing glm's orphan-claim gap), it re-points cross-prefix dependency edges (glm leaves them dangling), it propagates config read errors (glm swallows them, risking an allowed_prefixes overwrite in mint-only), and its CLI tests run end to end. AC-1: merge (opus code + repoint extension for source-renamed edges). AC-2: opus; equivalent to glm's, with a tighter dependency type/title check. AC-3: merge (opus planner + glm's richer planner table tests). AC-4: opus; same longest-known-prefix extraction, errors propagated. AC-5: opus; single-object JSON, dry-run test asserts mapping == stored. AC-6: merge (opus code/test + glm advanced.md + regenerated cli-reference). AC-7: opus; --mint-only+--repair refused before the store opens, e2e no-write check. Contributor PR #6621 (@rjgeng) started suffix preservation, but it uses per-issue hash fallback with heuristic prefix extraction (rejected by the design: it breaks dotted ancestry) and has no mint-only; it is credited, not ported.
Correction at this head:
docs/cli-reference/rename-prefix.mdis not regenerated. The generated CLI reference follows the release pinned indocs/cli-docs.pin, so--mint-onlyappears there once the pin moves past a release that has it. #6621 is no longer "not ported" in full: its two real-store tests are carried (see Prior art).Source bead:
bd-quj8ug· checkpoint pipeline v0Fixes #6591