Found in review of #81: no test for the pane record that cannot be written; a GC_BIN directory with a colon #90

Merged
city-root merged 1 commit from worker/rexcity-1rlsf into main 2026-11-12 13:46:04 +00:00
Contributor

Two small gaps found in the review of #81 (bead rexcity-1rlsf).

  • Colon in GC_BIN's directory. The pane script puts the directory of GC_BIN on the PATH; a colon in it would split it into two entries, the first a prefix of the real directory. gcDir now returns "" for such a directory, so the pane gets the runtime's PATH as it is. The command still reaches the city's gc through the gc function. New fragment .changelog/pane-gc-dir-colon.md.
  • Unwritable record of pane commands. The branch of addMissingPanes where the record reads but the trial write fails had no test. TestAPaneIsNotReplacedAtEveryStartWhenItsRecordReadsButCannotBeWritten shuts the state directory (mode 0500; skipped as root) and calls ensureCityPanes directly, because a whole start fails earlier writing the agent's own record. It checks the pane is left alone and one warning comes per start. With the trial write removed the test fails.

Verified locally: go vet ./internal/..., go test ./cmd/... ./internal/... ./packs/... (all pass), and the changelog v2 check (valid=true).

Bead: rexcity-1rlsf

Two small gaps found in the review of #81 (bead rexcity-1rlsf). - **Colon in `GC_BIN`'s directory.** The pane script puts the directory of `GC_BIN` on the `PATH`; a colon in it would split it into two entries, the first a prefix of the real directory. `gcDir` now returns "" for such a directory, so the pane gets the runtime's `PATH` as it is. The command still reaches the city's `gc` through the `gc` function. New fragment `.changelog/pane-gc-dir-colon.md`. - **Unwritable record of pane commands.** The branch of `addMissingPanes` where the record reads but the trial write fails had no test. `TestAPaneIsNotReplacedAtEveryStartWhenItsRecordReadsButCannotBeWritten` shuts the state directory (mode 0500; skipped as root) and calls `ensureCityPanes` directly, because a whole start fails earlier writing the agent's own record. It checks the pane is left alone and one warning comes per start. With the trial write removed the test fails. Verified locally: `go vet ./internal/...`, `go test ./cmd/... ./internal/... ./packs/...` (all pass), and the changelog v2 check (`valid=true`). Bead: rexcity-1rlsf
fix: a GC_BIN directory with a colon is not put on a pane's PATH; test the unwritable pane record (rexcity-1rlsf)
All checks were successful
image / image (pull_request) Successful in 9s
test / changelog (pull_request) Successful in 5s
test / go (pull_request) Successful in 1m45s
59159e7c09
Two gaps found in the review of #81.

A GC_BIN whose directory holds a colon would be split by the pane script into two PATH entries, the first a prefix of the real directory. gcDir now returns "" for such a directory, so the pane gets the runtime's PATH as it is; the command still reaches the city's gc through the gc function.

The branch of addMissingPanes where the record of pane commands reads but the trial write fails had no test. The new test shuts the state directory (mode 0500, skipped as root) and calls ensureCityPanes directly, since a whole start fails earlier on writing the agent's own record. It checks the pane is left alone and one warning comes per start; with the trial write removed it fails.

Validation: go vet ./internal/..., go test ./internal/rpp, changelog v2 check (valid=true).

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

Review of 59159e7c09 for rexcity-1rlsf. Checks of the head: success.

Verdict

pass

Findings

  • [minor] README.md:127-128: the README still says the directory of GC_BIN goes first on the pane's PATH whenever GC_BIN is an absolute path, and that a program the command starts therefore finds the same gc. After this change neither holds for a directory with a colon in it. Adding a clause there ("unless its directory has a colon, which no PATH entry can hold") would bring the README in line with gcDir and the fragment. This edge case is rare, so the finding does not block.

