Skip to content

ci(doop): train S5 — readback delay, confirm, rollback, evidence (CHE-5549) [squash] - #99

Merged
congvc-dev merged 3 commits into
agent/tofu/che-5548-2644b627ca4afrom
agent/x99-claude-sonnet-200k/che-5549-105c4406f6a8
Nov 20, 2026
Merged

congvc-dev merged 3 commits into
agent/tofu/che-5548-2644b627ca4afrom
agent/x99-claude-sonnet-200k/che-5549-105c4406f6a8

Conversation

@congvc-bot-x99

@congvc-bot-x99 congvc-bot-x99 Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

Train slice S5 of CHE-5474 (plan r5, rules C-9 and C-12). Issue: CHE-5549. Stacked on PR 56 (S4c, CHE-5548, head 50608e1f).
DOOP_DEPLOY_TRAIN stays absent or off; this PR approves no deploy.

What changed

  • c00.sh readback: window 900 s to 90 s; writes T0 (restart_count, health, t0_epoch). apply writes lock_wait_seconds.
  • c00.sh confirm (new, under flock): restart count unchanged since T0, healthy, digest and label still the candidate's, and at least 900 s since T0 (a missing wait timer fails closed).
  • c00.sh rollback: now under flock; with PREDECESSOR_DIGEST/PREDECESSOR_SHA it checks the retained image is the predecessor digest, then reads back predecessor digest, label and health.
  • cd-deploy.yml: readback-delay job (hosted, environment c00-readback-delay, holds no runner); readback-confirm needs it and runs c00.sh confirm before the restore; rollback also runs after a failed delay, reads back the predecessor, and ends red; new evidence job on every run.
  • scripts/deploy-evidence.mjs: deploy-evidence.json + run summary (candidate SHA, digest, health, readback, lock wait, ICT with UTC beside it).
  • The gate ops (pre-arm|pre-apply|confirm|rollback, marker and digest rules, superseded) already existed from S2/S3a; their tests (Done-when 3) are unchanged and pass. The MAX_AGE/LAG/MAX_PAGES walk is already gone (no hits in the repo).

Test first, observed red then green

Item Red (before the change) Green
tests/c00Deploy.test.ts readback window, T0, lock wait, confirm, predecessor rollback, lock 17 failed (defaults to a 90 s window, records T0..., all c00.sh confirm, all rollback to the predecessor by digest) 50 passed
tests/deployEvidence.test.ts Cannot find module '../scripts/deploy-evidence.mjs' 14 passed
tests/deployWorkflow.test.ts S5 block file failed at load: no job readback-delay 59 passed (with evidence file)
Done-when 3 in tests/deployTrain.test.ts (success sequence, rollback candidate/predecessor/third digest, confirm refused, pause or switch off, marker refusals) already green from S2/S3a passed
npx vitest run tests/c00Deploy.test.ts tests/c00Migrate.test.ts tests/c00Guard.test.ts tests/c00Sweep.test.ts tests/deployTrain.test.ts tests/deployWorkflow.test.ts tests/deployMarker.test.ts tests/deployEvidence.test.ts
 Test Files  8 passed (8)
      Tests  301 passed (301)

bun run typecheck PASS, bun run lint PASS. bun run build not run (no build input touched).

Not done here (owner action, before the C-11 drill)

Create repository environment c00-readback-delay with a 15 minute wait timer. It is not in the repo; GitHub makes a missing environment with no timer, and c00.sh confirm then refuses ("delay not honoured"). Listed in deploy/cd/README.md.

Risks

  • Not exercised on C00 (switch off); the workflow is covered by text assertions and c00.sh by a docker stub.
  • Rollback needs the retained doop-rollback:previous image to carry the predecessor's repo digest; otherwise it refuses before any change.

