Repository navigation
fix: close the defects a ninth audit found - #10
Merged
Merged
Conversation
A health-probe batch in flight could eat the whole stop budget. `prober.stop()` awaits the batch it is running, which is `providers / HEALTH_PROBE_CONCURRENCY` probes at `HEALTH_PROBE_TIMEOUT_MS` each, and it was awaited *before* the drain window opened: five unreachable endpoints at the defaults is a 25 s wait, so the drain started with nothing left, the hard timer fired at 23 s and the process exited 1 without ever closing the database - for an idle router. The background jobs now stop inside the window, bounded and concurrent with the drain. Every rejection log line redacted the OpenAI error code. `maskDeep()` treats a field named `code` as the OAuth authorization code, so `queue_full`, `model_not_allowed`, `gateway_shutting_down` and `metrics_unauthorized` all arrived as `[REDACTED]`; the payloads carry `errorCode`, which the logger's allowlist leaves readable while `?code=...` stays masked. A malformed percent-escape never reached the error handler. find-my-way raises `FST_ERR_BAD_URL` during lookup, before `onRequest`, so Fastify answered with its own body, no `X-Request-Id` and no log line, while the README promises both for every response. A `frameworkErrors` renderer answers it in the project's envelope, stamps the id and logs the framework code. The test suite could not fail for several of its claims. Twenty-two slow checks were never registered (one skip per section, and two sections were tallied under the wrong heading); "a model outside the last sync is flagged" asserted `inUpstream === true`; the status-sort assertion passed whether `ORDER BY` ran or not; `start()`/`stop()` were asserted with a literal `true`; the `/status` README row passed through an `includes()` fallback; a float skipped the bounds rule. A provider fixture answered 200 with an invented model for any id, rewrote generic failures with `STUB_QUOTA_STATUS`, and swallowed `/health` under `STUB_STALL`. Also: the `/metrics` example pointed at port 8080, and `METRICS_TOKEN` and `DEBUG` were refused as boot-only but never listed as such in Settings.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What was wrong
A ninth audit pass over the runtime, the fixture and the suites found four real defects and a
set of assertions that could not fail.
Shutdown could spend the whole grace period before the drain began
prober.stop()awaits the batch it has in flight, and a batch isproviders / HEALTH_PROBE_CONCURRENCYprobes atHEALTH_PROBE_TIMEOUT_MSeach. It was awaitedbefore the drain window opened: five unreachable endpoints at the tested settings is a 25 s
wait, the drain then started with nothing left to wait for, the hard timer fired at 23 s, and the
process exited
1without ever closing the database — for a router that was not serving asingle request.
maintenance.stop()had the same unboundedawait.Reproduced before the fix (five providers behind a socket that accepts and never answers,
SIGTERMwith no client work):
After:
exit 0in about 2 s, with the drain andshutdown completeboth logged.Every rejection log line redacted the error code
src/errors.jslogged{ code: thrown.code }andsrc/server/app.jslogged the parser's rawcode.maskDeep()decides on the field name, andcodeis in the credential alternationfor the OAuth authorization code, so
queue_full,model_not_allowed,gateway_shutting_downandmetrics_unauthorizedall arrived as[REDACTED]— the one field an operator greps for when arequest fails. Those payloads carry
errorCodenow, which the logger's allowlist leaves readablewhile
?code=…is still masked.A malformed percent-escape never reached the error handler
find-my-way throws
FST_ERR_BAD_URLduring lookup, beforeonRequest, sosetErrorHandlerneversaw it. Fastify answered with its own body, no
X-Request-Idand no log line, while the READMEpromises the envelope and the id for every response.
frameworkErrorsis the only seam that runsthere; it answers in the project's envelope, stamps the id and logs the framework code.
Assertions that could not fail
SMOKE_SLOWchecks were never registered: one skip per section, and two sectionsemitted their heading inside the branch so their skips were tallied under the previous one. The
summary claimed "4 skipped". Each check now has its own named skip and its own heading.
'a model outside the last sync is flagged'assertedinUpstream === true, the opposite of itsname. Invariant 10's other half is now asserted: a catalogue that shrinks keeps the vanished model
and flags it
inUpstream === false.ORDER BY statusran or not (the fixture wasinsertion-ordered ascending). It seeds
404, 200, 502and asserts the exact sequence both ways.start()/stop()were asserted with a literaltrue;runs >= 1was already true before thecode under test ran.
/statusREADME row passed through a|| readme.includes('/status')fallback; a floatskipped the bounds rule entirely; the event-loop check had no upper bound.
maskDeepaside, several checks accepted{}/nullbodies (?? 0,.every()on?? []).The fixture invented behaviour the provider does not have
GET /v1/models/<unknown>answered200with a fabricated entry,STUB_QUOTA_STATUSrewrotegeneric failures to
429, andSTUB_STALLswallowed/health,/__statsand/__reset, so thestalled fixture could not be started or observed at all.
Smaller ones
README.md's only/metricsexample pointed at port8080;METRICS_TOKENandDEBUGwererefused as boot-only by
PATCH /api/settingsbut never listed inbootOnly(), so the Settings tabhad no group that explained the refusal.
Verification
pnpm run checkpnpm run typecheckpnpm run test:webpnpm run buildpnpm run test:unitSMOKE_PORT=8399 SMOKE_STUB_PORT=4499 node test/smoke.mjsSMOKE_SLOW=1 …node test/check-commit-messages.mjsNot run: no Docker image build (no Docker on this machine), and the suite was not run against the
real
free-opencode-api— the stub is the contract, as designed.