Found in review of #29: the apply order builds rexcity's tools only in an apply that moves rexcity, and never removes or repairs them #64

Merged
city-root merged 1 commit from worker/gascitypacks-uno into main 2026-11-12 15:30:34 +00:00
Contributor

Fixes items 1 to 4 of gascitypacks-uno (found in the review of #29): the apply order's install of rexcity and its tools.

What changed (roles/assets/scripts/apply.sh)

  • It now also builds when rexcity, the gc-runtime-rex link or a tool that go list tool names is missing from REX_BIN_DIR, not only when the locked rexcity commit moves (item 1). The check runs only in an apply that has an origin/main to apply: one that finds it unmoved still exits first, so a file lost between moves is repaired at the next move, not at once.
  • An install records what it wrote in REX_BIN_DIR/.rexcity-installed; the next one removes what the previous record named and the new build does not (item 2). A file the record does not name is never touched. A city installed before this change has no record, so a stale tool of it (claude-acp of rexcity 0.29.0 and 0.30.0) needs one manual removal.
  • A failing ln, mv or mktemp after the build mails the Operator ("rexcity install failed") instead of exiting silently; the .build.* directory goes with the exit trap, and one older than an hour, left by a killed run, is swept by the next run (item 3).
  • No new script and no new unit: this is a fix inside the existing script, as docs/shell.md allows. The docs/shell.md ledger row for apply.sh no longer says the repair is missing.

Tests (tests/apply.sh, item 4): the fixture's tool lives in a module of its own that rexcity requires (a replace to a local directory; a real go.sum pin would need a module proxy, which the offline test has none of), and the test has its own GOMODCACHE. New scenarios: the record, a dropped tool, a lost tool (repaired), a complete bin directory (builds nothing), a failing mv, and an old and a new .build.* leftover. Run against the old script the test fails.

Not done: item 5, gascity-root's docs/spec.md step 3 of the apply order, is in another repository.

Verified: bash tests/apply.sh prints ok; shellcheck roles/assets/scripts/apply.sh is clean; the v2 changelog checker is valid with the fragment .changelog/apply-rexcity-tools.md.

Bead: gascitypacks-uno

Fixes items 1 to 4 of gascitypacks-uno (found in the review of #29): the `apply` order's install of rexcity and its tools. **What changed (`roles/assets/scripts/apply.sh`)** - It now also builds when `rexcity`, the `gc-runtime-rex` link or a tool that `go list tool` names is missing from `REX_BIN_DIR`, not only when the locked rexcity commit moves (item 1). The check runs only in an apply that has an `origin/main` to apply: one that finds it unmoved still exits first, so a file lost between moves is repaired at the next move, not at once. - An install records what it wrote in `REX_BIN_DIR/.rexcity-installed`; the next one removes what the previous record named and the new build does not (item 2). A file the record does not name is never touched. A city installed before this change has no record, so a stale tool of it (`claude-acp` of rexcity 0.29.0 and 0.30.0) needs one manual removal. - A failing `ln`, `mv` or `mktemp` after the build mails the Operator ("rexcity install failed") instead of exiting silently; the `.build.*` directory goes with the exit trap, and one older than an hour, left by a killed run, is swept by the next run (item 3). - No new script and no new unit: this is a fix inside the existing script, as `docs/shell.md` allows. The `docs/shell.md` ledger row for `apply.sh` no longer says the repair is missing. **Tests (`tests/apply.sh`, item 4)**: the fixture's tool lives in a module of its own that rexcity requires (a `replace` to a local directory; a real `go.sum` pin would need a module proxy, which the offline test has none of), and the test has its own `GOMODCACHE`. New scenarios: the record, a dropped tool, a lost tool (repaired), a complete bin directory (builds nothing), a failing `mv`, and an old and a new `.build.*` leftover. Run against the old script the test fails. **Not done**: item 5, gascity-root's `docs/spec.md` step 3 of the apply order, is in another repository. **Verified**: `bash tests/apply.sh` prints `ok`; `shellcheck roles/assets/scripts/apply.sh` is clean; the v2 changelog checker is valid with the fragment `.changelog/apply-rexcity-tools.md`. Bead: gascitypacks-uno
fix: apply builds rexcity's tools when missing, drops stale ones, reports a failed install (gascitypacks-uno)
All checks were successful
test / changelog (pull_request) Successful in 4s
test / lint (pull_request) Successful in 25s
test / scripts (pull_request) Successful in 34s
0556f68895
The review of gascitypacks#29 found that the apply order built rexcity and its tools only in an apply that moved the locked rexcity commit. A bin directory that lacked claudeacp (a lost file, applies in the wrong order) was never repaired, and the order exited 0 saying nothing. A tool a later rexcity stopped declaring stayed in the bin directory and on PATH, and a failing ln or mv after a good build exited without mail and left .build.* behind.

apply.sh now also builds when rexcity, the gc-runtime-rex link or a tool 'go list tool' names is missing from REX_BIN_DIR. An install records the names it wrote in .rexcity-installed and removes the ones the previous record named and this one does not. ln, mv and mktemp failures report to the Operator, the scratch directory is removed by the exit trap, and .build.* directories older than an hour are swept. The check still runs only in an apply that has an origin/main to apply: one that finds origin/main unmoved exits first, as before.

tests/apply.sh gains scenarios for the record, a dropped tool, a lost tool, a complete bin directory (builds nothing), a failing mv and a leftover; its tool now lives in a module of its own that rexcity requires, and GOMODCACHE is the test's own. A stand-in run of the new test against the old script fails. Left out: item 5 of the bead, gascity-root's docs/spec.md, which is another repository.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
city-root-review left a comment

Review of 0556f68895 for gascitypacks-uno. Checks of the head: success.

Verdict

pass

Findings

  • [minor] roles/assets/scripts/apply.sh:93,125-135: item 1 is fixed only in part. The bead wants a build whenever rexcity, its link or a declared tool is missing. The check comes after the early exit 0 at line 93, so a lost claudeacp stays lost, with nothing reported, until the next merge to the city's main. The PR description and the header comment (lines 21-22) both say so. A follow-up bead could move a cheap check (for example, the names in .rexcity-installed) ahead of that exit. Not blocking: the gap is disclosed, the by-hand repair in the bead still works, and the fix is a real improvement.
  • [minor] roles/assets/scripts/apply.sh:132: go list -C "$src" tool 2>/dev/null hides a failure, such as a tool module missing from the module cache with no proxy. When it fails, only rexcity and gc-runtime-rex are checked, and a missing tool goes unnoticed without a word. Logging the failure to stderr would leave a trace.
  • [minor] roles/assets/scripts/apply.sh:165: if rm -f fails on a stale tool (for example, a permission error), set -e ends the run with no mail. That is the same silent exit item 3 is about, now on the removal path. Adding || report "apply:rexinstall:$incoming" ... would match the mv calls.
  • [minor] The bead's 02:50 note from the review of #30 asks for two things. The first, the "since rexcity 0.29.0" header comment, is already gone on main. The second is not done, and the PR's "Not done" doesn't mention it: .forgejo/workflows/release.yaml still tags github.sha, the commit of its own run. It is unrelated to the apply order, so it is better as its own bead (the same family as claudeacp-aqp) than added to this PR. The Operator can split it out.

Verified

  • Read the work bead (description and notes), the PR description and the whole diff (4 files, +146/-37). origin/main has no REVIEW.md, AGENTS.md or CLAUDE.md.
  • Merged the head into current origin/main (be97be3, 3 commits ahead of the branch point) in my own clone. The merge is clean (docs/shell.md auto-merged) and Forgejo reports mergeable.
  • On the merged tree, with the city's variables removed (verified: none set): every script test CI runs passes (worktree-setup, worktree, gnu-tools, merge, handover, apply, upgrade, view-beads, view-mail, permission-deny, permission-request, formula, reviewer). go vet ./... and go test ./... pass. gc lint . reports 2 packs ok.
  • The new tests catch what they claim to. With main's apply.sh, tests/apply.sh fails on the record. With the missing-file check disabled (line 129 forced false), it fails with "apply did not rebuild the lost tool".
  • shellcheck roles/assets/scripts/apply.sh is clean. In tests/apply.sh it reports only SC2012 (info), which main's tests/apply.sh already fails on.
  • Ran go list tool on real rexcity checkouts in gc's pack cache. With a tool (claudeacp v0.5.0) it prints sarak.sh/mikluko/claudeacp/cmd/claudeacp, so the check sees claudeacp. Without one it only warns and exits 0, as the comment says. Neither run touched the checkout.
  • Built the changelog checker from mikluko/changelog v2.1.0 (= v2). Run on the head with -base=main it reports valid=true and exits 0, with the fragment .changelog/apply-rexcity-tools.md.
  • The PR description is there and states what is not done (item 5, in gascity-root).
Review of 0556f6889563866d6756bdc5830e62bc58647a80 for gascitypacks-uno. Checks of the head: success. ### Verdict pass ### Findings - [minor] roles/assets/scripts/apply.sh:93,125-135: item 1 is fixed only in part. The bead wants a build whenever `rexcity`, its link or a declared tool is missing. The check comes after the early `exit 0` at line 93, so a lost `claudeacp` stays lost, with nothing reported, until the next merge to the city's main. The PR description and the header comment (lines 21-22) both say so. A follow-up bead could move a cheap check (for example, the names in `.rexcity-installed`) ahead of that exit. Not blocking: the gap is disclosed, the by-hand repair in the bead still works, and the fix is a real improvement. - [minor] roles/assets/scripts/apply.sh:132: `go list -C "$src" tool 2>/dev/null` hides a failure, such as a tool module missing from the module cache with no proxy. When it fails, only `rexcity` and `gc-runtime-rex` are checked, and a missing tool goes unnoticed without a word. Logging the failure to stderr would leave a trace. - [minor] roles/assets/scripts/apply.sh:165: if `rm -f` fails on a stale tool (for example, a permission error), `set -e` ends the run with no mail. That is the same silent exit item 3 is about, now on the removal path. Adding `|| report "apply:rexinstall:$incoming" ...` would match the `mv` calls. - [minor] The bead's 02:50 note from the review of #30 asks for two things. The first, the "since rexcity 0.29.0" header comment, is already gone on main. The second is not done, and the PR's "Not done" doesn't mention it: `.forgejo/workflows/release.yaml` still tags `github.sha`, the commit of its own run. It is unrelated to the apply order, so it is better as its own bead (the same family as claudeacp-aqp) than added to this PR. The Operator can split it out. ### Verified - Read the work bead (description and notes), the PR description and the whole diff (4 files, +146/-37). origin/main has no REVIEW.md, AGENTS.md or CLAUDE.md. - Merged the head into current origin/main (be97be3, 3 commits ahead of the branch point) in my own clone. The merge is clean (docs/shell.md auto-merged) and Forgejo reports `mergeable`. - On the merged tree, with the city's variables removed (verified: none set): every script test CI runs passes (worktree-setup, worktree, gnu-tools, merge, handover, apply, upgrade, view-beads, view-mail, permission-deny, permission-request, formula, reviewer). `go vet ./...` and `go test ./...` pass. `gc lint .` reports 2 packs ok. - The new tests catch what they claim to. With main's apply.sh, tests/apply.sh fails on the record. With the missing-file check disabled (line 129 forced false), it fails with "apply did not rebuild the lost tool". - `shellcheck roles/assets/scripts/apply.sh` is clean. In tests/apply.sh it reports only SC2012 (info), which main's tests/apply.sh already fails on. - Ran `go list tool` on real rexcity checkouts in gc's pack cache. With a tool (claudeacp v0.5.0) it prints `sarak.sh/mikluko/claudeacp/cmd/claudeacp`, so the check sees `claudeacp`. Without one it only warns and exits 0, as the comment says. Neither run touched the checkout. - Built the changelog checker from mikluko/changelog v2.1.0 (= v2). Run on the head with `-base=main` it reports `valid=true` and exits 0, with the fragment `.changelog/apply-rexcity-tools.md`. - The PR description is there and states what is not done (item 5, in gascity-root).
Commenting is not possible because the repository is archived.
No reviewers
No labels
No milestone
No project
No assignees
2 participants
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
mikluko/gascitypacks!64
No description provided.