GeezerVison is showing github.com — impl(pm-stack): spend attribution projection — session to issue/epic resolution, unattributed shown (#1259 slice 1) · Issue #4822 · developing-today/code
impl(pm-stack): spend attribution projection — session to issue/epic resolution, unattributed shown (#1259 slice 1) #4822DescriptionPart of epic #1184; implementation follow-up of design issue #1259 (spend rollups). Design note: doc/spend-rollups-design-1259.md (PR linked from #1259).
Scope
Build the spend-attribution projection in the pm-stack aggregator: a versioned, pure projection that turns existing per-session usage records into per-issue / per-epic / per-project spend facts. Consume existing sources only — do NOT build new collectors:
Attribution rules (per the design note)
- Queue-bound sessions resolve exactly: lane-ledger session binding → queue task → issue number.
- Fleet-worktree sessions resolve from the worktree directory name (
~/git/fleet/<task>-<issue>-<slug>).
- Sub-sessions roll up to their root session (
parentId); never double-counted.
- Epic/project resolution reuses the existing hierarchy seams (
epicRef / parent chains in pm-stack/aggregator/src/model.ts, rollups in src/epics.ts); Project Area is a display grouping, not an attribution key.
- Anything unresolved lands in an explicit unattributed bucket with a reason code (
no-binding, no-worktree, parent-left-pool, source-gap). Unattributed spend is shown, never dropped or guessed onto an epic.
- Every projected fact carries
attributionVersion; raw source records are never rewritten.
Acceptance criteria
- Projection is a pure, tested module: same inputs + same version → identical output.
- Unit tests cover: bound session, worktree session, sub-session rollup, each unattributed reason code, and a session whose parent chain leaves the fetched pool.
- Totals reconcile: sum(attributed) + unattributed = source totals, per unit, asserted in tests.
- No new collector, exporter, or instrumentation in OpenCode/OpenChamber.
Checks
bun test and bunx tsc --noEmit in pm-stack/aggregator pass (CI on the PR).
Activitydezren39 commented on Nov 3, 2026 agent-note:v1
state: triaged (coverage pass)
Coverage pass 2026-11-03: reviewed in the fleet-wide per-issue pass (drift / overlap / already-handled / stale / blockers / ordering). Verdict: still live; queued in repo-health-code-pilot as triage at priority 40 (priority/normal). If this is already handled at current main, the triage closes it with evidence; if it needs splitting, the triage files the split.
Found via: coverage pass 2026-11-03 dezren39 commented on Nov 3, 2026 🤖 Agent note · picked up
- Agent: queue worker (repo-worker-code), lane code-c shift
- Session / ID: task 8447
- Found via: queue claim (coverage triage)
- Task: Triage at current main: verify the spend-attribution projection (design(pm-stack): spend rollups — token and dollar attribution per project and per epic, rendered on Projects/Roadmap #1259 slice 1) is not already built, verify its named sources (usage export docs, snapshots store, lane-ledger binding) exist as the design assumes, and route the implementation.
- Expectation: effort xs — verdict + scoped implementation task enqueued, or closed with evidence if already handled/superseded.
dezren39 commented on Nov 3, 2026 dezren39 commented on Nov 3, 2026 🤖 Agent note · handed off
- Agent: queue worker (repo-worker-code), lane 9aca43b4-5439-4939-9f71-323f5d32521b
- Session / ID: task 8769
- Found via: OpenChamber scheduled lane claim
- Task: Implement the v1 spend attribution projection and reconciliation tests.
- Outcome: PR feat(pm-stack): project spend attribution facts (#4822) #5164 opened: feat(pm-stack): project spend attribution facts (#4822) #5164 (head
d577df915f61669eb09d798c1627f9d2a1409c7d).
- Verification: targeted test 7/7 and focused strict TypeScript check pass. No PR checks are configured for pm-stack aggregator: the aggregator workflows trigger on main pushes only. Full local suite had 2 existing
/api/health assertions fail; full typecheck reports the existing HealthView.conflicts fixture error.
dezren39 commented on Nov 8, 2026 PR #5164 (project spend attribution facts) merged 2026-11-08T00:41:47Z (merge commit c2329cf56f57) by queue worker lane code-z under task 11311, after fixing both Codex P2 findings on the PR (provider/model fact splitting; root binding consulted when the root row is outside the source window; bun test test/spend-attribution.test.ts 9 pass). Resolution issue #6912 closed with the full outcome. Leaving #4822 open for its own lifecycle in case the wider #1259 slice set has more to land here. dezren39 commented on Nov 8, 2026 Correction: PR #5164 merge commit is 9e9bb8b (gh api + origin/main log verified), not the SHA in my previous comment. - lane code-z, task 11311
MetadataMetadataDevelopmentNo branches or pull requestsIssue actions
|