Skip to content

test(examples): CCP-first smoke coverage for Astro Node and Next.js hosts - #24

Merged
mrgoonie merged 4 commits into
mainfrom
claude/issue-22-ccp-smoke-35017c
Nov 1, 2026
Merged

mrgoonie merged 4 commits into
mainfrom
claude/issue-22-ccp-smoke-35017c

Conversation

@mrgoonie

@mrgoonie mrgoonie commented Nov 1, 2026

Copy link
Copy Markdown
Contributor

Closes #22

What

  • examples/astro-node: a TOSE-style Astro SSR shop on @astrojs/node over transport: "ccp", with these parts:
    • A demo login mapped through identity.authenticate, using rebindEachRequest and a logout that calls revoke with the widget's hint.
    • An orders.status read action.
    • A payments.create mutate action. The customer approves a server-signed quote, and the backend validates it again: login, same-origin JSON, owner, order state, amount, expiry and replay.
  • examples/ccp-smoke: vitest suites that start the built Astro Node and Next.js (next start) hosts as real servers against the existing fake CCP ingress.
    • A shared contract checks config, session and refresh, SSE chat and history, expired, forged, altered and missing tokens (401), and unknown routes (404).
    • It also checks origins and CORS, agent allowlists, 413 and 429 limits, mapped CCP refusals (503, 429, run_failed, revoked secret), and edge-session refresh.
    • Secret hygiene covers responses, pages, scripts, built client files and host logs, with no Gateway marker anywhere.
    • Astro-only checks cover identity, rebind and logout, two instances, the user directory being down (503), and the order and payment routes. They also check that the page-action manifest reaches CCP.
  • build:hosts builds both hosts with canary secrets and fails if one is inlined into a client bundle. test:staging validates the environment before starting anything; it reports variable names only, never values, and refuses Gateway variables.
  • docs/ccp-host-smoke.md covers:
  • CI: a new ccp-smoke job.

No SDK source or public API change; createDeweeHandler is used as is.

Findings

  • Behind a proxy, and under next start, request.url does not carry the public origin. Same-origin calls are therefore refused with 403 forbidden_origin unless the public origin is in DEWEE_ALLOWED_ORIGINS. This is documented, and the smoke runs set it the same way production would.
  • Logout on instance A revokes the hinted session and the sessions A holds. A session that only instance B exchanged stays valid at CCP until it expires (the test asserts this). This is the Server handler: pluggable store for CCP identity sessions #15 trade-off, not fixed here.
  • next build of Next.js 16.4.0 (already on main) stops once with a security advisory notice; build:hosts retries once. An upgrade of next is recommended separately.

Verification

Local runs (Windows, Node 24), all passing:

  • pnpm typecheck, pnpm test, pnpm build, pnpm test:bundlers
  • pnpm -r test and pnpm -r build. The first -r build hit the Next notice; the retry passed.
  • pnpm -C examples/ccp-smoke build:hosts, typecheck and test: 40 passed, 1 skipped (the staging-only check).

Not run: the staging smoke (no credentials).

🤖 Generated with Claude Code

mrgoonie and others added 4 commits November 1, 2026 19:44
A TOSE-style host on @astrojs/node: a demo login mapped through
identity.authenticate with rebinding and logout revocation, an order read
page action, and a payment action that needs the customer's approval of a
server-signed quote and is re-validated by the backend.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Starts the built hosts as real servers against the fake CCP ingress and
checks the browser contract (config, session, SSE chat, history, refresh,
token, origin, agent and limit errors), secret hygiene of responses,
pages, logs and client bundles, signed-in customers across two instances,
and the payment approval flow. A staging run validates its environment
before starting anything. CI gets a ccp-smoke job.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…t cleanup

- Payment quotes carry a signed nonce; a reused quote is refused even while the order is unpaid.
- The demo login cookie signs an 8-hour expiry, sets Max-Age, and is Secure when SITE_ORIGIN is https.
- Logout clears the cookie even when the user directory is down or the body is not JSON.
- Smoke hosts: probe timeout, port-takeover check, tree kill on Windows, no orphan when one start fails.
- Contract tests restore fake CCP state in finally; canary scan covers prerendered Next.js pages.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@mrgoonie
mrgoonie merged commit 14e1761 into main Nov 1, 2026
3 checks passed
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.

test(examples): CCP-first hosted Astro/Next.js smoke coverage for TOSE-style integrations

1 participant