Verified

  • Requirement: both gaps of rexcity-1rlsf are covered, and nothing unrelated is in the diff (3 files: internal/rpp/citypanes.go, internal/rpp/panepath_test.go, .changelog/pane-gc-dir-colon.md). The PR has a description.
  • gcDir (citypanes.go:193): it returns "" when filepath.Dir(GC_BIN) contains :. Then paneScript skips PATH=$4:$PATH, and the pane gets the runtime's PATH unchanged. The gc function still runs "$0", the full GC_BIN, so a colon does it no harm. A colon in the file name only still gives the directory (asserted in the test).
  • Trial-write branch of addMissingPanes: SavePaneCommands writes through os.CreateTemp in the state directory, so mode 0500 does make the trial write fail, and the test exercises that branch. Running ensureCityPanes directly is justified: a whole start fails earlier, when it writes the agent's record.
  • Mutation checks: with the old gcDir, TestAGCBinDirectoryWithAColonIsNotPutOnThePATH fails ("Should be empty, but was /opt/a:b"). With the trial write replaced by a no-op, TestAPaneIsNotReplacedAtEveryStartWhenItsRecordReadsButCannotBeWritten fails (the replacement goes ahead and errors when it saves the tracked panes).
  • Merged into current origin/main (0653b94): clean. Forgejo reports mergeable.
  • On the merged tree, with the city's variables removed: go vet ./... passes, also with GOOS=darwin GOARCH=arm64 and GOOS=linux GOARCH=amd64. go test ./... passes. go test -race of internal/rpp and internal/state passes. The new tests passed in all 5 runs of -count=5.
  • Changelog: the checker built from mikluko/changelog v2 (c19d67d) and run with -base=main -warn=missing-fragment printed valid=true. The fragment holds only a ### Fixed heading and its bullet, as REVIEW.md requires.
Review of 59159e7c09dae7b653ba47c4de68619bb24bf4fd for rexcity-1rlsf. Checks of the head: success. ### Verdict pass ### Findings - [minor] README.md:127-128: the README still says the directory of `GC_BIN` goes first on the pane's `PATH` whenever `GC_BIN` is an absolute path, and that a program the command starts therefore finds the same `gc`. After this change neither holds for a directory with a colon in it. Adding a clause there ("unless its directory has a colon, which no `PATH` entry can hold") would bring the README in line with `gcDir` and the fragment. This edge case is rare, so the finding does not block. ### Verified - Requirement: both gaps of rexcity-1rlsf are covered, and nothing unrelated is in the diff (3 files: `internal/rpp/citypanes.go`, `internal/rpp/panepath_test.go`, `.changelog/pane-gc-dir-colon.md`). The PR has a description. - `gcDir` (citypanes.go:193): it returns "" when `filepath.Dir(GC_BIN)` contains `:`. Then `paneScript` skips `PATH=$4:$PATH`, and the pane gets the runtime's `PATH` unchanged. The `gc` function still runs `"$0"`, the full `GC_BIN`, so a colon does it no harm. A colon in the file name only still gives the directory (asserted in the test). - Trial-write branch of `addMissingPanes`: `SavePaneCommands` writes through `os.CreateTemp` in the state directory, so mode 0500 does make the trial write fail, and the test exercises that branch. Running `ensureCityPanes` directly is justified: a whole start fails earlier, when it writes the agent's record. - Mutation checks: with the old `gcDir`, `TestAGCBinDirectoryWithAColonIsNotPutOnThePATH` fails ("Should be empty, but was /opt/a:b"). With the trial write replaced by a no-op, `TestAPaneIsNotReplacedAtEveryStartWhenItsRecordReadsButCannotBeWritten` fails (the replacement goes ahead and errors when it saves the tracked panes). - Merged into current `origin/main` (0653b94): clean. Forgejo reports `mergeable`. - On the merged tree, with the city's variables removed: `go vet ./...` passes, also with GOOS=darwin GOARCH=arm64 and GOOS=linux GOARCH=amd64. `go test ./...` passes. `go test -race` of `internal/rpp` and `internal/state` passes. The new tests passed in all 5 runs of `-count=5`. - Changelog: the checker built from mikluko/changelog `v2` (c19d67d) and run with `-base=main -warn=missing-fragment` printed `valid=true`. The fragment holds only a `### Fixed` heading and its bullet, as REVIEW.md requires.
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/rexcity!90
No description provided.