Skip to content

feat(gateway): record a successful mint in the run log - #1179

Open
brandonleung wants to merge 1 commit into
mainfrom
brandon/gateway-mint-observability
Open

feat(gateway): record a successful mint in the run log#1179
brandonleung wants to merge 1 commit into
mainfrom
brandon/gateway-mint-observability

Conversation

@brandonleung

@brandonleung brandonleung commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

Problem

resolveGatewayAuth logs on every failure and fallback branch but nothing on success, so posthog-wizard.log cannot distinguish a run that minted a scoped token from one that never reached the mint.

Changes

Adds one log line on the success path.

  • Logs program, team, TTL and gateway host once a scoped token is adopted. The token itself is never logged.
  • The test renders every argument of every logToFile call the way the sink does, so the no-leak assertion covers a token passed anywhere in a call rather than only in the first argument.

Test plan

npx vitest run src/lib/__tests__/gateway-session.test.ts

The no-leak assertion is pinned by mutation: appending the mint response as a second argument, or hiding the token behind a getter or a toJSON, each turn it red. logToFile is variadic and renders every argument through JSON.stringify, so a guard reading only the first argument passes all three while the token reaches disk.

Known gap: nothing redacts at the sink, and redactSecrets matches ph[xspc]_ but not the phe_ prefix this module mints. That predates this change and is worth a follow-up, since the log is a file users are asked to attach to bug reports.

LLM context

Authored by Claude Code (Opus 5). Requires human review.

Every other branch logs a failure, so a run that minted and one that never
reached the mint were indistinguishable. The token is never logged.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

🧙 Wizard CI

Run the Wizard CI and test your changes against wizard-workbench example apps by replying with a GitHub comment using one of the following commands:

Test all apps:

  • /wizard-ci all

Test all apps in a directory:

  • /wizard-ci ai-observability
  • /wizard-ci basic-integration
  • /wizard-ci mcp-analytics
  • /wizard-ci replay-vision
  • /wizard-ci revenue
  • /wizard-ci self-driving
  • /wizard-ci warehouse
  • /wizard-ci warehouse-seeded

Test an individual app:

  • /wizard-ci ai-observability/anthropic
  • /wizard-ci ai-observability/groq
  • /wizard-ci ai-observability/manual-capture
Show more apps
  • /wizard-ci ai-observability/openai
  • /wizard-ci ai-observability/openai-agents
  • /wizard-ci ai-observability/vercel-ai
  • /wizard-ci basic-integration/android
  • /wizard-ci basic-integration/angular
  • /wizard-ci basic-integration/astro
  • /wizard-ci basic-integration/django
  • /wizard-ci basic-integration/fastapi
  • /wizard-ci basic-integration/flask
  • /wizard-ci basic-integration/flutter
  • /wizard-ci basic-integration/javascript-node
  • /wizard-ci basic-integration/javascript-web
  • /wizard-ci basic-integration/laravel
  • /wizard-ci basic-integration/next-js
  • /wizard-ci basic-integration/nuxt
  • /wizard-ci basic-integration/python
  • /wizard-ci basic-integration/rails
  • /wizard-ci basic-integration/react-native
  • /wizard-ci basic-integration/react-router
  • /wizard-ci basic-integration/sveltekit
  • /wizard-ci basic-integration/swift
  • /wizard-ci basic-integration/tanstack-router
  • /wizard-ci basic-integration/tanstack-start
  • /wizard-ci basic-integration/vue
  • /wizard-ci mcp-analytics/custom-dispatcher
  • /wizard-ci mcp-analytics/typescript-sdk
  • /wizard-ci replay-vision/javascript-node
  • /wizard-ci replay-vision/next-js
  • /wizard-ci replay-vision/react-vite
  • /wizard-ci revenue/stripe
  • /wizard-ci self-driving/astro
  • /wizard-ci self-driving/fastapi
  • /wizard-ci self-driving/nuxt
  • /wizard-ci self-driving/react-router
  • /wizard-ci self-driving/sveltekit
  • /wizard-ci warehouse/monorepo-env
  • /wizard-ci warehouse/multi-source-next
  • /wizard-ci warehouse/stripe-node
  • /wizard-ci warehouse/zero-source
  • /wizard-ci warehouse-seeded/next-stripe
  • /wizard-ci warehouse-seeded/next-stripe-declined

Test against a Context Mill branch:

  • /wizard-ci all context-mill:my-branch

Add context-mill:<branch> to any command above to pin the Context Mill branch. It defaults to main.

Results will be posted here when complete.

@brandonleung
brandonleung marked this pull request as ready for review August 31, 2026 22:49
@brandonleung
brandonleung requested a review from a team as a code owner August 31, 2026 22:49

@edwinyjlim edwinyjlim left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀

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