Skip to content

Choreography: Arda API Proxy

OrderRunDirectoryTriggerDescription
1Run 1: Foundationrun-1-foundation/ManualRepo scaffolding, shared infra, TenantProxy reference, CI/CD, spec path corrections
2Run 2: Proxies and Publishrun-2-proxies-and-publish/After Run 1 exit gate passesRemaining 7 proxies + types + tests, barrel exports, README, CHANGELOG
ArtifactProduced ByConsumed ByPathFormat
Package toolchain (package.json, tsconfig, eslint, vitest, prettier)Run 1Run 2api-proxy/ rootJSON/JS/TS
Shared utilities (HttpClient, types, errors)Run 1Run 2 (all proxies)api-proxy/src/shared/TypeScript
TenantProxy + types (reference pattern)Run 1Run 2 (template for remaining proxies)api-proxy/src/system/tenant.*TypeScript
Tenant test (test pattern)Run 1Run 2 (template for remaining tests)api-proxy/tests/system/tenant.test.tsTypeScript
CI/CD workflowsRun 1PR review after Run 2api-proxy/.github/workflows/YAML
Corrected specificationRun 1 (task 1.1)Run 2 (path reference)documentation/.../specification.mdMarkdown
Complete packageRun 2PR → merge → publishapi-proxy/TypeScript/npm

All hand-offs are filesystem-only — no in-memory state is shared between runs. Each run reads its inputs from files produced by prior runs and writes its outputs to files for subsequent runs.

  1. Run 1 completes and run-1-foundation/validate-exit.sh passes all 10 checks.
  2. The user verifies the exit gate output and reviews the foundation code.
  3. Run 2’s entry criteria are checked (which reference Run 1’s output files: shared utilities, TenantProxy, CI workflows).
  4. Run 2 is launched in the same worktree, same branch — it picks up where Run 1 left off.
  1. Run 2 completes and run-2-proxies-and-publish/validate-exit.sh passes all 13 checks.
  2. The user reviews the complete package.
  3. Push the branch and create a PR against main for api-proxy.
  4. After CI passes and PR is approved, merge to main.
  5. The publish.yml workflow publishes @arda-cards/api-proxy@0.1.0 to GitHub Packages.
  6. Commit and push documentation changes from the documentation worktree; create PR.
  1. Check which tasks completed by reviewing git log and file state.
  2. Fix the failing task (most likely: npm install issues, TypeScript compilation errors, or test failures).
  3. Re-run the remaining tasks from the point of failure.
  4. Re-run validate-exit.sh to confirm all criteria pass.
  1. Read the validate-exit.sh output to identify which criteria failed.
  2. Common failures:
    • Coverage below 80%: Add more test cases to tests/shared/http-client.test.ts or tests/system/tenant.test.ts.
    • Lint/format failures: Run npm run format and npm run lint -- --fix.
    • Uncommitted changes: Stage and commit remaining files.
  3. Re-run validate-exit.sh after fixes.
  1. The repetitive proxy pattern means failures are usually isolated to a single proxy.
  2. Check which proxy failed by reviewing the error output.
  3. Compare the failing proxy against the TenantProxy reference to identify deviations.
  4. Fix and re-run tests for that specific proxy: npx vitest run tests/{domain}/{proxy}.test.ts.
  5. Continue with remaining tasks.
  1. Most likely causes: missing files, coverage regression, or import resolution failures.
  2. Check the specific failing criterion and address it.
  3. Re-run the full verification: npm run format:check && npm run typecheck && npm run lint && npm run test:coverage && npm run build.

Single directory — no worktrees needed within the api-proxy repository. Both runs operate on the same worktree:

  • Worktree: /Users/jmp/code/arda/projects/api-proxy-worktrees/api-proxy
  • Branch: jmpicnic/initial-implementation

The documentation worktree is separate:

  • Worktree: /Users/jmp/code/arda/projects/api-proxy-worktrees/documentation
  • Branch: jmpicnic/initial-implementation
RunCommand
1Single-agent launch against run-1-foundation/project-plan.md
2Single-agent launch against run-2-proxies-and-publish/project-plan.md