Commit 3d0c3f4
[GRV-26]: Establish attribution catalog and repair boundary guard (#44)
## Summary
Part of the **llm-cost architecture contracts** Project. Two
deliverables, both scoped to the `llm-cost-attribution` package (per
this issue's title + `llm-cost-attribution` label):
1. **Repair the boundary guard** so its config reflects the package
after the estimation extraction.
2. **Establish the attribution use-case catalog** as the canonical,
complete source of truth for the attribution surface.
### Repair boundary guard —
`packages/llm-cost-attribution/scripts/check-boundary.mjs`
The boundary config carried two **dead references** to modules that were
extracted to `llm-cost-estimation` (in GRV-2 / the estimation split) but
never removed here:
- `src/enrich.mjs` in `coreModules`
- `src/linear-estimate-source.mjs` in `adapterModules`
Neither file exists in this package, so `existsSync` silently skipped
them — the guard *claimed* to protect/classify modules it can no longer
see. Repaired by:
- Removing both dead entries.
- Replacing stale remediation text that still pointed at the moved
`LinearEstimateSource` with port-neutral attribution guidance
(`SessionSource` / `IssueMatcher` / `UsageRecordSource` /
`UsageRecordSink`). The defensive `@linear` / `https` / `fs` /
`child_process` forbidden-package rules are kept.
To repair the *class* of bug (not just the instance),
`test/boundary.test.mjs` now:
- Adds **config-integrity tests** asserting every configured
`coreModules` / `adapterModules` path exists on disk, so dead or phantom
entries fail CI instead of silently passing.
- Exercises the core-imports-adapter rule against a **real** adapter
(`attribution-adapters.mjs`) instead of the removed Linear adapter.
### Establish attribution catalog —
`docs/architecture/use-case-catalog.md`
- Added a canonical intro, the inward dependency rule, and the linkage
to the boundary guard that enforces it.
- Cataloged the two remaining public use cases that were documented in
the package catalog/README but missing here:
**CreateAttributionWorkflow** and **ListKnownIssues**. The catalog now
covers the full attribution public surface.
## Verification
- `npm test` (llm-cost-attribution): **200 pass / 0 fail** (was 198; +2
new config-integrity tests).
- `node scripts/check-boundary.mjs`: **Boundary check passed**.
- `node --check` on changed `scripts/check-boundary.mjs` and
`test/boundary.test.mjs`: ✓.
- Project-acceptance, llm-cost-architecture-contracts — **GRV-26's
portion is fully green**:
- `architecture-boundary.check.mjs` (runs the repaired guard): ✓
- `attribution-ports.test.mjs`: ✓
- catalog/API alignment: **no findings for `llm-cost-attribution`**.
- Rebased onto latest `origin/main` (includes #43 / GRV-27).
## Out of scope (observed, not fixed here)
The non-required project-acceptance gate still reports **one** finding,
in the separate **`llm-cost-estimation`** package, left by the
just-merged GRV-27 (#43):
`packages/llm-cost-estimation/docs/use-cases.md:67` marks the
now-implemented `forecastProjectCost` as planned/stubbed. That is
estimation-catalog territory (GRV-27's rollout), not this attribution
issue — flagged here as a breadcrumb for a follow-up rather than mixing
packages in one PR. `pr-build` (the required gate) excludes the
project-acceptance directory, so this does not block merge.
Co-authored-by: riddim-developer-bot <developer-bot@riddimsoftware.com>1 parent 347b6dc commit 3d0c3f4
3 files changed
Lines changed: 73 additions & 10 deletions
File tree
- docs/architecture
- packages/llm-cost-attribution
- scripts
- test
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
3 | 19 | | |
4 | 20 | | |
5 | 21 | | |
| |||
53 | 69 | | |
54 | 70 | | |
55 | 71 | | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
56 | 83 | | |
57 | 84 | | |
58 | 85 | | |
| |||
103 | 130 | | |
104 | 131 | | |
105 | 132 | | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
15 | 14 | | |
16 | 15 | | |
17 | 16 | | |
18 | 17 | | |
19 | 18 | | |
20 | 19 | | |
21 | | - | |
22 | 20 | | |
23 | 21 | | |
24 | 22 | | |
| |||
37 | 35 | | |
38 | 36 | | |
39 | 37 | | |
40 | | - | |
| 38 | + | |
41 | 39 | | |
42 | 40 | | |
43 | 41 | | |
44 | 42 | | |
45 | | - | |
| 43 | + | |
46 | 44 | | |
47 | 45 | | |
48 | 46 | | |
| |||
185 | 183 | | |
186 | 184 | | |
187 | 185 | | |
188 | | - | |
| 186 | + | |
189 | 187 | | |
190 | 188 | | |
191 | 189 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
| 2 | + | |
2 | 3 | | |
3 | 4 | | |
4 | 5 | | |
5 | 6 | | |
6 | 7 | | |
7 | 8 | | |
8 | 9 | | |
| 10 | + | |
| 11 | + | |
9 | 12 | | |
10 | 13 | | |
11 | 14 | | |
| |||
41 | 44 | | |
42 | 45 | | |
43 | 46 | | |
44 | | - | |
| 47 | + | |
45 | 48 | | |
46 | | - | |
| 49 | + | |
47 | 50 | | |
48 | 51 | | |
49 | 52 | | |
50 | | - | |
51 | | - | |
52 | | - | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
53 | 56 | | |
54 | 57 | | |
55 | 58 | | |
| |||
123 | 126 | | |
124 | 127 | | |
125 | 128 | | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
0 commit comments