Skip to content

fix(test): canonicalize cityDir to make reaper scope test pass on macOS#1759

Open
eric-jones wants to merge 1 commit intogastownhall:mainfrom
eric-jones:fix/test-reaper-citydir-symlink-canon
Open

fix(test): canonicalize cityDir to make reaper scope test pass on macOS#1759
eric-jones wants to merge 1 commit intogastownhall:mainfrom
eric-jones:fix/test-reaper-citydir-symlink-canon

Conversation

@eric-jones
Copy link
Copy Markdown
Contributor

@eric-jones eric-jones commented May 6, 2026

Summary

TestReaperScopesIssueAutoCloseToCityBeadsDir in
examples/gastown/maintenance_scripts_test.go fails deterministically on
macOS. reaper.sh canonicalizes its CITY argument via pwd -P (line 14
of examples/gastown/packs/maintenance/assets/scripts/reaper.sh), so on
macOS the bd-call log records pwd=/private/var/folders/... while the
test asserts against the unresolved t.TempDir() value
(/var/folders/...).

Resolve cityDir once via filepath.EvalSymlinks before using it. On
Linux the call is identity for non-symlinked paths, so the change is a
no-op there. Pattern matches the existing usage at
test/acceptance/worker_inference/worker_inference_test.go:4971.

Testing

  • make checkexamples/gastown package passes (was failing
    deterministically before this change). 4 unrelated pre-existing macOS
    failures still present (none in the touched package):
  • Targeted: go test -count=3 -run '^TestReaperScopesIssueAutoCloseToCityBeadsDir$' ./examples/gastown/ — passes consistently (was failing every run before).
  • make check-docs — no docs touched.
  • make test-integration — not run.

Used --no-verify on commit per the #1729 workaround for the broken
macOS pre-commit hook.

Checklist

  • Linked an issue, or explained why one is not needed — internal tracker bead stg-ize.
  • Added or updated tests for behavior changes — the existing test is the regression coverage.
  • Updated docs for user-facing changes — none.
  • Called out breaking changes or migration notes — none.

View in Codesmith
Need help on this PR? Tag @codesmith with what you need.

  • Let Codesmith autofix CI failures and bot reviews

reaper.sh canonicalizes its CITY argument via `pwd -P` (resolves
symlinks). On macOS, t.TempDir returns paths under /var/folders/...,
which the kernel resolves to /private/var/folders/... when the shell
takes its working directory. The bd-call log captured by the test
therefore records pwd= and beads= prefixes in the resolved form,
while the assertions compared against the unresolved t.TempDir
value — failing deterministically on macOS.

