2.2 KiB
2.2 KiB
SDK Test App Implementation Plan
Purpose
apps/sdk-test is the canonical integration harness for validating autumn-js behavior in a Next.js App Router environment.
The app is scenario-driven and optimized for debugging:
- stable identity,
- deterministic API routing,
- compact black/white UI,
- structured payload inspection.
Current Baseline
Implemented baseline scenario:
Core / useCustomer
Implemented infrastructure:
AutumnProviderinapp/layout.tsx- API catch-all route through
autumn-js/nextautumnHandler - Static test identity for deterministic customer resolution
- Sidebar navigation shell (desktop + mobile)
- Structured data viewer components for hook payloads
Directory Map
app/layout.tsx: Root app shell and provider mountingapp/api/autumn/[[...path]]/route.ts: Backend proxy routing viaautumnHandlerapp/scenarios/*: Scenario pagescomponents/app-sidebar.tsx: Navigation shellcomponents/debug/*: Reusable debug panels and JSON viewerlib/scenarios.ts: Navigation + scenario metadata source of truthlib/autumn/testIdentity.ts: Static identify payloadlib/autumn/debug.ts: Server debug logging helpers
Scenario Contract
Each scenario route should include:
- Hook/action params panel
- Hook/action state panel
- Payload viewer panel
- Action controls (refetch / execute)
Logging Contract
Server logs must include:
- method
- URL/path
- request body summary (shape only)
- resolved identity
Never log:
- secret keys
- full auth headers
- raw tokens
How to Add a New Scenario
- Add route page under
app/scenarios/<integration>/<feature>/page.tsx - Add metadata entry in
lib/scenarios.ts - Reuse
DebugCard+DataViewer+HookStatePanel - Add status in sidebar (
ready,wip,planned) - Validate layout on desktop and mobile
Planned Next Scenarios
Core / useAutumnCore / useEntityBetter Auth / useCustomerConvex / useCustomer
Acceptance Checklist
- Scenario is discoverable from sidebar and
/ - Route renders within compact layout bounds
- Payloads are inspectable without overflow issues
- Error and loading states are explicit
- No secrets appear in logs or UI