oficina / equipo Public

equipo: Task 27 review 1, each digest-bound field and key bytes tested

TestAckImmutable alters each field the checkpoint digest binds (task,
attempt, launch, repo, base, candidate, pack digest) separately in the
trigger-free fixture: each renders ErrCheckpointMismatch with nothing.
TestCheckpointMachineKeyFromEnrolment adds an enrolment whose stored
hash matches the runner but whose key bytes do not: no key. Mutations
removing only the checkpoint-digest comparison and only the key hash
recomputation each fail. Test budget records raised.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev pushed by paul@keymail.dev fd36bc2c47a355a84bba2c56665f352faa08ce7e parent f693f1f
4 files changed, +48 −7
  • .rastrillo/budgets.txt +2 −2
  • docs/superpowers/plans/HOSTED-SLICE2-PROGRESS.md +15 −0
  • internal/equipo/chat/checkpoint_test.go +23 −4
  • internal/equipo/checkpoint_key_test.go +8 −1

CI failed — run details

CI log
=== prepare ===
ci-box: machine: aarch64, 32 CPUs, 62 GiB memory, kernel 7.0.0-1017-aws
ci-box: python 3.12.3; Docker version 29.1.3, build 29.1.3-0ubuntu3~24.04.2
ci-box: user namespaces allowed: 233151
ci-box: cgroup: cgroup2fs
ci-box: disk /home/ci/work/repos/oficina__equipo/wt/hosted-runners-2: Type  Size Avail | ext4   96G   84G
ci-box: disk /home/ci/.cache/equipo-ci-box: Type  Size Avail | ext4   96G   84G
ci-box: bwrap: fetched and verified in 0.3s
ci-box: claude: fetched and verified in 2.1s
ci-box: codex: fetched and verified in 3.4s
ci-box: codex-code-mode-host: fetched and verified in 1.3s
ci-box: libwrap: fetched and verified in 0.3s
ci-box: socat: fetched and verified in 0.3s
npm warn deprecated node-domexception@1.0.0: Use your platform's native DOMException instead
ci-box: image pulled in 9.9s
ci-box: pi: installed and verified in 7.6s
ci-box: opencode: installed and verified in 2.3s
ci-box: chromium 156.0.8078.79-1~deb13u1: 76 packages fetched, verified and unpacked in 8.6s
ci-box: clone deepened in 5.8s
ci-box: file times set from content: 3924 files, 272 directories
ci-box: ready in 19.5s
=== copy ===
EQUIPO_RELEASE_COPY_CHECK=1 CGO_ENABLED=0 go test ./internal/equipotest -run '^TestReleaseCopyReviewed$' -count=1
--- FAIL: TestReleaseCopyReviewed (0.09s)
    task_pages_test.go:236: COPY REVIEW REQUIRED: copy-status.py verify found copy pending review or stale bookkeeping
FAIL
rastrillo-budget/v1 ran 88ms
FAIL	amadan.net/oficina/equipo/internal/equipotest	0.239s
FAIL
make: *** [Makefile:273: copy-release-check] Error 1

amadan: step copy failed: exit status 2

