SpecsCLIIP-138-backoffice-project-usage
Implementation Notes: IP-138 Backoffice Project Usage Visibility
Implementation Notes: IP-138 Backoffice Project Usage Visibility
Execution Mode
Sequential (parallel: false). The shared contract, API read model, auth boundary, and app UI were tightly coupled around one M4.5 vertical slice.
Completed Scope
| Issue | Status | Evidence |
|---|---|---|
| IP-139 | Implemented | Backoffice contract/API exposes ProjectUsage summaries/details, observed repositories, events, reports, and repository mapping. DB mapping also moves events/reports tied to the observed repository. |
| IP-140 | Preserved | Existing five-event taxonomy remains unchanged. Backoffice adoption summaries count only normal-source counted events and keep local/test/debug/CI as non-adoption context. |
| IP-141 | Implemented | Better Auth bearer/device auth is the operator identity flow and git identity remains observed metadata. |
| IP-142 | Implemented | apps/backoffice exists separately from apps/web with project usage list/detail, repository table, recent events, and manual repository mapping form. |
| IP-143 | Implemented | Backoffice report cards support status transitions and GitHub issue/PR URL linking. Reports remain distinct from happy-path usage stats. |
Files And Artifacts
packages/contract/src/schemas.ts,api.ts,errors.ts: backoffice schemas, endpoint group, and typed errors.apps/api/src/backoffice.ts: in-memory and database-backed backoffice store.apps/api/src/backoffice.test.ts: adoption source filtering, repository mapping, report triage, and status schema tests.packages/auth/src/index.ts: Better Auth bearer/device authorization configuration.packages/auth/src/index.test.ts: auth option regression coverage.apps/backoffice: separate internal Next.js backoffice app.docs/README.md,docs/reference/harness-intelligence.md: setup and architecture docs.apps/wiki/content/docs/harness/*,apps/wiki/content/docs/harness/trust-and-adoption/*: docs-ingest output.
Manual Review Checklist
- Confirm backoffice remains separate from
apps/web. - Confirm no UI or API field ranks, scores, or compares developers.
- Confirm GitHub URL linking is stored but automatic GitHub issue creation is not introduced.
- Confirm local/test/debug/CI sources do not inflate adoption counts.
- Confirm Better Auth bearer/device authorization remains available for CLI/API/backoffice sessions.
Validation
bun run --filter=@punks/contract check-typespassed.bun run --filter=@punks/api test -- backoffice.test.tspassed.bun run --filter=@punks/auth testpassed.bun run --filter=@punks/backoffice check-typespassed.bun run --filter=@punks/backoffice buildpassed.bun run --filter=@punks/api testpassed.bun run check-typespassed.bun run testpassed.bun run checkpassed after addingapps/backoffice/.gitignorefor generated Next output.git diff --checkpassed.- Browser smoke passed with
agent-browseragainsthttp://localhost:3002: project usage list rendered, project detail rendered, observed repository table rendered, recent event rendered, and report triage form rendered.