Retire /api/app-version, consolidate on /api/health (Elazar one-endpoint directive)
Elazar directive relayed by coder-pluto-cc 2026-08-22: ONE version/health surface, /api/health. Second endpoints retire in each lane at its own pace. Origin was a token-waste event in pluto's lane - a typo'd third path returned the full Next 404 HTML page inside a 10s retry loop. MARS INVENTORY (measured): - src/app/api/health/route.ts - force-dynamic, queries SELECT 1 for dbOk, returns {version,node,dbOk,ts}, NO Cache-Control. - src/app/api/app-version/route.ts - DB-free, returns {version,deploymentId}, CDN-cached s-maxage=30 swr=60. - Consumers: src/components/skew-guard.tsx:36 (fires once per session per client); src/lib/not-found-classify.test.ts:213,453 (asserts /api/app-version is a known route); .gitpush-pre.sh:378 (comment only); mars/shared/md/mars-commons.md App Version Probe section; evolutiva-coder-commons.md Push-to-Done live-version rule names Mars /api/app-version; probe-curl.sh recipes. DESIGN OBJECTION, raised to pm-mars-cc, NOT a refusal: these two are not redundant in cost profile, so a straight deletion is a regression. /api/health is force-dynamic AND runs a DB query per request. skew-guard fires per session per client, and app-version is CDN-cached precisely so that volume never reaches the origin (the header comment documents the per-deployment cache-key reasoning that makes SWR safe for the post-push confirm). Pointing skew-guard at /api/health converts a cached edge hit into an origin request plus a DB round trip per client session. Also /api/health omits deploymentId, which the PTD flow uses. PROPOSED SHAPE (pending PM): keep ONE route file, /api/health, and give it the union payload {version,deploymentId,node,dbOk,ts} with a cheap default; make the DB probe opt-in (?db=1) so the high-volume skew-guard path stays CDN-cacheable and only an explicit health check pays for SELECT 1. Then delete /api/app-version and update the four doc/test consumers in the same change. SEQUENCING (from pluto's hard-won note): check consumers BEFORE deleting - a removed endpoint something still polls becomes a recurring 404 alert, the same failure with the opposite sign. Mars-specific: not-found-classify.test.ts will fail on deletion by design, and the fleet commons Push-to-Done rule names the Mars endpoint, so the commons edit is part of this WI (I am the commons maintainer). No reply sent to the relay - Elazar asked for no message storm.
Activity
-
SHIPPED. ea5b208 (v2.79.0, PASS:ea5b208 deep from audit-mars-ca) + 9e293a4 (v2.79.3, closes audit's residual test gap). Commons companion c17455b in pensanta-websites. /api/health is now Mars's only version/health surface: {version, deploymentId, node, dbOk, ts}. Default branch is version-only with dbOk:null and CDN-cached (s-maxage=30, swr=60); ?db=1 runs the SELECT 1 probe and is no-store. The opt-in split exists because the two merged routes had OPPOSITE cost profiles - health was force-dynamic with a DB query per request, app-version was DB-free and cached precisely because skew-guard fires once per session per client. A straight deletion would have shipped a per-session origin+DB cost as a cleanup; pm-mars-cc approved the union shape over the literal minimum for that reason. Consumers repointed in the same commit: skew-guard.tsx (explicitly WITHOUT ?db=1, comment says why), not-found-classify.test.ts (hold-out list + the toContain assertion that would have failed on deletion by design), .gitpush-pre.sh comment, mars-commons.md App Version Probe, and the fleet Push-to-Done endpoint line in evolutiva-coder-commons.md - which named Mars's endpoint by path, so the fleet rule moved with the route. VERIFIED LIVE: remote package.json on main 2.79.3 == live /api/health 2.79.3 (read at check time, never the local checkout). Default dbOk:null, ?db=1 dbOk:true, retired /api/app-version 404s. Route test pins cache headers and DB-touch per branch, dbOk:false on query failure rather than a throw, and that only the literal db=1 opts in (db=0/db=true/db= stay cheap). DID NOT HIT coder-pluto-cc's superset trap (their correction arrived after ship): Pluto's health lacked deploymentId, and losing it fails SILENTLY because a version string can match a DIFFERENT deployment, so version-only verification keeps reporting success against the wrong deploy. Mars carried deploymentId on both branches. I did ship parity and retirement in ONE commit rather than their safer two-step; that held only because the live checks passed, and the two-step is the better default. Also folded in: probe recipe now uses curl -fsS. Measured fleet-wide today - a 404 captures 17,132 bytes without -f, 49 with it, which is the cost that triggered the one-endpoint directive.