Skip to content

feat(metrics): ADR-0030 P-CODE.1 — git workspace code-activity (/api/code-activity)#72

Merged
mlcyclops merged 1 commit into
masterfrom
feat/p-code-1-code-activity
Jun 24, 2026
Merged

feat(metrics): ADR-0030 P-CODE.1 — git workspace code-activity (/api/code-activity)#72
mlcyclops merged 1 commit into
masterfrom
feat/p-code-1-code-activity

Conversation

@mlcyclops

Copy link
Copy Markdown
Owner

Implements ADR-0030 P-CODE.1, making the code-activity contract surface real (it was design-only until now). Honest framing throughout: this is repo/workspace activity (every commit), not AI authorship — that's the separate aiLoc metric (ADR-0031).

What's included

  • tools/memory_data.tscodeActivity() + pure parseNumstat()/renamedPath(). git log --numstat for the calendar month via an args array (no shell), each workspace confined with pathWithin to the home subtree (ADR-0022/0023), 15s timeout, vendored-churn pathspec excludes, rename + binary handling. Fail-closed: a non-git / out-of-home / failed-git workspace is omitted, never faked (invariant build(deps): bump github/codeql-action from 3 to 4 #3). Per-workspace spend is deferred to P-CODE.2 (spend: 0).
  • desktop/dev.tsGET /api/code-activity (30s memo; ?force=1 bypass).
  • desktop/rendererCodeActivity bridge type + accessor; a "workspace activity" ledger-card row (+added / −deleted / files) with green/red CSS; a "lines" rail tile. Labels say "workspace activity", not "AI-authored" (AGENTS.md build(deps-dev): bump electron from 33.4.11 to 42.4.1 in /desktop #10).
  • Tests/demoharness/code_activity.test.ts (12 tests; numstat parser keystone: renames, binary, dedup, blank lines, CRLF; fail-closed omits; pinned shape) + demo-P-CODE.1.

Verification

  • 456/456 harness tests green (444 baseline + 12 new); demo-P-CODE.1 passes.
  • No new typecheck errors. (The pre-existing desktop/personal.ts:50 failure from ADR-0042 is unrelated and left as-is.)
  • Live endpoint: 403 without token (fail-closed); real data with it — LucidAgentIDE: +39,271 / −2,801, 302 files this month.
  • UI rendered live (ledger row + green "+39.3k LINES" rail tile), no console errors. Prompt prefix untouched (read-only metrics).

Scope

Per the one-increment rule, stops at P-CODE.1. P-CODE.2 (monthly workspace table + spend attribution) and P-CODE.3 (polish: no-changes / detached-HEAD edges) are follow-ups.

🤖 Generated with Claude Code

…code-activity)

Make the code-activity contract surface real (it was design-only in ADR-0030).
Honest framing: this is REPO/WORKSPACE activity (every commit), NOT AI authorship
— that's the separate aiLoc metric (ADR-0031).

- tools/memory_data.ts: codeActivity() + pure parseNumstat()/renamedPath().
  `git log --numstat` for the calendar month via an args ARRAY (no shell), each
  workspace confined with pathWithin to the home subtree (ADR-0022/0023), 15s
  timeout, vendored-churn pathspec excludes, rename + binary handling. Fail-closed:
  a non-git / out-of-home / failed-git workspace is OMITTED, never faked (#3).
  Spend attribution is deferred to P-CODE.2 (spend: 0).
- desktop/dev.ts: GET /api/code-activity (30s memo — each call spawns git per
  workspace; ?force=1 bypasses the cache).
- desktop/renderer: CodeActivity bridge type + accessor; a "workspace activity"
  ledger-card row (+added / -deleted / files) with green/red CSS; a "lines" rail
  tile. Labels say "workspace activity", not "AI-authored" (AGENTS.md #10).
- harness/code_activity.test.ts: 12 tests (numstat parser keystone — renames,
  binary, dedup, blank lines, CRLF; fail-closed omits; pinned shape).
- demo-P-CODE.1 (Makefile + package.json) + harness/scripts/demo_pcode1.ts.

Verified: 456/456 harness tests green; demo OK; no new typecheck errors; live
endpoint 403 without token and real data with it (+39,271/-2,801, 302 files this
month); UI rendered + screenshot, no console errors. Prompt prefix untouched.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@mlcyclops mlcyclops merged commit 549c052 into master Jun 24, 2026
5 checks passed
@mlcyclops mlcyclops deleted the feat/p-code-1-code-activity branch June 24, 2026 05:40
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.

1 participant