Public: anyone can read this; the crew can change it.

The v1 production probe retries a 502 or 503 once after a pause, so a release swap is not read as a failure #15608

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

If a v1 production probe gets a 502, 503 or 504 during a release swap, it now waits 3 s and reads the same URL once more, and only the second answer counts. The type check and the six test files that import the proof pass (98 tests). The full suite was not run here, and the forge's check runs it on this push.

Notes

shipped production is serving it deploy 3fede26

opened this

If a v1 production probe gets a 502, 503 or 504 during a release swap, it now waits 3 s and reads the same URL once more, and only the second answer counts. The type check and the six test files that import the proof pass (98 tests). The full suite was not run here, and the forge's check runs it on this push.

prove() in src/core/v1_proof.ts

  • Retry: the retry happens inside each probe's own GET. The probes still run side by side, so the whole proof still takes as long as its slowest probe, not the sum. A connection reset (ECONNRESET, or Bun's ConnectionClosed) is also read once more.
  • No retry: a 404 or 500 is taken as the answer, and so is any other network error.
  • Same answer twice: the line fails as <path> answers 502 twice, not 200.
  • Evidence: Seen gets an optional first holding the first read's status and ms. In src/maintain/proven.ts, the defect now has a Reads: first read 502 in 12.5 ms, read again after 3 s: 502 in 8 ms. line just above its evidence block.
  • Pause: prove(base, fetcher, pause?) takes the pause as an optional third argument, and RETRY_PAUSE_MS is exported.

What to look at

  • Evidence block shape: I left its fixed six fields alone (src/maintain/evidence.ts), because other parts of the forge read it. The block carries the second read, and the new Reads: line names both. If "the evidence block names both reads" was meant literally, that file needs a new field.
  • Changed test: the script exits 1 against a failing server now really waits the 3 s pause, so its timeout is 20 s. It also checks that the output says answers 503 twice.
  • docs/features/v1-proven.md: one new bullet, "A release swap".

Tests:

  • test/v1-proven.test.ts: the proofs in this file use an instant pause that records each wait. New cases cover 502 then 200 passing with one 3 s wait; 502, 503 and 504 twice failing with "twice" and both reads named; 404 and 500 read once and never retried; and a reset connection read again while "refused" is not. With the retry switched off, 5 of these tests fail.
  • test/maintain-v1-proven.test.ts: a new test checks that the filed defect has the Reads: line above its evidence block.

scripts/fast.ts named 3,349 test files (about 282 min) for this change, too broad to run here, so I picked the six that cover the proof and its defect filing. scripts/gate.ts --fix rewrapped comments in two files, and that is committed. I didn't record a plan or an estimate on the issue because the keep_plan and estimate tools aren't available in this session.

To try it: bun test test/v1-proven.test.ts test/maintain-v1-proven.test.ts, or bun scripts/v1-proven.ts https://lab--forge-trevato-apps.open-platform.sh during a deploy.

🤖 Generated with Claude Code

Closes #15604

commented

If a v1 production probe gets a 502, 503 or 504 during a release swap, it now waits 3 s and reads the same URL once more, and only the second answer counts. The type check and the six test files that import the proof pass (98 tests). The full suite was not run here, and the forge's check runs it on this push.

prove() in src/core/v1_proof.ts

  • Retry: the retry happens inside each probe's own GET. The probes still run side by side, so the whole proof still takes as long as its slowest probe, not the sum. A connection reset (ECONNRESET, or Bun's ConnectionClosed) is also read once more.
  • No retry: a 404 or 500 is taken as the answer, and so is any other network error.
  • Same answer twice: the line fails as <path> answers 502 twice, not 200.
  • Evidence: Seen gets an optional first holding the first read's status and ms. In src/maintain/proven.ts, the defect now has a Reads: first read 502 in 12.5 ms, read again after 3 s: 502 in 8 ms. line just above its evidence block.
  • Pause: prove(base, fetcher, pause?) takes the pause as an optional third argument, and RETRY_PAUSE_MS is exported.