amadan: job failed at step copy — its output is above, not at the tail of this log
diff --git a/.rastrillo/budgets.txt b/.rastrillo/budgets.txt
index 3f17e287..29bbc6a3 100644
--- a/.rastrillo/budgets.txt
+++ b/.rastrillo/budgets.txt
@@ -15,7 +15,7 @@ time internal/equipo/team 60s Plan 3 loaded CI measured 45.985s; niced serial re
time internal/equipotest 300s Final fix package rerun measured 187.035s (review 172.4s); 300s gives 60 percent headroom for HTTP, sandbox, authority and final regression coverage.
time internal/equipo/hostedrun 60s Hosted slice 2 Task 21: TestDispatcherSimulation runs 200 seeds of the real chat store (SQLite) and dispatcher against a fake controller, with unlinked VMs that run to their 90-minute lifetime since review round 1, and one test drives the real controller over TLS for 90 simulated minutes; about 35 s of CPU in parallel subtests; measured 14 s on a 16 CPU docs-t1 under load 2.4; 60s covers a loaded 4 CPU runner.
-size internal/equipo 25562 9312 Preview, retry, merges, kept work, check-db, notifications, places, GitHub routes, installer, abilities, lookups, Mac waits, slice F codes, D1, probe details, Design's copy, /api/team; measured 24735. Hosted slice 2 Task 15 review 1: work.reason.pack_incomplete (pending); 24736. Task 17: work.reason.deps_conflict, deps_new_module, deps_missing, deps_too_large and token_renewal_failed (pending); 24741. Task 18: the owner setting "Run checks in a hosted VM" (config flag, routes, section, handler, four pending keys); 24825. Its review round 1: chatMe reports a roster denial as chat.ErrForbidden too (chatDenied); 24837. Task 21: the hosted dispatcher started only with EQUIPO_HOSTED_RUNNERS=1, execution on and a controller configured (EQUIPO_HOSTED_* config, RevokeRunner wiring), and the work.reason words for hosted_enrol_timeout, hosted_vm_lost and hosted_unavailable (pending); 24867. Task 22: hosted_enrol.go, a hosted VM's enrolment (POST /api/hosted/enrol) and its runner's challenge and renewal under /api/runner/v2 (the store methods over the runner and credential rows, the handlers, the routes only with EQUIPO_HOSTED_RUNNERS=1 and an admission reader), and mintRunnerCredential's lifetime and cap; 25248. Its tests (hosted_enrol_test.go: the routes through the whole application, and the runner's hosted.Start end to end through the test proxy) drive the unexported store, router and admission reader, so they live beside them and take the directory past the 8000-line test default; measured 8563 test lines. Task 22 review 1: the controller's deadline in the credential cap, and tests for a stale admission after a newer refusal, the first sighting and its window, code single use alone and the controller's deadline; 25256/8669. Review 2: a renewal reads the controller's admission record first, outside the transaction, and is capped by its current deadline; its tests (a deadline moved earlier after launch, the controller away or without a record); 25304/8724. Review 3: enrolment tests for a deadline moved earlier before enrolment and one already passed; 25304/8741. Task 25: what the person sees of hosted work: the checks line and timeline for a hosted wait and for each hosted limit (hostedWaitLine), the hosted reasons' words on the checks line and the merge decision, the Usage page's Hosted machines block (unknown, never zero, when unread), the owner's per-person limit editor (form, parsing, save route, the members it lists) and nineteen pending keys; hosted_views_test.go drives the store through the production wiring; 25478/9069. Task 25 review round 1: the limit save keeps a stored figure submitted as shown (hostedLimitsFrom), refuses limits below one checks run in their own words (hosted.limits.too_low), and handler tests for the Usage block and the save (flag, unknown totals, session actor, target, revision, member); 25524/9235. Task 26: runner_update_needed waits for the runner's update on the pause line (tooOld) and its pending work.reason words; 25525/9235. Task 27: checkpoint_key.go, a runner's machine public key for pack receipts (chat.Authority.RunnerMachineKey: runner rows keep only the key's hash, so the key comes from the runner's exchanged enrolment and must hash to it), wired in chat_wiring.go, and checkpoint_key_test.go; 25562/9312.
+size internal/equipo 25562 9319 Preview, retry, merges, kept work, check-db, notifications, places, GitHub routes, installer, abilities, lookups, Mac waits, slice F codes, D1, probe details, Design's copy, /api/team; measured 24735. Hosted slice 2 Task 15 review 1: work.reason.pack_incomplete (pending); 24736. Task 17: work.reason.deps_conflict, deps_new_module, deps_missing, deps_too_large and token_renewal_failed (pending); 24741. Task 18: the owner setting "Run checks in a hosted VM" (config flag, routes, section, handler, four pending keys); 24825. Its review round 1: chatMe reports a roster denial as chat.ErrForbidden too (chatDenied); 24837. Task 21: the hosted dispatcher started only with EQUIPO_HOSTED_RUNNERS=1, execution on and a controller configured (EQUIPO_HOSTED_* config, RevokeRunner wiring), and the work.reason words for hosted_enrol_timeout, hosted_vm_lost and hosted_unavailable (pending); 24867. Task 22: hosted_enrol.go, a hosted VM's enrolment (POST /api/hosted/enrol) and its runner's challenge and renewal under /api/runner/v2 (the store methods over the runner and credential rows, the handlers, the routes only with EQUIPO_HOSTED_RUNNERS=1 and an admission reader), and mintRunnerCredential's lifetime and cap; 25248. Its tests (hosted_enrol_test.go: the routes through the whole application, and the runner's hosted.Start end to end through the test proxy) drive the unexported store, router and admission reader, so they live beside them and take the directory past the 8000-line test default; measured 8563 test lines. Task 22 review 1: the controller's deadline in the credential cap, and tests for a stale admission after a newer refusal, the first sighting and its window, code single use alone and the controller's deadline; 25256/8669. Review 2: a renewal reads the controller's admission record first, outside the transaction, and is capped by its current deadline; its tests (a deadline moved earlier after launch, the controller away or without a record); 25304/8724. Review 3: enrolment tests for a deadline moved earlier before enrolment and one already passed; 25304/8741. Task 25: what the person sees of hosted work: the checks line and timeline for a hosted wait and for each hosted limit (hostedWaitLine), the hosted reasons' words on the checks line and the merge decision, the Usage page's Hosted machines block (unknown, never zero, when unread), the owner's per-person limit editor (form, parsing, save route, the members it lists) and nineteen pending keys; hosted_views_test.go drives the store through the production wiring; 25478/9069. Task 25 review round 1: the limit save keeps a stored figure submitted as shown (hostedLimitsFrom), refuses limits below one checks run in their own words (hosted.limits.too_low), and handler tests for the Usage block and the save (flag, unknown totals, session actor, target, revision, member); 25524/9235. Task 26: runner_update_needed waits for the runner's update on the pause line (tooOld) and its pending work.reason words; 25525/9235. Task 27: checkpoint_key.go, a runner's machine public key for pack receipts (chat.Authority.RunnerMachineKey: runner rows keep only the key's hash, so the key comes from the runner's exchanged enrolment and must hash to it), wired in chat_wiring.go, and checkpoint_key_test.go; 25562/9312. Task 27 review 1: an enrolment whose stored hash matches the runner beside another key's bytes; 25562/9319.
size internal/wire 9962 - Protocols 31 to 35 (facts, diffs, evidence, CI units, files, places), abilities, 36 lookups, 37 Mac Engineering, 38 Design, unproven and probe detail codes, 39 hosted runners (hosted.go: placement, hosted_pack and deps transfer limits, enrolment types); measured 9848. Task 15 opened TransferHeader.Valid to hosted_pack (inbound, base then candidate) and added ReasonPackIncomplete; 9860. Its review round 1 registered it in StepReasons; 9862. Task 17: the hosted worker's reasons (deps_conflict, deps_new_module, deps_missing, deps_too_large, token_renewal_failed) registered in StepReasons, and TransferHeader.Valid opened to deps with the hosted_pack rules (the worker accepts the bundle; Task 23 sends it); 9884. Task 21: ReasonHostedEnrolTimeout, ReasonHostedVMLost and ReasonHostedUnavailable, registered in StepReasons; 9899. Task 23: SendPackCommand.Deps, refused below ProtocolHostedRunners; 9902. Task 26: ReasonRunnerUpdateNeeded registered in StepReasons, and ProtocolHostedRunners documented as marking Research's quoting; 9912. Task 27: checkpoint.go, the Checkpoint and PackReceipt types slice 4 sends, the notes bounds, ValidPackDigest and PackReceiptMessage (the receipt's domain-separated signed message); no frame; 9962.
size internal/equipotest - 12693 GitHub connect value search, lifecycle and sweep-log contracts; Task 21 migration fixtures, Rastrillo asset contract, renderer archive link; measured 0/12693 source/test lines.
time internal/runner/checks 90s CI worker measured 44.553s (44.6s rounded);
@@ -60,7 +60,7 @@ perf GET /api/v1/assistant/snapshot skip Assistant person API: bearer-only JSON
perf GET /api/v1/assistant/messages skip Assistant person API: bearer-only JSON for Base's chat, not a browser screen.
perf GET /api/v1/assistant/events skip Assistant event stream (Server-Sent Events), bearer-only and long-lived; not a screen.
perf GET /api/v1/assistant/abilities skip Assistant person API: bearer-only JSON for Base's Settings line, not a browser screen.
-size internal/equipo/chat 47548 22421 File facts/diffs, previews, merges, unfinished work, CI, receipts, Assistant files, places, abilities, lookups, go-aheads, Mac work, D1, Design specialists, grants, captures; 45093/18782. Hosted slice 2 Task 15: openHostedPack (the instance's send_pack for a hosted pack) and its test; 45105/18883. Its review round 1 added the report-ingestion test for pack_incomplete; 45105/18911. Task 18: hosted_setting.go (SetHostedChecks, hostedChecks, HostedSettings; owner only, roster in the transaction, audited) and its tests; 45208/19070. Its review round 1: the audit atomicity test; 45208/19113. Task 19: hosted_jobs.go (the hosted_jobs and hosted_challenges tables, HostedJob and its lifecycle: newHostedJob, the listed moves only, ended and failed only with stop proof or never-launched evidence, settleHostedJob once, hostedJobForRunner; each move audited in its transaction) and its tests, TestMigrationAdditive included; 45658/19577. Its review round 1: the never-launched evidence contract (HostedNeverLaunched, launch_by and launching_since, hostedLaunchReturned) and tests for it, settlement of unproven terminal records and audit atomicity; 45728/19739. Task 20: hosted_limits.go (per-person hosted limits, S2-9: hostedAdmit held in the write by a per-person lock row, hostedHoldFor, Allocate, hostedSettle at 4x the baseline, SetHostedLimits owner only with the roster, revision and audit in the transaction) and its tests; 46013/20214. Its coordinator ruling: a limit counts only while its setting owner is a current owner (defaults otherwise, checked in the admission transaction) and TestOwnerRaisesLimitRevoked; 46022/20284. Its review round 1: Allocate returns nothing for an empty or reversed span before widening, and its assertions; 46025/20290. Hosted slice 2 Task 21: placement on hosted VMs (placeHosted before the checks early return, its five rules), the bound runner's fits, Authorize by job identity, the hosted offline rule and withdrawal exemption, the hosted pack at dispatch, the step-terminal hook, and the dispatcher's store methods (HostedLive, HostedSweep, HostedLaunching with relaunch, HostedLaunched, HostedAdmitted, HostedFailed, HostedStopped, HostedNeverLaunched, HostedReplaces, PlaceHosted; end, settle, revoke, step moved on) in hosted_run.go, and hosted_place_test.go; 46665/20804. Task 21 review round 1: abandoned-intent evidence waits for the job's lifetime, the job keeps its lifetime and first running sight, admission takes the placing transaction's step attempt, provider-valid attempt IDs, HostedRunning, and the Retry, replacement-runner, cancelled-task and stopping-VM tests; 46709/20937. Its review round 2: TestHostedReplacesNeedsProof; 46709/20971. Task 22: hosted_enrol.go (the enrolment and renewal store steps inside the instance's write transaction: HostedClaimCode, HostedEnrolAdmit, HostedEnrolBind, HostedRunnerJob, HostedNewChallenge, HostedUseChallenge; hostedAdmitted shared with HostedAdmitted); its tests drive it through the instance's routes (internal/equipo); 46848/20971. Its review round 1: hostedAdmitted reports whether the record was kept, the enrolment records the first sighting and applies the window from it, and the launch view's deadline is kept (hosted_jobs.deadline, earliest wins); 46903/20971. Its review round 2: an admission record's current deadline is kept too (hostedAdmitted, for the dispatcher's refresh and the renewal's HostedRenewAdmit); 46932/20971. Round 3: HostedEnrolAdmit returns the job re-read after recording the admission, so the enrolment caps by its deadline; 46937/20971. Task 23: openHostedPack opens the deps bundle after the hosted pack (send_pack with Deps), the instance's chunk and byte checks per kind (wire.MaxChunks, wire.MaxBytes), deps_too_large for a bundle past its limit, and a hosted attempt's pack and bundle closed when its checks end; hosted_deps_test.go; 46957/21199. Task 24: hosted_results.go (hostedCertified, AdmissionFresh: a hosted worker's checks count as sandboxed and its base checks as trusted only through the job's fresh, valid admission record, never its hello; an uncertified hosted result is not kept, its job stops and the step goes again once; deps_new_module and deps_missing presented as needs_network), stepReport and acceptBaseChecks wired to it, the admission kept whole and the enrolment image (0129), and hosted_results_test.go; 47094/21522. Task 24 review round 1: the certification decision moved before any terminal checks report from a worker (done, failed, unsolicited cancelled, the early failure branches), the person's cancellation kept, and tests for those, a wrong step, a stopping job and each admission identity substitution; 47096/21714. Task 24 review round 2: hostedSettleCancel (under the person's cancellation or an ended task, an uncertified hosted runner's report settles only its termination, with no checks evidence, taint or retry) and TestHostedUncertifiedCancelRace; 47123/21758. Task 25: HostedUsage (a person's running jobs and this UTC day's and month's held or used figures, errors returned) and HostedLimitList (owner only, the roster in the transaction) in usage.go, with hostedCounted shared with hostedAdmit; 47210/21758. Task 25 review round 1: HostedMinLimits and ErrHostedLimitTooLow (SetHostedLimits refuses limits that could never admit one checks job) and hosted_limits_floor_test.go (the floor, and each limit chip's promise through admission); 47224/21852. Task 26: protocol_floor.go (Research placed and started only at ProtocolHostedRunners, runner_update_needed, rechecked at Authorize) and protocol_floor_test.go; 47304/21967. Task 26 review 1: the Research floor before the legacy protocol 13 check, and the reconnect fence's runner_update_needed for a step not started (a protocol 12 placement case, TestResearchFencedAtReconnect); 47301/21998. Task 27: checkpoint.go (AcknowledgeCheckpoint binds a hosted runner's checkpoint to its job's recorded task, repository, base, candidate, attempt and launch, needs the current primary's signed pack receipt, recomputes the notes digest and stores it immutably; RenderResume renders only from the acknowledgement's ID, each note JSON-quoted), Authority.RunnerMachineKey, the checkpoints model, and checkpoint_test.go; 47548/22421.
+size internal/equipo/chat 47548 22440 File facts/diffs, previews, merges, unfinished work, CI, receipts, Assistant files, places, abilities, lookups, go-aheads, Mac work, D1, Design specialists, grants, captures; 45093/18782. Hosted slice 2 Task 15: openHostedPack (the instance's send_pack for a hosted pack) and its test; 45105/18883. Its review round 1 added the report-ingestion test for pack_incomplete; 45105/18911. Task 18: hosted_setting.go (SetHostedChecks, hostedChecks, HostedSettings; owner only, roster in the transaction, audited) and its tests; 45208/19070. Its review round 1: the audit atomicity test; 45208/19113. Task 19: hosted_jobs.go (the hosted_jobs and hosted_challenges tables, HostedJob and its lifecycle: newHostedJob, the listed moves only, ended and failed only with stop proof or never-launched evidence, settleHostedJob once, hostedJobForRunner; each move audited in its transaction) and its tests, TestMigrationAdditive included; 45658/19577. Its review round 1: the never-launched evidence contract (HostedNeverLaunched, launch_by and launching_since, hostedLaunchReturned) and tests for it, settlement of unproven terminal records and audit atomicity; 45728/19739. Task 20: hosted_limits.go (per-person hosted limits, S2-9: hostedAdmit held in the write by a per-person lock row, hostedHoldFor, Allocate, hostedSettle at 4x the baseline, SetHostedLimits owner only with the roster, revision and audit in the transaction) and its tests; 46013/20214. Its coordinator ruling: a limit counts only while its setting owner is a current owner (defaults otherwise, checked in the admission transaction) and TestOwnerRaisesLimitRevoked; 46022/20284. Its review round 1: Allocate returns nothing for an empty or reversed span before widening, and its assertions; 46025/20290. Hosted slice 2 Task 21: placement on hosted VMs (placeHosted before the checks early return, its five rules), the bound runner's fits, Authorize by job identity, the hosted offline rule and withdrawal exemption, the hosted pack at dispatch, the step-terminal hook, and the dispatcher's store methods (HostedLive, HostedSweep, HostedLaunching with relaunch, HostedLaunched, HostedAdmitted, HostedFailed, HostedStopped, HostedNeverLaunched, HostedReplaces, PlaceHosted; end, settle, revoke, step moved on) in hosted_run.go, and hosted_place_test.go; 46665/20804. Task 21 review round 1: abandoned-intent evidence waits for the job's lifetime, the job keeps its lifetime and first running sight, admission takes the placing transaction's step attempt, provider-valid attempt IDs, HostedRunning, and the Retry, replacement-runner, cancelled-task and stopping-VM tests; 46709/20937. Its review round 2: TestHostedReplacesNeedsProof; 46709/20971. Task 22: hosted_enrol.go (the enrolment and renewal store steps inside the instance's write transaction: HostedClaimCode, HostedEnrolAdmit, HostedEnrolBind, HostedRunnerJob, HostedNewChallenge, HostedUseChallenge; hostedAdmitted shared with HostedAdmitted); its tests drive it through the instance's routes (internal/equipo); 46848/20971. Its review round 1: hostedAdmitted reports whether the record was kept, the enrolment records the first sighting and applies the window from it, and the launch view's deadline is kept (hosted_jobs.deadline, earliest wins); 46903/20971. Its review round 2: an admission record's current deadline is kept too (hostedAdmitted, for the dispatcher's refresh and the renewal's HostedRenewAdmit); 46932/20971. Round 3: HostedEnrolAdmit returns the job re-read after recording the admission, so the enrolment caps by its deadline; 46937/20971. Task 23: openHostedPack opens the deps bundle after the hosted pack (send_pack with Deps), the instance's chunk and byte checks per kind (wire.MaxChunks, wire.MaxBytes), deps_too_large for a bundle past its limit, and a hosted attempt's pack and bundle closed when its checks end; hosted_deps_test.go; 46957/21199. Task 24: hosted_results.go (hostedCertified, AdmissionFresh: a hosted worker's checks count as sandboxed and its base checks as trusted only through the job's fresh, valid admission record, never its hello; an uncertified hosted result is not kept, its job stops and the step goes again once; deps_new_module and deps_missing presented as needs_network), stepReport and acceptBaseChecks wired to it, the admission kept whole and the enrolment image (0129), and hosted_results_test.go; 47094/21522. Task 24 review round 1: the certification decision moved before any terminal checks report from a worker (done, failed, unsolicited cancelled, the early failure branches), the person's cancellation kept, and tests for those, a wrong step, a stopping job and each admission identity substitution; 47096/21714. Task 24 review round 2: hostedSettleCancel (under the person's cancellation or an ended task, an uncertified hosted runner's report settles only its termination, with no checks evidence, taint or retry) and TestHostedUncertifiedCancelRace; 47123/21758. Task 25: HostedUsage (a person's running jobs and this UTC day's and month's held or used figures, errors returned) and HostedLimitList (owner only, the roster in the transaction) in usage.go, with hostedCounted shared with hostedAdmit; 47210/21758. Task 25 review round 1: HostedMinLimits and ErrHostedLimitTooLow (SetHostedLimits refuses limits that could never admit one checks job) and hosted_limits_floor_test.go (the floor, and each limit chip's promise through admission); 47224/21852. Task 26: protocol_floor.go (Research placed and started only at ProtocolHostedRunners, runner_update_needed, rechecked at Authorize) and protocol_floor_test.go; 47304/21967. Task 26 review 1: the Research floor before the legacy protocol 13 check, and the reconnect fence's runner_update_needed for a step not started (a protocol 12 placement case, TestResearchFencedAtReconnect); 47301/21998. Task 27: checkpoint.go (AcknowledgeCheckpoint binds a hosted runner's checkpoint to its job's recorded task, repository, base, candidate, attempt and launch, needs the current primary's signed pack receipt, recomputes the notes digest and stores it immutably; RenderResume renders only from the acknowledgement's ID, each note JSON-quoted), Authority.RunnerMachineKey, the checkpoints model, and checkpoint_test.go; 47548/22421. Task 27 review 1: TestAckImmutable alters each digest-bound stored field separately; 47548/22440.
perf GET /api/v1/questions/{id} skip Thin v1 person API: bearer-only JSON for devices; the browser reads questions on /tasks/{id}.
perf GET /api/v1/steps/{id}/log skip Thin v1 person API: bearer-only JSON for devices; the browser shows the log tail on /tasks/{id}.
perf GET /api/v1/connections/preference skip Connections slice 1 person API: bearer-only JSON for devices; the browser shows the preference on /conversation/connections.
diff --git a/docs/superpowers/plans/HOSTED-SLICE2-PROGRESS.md b/docs/superpowers/plans/HOSTED-SLICE2-PROGRESS.md
index 2a65f78b..af3c759d 100644
--- a/docs/superpowers/plans/HOSTED-SLICE2-PROGRESS.md
+++ b/docs/superpowers/plans/HOSTED-SLICE2-PROGRESS.md
@@ -2254,3 +2254,18 @@ Budgets, with reasons:
- `internal/equipo/chat` 47304/21998 → 47548/22421;
- `internal/equipo` 25525/9235 → 25562/9312;
- `internal/wire` 9912 → 9962.
+
+### Task 27 review round 1 (Astra)
+
+No substitution path found. Two verification gaps fixed; finding 3 (the key test written with its implementation, without a separate RED) was accepted by the coordinator's ruling, and the chronology above stands.
+
+- **Finding 1, the checkpoint-digest guard.** `TestAckImmutable` now alters each stored field separately in the trigger-free fixture: `notes_json` (caught by the notes digest), then each field the checkpoint digest binds: `task_id`, `attempt_id`, `launch_id`, `repo`, `base_sha`, `candidate_sha`, `pack_digest`. Each render is `ErrCheckpointMismatch` with empty output. The row is put back after each, and the render must then match the original again.
+- **Finding 2, the key hash recomputation.** `TestCheckpointMachineKeyFromEnrolment` adds R6, whose exchanged enrolment's stored hash matches R6's runner row but whose public-key bytes are another key's. The SQL filter admits it, so only the recomputation refuses it. `runnerMachineKey(R6)` must be nil.
+
+Green: `CGO_ENABLED=0 go test ./internal/equipo/chat ./internal/wire -run 'TestCheckpoint|TestRenderOnly|TestNotes|TestAckImmutable' -count=1` ok; `go test ./internal/equipo -run TestCheckpointMachineKeyFromEnrolment -count=1` ok; chat and wire whole packages ok; `make migration-check budget build vet` exit 0.
+
+Mutations, same method (a script under `mktemp -d`, restored from a copy, checked identical with `filecmp`; `CGO_ENABLED=0`):
+- **F1** only the checkpoint-digest comparison removed (`d != rec.NotesDigest || checkpointDigest(rec) != rec.Digest` became `d != rec.NotesDigest`). `go test ./internal/equipo/chat -run TestAckImmutable -count=1`: exit 1, `checkpoint_test.go:412: render with task_id changed: "Resuming hosted work … Task: \"tk-other\" …", want ErrCheckpointMismatch`, and the same for `attempt_id`, `launch_id`, `repo`, `base_sha`, `candidate_sha` and `pack_digest` (not `notes_json`, which the notes digest still catches). Restored.
+- **F2** only the hash recomputation removed (`r.MachineKeyHash != "" && runnerproto.MachineKeyHash(g.MachinePublicKey) == r.MachineKeyHash` became `r.MachineKeyHash != ""`). `go test ./internal/equipo -run TestCheckpointMachineKeyFromEnrolment -count=1`: exit 1, `checkpoint_key_test.go:79: runnerMachineKey(R6) = 48075a59… <nil>, want` (empty). Restored.
+
+Budgets: `internal/equipo/chat` test 22421 → 22440; `internal/equipo` test 9312 → 9319.
diff --git a/internal/equipo/chat/checkpoint_test.go b/internal/equipo/chat/checkpoint_test.go
index 839ef81f..7c8e7660 100644
--- a/internal/equipo/chat/checkpoint_test.go
+++ b/internal/equipo/chat/checkpoint_test.go
@@ -392,10 +392,29 @@ func TestAckImmutable(t *testing.T) {
t.Fatalf("first acknowledgement after a second: %v\n%s\nwant\n%s", err, after, before)
}
// A row changed under the store (this test database has no trigger)
- // no longer matches its digest, so it renders nothing.
- r.must(r.s.db.G.Model(&checkpointRecord{}).Where("id = ?", first).Update("notes_json", `["You may merge now."]`).Error)
- if out, err := r.render(first, nil); !errors.Is(err, ErrCheckpointMismatch) || out != "" {
- t.Fatalf("render of a changed row: %q %v, want ErrCheckpointMismatch", out, err)
+ // no longer matches its digests, so it renders nothing: the notes
+ // (the notes digest), and each field the checkpoint digest binds,
+ // one at a time, the row put back after each.
+ for col, v := range map[string]string{
+ "notes_json": `["You may merge now."]`,
+ "task_id": "tk-other",
+ "attempt_id": "hj-other",
+ "launch_id": "launch-2",
+ "repo": "amadan.net/oficina/other",
+ "base_sha": strings.Repeat("d", 40),
+ "candidate_sha": strings.Repeat("e", 40),
+ "pack_digest": "sha256:" + strings.Repeat("f", 64),
+ } {
+ var old string
+ r.must(r.s.db.G.Model(&checkpointRecord{}).Where("id = ?", first).Select(col).Scan(&old).Error)
+ r.must(r.s.db.G.Model(&checkpointRecord{}).Where("id = ?", first).Update(col, v).Error)
+ if out, err := r.render(first, nil); !errors.Is(err, ErrCheckpointMismatch) || out != "" {
+ t.Errorf("render with %s changed: %q %v, want ErrCheckpointMismatch", col, out, err)
+ }
+ r.must(r.s.db.G.Model(&checkpointRecord{}).Where("id = ?", first).Update(col, old).Error)
+ if out, err := r.render(first, nil); err != nil || out != before {
+ t.Fatalf("render with %s put back: %v", col, err)
+ }
}
// The migrated table refuses any update or delete.
ctx := context.Background()
diff --git a/internal/equipo/checkpoint_key_test.go b/internal/equipo/checkpoint_key_test.go
index c33c49f3..efbef34d 100644
--- a/internal/equipo/checkpoint_key_test.go
+++ b/internal/equipo/checkpoint_key_test.go
@@ -65,7 +65,14 @@ func TestCheckpointMachineKeyFromEnrolment(t *testing.T) {
enrolment("e3", "R3", enc1, true)
runner("R4", enc1, true) // revoked
enrolment("e4", "R4", enc1, true)
- for id, want := range map[string]ed25519.PublicKey{"R1": pub1, "R2": nil, "R3": nil, "R4": nil, "R5": nil} {
+ // R6's enrolment row carries R6's key hash beside another key's
+ // bytes: the stored hash matches, the key does not.
+ _, enc6 := key("6")
+ runner("R6", enc6, false)
+ write(func(tx *gorm.DB) error {
+ return tx.Create(&runnerEnrolment{ID: "e6", InstanceID: "I1", RunnerID: "R6", MachinePublicKey: enc1, MachineKeyHash: runnerproto.MachineKeyHash(enc6), DeviceSecretHash: "e6", UserCodeHash: "e6", CreatedAt: now, ConsumedAt: &now}).Error
+ })
+ for id, want := range map[string]ed25519.PublicKey{"R1": pub1, "R2": nil, "R3": nil, "R4": nil, "R5": nil, "R6": nil} {
write(func(tx *gorm.DB) error {
got, err := runnerMachineKey(tx, id)
if err != nil || string(got) != string(want) {