Review round 1 (head 3e72583): the two P1 findings

  • P1-1, quiescence. deploy-gate.mjs recheck now runs the real proof (c00.sh quiescence: no migrate container running, no doop-migrate-% session, advisory key free) instead of a hardcoded { ok: true }. c00.sh confirm and c00.sh rollback prove it under the lock with the train switch absent, off or on (before, rollback skipped it with the switch off and confirm never proved it). A failed read, a hang or a missing script counts as not proven.
  • P1-2, rollback on the current state. The confirm and rollback checks now run inside c00.sh, after take_lock and after quiescence, before any docker change. The workflow no longer decides in a step before the lock; the rollback job is one c00.sh rollback step whose action (rollback, none, superseded) comes from the in-lock check. A deployment or a marker change that lands while waiting for the lock is seen: superseded and none change nothing, a changed marker refuses. The marker token and suspension now follow that step's own go output, so a failed rollback still gets its token.

Test first, red then green:

Test Red Green
tests/c00Deploy.test.ts new blocks (decide under the lock incl. competing change while waiting for the lock: superseded, changed marker, migration started; quiescence for confirm and rollback x switch absent/off/on x session/lock/container; confirm check) 30 failed 89 passed
tests/deployTrain.test.ts c00Quiescent + CLI refuses on unproven quiescence c00Quiescent is not a function (5 failed) 85 passed
tests/deployWorkflow.test.ts in-lock order (lock, quiescence, recheck), one rollback step, token and suspend if 3 failed 45 passed
tests/c00Migrate.test.ts rollback with the switch off now proves quiescence updated 53 passed

vitest on c00Deploy, c00Migrate, c00Guard, c00Sweep, deployTrain, deployWorkflow, deployMarker, deployEvidence, imageWorkflow: all passed. bun run typecheck and bun run lint PASS. bun run build not run (no build input touched).

Added risk

  • The gate's pre-arm and pre-apply now also need Docker and a Postgres container on the runner (recovery and drill modes too, with the switch off). Not exercised on C00.
  • confirm and rollback with the switch off now need a readable Postgres container; an unreadable one refuses (needs_operator).

Review round 2 (head after 3e72583): confirm wiring

  • Finding: readback-confirm set neither C00_COMPOSE_DIR nor C00_PG_CONTAINER, so the new quiescence proof in c00.sh confirm died with C00_COMPOSE_DIR is not set and a healthy deploy would have rolled back.
  • Fix: the confirm job now has the same C00_COMPOSE_DIR (variable or default), C00_PG_CONTAINER (empty: default discovery of the db service) and DOOP_DEPLOY_TRAIN as deploy and rollback.
  • Test first: tests/c00Deploy.test.ts "workflow job env reaches c00.sh" parses each C00 job's own env block and runs c00.sh confirm / rollback with only that env. Red: 2 failed (confirm env lacked the compose dir; confirm died on C00_COMPOSE_DIR is not set). Green: c00Deploy 94 passed, deployWorkflow 45 passed. typecheck, oxlint and Prettier clean.

congvc-bot[bot] added 3 commits November 20, 2026 14:25
…ce (CHE-5549)

Rules C-9 and C-12 of CHE-5474. Ships with DOOP_DEPLOY_TRAIN absent or off.
…lock (CHE-5549)

Review round 1 on the S5 slice:
- deploy-gate recheck runs the real quiescence proof (c00.sh quiescence) instead of a hardcoded ok.
- c00.sh confirm and rollback prove migration quiescence under the lock, switch on or off.
- The confirm and rollback checks run inside c00.sh after take_lock, so a newer deployment or a changed marker that
  lands while waiting for the lock is seen (superseded, none, refused); the workflow no longer decides before the lock.
- The rollback job is one c00.sh step; the marker token and suspension follow the step's own go output.
… (CHE-5549)