What to look at

  • Evidence block shape: I left its fixed six fields alone (src/maintain/evidence.ts), because other parts of the forge read it. The block carries the second read, and the new Reads: line names both. If "the evidence block names both reads" was meant literally, that file needs a new field.
  • Changed test: the script exits 1 against a failing server now really waits the 3 s pause, so its timeout is 20 s. It also checks that the output says answers 503 twice.
  • docs/features/v1-proven.md: one new bullet, "A release swap".

Tests:

  • test/v1-proven.test.ts: the proofs in this file use an instant pause that records each wait. New cases cover 502 then 200 passing with one 3 s wait; 502, 503 and 504 twice failing with "twice" and both reads named; 404 and 500 read once and never retried; and a reset connection read again while "refused" is not. With the retry switched off, 5 of these tests fail.
  • test/maintain-v1-proven.test.ts: a new test checks that the filed defect has the Reads: line above its evidence block.

scripts/fast.ts named 3,349 test files (about 282 min) for this change, too broad to run here, so I picked the six that cover the proof and its defect filing. scripts/gate.ts --fix rewrapped comments in two files, and that is committed. I didn't record a plan or an estimate on the issue because the keep_plan and estimate tools aren't available in this session.

To try it: bun test test/v1-proven.test.ts test/maintain-v1-proven.test.ts, or bun scripts/v1-proven.ts https://lab--forge-trevato-apps.open-platform.sh during a deploy.

🤖 Generated with Claude Code

commented

The v1 production probe now reads a 502, 503 or 504 once more after 3 s, so the brief gateway answer during a release swap isn't counted as a failure. A reset connection gets the same second read. A 404 or 500 is never retried. If the second read gets the same answer, the line says answers 502 twice, and the defect issue names both reads above its evidence block. The retry sits inside each probe's own GET and the probes run side by side, so the whole proof still takes as long as the slowest probe. The pause can be swapped out, so the unit tests run instantly.

Two fixes after the first check:

  • Slow test: test/v1-proven.test.ts ran scripts/v1-proven.ts against a server answering 503, so all 15 probes really waited the 3 s pause and the test went over the 2 s budget. The test was wrong: it now answers 500, which is never retried, so the script returns at once, and it checks that no line says "twice". The 503/504/502 retry and the "twice" wording are still covered by the unit tests in the same file and in test/maintain-v1-proven.test.ts, which pass in a pause that resolves immediately.
  • Timer allow-list: the probe's pause added a setTimeout to src/core/v1_proof.ts that only resolves the promise its caller awaits. It is now on the SLEEP allow-list in test/timers-named.test.ts, next to src/kernel/breathe.ts's sleep.

The other two failures in that log (test/following-cache.test.ts, test/spawn-reach-door.test.ts) don't touch the probe and pass locally, so they look like timing flakes on a busy shard.

bun scripts/gate.ts --fix and bun x tsc --noEmit are clean. test/v1-proven.test.ts, test/maintain-v1-proven.test.ts, test/timers-named.test.ts and the two flaky files pass locally. To try it: bun scripts/v1-proven.ts <base-url> against a server that answers 503 once and then 200 reports a pass.

🤖 Generated with Claude Code

Approved

Approved. prove() reads a 502/503/504 or a reset once more after an injectable 3 s pause and only the second answer counts. 404 and 500 are never retried. Two identical swap answers fail as answers N twice. Tests cover each case and fail without the retry, the feature doc has its bullet, README is untouched, and there is no new dependency. This change adds no page or terminal screen. Two things I would do next: (1) put the two reads in the evidence block itself (a field in src/maintain/evidence.ts) instead of the separate Reads: line, and call readsWords once in proven.ts rather than twice; (2) the twice rewrite is a string replace on answers N, so a probe whose failure text does not use that phrase silently loses the word. Let Fail carry the status, or test every probe.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs