4.2 KiB
Capture maintenance write cost
Baseline: deployed dffba6ca; local branch codex/maintenance-reconcile-first.
Repeated reconciliation wrote the entire Capture and refreshed updatedAt even when its Run-derived fields were unchanged. A deterministic probe reproduced 11 writes for one transition followed by ten identical observations. The candidate performs one write for that sequence and still persists subsequent failure/status/error/time changes. Failed writes restore the caller's prior record so a subsequent observation cannot incorrectly suppress recovery.
No API, schema, index, ownership, source, permission, polling interval or resource change. Existing historical-owner and unknown-launch protections remain. UpdatedAt now records an actual reconciliation change, rather than an unchanged observation; worker maintenance metrics continue to describe progress. This change does not reduce Run reads or change discovery ordering.
Validation:
TestCaptureReconcileStableStateDoesNotWrite: reproduced 11 writes before the fix; passes with one write, then a second write for an actual state change.TestCaptureReconcileFailedWriteRetainsRetryState: failure preserves retry state and subsequent persistence succeeds.CAPTURE_RECONCILE_MONGO_TEST=1 go test ./internal/worker -run '^TestCaptureReconcile' -count=1 -v: all three tests executed and passed, including isolated local Mongo 27018 persistence and new-store-instance recovery. Only a uniquely named synthetic database was created/dropped.go test ./internal/worker -run 'TestCapture(Reconcile|Cutover|Activation|Launch)' -count=1: passed, including ownership, cutover, and unknown launch regressions.
Production background observations from the prior release: human-release cycles took approximately 243–245 seconds; the repaired 73 Captures eventually converged automatically. Those timings are not a candidate benchmark. No new production deployment or write test was performed for this change.
Next work: separate status reconciliation from source discovery with bounded reads and conditional persistence; preserve fresh admission state after long object listing. Simply moving the existing family read before listing would reuse a stale snapshot and risk overwriting changes during the scan, while reading the entire family twice increases load. Measure and address human-release batch traversal separately. Do not claim this small write optimization solves those issues or validates 120-person capacity.
Independent bounded status lane
Follow-up on the same local branch adds capture_status, independent of BOS discovery, with the contract in docs/architecture/capture-status-maintenance.md.
- A blocking BOS fixture confirms status reaches waiting_for_human before the blocked listing is released, preserving owner/Run/source fields.
- A 56-record fixture proves the first pass is limited to 50, the next page progresses, and an unresolved first claim is reported without being relaunched or starving later records.
- A context timeout advances past the attempted record, preventing starvation. Cross-project Run references are rejected.
- Conditional-write tests cover concurrent discard, newer timestamps, sampling decision changes including legacy partial sampling metadata, source/unknown-field preservation, and project-deletion blocking.
- Concurrent Run creation/adoption cannot regress waiting_for_human to queued. Lost create-response/cutover historical compatibility tests continue to pass.
- Isolated Mongo 27018: 101 records including large synthetic source keys; page limit 50, summary excludes source keys, explain shows nReturned=50 and totalDocsExamined=50 via the existing ID index. This verifies bounded page work, not whole-platform capacity.
CAPTURE_RECONCILE_MONGO_TEST=1 go test -race ./internal/worker -run '^TestCapture' -count=1passed, with the Mongo test executed. API/Worker builds passed. No frontend or full load suite run.
Logs are under ignored local-data/releases/recent-integration-preparation/maintenance-status-*.log. No production writes, new deployment, push or PR update for this follow-up. Human-release's 243–245 second cycle and full-scale synchronization SLA remain unresolved; server resource changes are not justified by these local tests.