Quiescence in confirm reads the live database, so the job needs the same
C00_COMPOSE_DIR and C00_PG_CONTAINER as deploy and rollback. Test drives
c00.sh with only each job's own env block.
@congvc-bot-x99
congvc-bot-x99 Bot marked this pull request as ready for review November 20, 2026 09:22
@congvc-dev
congvc-dev merged commit 7459535 into agent/tofu/che-5548-2644b627ca4a Nov 20, 2026
12 checks passed
@congvc-dev
congvc-dev deleted the agent/x99-claude-sonnet-200k/che-5549-105c4406f6a8 branch November 20, 2026 18:13
congvc-dev pushed a commit that referenced this pull request Nov 23, 2026
…smoke (CHE-5548) [squash] (#56)

* ci(doop): train S4c compat sandbox, isolation probes, env allowlist, sweep, smoke (CHE-5548)

* fix(deploy): real smoke ops, supervised clone migration, probe the sandbox gateway (CHE-5548)

* fix(deploy): bounded quiescence proof and durable needs_operator guard (CHE-5548)

- proveQuiescence: kill, wait, record (pid, backend_start), terminate, prove three
  facts inside one 30 s budget; every step bounded; a timeout leaves a fact unproven.
- Failed migration: clone ledger must equal the pre-migration ledger.
- needs_operator writes a guard file that no sweep removes, keeps the sandbox, skips
  the final sweep. runCompat, c00.sh apply, rollback, sweep and guard refuse until
  the facts hold; lift calls c00.sh guard.
- Tests: stuck docker kill/wait/inspect/psql, later job after a failed proof,
  c00.sh refusal. Run against the previous implementation: 67 of 107 failed.
  Written after the code, so retrospective test-first.

* fix(deploy): persist the needs_operator guard before the clone migration, clear it only after proof (CHE-5548)

Red (6 failures) before the change, green (174 passed across compat and c00 suites) after.

* ci(doop): widen drawingBrowser waits to 30s for loaded runners (CHE-6913)

* test(doop): wait for the element probe before navigating away in pageCanvasBrowser (CHE-6913)

* test(doop): raise the expect.poll default to 30s for loaded runners (CHE-6913)

* test(doop): name the stalled drawingBrowser beforeEach step (CHE-6913)

* test(doop): reload the drawing fixture when Chrome aborts its module imports (CHE-7020)

Chrome aborts in-flight requests with net::ERR_NETWORK_CHANGED when host
network interfaces change. The module script in drawing.html then never sets
window.drawingHarness and no wait recovers. Print pageerror/requestfailed/
readyState on a stall and load the page again (3 tries, 8s ready wait).

* test(doop): give elementPanelBrowser waits 12 s on loaded runners (CHE-7021)

The first seedPanel wait timed out at the 5 s puppeteer default on CI shard 2
(run 44129413615, job 134202011472). Widen the file default and the one
explicit 5 s poll to 12 s, under the 15 s per-test limit.

* ci(doop): smoke routes for agents, custom-providers, image-descriptions, icons, photos (CHE-6841)

* ci(doop): smoke write chains for agents and image descriptions, providers contract (CHE-7697)

* ci(doop): train S5 — readback delay, confirm, rollback, evidence (CHE-5549) [squash] (#99)

* ci(doop): train S5 readback delay, confirm, rollback readback, evidence (CHE-5549)

Rules C-9 and C-12 of CHE-5474. Ships with DOOP_DEPLOY_TRAIN absent or off.

* ci(doop): prove quiescence and decide confirm and rollback under the lock (CHE-5549)

Review round 1 on the S5 slice:
- deploy-gate recheck runs the real quiescence proof (c00.sh quiescence) instead of a hardcoded ok.
- c00.sh confirm and rollback prove migration quiescence under the lock, switch on or off.
- The confirm and rollback checks run inside c00.sh after take_lock, so a newer deployment or a changed marker that
  lands while waiting for the lock is seen (superseded, none, refused); the workflow no longer decides before the lock.
- The rollback job is one c00.sh step; the marker token and suspension follow the step's own go output.

* fix(cd): give readback-confirm the compose dir and Postgres container (CHE-5549)

Quiescence in confirm reads the live database, so the job needs the same
C00_COMPOSE_DIR and C00_PG_CONTAINER as deploy and rollback. Test drives
c00.sh with only each job's own env block.

---------

Co-authored-by: congvc-bot[bot] <3634010+congvc-bot[bot]@users.noreply.github.com>

* ci(doop): train S7 watchers and /healthz revision (CHE-5550) [squash] (#103)

* ci(doop): train S5 readback delay, confirm, rollback readback, evidence (CHE-5549)

Rules C-9 and C-12 of CHE-5474. Ships with DOOP_DEPLOY_TRAIN absent or off.

* ci(doop): prove quiescence and decide confirm and rollback under the lock (CHE-5549)

Review round 1 on the S5 slice:
- deploy-gate recheck runs the real quiescence proof (c00.sh quiescence) instead of a hardcoded ok.
- c00.sh confirm and rollback prove migration quiescence under the lock, switch on or off.
- The confirm and rollback checks run inside c00.sh after take_lock, so a newer deployment or a changed marker that
  lands while waiting for the lock is seen (superseded, none, refused); the workflow no longer decides before the lock.
- The rollback job is one c00.sh step; the marker token and suspension follow the step's own go output.

* fix(cd): give readback-confirm the compose dir and Postgres container (CHE-5549)

Quiescence in confirm reads the live database, so the job needs the same
C00_COMPOSE_DIR and C00_PG_CONTAINER as deploy and rollback. Test drives
c00.sh with only each job's own env block.

* ci(doop): train S7 watchers and /healthz revision (CHE-5550)

* fix(ci): keep the last confirmed deploy durably for the D2 watchers (CHE-5550)

The watchers searched only the 30 newest D2 runs for a confirmed deployment.
After 30 skipped slots the SHA came back null: the live watch then passed an
unreachable /healthz and the freshness watch treated the deployed candidate as
overdue.

- D2's evidence job records each confirmed deploy as a GitHub deployment
  (environment c00-doop, deployments: write), read back before the step passes.
- The last successful D2 SHA is tri-state: known, none (a proven first
  deployment) or unknown. Unknown history alarms and fails visibly.
- Artifact scan is only the fallback: paginated, up to 100 runs, and a green
  run whose evidence is gone counts as unknown.
- /healthz must be healthy with a 40-hex revision even when nothing deployed.

* fix(ci): reconcile the deploy record with newer D2 evidence and send typed booleans (CHE-5550)

A prior deployment record no longer hides a newer confirmed deploy whose own
record write failed: that history is unknown and fails both watchers visibly.
The record carries its D2 run id; auto_merge and production_environment go
out as JSON booleans (gh api -F) and the request and failure path are tested.

* fix(ci): treat a newer D2 run with no evidence as unknown, not skipped (CHE-5550)

* fix(ci): order the last confirmed D2 deploy by confirmation time, not run ID (CHE-8873, CHE-5550)

Round 4 P1: an older run can confirm after a newer run recorded another SHA. Check every run
active at or after the record's confirmation, treat unfinished runs as pending/stuck, record the
confirmation time in the deployment description.

* fix(ci): a pending D2 run no longer hides the 90 min alarm or a failed /healthz (CHE-8873, CHE-5550)

---------

Co-authored-by: congvc-bot[bot] <3634010+congvc-bot[bot]@users.noreply.github.com>

* ci(doop): train S3b — audited lift workflow (CHE-5551) [squash] (#104)

* ci(doop): train S3b — audited lift workflow (CHE-5551)

Add cd-lift.yml, the only way from armed/suspended back to clear (plan CHE-5474
C-10.6, C-10.7). Dispatch only, one input (decision_id), allowlisted dispatcher,
C00 runner under the host deploy lock.

scripts/deploy-lift.mjs refuses unless the Multica decision is an approved
doop.deploy_lift by the configured approver, not withdrawn/revoked/expired, its
marker_value equals the standing marker and repo matches, quiescence and
/healthz are proven, and the decision and marker still hold when re-read right
before the write. It then writes clear:<nonce>:<run id>, reads it back and
records lift-evidence.json. A refusal leaves the marker unchanged.

c00.sh gains a `lift` command (guard, lock, quiescence, digest, revision label,
container health). deploy-marker.mjs gains lift() and exports readMarker().
The train switch DOOP_DEPLOY_TRAIN is not touched.

* fix(ci): lift refuses a decision answer that omits withdrawn_at, revoked_at or expires_at (CHE-5551)

---------

Co-authored-by: congvc-bot[bot] <3634010+congvc-bot[bot]@users.noreply.github.com>

---------

Co-authored-by: congvc-bot[bot] <3634010+congvc-bot[bot]@users.noreply.github.com>
Co-authored-by: congvc-bot-x99[bot] <282619718+congvc-bot-x99[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant