Skip to content

feat(obs): Phase-0 oauth+approve trace wire (additive, un-deployed)#429

Draft
Victor "David" Medina (Victor-David-Medina) wants to merge 2 commits into
mainfrom
otel/phase0-oauth-approve-wire
Draft

feat(obs): Phase-0 oauth+approve trace wire (additive, un-deployed)#429
Victor "David" Medina (Victor-David-Medina) wants to merge 2 commits into
mainfrom
otel/phase0-oauth-approve-wire

Conversation

@Victor-David-Medina

Copy link
Copy Markdown
Collaborator

What

The no-deploy-risk first wire of the Phase-0 OAUTH -> APPROVE trace into relaylaunch-console. An additive, failure-isolated structured-logger shim — visible in runtime logs today, with the real @opentelemetry/api SDK + Langfuse OTLP exporter swap documented as the deploy-time follow-up at the SAME call-sites.

Contract: docs/specs/PHASE0-OTEL-TRACE-OAUTH-SEND-RECEIPT-2026-06-15.md + phase0-trace.stub.ts.

Changes (4 files, +109)

  • lib/observability/phase0-trace.ts (new) — dependency-free shim. emit() records the Phase-0 span name + honesty attrs to the existing pino logger (@/lib/logger), internally try/catch so it can never throw into the caller. Public phase0.{oauthConnect,approve,send,receipt} surface mirrors the spec stub, so the deploy-time swap to the OTel SDK + Langfuse OTLP exporter happens at the same call-sites with zero caller changes.
  • app/(auth)/auth/callback/route.tsphase0.oauthConnect({provider:'google', result: error?'error':'success'}) after the real verifyOtp/exchangeCodeForSession result (the real login OAuth moment).
  • app/api/v1/actions/approve/route.tsphase0.approve(...) after the recovery_items approve update succeeds (email deep-link, the HRC one-tap path). channel:'email', mode:'live'.
  • app/api/v1/action-map/briefs/[id]/approve/route.tsphase0.approve(...) after the recovery_opportunities update succeeds (in-app approve). mode:'live'.

Honesty attrs

approval.mode=live (real one-tap approval, not a projected demo) + oauth.result (success|error). These are the guards that keep a demo from being mistaken for a real recovered dollar — and keep the $500 HRC website payment distinct from the first AI-recovered dollar.

Guarantees

  • ADDITIVE ONLY. Every phase0.* call is a new standalone statement placed AFTER the real outcome is known. No existing logic changed, reordered, or gated.
  • FAILURE-ISOLATED. emit() is internally try/catch; each call runs after the real auth/approve work, so even a throw could not abort it. Never awaited in a way that blocks a provider call.
  • NO new dependencies, NO package.json/lock change, NO migration, NO SDK/exporter registration.

Verification

  • tsc --noEmit — clean (EXIT 0) on the full project.
  • eslint — clean (EXIT 0) on all four touched files.

Status

DRAFT — do not merge, do not deploy. Merge AFTER the first attributed receipt lands (Phase-0 acceptance). The deploy-time follow-up (real OTel SDK + Langfuse OTLP exporter at these same call-sites) is documented in the shim header; confirm the Langfuse OTLP path via Context7 before that swap.

Generated with Claude Code by RelayLaunch

Wire the Phase-0 OAUTH -> APPROVE trace into relaylaunch-console as a
dependency-free, failure-isolated logger shim. NO new npm deps, NO
package.json/lock change, NO migration, NO SDK/exporter registration.

- lib/observability/phase0-trace.ts: dep-free shim. emit() records the
  Phase-0 span name + honesty attrs to the existing pino logger
  (@/lib/logger), internally try/catch so it can NEVER throw into the
  caller. Public phase0.* surface matches the spec stub so the deploy-time
  swap to @opentelemetry/api + Langfuse OTLP exporter happens at the SAME
  call-sites with no caller changes.
- app/(auth)/auth/callback/route.ts: phase0.oauthConnect after the real
  verifyOtp/exchangeCodeForSession result (oauth.result success|error).
- app/api/v1/actions/approve/route.ts: phase0.approve after the
  recovery_items approve update succeeds (email deep-link, mode='live').
- app/api/v1/action-map/briefs/[id]/approve/route.ts: phase0.approve after
  the recovery_opportunities update succeeds (in-app, mode='live').

ADDITIVE ONLY: every phase0.* call is a new standalone statement placed
AFTER the real outcome is known; no existing logic changed/reordered/gated.
Honesty attrs: approval.mode=live + oauth.result. Verified tsc --noEmit +
eslint clean on all four touched files. DRAFT until first receipt.

Contract: docs/specs/PHASE0-OTEL-TRACE-OAUTH-SEND-RECEIPT-2026-06-15.md

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@vercel

vercel Bot commented Jun 15, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
relaylaunch-console Ready Ready Preview, Comment Jun 16, 2026 12:00am

Genericize the honesty-guard comment in lib/observability/phase0-trace.ts:
the pilot business name is a banned token in changed-file PII scan
(scripts/scan-pii-leaks.ps1). Replace it with "website/console payment"
- same honesty point (measured recovered dollar is distinct from the
website/console payment), no PII. Code behavior unchanged.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@github-actions

github-actions Bot commented Jun 15, 2026

Copy link
Copy Markdown

🛡️ Cascade Quality Score: 100/100

Category Score Status
TypeScript 20/20
ESLint 20/20
Brand Compliance 15/15
Test Suite 25/25
Build 20/20

Threshold: 85/100 | Result: PASS ✅

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.

1 participant