Skip to content

fix(verifier): close two truth-contract gaps — typo'd issuer env + /trust allowlist#360

Open
ctol3r wants to merge 2 commits into
mainfrom
wave/canonical-truth-hygiene
Open

fix(verifier): close two truth-contract gaps — typo'd issuer env + /trust allowlist#360
ctol3r wants to merge 2 commits into
mainfrom
wave/canonical-truth-hygiene

Conversation

@ctol3r
Copy link
Copy Markdown
Owner

@ctol3r ctol3r commented May 13, 2026

Summary

Truth rules

  • Does NOT add any new product concept.
  • Does NOT depend on any in-flight PR landing first.
  • Back-compat preserved for any operator who already named the env var with the typo.

Validation

  • pnpm --filter @vitalcv/web exec vitest run __tests__/middleware.test.ts — 38/38 passing (2 new cases for /trust + /trust/doctrine).
  • pnpm --filter @vitalcv/web exec vitest run __tests__/crypto-receipt.test.ts __tests__/es256-receipt-engine.test.ts — 16/16 passing (no regression).
  • pnpm turbo run build --filter @vitalcv/web — 13/13 successful.
  • Banned-strings scan: CLEAN.

Two one-line product fixes surfaced by the institutional-readiness audit
set on PR #358. Both close real risks listed in
docs/architecture/mega-convergence-synthesis.md §2.C without depending on
the in-flight #345/#349/#355 stack.

1) Fix typo'd env var read in apps/web/lib/crypto/receiptIssuer.ts:106.
   The handler reads `VITACV_ISSUER_URL` (missing the 'L'); when any
   operator names the var correctly as `VITALCV_ISSUER_URL`, the value
   is ignored and the handler falls through to the `NEXT_PUBLIC_APP_URL`
   path. Resolution order is now `VITALCV_ISSUER_URL` (canonical) ->
   `VITACV_ISSUER_URL` (back-compat for any deploy that already set the
   typo'd name) -> `NEXT_PUBLIC_APP_URL` -> `https://vitalcv.com`.
   Closes mega-convergence-synthesis.md §2.C risk #15.

2) Add `/^\/trust(\/.*)?$/` to PUBLIC_ROUTE_PATTERNS in
   apps/web/lib/auth/roles.ts. Before this change `/trust` (the
   institutional trust overview surface shipping on PR #355) reached
   the page only via middleware fall-through (no PROTECTED_ROUTES
   pattern caught it). This made the public exposure brittle and
   implicit; making it explicit closes the gap deterministically.
   `/trust-state(/...)?` was already allowlisted on the next line;
   this commit slots `/trust` adjacent to it.
   Closes mega-convergence-synthesis.md §2.C risk #14.

Validation:
- pnpm --filter @vitalcv/web exec vitest run __tests__/middleware.test.ts
  -> 38/38 passing (added 2 new cases pinning /trust and /trust/doctrine
  as public).
- pnpm --filter @vitalcv/web exec vitest run __tests__/crypto-receipt.test.ts
  __tests__/es256-receipt-engine.test.ts -> 16/16 passing (no regression).
- pnpm turbo run build --filter @vitalcv/web -> 13/13 successful.
- Banned-strings scan: CLEAN.

Truth rules:
- Does NOT add any new product concept.
- Does NOT depend on any in-flight PR landing first.
- Preserves the existing behavior for the typo'd env var via back-compat
  fallback so no operator with the misspelled name in production breaks.
- The `/^\/trust(\/.*)?$/` pattern is the same regex shape used for every
  sibling public route; no new convention introduced.
@vercel
Copy link
Copy Markdown

vercel Bot commented May 13, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
vcv-web Ready Ready Preview, Comment May 13, 2026 6:20pm
vitalcv Ready Ready Preview, Comment May 13, 2026 6:20pm

ctol3r pushed a commit that referenced this pull request May 13, 2026
Adds docs/architecture/final-runtime-reality-state.md, the TASK 7 output
of the HARD OPERATIONAL CONVERGENCE wave. Strictly scoped to what is
true on apex vitalcv.com RIGHT NOW (origin/main HEAD); excludes
roadmap, planned features, in-flight PRs, and theoretical topology.

Five required answers, each with file:line attribution:

1. What can institutions verify RIGHT NOW?
   Apex deploys, legacy JWKS at non-canonical path, ES256 signature
   oracle at /api/receipts/verify, /api/health config probe, OS
   association manifests. Five surfaces total.

2. What survives runtime restart RIGHT NOW?
   All Prisma-persisted state. Does NOT survive: ES256 keypair when
   env unset, lineageKey/runId continuity (not persisted), receipt
   issuance records by jti, lane-health snapshots.

3. What is still synthetic RIGHT NOW?
   /passport sample card (labeled), /api/ingest/[npi] fallback body,
   AASA advertisement of /verify/* (route absent on main), Macie
   Miller demo NPI (vitalcv_dev only).

4. What still breaks institutional continuity RIGHT NOW?
   9 concrete observable failures: 404 cascade on canonical
   discovery paths, non-deterministic receipt jti, no
   lineageKey/runId claims, no replay readers, probe runner
   unscheduled, clerk.enabled=false, legacy JWKS media-type, OID4VCI
   credential_endpoint advertising non-existent path, OIDC
   pointer-not-flow endpoints.

5. What remains before true production-grade verifier infrastructure
   exists?
   Tier A: 6 operator-side configuration steps.
   Tier B: 5-PR merge train (#345, #349, #355, #358, #360).
   Tier C: 6-7 engineering PRs for replay persistence (per
   replay-topology-gap-analysis.md §7).
   Tier D: hygiene fix-ups (some already in flight on #360).
   No new product concept required at any tier.

Truth contract: doc scanned CLEAN. No banned strings, no aspirational
claims, no future-state invention.
Resilience hardening for the highest-impact fetch site in the web
runtime per upstream-fetch-topology.md §D (PR #358 audit set).

The resolve-role fetch in middleware.ts:69 has no timeout, so a slow
or hanging /api/auth/resolve-role upstream blocks the middleware for
the full Vercel function execution timeout (10s on hobby, 60s+ on
pro). Adding AbortSignal.timeout(8000) bounds the round-trip:
- On normal response (<8s): unchanged behavior.
- On timeout: the existing catch clause swallows AbortError and the
  function falls through to the /auth/error redirect (the existing
  circuit-breaker path).
- On network error: same as today.

No behavior change on the happy path. Resilience improvement under
the slow-upstream condition documented in
final-production-resilience-state.md §5 Tier D.

Validation:
- pnpm --filter @vitalcv/web exec vitest run __tests__/middleware.test.ts
  -> 38/38 passing.
- pnpm turbo run build --filter @vitalcv/web -> 13/13 successful.

Adheres to user constraint "do not generate speculative infrastructure":
this is a one-line resilience hardening on an existing fetch site,
not a new feature.
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.

2 participants