From e7015b73cfadda3ca6266679ab7ac24e43ee199a Mon Sep 17 00:00:00 2001 From: REPPL <77722411+REPPL@users.noreply.github.com> Date: Thu, 3 Dec 2026 08:39:12 +0000 Subject: [PATCH 1/8] fix: keep a landing's report only once origin's URLs read unchanged The gate kept the receipt it counted as the landing's report before land read origin's URLs again, so a preflight that rewrote them (a push URL, a pushInsteadOf) left a report for a head land then refused to push. The gate now returns the receipt, and land keeps it after the URLs are read again unchanged. The land page says a refused landing keeps none and that the store keeps a repository's newest 200 reports. Resolves: iss-2612030838336459 Assisted-by: Claude:claude-opus-5-5 --- ...-abcd-land-keeps-a-landing-report-for-a.md | 17 +++++++++ commands/land.md | 11 +++--- internal/core/landing/land.go | 36 ++++++++++--------- internal/core/landing/report.go | 3 +- internal/core/landing/report_test.go | 32 +++++++++++++++++ 5 files changed, 77 insertions(+), 22 deletions(-) create mode 100644 .abcd/work/issues/resolved/iss-2612030838336459-abcd-land-keeps-a-landing-report-for-a.md diff --git a/.abcd/work/issues/resolved/iss-2612030838336459-abcd-land-keeps-a-landing-report-for-a.md b/.abcd/work/issues/resolved/iss-2612030838336459-abcd-land-keeps-a-landing-report-for-a.md new file mode 100644 index 0000000000..1c852eefdc --- /dev/null +++ b/.abcd/work/issues/resolved/iss-2612030838336459-abcd-land-keeps-a-landing-report-for-a.md @@ -0,0 +1,17 @@ +--- +schema_version: 1 +id: "iss-2612030838336459" +slug: "abcd-land-keeps-a-landing-report-for-a" +severity: "minor" +category: "drift" +source: "drift-detection" +found_during: "manual-capture" +origin: researcher-authored +production_mode: hand-written +found_at: "internal/core/landing/land.go" +remedy: "keep the report only after origin's URLs are read again unchanged, and say on the land page that the store keeps the newest 200 reports" +resolution: "land keeps the report only after origin's URLs are read again unchanged; land.md says so and names the 200-report cap" +impact: fix +--- + +abcd land keeps a landing report for a head it then refuses to push because the preflight rewrote origin's URLs diff --git a/commands/land.md b/commands/land.md index b228ea621f..cfa8091ab1 100644 --- a/commands/land.md +++ b/commands/land.md @@ -98,11 +98,12 @@ that name with none at this head, since the proof may lie past the bound. branch's own preflight could add a push URL or a `pushInsteadOf`). A repository whose make file declares no `preflight` target gets no push. The receipt is a convenience check, not a security boundary: CI re-runs every gate on the pushed commit. Once the gate - passes, land keeps a copy of the receipt it counted, with its reuse counts - and times, as the landing's report in - `~/.abcd.noindex/landing-reports//`; a report it cannot - keep (a symlinked folder, a receipt over 64 KiB) is a notice, and the - landing goes on. + passes, `origin`'s URLs included, land keeps a copy of the receipt it + counted, with its reuse counts and times, as the landing's report in + `~/.abcd.noindex/landing-reports//`, and a landing the gate + refuses keeps none. The store keeps a repository's newest 200 reports. A + report it cannot keep (a symlinked folder, a receipt over 64 KiB) is a + notice, and the landing goes on. 2. **announce** (with `land.push` on, after the release hold below): the announcements above. Each item is announced once: one you already announced `merging` that still stands for more than a minute is not diff --git a/internal/core/landing/land.go b/internal/core/landing/land.go index f95f4b2b11..a0653f5784 100644 --- a/internal/core/landing/land.go +++ b/internal/core/landing/land.go @@ -372,7 +372,8 @@ func Land(cwd string, o Options) (Result, error) { res.add("land", StatusLanded, fmt.Sprintf("pull request #%d merged %s into %s (by a squash or rebase, so the commit itself is not on %s/%s), so %s has landed: nothing was gated, pushed or queued", pr, short(head), def, Remote, def, branch)+observed(dir, def), "") return res, nil } - if err := gate(&res, o, dir, head); err != nil { + rcp, err := gate(&res, o, dir, head) + if err != nil { return res, err } // The preflight is the branch's own and runs with the person's @@ -381,6 +382,10 @@ func Land(cwd string, o Options) (Result, error) { if err := origin.unchanged(dir); err != nil { return res, err } + // The gate has passed, origin's URLs included: the receipt it counted is + // kept as the landing's report (keepReport, report.go), which never fails + // the landing. + keepReport(&res, o.Roots.Home, dir, head, rcp) if err := stopHold(&res, o); err != nil { return res, err } @@ -488,49 +493,48 @@ func dirtyTree(dir string) (bool, error) { // skip the preflight (receiptOutsideLanes), and does not stand in for the // receipt the preflight run here mints once it passes: that one counts // outside the lanes, or, run from inside a lane, only in the checkout it ran -// in (ownReceipt). The receipt it counts is kept as the landing's report -// (keepReport, report.go), which never fails the gate. -func gate(res *Result, o Options, dir, head string) error { +// in (ownReceipt). It returns the receipt it counted, which the landing keeps +// as its report once origin's URLs are read again unchanged (Land), never +// before: a landing refused there keeps no report. +func gate(res *Result, o Options, dir, head string) (string, error) { rcp, err := receiptOutsideLanes(dir, head) if err != nil { - return err + return "", err } if rcp != "" { res.add("gate", StatusSkipped, "a preflight receipt already names "+short(head)+" ("+fsutil.RedactHome(rcp)+")", "") - keepReport(res, o.Roots.Home, dir, head, rcp) - return nil + return rcp, nil } if err := o.Gate(dir); err != nil { var r *Refusal if errors.As(err, &r) { - return err + return "", err } - return refuse("the preflight did not pass on "+short(head)+": "+fsutil.RedactHome(err.Error()), + return "", refuse("the preflight did not pass on "+short(head)+": "+fsutil.RedactHome(err.Error()), "settle what it reports, then run abcd land again; nothing was pushed") } now, err := headOf(dir) if err != nil { - return err + return "", err } if now != head { - return refuse(fmt.Sprintf("HEAD moved from %s to %s while the preflight ran, so its receipt does not vouch for what would be pushed", short(head), short(now)), + return "", refuse(fmt.Sprintf("HEAD moved from %s to %s while the preflight ran, so its receipt does not vouch for what would be pushed", short(head), short(now)), "run abcd land again to gate the new head; nothing was pushed") } if rcp, err = receiptOutsideLanes(dir, head); err != nil { - return err + return "", err } if rcp == "" && insideDriveLane(dir) { if rcp, err = ownReceipt(dir, head); err != nil { - return err + return "", err } } if rcp == "" { - return refuse("the preflight finished but no preflight receipt names "+short(head)+" (it mints one only on a tree that matched HEAD throughout)", + return "", refuse("the preflight finished but no preflight receipt names "+short(head)+" (it mints one only on a tree that matched HEAD throughout)", "keep the tree clean while it runs, then run abcd land again; nothing was pushed") } res.add("gate", StatusDone, "the preflight passed and its receipt names "+short(head), "") - keepReport(res, o.Roots.Home, dir, head, rcp) - return nil + return rcp, nil } // makePreflight is the real gate: `make preflight` in the branch's checkout, diff --git a/internal/core/landing/report.go b/internal/core/landing/report.go index 0b7f5c2118..381695e497 100644 --- a/internal/core/landing/report.go +++ b/internal/core/landing/report.go @@ -15,7 +15,8 @@ import ( ) // The landing reports (itd-2611011325421304, iss-2611211206046947): once its -// gate passes, a landing keeps a copy of the preflight receipt it counted, which +// gate passes, origin's URLs read again unchanged after the preflight among its +// checks, a landing keeps a copy of the preflight receipt it counted, which // names the commit, its scope, how many packages each test stage reused and, from // a preflight that named its clock, the times the run printed. The copy is the // landing's report: a worktree's receipts go with the worktree, and a landing diff --git a/internal/core/landing/report_test.go b/internal/core/landing/report_test.go index 9d175ead06..a6fc71a454 100644 --- a/internal/core/landing/report_test.go +++ b/internal/core/landing/report_test.go @@ -247,3 +247,35 @@ func TestAFailedGateKeepsNoReport(t *testing.T) { }) } } + +// TestALandingRefusedOverOriginsURLsKeepsNoReport: a preflight that passes and +// mints its receipt, but rewrites origin's URLs as it runs (a push URL, a +// pushInsteadOf), refuses the landing before the push, and a landing refused +// there keeps no report: the gate's checks include origin's URLs as they were +// checked, so the receipt is kept only once they are read again unchanged. +func TestALandingRefusedOverOriginsURLsKeepsNoReport(t *testing.T) { + for name, rewrite := range map[string]func(f *fixture){ + "a push URL": func(f *fixture) { + f.repo.Git("remote", "set-url", "--add", "--push", "origin", "https://example.com/someone-else/r") + }, + "a pushInsteadOf": func(f *fixture) { + f.repo.Git("config", "url.https://example.com/someone-else/.pushInsteadOf", f.bare) + }, + } { + t.Run(name, func(t *testing.T) { + f := newFixture(t, "") + f.gate = func(dir string) error { + rewrite(f) + return f.mint(dir) + } + _, err := f.land(f.options()) + wantRefusal(t, err, "while the preflight ran") + if len(f.pushes()) != 0 { + t.Fatalf("pushed %v", f.pushes()) + } + if _, err := os.Lstat(abcdhome.Path(f.home, reportsLeaf)); !os.IsNotExist(err) { + t.Errorf("a landing refused over origin's URLs made the report store: %v", err) + } + }) + } +} From bbd3fbdd6955059e667a8d1e8e7a86cb8a14bdc3 Mon Sep 17 00:00:00 2001 From: REPPL <77722411+REPPL@users.noreply.github.com> Date: Thu, 3 Dec 2026 08:39:21 +0000 Subject: [PATCH 2/8] fix: say a skip list a drive carries clears as the drive ends The move that holds an issue back said the skip list clears when this drain ends, and the pass-over said the hold lasts until --unskip or the drain ends. A drive that goes on past a drain's end (at a cap of its own, or empty under its end time) keeps the list for its next drain, so under a drive both were false. Both now say the list clears as the drain ends or, where a drive carries it into its next drain, as the drive ends. Assisted-by: Claude:claude-opus-5-5 --- internal/core/implement/loop/drain_skip.go | 15 +++++++++---- .../core/implement/loop/drain_skip_test.go | 21 +++++++++++++++++++ 2 files changed, 32 insertions(+), 4 deletions(-) diff --git a/internal/core/implement/loop/drain_skip.go b/internal/core/implement/loop/drain_skip.go index 0dca40b117..1ed25ba17d 100644 --- a/internal/core/implement/loop/drain_skip.go +++ b/internal/core/implement/loop/drain_skip.go @@ -5,7 +5,9 @@ package loop // found_at falls in one path, for the drain in progress, each with a reason. // A held-back issue is passed over before anything is pushed or asked, named // in the move's passed entries with the reason, and the list clears when the -// drain ends, so a hold for now never outlives the drain it was given to. +// drain ends, so a hold for now never outlives the drain it was given to, +// except where a drive goes on past that end (drainGoesOn): the drive's next +// drain takes the list, which clears as the drive ends (clearKeptSkips). import ( "fmt" @@ -26,6 +28,11 @@ const CheckSkipped = "skipped" // CheckNeedsPerson is the pass-over of an issue a drive may not work. const CheckNeedsPerson = "needs-a-person" +// skipListClears is when the skip list clears, as a move that holds an issue +// back says it: at the drain's end, or, for a list a drive goes on past that +// end with (drainGoesOn), at the drive's (clearKeptSkips). +const skipListClears = "the skip list clears as the drain ends, or, where a drive carries it into the next drain it begins, as the drive ends" + // maxDrainSkips caps the skip list, and maxSkipReasonBytes one entry's reason. const ( maxDrainSkips = 64 @@ -138,7 +145,7 @@ func applySkips(st *DrainState, d DrainOptions, now time.Time) (string, error) { "hold back a path that covers several issues, or --unskip entries no longer needed") } if len(added) > 0 { - clauses = append(clauses, "held back for now: "+strings.Join(added, ", ")+" ("+reason+"); the skip list clears when this drain ends") + clauses = append(clauses, "held back for now: "+strings.Join(added, ", ")+" ("+reason+"); "+skipListClears) } return strings.Join(clauses, "; "), nil } @@ -170,8 +177,8 @@ func skipPassed(id string, s DrainSkip) Excluded { if s.Target != id { by = "its found_at path, in " + s.Target + "," } - return Excluded{ID: id, Check: CheckSkipped, Reason: fmt.Sprintf("held back for now: %s is on the drain's skip list since %s: %s; passed over with nothing pushed and no judgement asked, until `abcd drain --unskip %s` or the drain ends", - by, stamp(s.At), s.Reason, s.Target)} + return Excluded{ID: id, Check: CheckSkipped, Reason: fmt.Sprintf("held back for now: %s is on the drain's skip list since %s: %s; passed over with nothing pushed and no judgement asked, until `abcd drain --unskip %s` or %s", + by, stamp(s.At), s.Reason, s.Target, skipListClears)} } // skipsWritten reports whether every skip-list entry is one the drain writes. diff --git a/internal/core/implement/loop/drain_skip_test.go b/internal/core/implement/loop/drain_skip_test.go index bdec86b431..573f865030 100644 --- a/internal/core/implement/loop/drain_skip_test.go +++ b/internal/core/implement/loop/drain_skip_test.go @@ -23,6 +23,27 @@ func drainStatePresent(t *testing.T, root string) bool { return err == nil } +// TestAHoldSaysAListADriveCarriesLastsTheDrive: the move that holds an issue +// back, and the pass-over that names it, say when the hold ends in words true +// under a drive as well as a session's drain: a drive that goes on past the +// drain's end carries the list into its next drain (drainGoesOn), so the list +// clears at the drain's end, or at the drive's for a list a drive carries. +func TestAHoldSaysAListADriveCarriesLastsTheDrive(t *testing.T) { + repo := drainRepo(t) + res, err := Drain(repo.Root(), Options{}, DrainOptions{Skip: []string{secondIssue}, SkipReason: "a peer's fix is in flight"}) + if err != nil { + t.Fatal(err) + } + const lasts = "the skip list clears as the drain ends, or, where a drive carries it into the next drain it begins, as the drive ends" + p := passedFor(t, res, secondIssue) + if !strings.Contains(p.Reason, "until `abcd drain --unskip "+secondIssue+"` or "+lasts) { + t.Errorf("the pass-over says the hold ends with the drain alone: %q", p.Reason) + } + if !strings.Contains(res.Next, "held back for now: "+secondIssue+" (a peer's fix is in flight); "+lasts) { + t.Errorf("the move that holds it back says the list clears with the drain alone: %q", res.Next) + } +} + // TestAnIssueOnTheSkipListIsPassedOverWithItsReason: the documentation issue, // which the order takes first, is held back; the move names it in its passed // entries with the reason and asks the judgement over the next issue, and a From a90f82c4e38dd80bad58e07325eafc4410665074 Mon Sep 17 00:00:00 2001 From: REPPL <77722411+REPPL@users.noreply.github.com> Date: Thu, 3 Dec 2026 08:40:13 +0000 Subject: [PATCH 3/8] docs: say when a drive's skip list clears and how a bounded drive ends The drain page and the drain help said the skip list clears when the drain ends, and when the drive ends. A drive that goes on past a drain's end keeps the list for its next drain, and at its end clears only an ended drain's list; a drain still in progress keeps its list until it ends. The page also said a bounded drive ends only at its bound, its cap or a stop, and would have ended with nothing eligible: it waits on an empty ledger, and ends on a check that no longer holds, on a refusal it cannot go past, and with only lanes it passed over left. A look that finds nothing publishes the pending hand-backs it carries, and the last wait before the end time says the drive ends then. The CLI reference is regenerated from the help. Resolves: iss-2612030838386015 Assisted-by: Claude:claude-opus-5-5 --- ...the-drain-page-and-help-say-a-held-back.md | 17 +++++++ commands/drain.md | 49 +++++++++++++------ docs/reference/cli/commands.md | 3 +- internal/surface/cli/drain.go | 3 +- 4 files changed, 54 insertions(+), 18 deletions(-) create mode 100644 .abcd/work/issues/resolved/iss-2612030838386015-the-drain-page-and-help-say-a-held-back.md diff --git a/.abcd/work/issues/resolved/iss-2612030838386015-the-drain-page-and-help-say-a-held-back.md b/.abcd/work/issues/resolved/iss-2612030838386015-the-drain-page-and-help-say-a-held-back.md new file mode 100644 index 0000000000..7a2cb735e0 --- /dev/null +++ b/.abcd/work/issues/resolved/iss-2612030838386015-the-drain-page-and-help-say-a-held-back.md @@ -0,0 +1,17 @@ +--- +schema_version: 1 +id: "iss-2612030838386015" +slug: "the-drain-page-and-help-say-a-held-back" +severity: "minor" +category: "drift" +source: "drift-detection" +found_during: "manual-capture" +origin: researcher-authored +production_mode: hand-written +found_at: "commands/drain.md" +remedy: "say that a drive going on past a drain's end keeps its skip list, that its end clears only an ended drain's list, that a bounded drive ends on refusals and on lanes it passed over, and that a look publishes pending hand-backs" +resolution: "the drain page, the drain help and the skip-list messages say when a drive's skip list clears, how a bounded drive ends and what a look pushes, as the code does" +impact: fix +--- + +the drain page and help say a held-back issue's skip list clears when the drain or the drive ends, and misstate how a bounded drive ends and what an empty look pushes diff --git a/commands/drain.md b/commands/drain.md index d85d9f9574..ade0f75801 100644 --- a/commands/drain.md +++ b/commands/drain.md @@ -221,8 +221,10 @@ typed start's first move also gives them to a drain in progress it finds, as a b move does; after that move, and on the drive's own re-execution, they go only to the drains it begins), keeps the pending hand-backs, and takes the ended drain's skip list as that drain's state left it, so a -`--skip` or `--unskip` made from another terminal mid-drive carries on, and the list -clears when the drive ends. Before the new drain's state is written over the old, +`--skip` or `--unskip` made from another terminal mid-drive carries on. As the drive +ends it clears the list of an ended drain; a drive that ends while a drain is still in +progress, at its bound with a lane in progress or on a stop or a refusal mid-drain, leaves +the list on that drain until that drain ends. Before the new drain's state is written over the old, the ended one, where it opened a lane, asked or took a judgement or handed an issue back, is copied to `.abcd/.work.local/run/drains/drain-.json`, named by the move's own clock and never by a time the state carries, the newest twenty @@ -235,10 +237,14 @@ opened, its pace and its cap, or an ended one as ended, after which a new drain **An empty ledger is waited on.** Under the bound a drain that finds nothing eligible, held or not, ends without ending the drive. The drive says `nothing is eligible; looking -again at