feat+test+docs: D56 — v1.x cleanup batch #1: AUTH_MISSING tuple test + /health activeSpawns (#34)

Post-Phase-3 cleanup batch #1. Bundles two small v1.x-roadmap deferrals (#4
and #7 in docs/v1x-roadmap.md) into one D-day. No new user-facing feature;
pins existing behaviour into tests + finally wires the ADR-documented
activeSpawns field on /health.

(1) AUTH_MISSING tuple test (v1.x #7, D45 P3 deferral)

New engine-level test in Suite D40 asserts that an AUTH_MISSING hop produces
a fallbackDetail tuple with trigger_type: 'auth_missing' AND that the engine
does NOT advance past it (HARD_TRIGGER_CODES[AUTH_MISSING]=false). Pre-D56 the
behaviour was implicit through neighbouring tests; D56 makes it explicit so a
future refactor that moves the tuple-push past the auth_missing branch fails
this test directly.

Authority: ADR 0004 § Decision (hard-trigger table) + Amendment 5 (tuple shape).

(2) /health activeSpawns integration (v1.x #4, ADR 0002 Amendment 6 forward
note)

handleHealth now surfaces providers.status.<name>.activeSpawns (sourced from
D38 getActiveSpawnCount(name) — already imported at server.mjs:39). The field
is computed BEFORE healthCheck() is awaited so it remains present even when
healthCheck() throws — getActiveSpawnCount is a cheap in-memory counter read.
New Suite 21c-extra test pins the field presence + numeric + non-negative for
every enabled provider in the fixture.

Authority: ADR 0002 Amendment 6 § "Forward note — exposing the counter via
HTTP" — names the path providers.status.<name>.activeSpawns and pins it as
the Phase 1 deferral that becomes due once management endpoints exist (which
they now do, post-Phase-3).

Test count: 601 → 603 (+2 D56 tests; 603/603 pass locally).

Release-kit: under Unreleased per phase_rolling_mode (Phase 3 closed at v0.3.0;
Phase 4 entries also land here once Phase 4 opens — D56 is a cleanup-D-day
that ships under v0.3.x, not a Phase 4 deliverable).

Co-authored-by: dtzp555 <dtzp555@gmail.com>
Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
dtzp555-max
2026-05-25 18:11:36 +10:00
committed by GitHub
co-authored by taodeng Claude Opus 4.7
parent 179b4707a7
commit 5ebe3dc77c
3 changed files with 66 additions and 3 deletions
+9 -2
View File
@@ -577,10 +577,17 @@ async function handleHealth(req, res) {
const available = listAllProviderNames().length;
const providerStatuses = {};
for (const [name, provider] of loadedProviders) {
// D56 / v1.x roadmap #4 (ADR 0002 Amendment 6 forward note): surface
// per-provider active spawn count for capacity-planning observability.
// D38 shipped getActiveSpawnCount; this is the /health integration.
// The field is set BEFORE healthCheck() in case healthCheck throws —
// activeSpawns is cheap (in-memory counter read) and useful even
// when healthCheck fails.
const activeSpawns = getActiveSpawnCount(name);
try {
providerStatuses[name] = await provider.healthCheck();
providerStatuses[name] = { ...(await provider.healthCheck()), activeSpawns };
} catch (e) {
providerStatuses[name] = { ok: false, error: e.message };
providerStatuses[name] = { ok: false, error: e.message, activeSpawns };
}
}
sendJSON(res, 200, {