Resolve cityDir once via filepath.EvalSymlinks before using it
(matching the existing pattern at worker_inference_test.go:4971).
On Linux the call is identity for non-symlinked paths, so the
change is a no-op there.
@eric-jones eric-jones requested a review from julianknutsen as a code owner May 6, 2026 20:11
@github-actions github-actions Bot added the status/needs-triage Inbox — we haven't looked at it yet label May 6, 2026
@codecov-commenter
Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@randy-release-manager randy-release-manager Bot added kind/chore Internal improvement (refactor, tests, CI, tooling) priority/p2 Medium — real problem, workaround exists and removed status/needs-triage Inbox — we haven't looked at it yet labels May 6, 2026
julianknutsen pushed a commit that referenced this pull request May 7, 2026
… (boot) (#1769)

## Summary

- Replace the broken pipeline `gc mail inbox --address=deacon --json
2>/dev/null | jq length` with `gc mail count deacon 2>/dev/null` in
`examples/gastown/packs/gastown/agents/boot/prompt.template.md` line 55.
- `gc mail inbox` accepts `[session]` as a positional and has no
`--json` flag — the original line failed at runtime with two flag errors
(`--address` not recognized, `--json` not recognized). The intent (count
deacon's unread mail to triage idle state) is exactly what `gc mail
count [session]` reports directly.
- No new API surface — `gc mail count` is already part of the documented
`gc mail` command set; this is a swap from the broken inbox-pipeline
pattern to the count subcommand that exists for this purpose.

Verified via `--help`:
```
$ gc mail count --help
Show total and unread message counts for a session alias or human.
The recipient defaults to $GC_SESSION_ID, $GC_ALIAS, $GC_AGENT, or "human".
Usage:
  gc mail count [session] [flags]
```

## Testing

- [x] `~/cities/test-series/bin/lint-pack
~/wrk/gascity/examples/gastown/ --check command-syntax` — boot:55's two
violations (one for each invalid flag) are removed by this change.
Remaining errors on main are covered by other open PRs (#1743 fixes `gc
agent peek/list/drain` at boot:39/49 and mayor:205; #1768 fixes the
witness `gc session peek` positional at witness:188).
- [x] `make lint` — 0 issues.
- [x] `make vet` — clean.
- [x] `go test ./examples/gastown/...` — only the pre-existing
`TestReaperScopesIssueAutoCloseToCityBeadsDir` failure (documented in
the EXPECT-FAIL list below; not caused by this change — fixed by open PR
#1759).
- [ ] `make check` — full suite not run. Prose-only one-line edit to a
pack prompt template; no Go code is exercised by the diff. lint-pack is
the static check covering this surface.
- [ ] `make check-docs` — not applicable.
- [ ] `make test-integration` — not run (per cities CLAUDE.md, deferred
while the suite times out without saving partial output).

**Pre-existing macOS test failures** (per `bd list --label=expect-fail
--status=open,in_progress` in cities):

- `TestBuiltinDoltDoctorBoundsVersionProbe` — fixed by #1729
- `TestBuiltinDoltDoctorReportsTimedOutVersionProbe` — fixed by #1729
- `TestExecCommandRunnerTimeoutKillsChildProcess` — fixed by #1729
- `TestReaperScopesIssueAutoCloseToCityBeadsDir` — fixed by #1759
- `TestCityRuntimeManualReloadPanicAfterReloadKeepsReloadReplyAndClears`
— fixed by #1741
- `TestStartLongSocketPathUsesShortSocketName` — no fix-PR yet (flakes
under make check parallel load on macOS)

Committed with `--no-verify` because the macOS pre-commit hook is
currently blocked by these pre-existing failures until #1729 lands.

## Checklist

- [x] Linked an issue, or explained why one is not needed — internal
bead `stg-xin` (cities)
- [ ] Added or updated tests for behavior changes — not applicable
(one-line prompt-template fix; no Go behavior changed; the static
lint-pack check catches this bug class)
- [x] Updated docs for user-facing changes — the prompt template *is*
the user-facing artifact
- [ ] Called out breaking changes or migration notes — none (the broken
syntax was already failing at runtime)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

<!-- codesmith:footer -->
---
<a
href="https://app.blacksmith.sh/gastownhall/codesmith/gascity/pr/1769"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://pr-comments-assets.blacksmith.sh/codesmith/view-in-codesmith-dark.svg"><source
media="(prefers-color-scheme: light)"
srcset="https://pr-comments-assets.blacksmith.sh/codesmith/view-in-codesmith-light.svg"><img
alt="View in Codesmith"
src="https://pr-comments-assets.blacksmith.sh/codesmith/view-in-codesmith-dark.svg"></picture></a>
<sup>Need help on this PR? Tag <code>@codesmith</code> with what you
need.</sup>

- [ ] Let Codesmith autofix CI failures and bot reviews
<!-- /codesmith:footer -->

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
julianknutsen pushed a commit that referenced this pull request May 7, 2026
…1768)

## Summary

- Replace `gc session peek <target> 50` with `gc session peek <target>
--lines 50` in
`examples/gastown/packs/gastown/agents/witness/prompt.template.md` line
188.
- Same bug class as the boot/deacon/dog fixes in #1743 / #1744 / #1753:
the line-count is now a flag, not a positional. Without `--lines`,
runtime fails with `accepts 1 arg(s), received 2`.
- The witness agent runs `gc session peek` to inspect polecat output
during patrol; every witness invocation currently burns a tool call on
this error before falling back to `--help` discovery.
- Filed separately because the witness prompt was missed when the
boot/deacon/dog fixes went out — neither bundled into those PRs nor
pre-emptively listed anywhere; surfaced when the new pack-aware
command-syntax linter (cities `test-series/lint_pack/`) ran against
`examples/gastown/` on main.

Verified the new syntax against `gc session peek --help`:
```
Flags:
  -h, --help        help for peek
      --lines int   number of lines to capture (default 50)
```

## Testing

- [x] `~/cities/test-series/bin/lint-pack
~/wrk/gascity/examples/gastown/ --check command-syntax` — 6 errors
before fix, 5 after; the witness:188 violation is the one removed.
Remaining 5 are covered by other open PRs (#1743 fixes the `gc agent
peek/list/drain` errors at boot:39/49 and mayor:205) or other open beads
(the boot:55 `gc mail inbox --address/--json` flag errors are tracked
separately).
- [x] `make lint` — 0 issues.
- [x] `make vet` — clean.
- [x] `go test ./examples/gastown/...` — only the pre-existing
`TestReaperScopesIssueAutoCloseToCityBeadsDir` failure (documented in
the EXPECT-FAIL list below; not caused by this change — it's a `/var →
/private/var` symlink resolution issue fixed by open PR #1759).
- [ ] `make check` — full suite not run. The change is a prose-only
one-line edit to a pack prompt template; no Go code is exercised by the
diff. lint-pack is the static check that covers the surface of this
change, and `go test ./examples/gastown/...` exercises the
embedding/loading path.
- [ ] `make check-docs` — not applicable (no `docs/` changes).
- [ ] `make test-integration` — not run (per cities CLAUDE.md, deferred
while the suite times out without saving partial output).

**Pre-existing macOS test failures** (per `bd list --label=expect-fail
--status=open,in_progress` in cities):

- `TestBuiltinDoltDoctorBoundsVersionProbe` — fixed by #1729
- `TestBuiltinDoltDoctorReportsTimedOutVersionProbe` — fixed by #1729
- `TestExecCommandRunnerTimeoutKillsChildProcess` — fixed by #1729
- `TestReaperScopesIssueAutoCloseToCityBeadsDir` — fixed by #1759
- `TestCityRuntimeManualReloadPanicAfterReloadKeepsReloadReplyAndClears`
— fixed by #1741
- `TestStartLongSocketPathUsesShortSocketName` — no fix-PR yet (flakes
under make check parallel load on macOS)

Committed with `--no-verify` because the macOS pre-commit hook is
currently blocked by these pre-existing failures until #1729 lands.

## Checklist

- [x] Linked an issue, or explained why one is not needed — internal
bead `stg-lls` (cities)
- [ ] Added or updated tests for behavior changes — not applicable
(one-line prompt-template fix, same class as #1743 / #1744 / #1753 which
also added no tests; the static lint-pack check catches this bug class)
- [x] Updated docs for user-facing changes — the prompt template *is*
the user-facing artifact
- [ ] Called out breaking changes or migration notes — none (the broken
syntax was already failing at runtime)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

<!-- codesmith:footer -->
---
<a
href="https://app.blacksmith.sh/gastownhall/codesmith/gascity/pr/1768"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://pr-comments-assets.blacksmith.sh/codesmith/view-in-codesmith-dark.svg"><source
media="(prefers-color-scheme: light)"
srcset="https://pr-comments-assets.blacksmith.sh/codesmith/view-in-codesmith-light.svg"><img
alt="View in Codesmith"
src="https://pr-comments-assets.blacksmith.sh/codesmith/view-in-codesmith-dark.svg"></picture></a>
<sup>Need help on this PR? Tag <code>@codesmith</code> with what you
need.</sup>

- [ ] Let Codesmith autofix CI failures and bot reviews
<!-- /codesmith:footer -->

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/chore Internal improvement (refactor, tests, CI, tooling) priority/p2 Medium — real problem, workaround exists

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants