Skip to content

chore(integration): NaaP wave-1 preview — DO NOT MERGE (C0+NAAP-0+NAAP-A)#370

Draft
seanhanca wants to merge 5 commits into
mainfrom
preview/wave-1-integration
Draft

chore(integration): NaaP wave-1 preview — DO NOT MERGE (C0+NAAP-0+NAAP-A)#370
seanhanca wants to merge 5 commits into
mainfrom
preview/wave-1-integration

Conversation

@seanhanca

Copy link
Copy Markdown
Contributor

DO NOT MERGE — for integration testing only.

This is an aggregated preview integration branch that merges the three NaaP wave-1 feature branches together so Vercel produces a single preview deployment for end-to-end integration testing. It is not intended to be merged into main; the individual PRs below are the real review/merge units (gated by D0).

Aggregated PRs

PR id PR Branch
C0 #367 — BPP contracts + conformance suite (flag-OFF) feat/bpp-contracts
NAAP-0 #368 — pymthouse BillingProvider env/seed verifier (flag-OFF) feat/naap-pymthouse-provider-config
NAAP-A #369 — BillingProviderAdapter SPI + registry + generic provider route (flag-OFF) feat/billing-provider-adapter-spi

Notes

  • Merge strategy: --no-ff octopus merge of the three branches off origin/main; no conflicts.
  • All runtime additions are flag-gated (provider_adapters, default OFF); contracts/tests are additive.
  • For integration testing only — do not merge this branch.

Made with Cursor

seanhanca and others added 3 commits June 17, 2026 11:15
…rovider + conformance suite

C0 (first-wave). Author the provider-neutral BPP seams as JSON Schema (2020-12)
under contracts/billing-provider-protocol/: ② validate, ④ plans, ⑤ account+member
(+ billingAccountRef), ⑥ usage ingest, ⑦ discovery response, ⑧ curated list +
token bundle, and ⑨ provider-internal OpenMeter documented explicitly as NOT part
of the BPP.

Add a tiny in-memory stub billing provider (the second BPP implementation) and a
conformance suite (ajv) that:
- compiles every schema (schema-lint guardrail),
- validates a provider's ②④⑤⑥⑧ payloads against the schemas,
- asserts seam isolation: no provider-internal field names (e.g.
  openmeter_subscription_id, network_fee_usd_micros) leak through ② or ⑥.

Runs in NaaP CI via vitest. No runtime/route changes; zero regression.

Co-authored-by: Cursor <cursoragent@cursor.com>
…AP-0)

NAAP-0 (first-wave). Add a server-only verifier for the PYMTHOUSE_* env wiring
and the pymthouse BillingProvider seed:

- verifyPymthouseEnv() reports presence booleans + missing vars and whether the
  configured issuer origin / public client id match the staging reference
  (https://staging.pymthouse.com, app_2d89999406f9be57dd0233de). It NEVER reads,
  returns, or logs the M2M client secret value — only a boolean "is it set".
- logPymthouseEnvStatus() emits a single structured log line (with correlation
  id) of presence booleans only; a test asserts the secret value never appears.
- Seed verify: assert the canonical @naap/database seed declares
  BillingProvider{slug:pymthouse, enabled:true} (already present).
- Document staging PYMTHOUSE_* values in the env example (secret via env only).

No runtime/route changes; zero regression.

Co-authored-by: Cursor <cursoragent@cursor.com>
…er route (NAAP-A)

NAAP-A (first-wave). Introduce the provider-neutral seam so NaaP never imports a
billing provider directly.

- adapter.ts: BillingProviderAdapter SPI (the BPP method surface) + types +
  AdapterNotImplementedError.
- pymthouse-adapter.ts: reference adapter wrapping the existing
  getPmtHouseServerClient() BEHIND the SPI (the only place importing the client).
  Implemented: usage (me/app) + mintSignerSession; validate/getPlans/curation/
  manifest throw NotImplemented (PYMT-3/5/7 pending) rather than fabricating.
- stub-adapter.ts: tiny in-memory second adapter so the registry resolves ≥2
  providers (Phase 0 gate).
- registry.ts: slug → adapter resolution (adapterType defaults to slug).
- feature-flags.ts: add provider_adapters flag (default OFF) + isFeatureEnabled().
- api/v1/billing/[provider]/[...path]/route.ts: generic routing that delegates to
  the registry for usage (GET) + token (POST). Gated behind provider_adapters:
  OFF = 404 no-op (checked before any DB/session work), so the existing explicit
  /billing/pymthouse/* routes remain the only billing surface and are byte-for-byte
  unchanged. Structured logs with correlation ids; never logs secrets/tokens/PII.

Zero regression: flag OFF is a no-op; existing routes untouched. Static
/billing/pymthouse/* segments take routing precedence over [provider] when ON.

Co-authored-by: Cursor <cursoragent@cursor.com>
@vercel

vercel Bot commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

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

Project Deployment Actions Updated (UTC)
naap-platform Ready Ready Preview Jun 17, 2026 6:42pm

Request Review

@coderabbitai

coderabbitai Bot commented Jun 17, 2026

Copy link
Copy Markdown

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 2db469b7-7e5a-4380-a823-cb63d62cd30d

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch preview/wave-1-integration

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions github-actions Bot added scope/shell Shell app changes size/XL Extra large PR (500+ lines) labels Jun 17, 2026
@github-actions

github-actions Bot commented Jun 17, 2026

Copy link
Copy Markdown

⚠️ This PR is very large (1969 lines changed). Please split it into smaller, focused PRs if possible.

@seanhanca seanhanca changed the title [PREVIEW · DO NOT MERGE] NaaP wave-1 integration chore(integration): NaaP wave-1 preview — DO NOT MERGE (C0+NAAP-0+NAAP-A) Jun 17, 2026
seanhanca and others added 2 commits June 17, 2026 11:36
- conformance: capture each seam payload once and reuse for the ⑨ leak
  checks (no second provider call) so stateful providers can't be flaky
- conformance: reject non-string x-bpp-forbidden-field-names entries
  instead of silently String()-coercing malformed schema values
- conformance: enforce ⑤ account.id/providerSlug == billingAccountRef
  identity invariant (JSON Schema 2020-12 can't express cross-field
  equality); surfaced as report.accountRefMismatches + a $comment
- plans.schema: constrain price.currency to ISO-4217 (^[A-Z]{3}$)
- tests: add negative cases for usage-ingest leak and account-ref drift
- declare ajv + ajv-formats as web-next devDependencies (were only
  available transitively); lockfile already had the resolved versions
Co-authored-by: Cursor <cursoragent@cursor.com>
@github-actions

Copy link
Copy Markdown

⚠️ Merge conflict detected

This PR has conflicts with the base branch. Please rebase to resolve them:

git fetch origin
git rebase origin/main
# resolve conflicts, then:
git push --force-with-lease

The needs-rebase label will be removed automatically once the conflicts are resolved.

@github-actions github-actions Bot added needs-rebase Has merge conflicts and removed needs-rebase Has merge conflicts labels Jun 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-rebase Has merge conflicts scope/shell Shell app changes size/XL Extra large PR (500+ lines)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant