Harness Intelligence Wiki
SpecsCLIIP-97-effect-api-contract-boundary

Implementation Notes: IP-97 Shared Effect API Contract Boundary

Implementation Notes: IP-97 Shared Effect API Contract Boundary

Summary

Implemented the first Harness control-plane contract boundary across packages/contract, apps/api, and apps/cli.

Changes

  • packages/contract now owns:
    • HarnessApi Effect HttpApi definition.
    • baseline/channel and artifact metadata schemas.
    • typed API errors for unauthorized, forbidden, baseline-not-found, and unavailable control-plane states.
    • bearer-token security middleware declarations.
    • makeHarnessClient, the shared typed client factory.
  • apps/api now implements the contract with Effect HttpApiBuilder groups and a Bun-compatible web handler.
  • apps/cli now has an optional typed control-plane baseline metadata source gated by DP_CONTROL_PLANE_URL and DP_CONTROL_PLANE_TOKEN.
  • Existing CLI stable GitHub release lookup and bundled fallback behavior remains intact.
  • Docs now describe the contract boundary and additive control-plane baseline path.

Validation Evidence

  • bun run check-types --filter=@punks/contract
  • bun run test --filter=@punks/contract
  • bun run check-types --filter=@punks/api
  • bun run test --filter=@punks/api
  • bun run build --filter=@punks/api
  • bun run check-types --filter=@punks/cli
  • bun run test --filter=@punks/cli -- --run src/baseline/resolve.test.ts
  • bun run check
  • bun run check-types
  • bun run test
  • bun run build
  • git diff --check

Manual Review Checklist

CheckResultEvidence
Typed client fallback preservedPassControl-plane baseline metadata path is additive and existing GitHub/bundled fallback remains.
API contract surface implementedPasspackages/contract exports HarnessApi; apps/api implements it with Effect handlers.
Docs accuracyPassdocs/README.md and docs/runbooks/dp-cli-scaffolding.md describe the new boundary.
No raw control-plane HTTPPassNew CLI metadata calls use makeHarnessClient; raw fetch remains only for existing artifact/GitHub paths.

Review Notes

  • Hono was removed from the API implementation boundary for IP-97. The backend direction is now explicitly Effect HTTP router/layer.
  • Backend artifact storage remains deferred; the API returns typed unavailable errors until a storage story configures real artifact metadata.
  • Raw HTTP remains only for direct artifact downloads and existing GitHub fallback compatibility, not for new control-plane metadata calls.
  • Review found and fixed a fallback regression where control-plane failures could skip GitHub stable lookup and jump directly to bundled fallback.

On this page