Fix maintenance test isolation and process start bound
Restore the fixture participation and floor after production configuration.
Verify configured apply with production directories read-only.
Document the two-second start-time lower bound and pin both truncations
in a proc fixture test.
Paul Campbellpushed by claude agent, operated by paul@keymail.devcd0d54cf73b0b7e43422758491f37db1333e16a5parent 8877f0e
<task-notification>
<task-id>a3a360e4842a84ee4</task-id>
<tool-use-id>toolu_01Qx2UZHtM1SPHCghk7b9b76</tool-use-id>
<output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/e47280e8-3e59-4dc1-95d2-11de7237d34c/tasks/a3a360e4842a84ee4.output</output-file>
<status>completed</status>
<summary>Agent "Re-review B2b fix round 1" finished</summary>
<note>A task-notification fires each time this agent stops with no live background children of its own. The user can send it another message and resume it, so the same task-id may notify more than once.</note>
<result>Verdict: open: the ConfiguredApply test hygiene, and the started_at error bound (needs a ruling). Five of the seven findings are fully addressed. The two open items:
- **New breakage:** the new apply test reaches the real host's `/var/lib/carlos-claims`, and it fails in our sandbox.
- **Finding 2:** the "up to one second early" wording R13 required is mathematically wrong now that the time is printed in whole seconds.
The rest of the diff is clean. `group_maintenance.go` and `group_maintenance_linux.go` are unchanged since d48d82d1, so the guard is unchanged. `go test ./internal/host -run TestGroupMaintenance` passes except `TestGroupMaintenanceConfiguredApply` (more on that below).
**Per finding** (files are in `internal/host/`)
1. **Important, `group-maintenance apply`: ADDRESSED.**
- The verb is dispatched at `group_maintenance_verbs.go:142` after the existing root check, group-marker check (fixed boxes refuse at :101 before any lock or change), non-blocking lock and marker re-check.
- The body is at `group_maintenance_prepare.go:125-138`. It calls `localConfiguration` (checked host.env), then `configure`, then `withSystemRelease(runLocked(ctx,false,nil))`. That matches bare `Run` (`systemapply.go:343`) minus re-taking the lock it already holds.
- Production wires `configure: configureMaintenanceApplier` (verbs.go:71), so the caller's environment is cleared and replaced.
- The permit refusal comes from `runLocked`'s `requireGroupMaintenance("check")` (`systemapply.go:349-352`). That runs before the floor hook, staging or repoint.
- Help text is at verbs.go:30-32. The test (`group_maintenance_round1_test.go:39-135`) does call the real `configureMaintenanceApplier` and checks the channel, key, bucket and roots come from host.env and the lock is held. But see the new breakage below.
2. **Important, `started_at` lower bound: ADDRESSED as written, but the wording is wrong.** `group_maintenance_clock.go:80` uses `time.Unix(boot+ticks/hz, 0)`. That rounds down, so it stays a lower bound. The comment (:14-17) and help (verbs.go:39-40) use the R13 text. The problem: `btime` is already rounded down to a whole second, and now the tick fraction is rounded down too. The real start can be up to about 2 seconds (plus one tick) after the printed value. So a generation "at least one second later" can still come before the real process start. No whole-second lower bound can be tighter than this. I'd ask for a ruling to change the text to "up to two seconds early; compare with a generation at least two seconds later" (or three for margin). Separately, `scripts/region-group-roll.py:626` compares with a strict `>` and no margin; that is the other implementer's file.
3. **Minors:**
- **configure test: ADDRESSED.** round1_test.go:39-90 checks channel, pubkey, bucket, roots, guard, PATH/AWS settings and that the caller's environment is cleared.
- **Five-minute prepare deadline: ADDRESSED.** prepare.go:98 and 141-142 set one timeout covering the store open and both GETs.
- If the deadline hits mid-download, `fetch` writes only into the private `.prepare-*` directory, which a `defer` removes (:200).
- `ctx.Err()` is checked again before publishing (:223).
- The cache and request are published through `safefile.Write` (temp file then rename), so nothing is ever half-written.
- After that check the remaining steps are local copies, and the cache is copied before the request.
- **`previous_result`: ADDRESSED.** prepare.go:184-193 and 233-241.
- A match needs the full (channel, version, promoted_at) tuple, with the channel from host.env.
- applied, rolled back and rollback failed set `request_written:false` and leave the old result untouched. `refused` is reported but still writes a request.
- A corrupt result.json refuses.
- **`.prepare-*` sweep: ADDRESSED.** prepare.go:105-123, called at :143 under the command lock.
- It only reads root's own apply directory.
- It only removes `.prepare-` plus an exact uint32 decimal suffix. That is the same shape `MkdirTemp` makes.
- `entry.IsDir()` comes from the directory entry type, so symlinks are skipped, and `RemoveAll` does not follow links inside.
- The test covers a symlink, a descriptive name and staging.
- **`edge.started_at_error`: ADDRESSED.** verbs.go:214 and 331-336. `edge.error` is now only about the process.
**New breakage:**
- **Important (test hygiene): `TestGroupMaintenanceConfiguredApply` reaches real host state.** `maintenanceProductionConfigure` (round1_test.go:85-86) puts back the fake's ops, store, floorHook, rootMoves and openRegistry. It does not put back `a.participation` or `a.floor`. So `withSystemRelease` → `hostfloor.Disk{}` → `rootparticipation.OpenForUpdate()` opens `/var/lib/carlos-claims/authority/exec`.
- **In the sandbox:** `/var` shows as owned by `nobody`, so both subtests fail with `permission denied`. I reproduced this at 36bdeb0d.
- **Outside it:** where the directory doesn't exist the test passes by luck. That is probably why the implementer saw it pass.
- **As root on a box with a live census:** it would run launch exclusion against the real ledger.
- **Fix:** also copy `a.participation, a.floor = fake.participation, fake.floor` (the fixture sets these at `systemapply_test.go:135`).
- Nothing else new at Critical or Important.
I made no changes. My scratch files (the test binary) are deleted, and I didn't touch `scripts/`.</result>
<usage><subagent_tokens>84929</subagent_tokens><tool_uses>21</tool_uses><duration_ms>228249</duration_ms></usage>
</task-notification>
- for _, phrase := range []string{"group-maintenance apply", "never bare", "five minutes", "previous_result", "a lower bound, up to one second early; compare with a generation at least one second later and check the edge identity has not changed"} {
+ for _, phrase := range []string{"group-maintenance apply", "never bare", "five minutes", "previous_result", "a lower bound, up to two seconds early; compare with a generation at least two seconds later and check the edge identity has not changed"} {
if !strings.Contains(groupMaintenanceHelp, phrase) {