Repository navigation
[5] Check PR costs against independent receipts - #1350
tautvydasLiekis wants to merge 28 commits into
Conversation
Kimchi Code Review
Summary🚫 Merge request too large to review 📏 Size: 7 file(s) changed, +2659 / −0 lines 🧠 Cognitive load: 4/5 (1 = trivial, 5 = extremely demanding) One cohesive feature but very large: two comparison engines (label-only vs independent reference) with overlapping metrics, dense financial rules (nanos integer math, bucket taxonomies, account scoping), plus ~1.6k lines of edge-case-pinned tests that must be verified line by line. ✂️ Suggested split
👉 Please split this merge request into the smaller merge requests suggested above — the AI review will run automatically on each of them. What to expectKimchi will analyze the changes in this pull request and post:
The review typically completes within a few minutes. This comment will be updated once the review is ready. Interact with Kimchi
ConfigurationReviews are configured by your organization admin. Powered by Kimchi — AI-powered code review by CAST AI |
There was a problem hiding this comment.
🚫 Merge request too large to review
📏 Size: 7 file(s) changed, +2659 / −0 lines
🧠 Cognitive load: 4/5 (1 = trivial, 5 = extremely demanding)
One cohesive feature but very large: two comparison engines (label-only vs independent reference) with overlapping metrics, dense financial rules (nanos integer math, bucket taxonomies, account scoping), plus ~1.6k lines of edge-case-pinned tests that must be verified line by line.
✂️ Suggested split
- Add attribution accuracy metric engine — Core correct/wrong/missed bucketing and percentage metrics for cost reports.
src/extensions/work-attribution/accuracy.tssrc/extensions/work-attribution/accuracy.test.ts
- Add independent reference verification and CLI — Cross-checks reports against external receipts and exposes the accuracy-cli entry point.
src/extensions/work-attribution/accuracy-reference.tssrc/extensions/work-attribution/accuracy-cli.ts
- Cover the CLI end to end and document the workflow — Reference and CLI scenario suites plus the offline verification guide.
src/extensions/work-attribution/accuracy-reference.test.tssrc/extensions/work-attribution/accuracy-cli.test.tsdocs/work-attribution-accuracy.md
👉 Please split this merge request into the smaller merge requests suggested above — the AI review will run automatically on each of them.
f35a09c to
5c7ff23
Compare
4349d37 to
a76bbb2
Compare
5c7ff23 to
c3fb131
Compare
711e09e to
13cb56f
Compare
65d1089 to
4ddd773
Compare
fbb4685 to
8a8d570
Compare
99886a6 to
5c55112
Compare
07e8f4d to
eb6f010
Compare
5c55112 to
d0a25d4
Compare
eb6f010 to
698a241
Compare
4d5285c to
324aa28
Compare
698a241 to
e715a29
Compare
324aa28 to
f2ed5f7
Compare
a3b50a2 to
d9d7a5a
Compare
a8698f1 to
a1a89a1
Compare
8663368 to
1221090
Compare
7c4b96a to
da9d349
Compare
ec3fd92 to
69cee61
Compare
…t-accuracy # Conflicts: # src/extensions/work-attribution/cost-details.ts
Adds an offline command that checks a saved PR cost report against separate billing receipts and human ownership labels. It answers "are these PR totals right?" with an exit code and a list of differences, so the attribution in #1347–#1349 can be measured instead of trusted.
Linked issue
Depends on #1349. No public issue is linked.
What does this PR do?
pnpm exec tsx src/extensions/work-attribution/accuracy-cli.ts report.json reference.jsonreport.jsonis a savedcosts.json.reference.jsonlists each request's receipt amount, billing account and the PR a person says owns it. The command reads both files, prints the differences and exits. It makes no network or model calls and writes nothing.What it checks:
So that one file can be scored, each work's
costs.jsonnow also lists all six unallocated buckets and the requests and PR totals of every work connected to it through a shared PR or a work link./workstill counts only the work's own requests in its price, untagged and failed-refresh lines. The guide covers the reference format, shared work, unknown labels and metrics.Evidence
12 October retest with real GLM models and real bills on a binary of this head (
ca92df405): 18 of 18 requests priced and assigned to the PR, the six unallocated buckets written tocosts.json, and the total equal to the bills. CI passes on6bd52ec2a.On
69cee6180, after the final review fixes:pr-checks,master-checks, TUI e2e in 4 shards, ACP e2e and MCP e2e pass on this head. A duplicatetui-e2eentry from a superseded workflow run shows as cancelled.95614e7c6(#1389) contains this PR. On it,pnpm checkpasses and the full unit suite passes except 5 tests that need tools this machine lacks: a DAP js-debug adapter, a builtvalidate-skill.mjsand a binary rebuilt for the smoke test.95614e7c6(scripted model; local GitHub, billing and report fixtures): 73/73 default scenarios pass. Its happy-path scenarios run this command on their saved reports and require exit 0.price-mismatchlines after the request's price was changed.All inputs are synthetic. This PR provides the measuring tool; it does not report an accuracy rate over real PRs.
Limits
costs.json, so its size grows with the connected group. [11] Store work summaries as row logs #1389 limits how often the full file is rewritten.Checklist
pnpm run test)pnpm run check)