forked from colbymchenry/codegraph
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathallocation-fixtures.json
More file actions
344 lines (344 loc) · 21.5 KB
/
Copy pathallocation-fixtures.json
File metadata and controls
344 lines (344 loc) · 21.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
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
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
{
"$comment": [
"Regression fixtures for GitHub issue #1500 / epic CG-1 — relevance-proportional",
"explore budget allocation. Run them with `node scripts/agent-eval/probe-allocation.mjs`",
"against a built dist/.",
"",
"STATUS: BOTH FIXTURES PASS again as of CG-31. self-query's delivered-share gates",
"failed on the CG-30-only build (`afterCG30`) and CG-31 restored them (`afterCG31`):",
"the incidental file was not over-RESERVED at all — it was over-SPENDING, drawing on",
"the reservations of files the render loop had not reached yet. Bounding that put the",
"response back inside the envelope, so nothing truncates and every admitted file",
"delivers. Read the two blocks together; the CG-30 verdict's diagnosis was wrong.",
"",
"CG-10 (relevance scoring) closed the RANKING half —",
"nothing incidental reaches the envelope any more — and CG-12 (score-proportional",
"allocation with a relative cliff) closed the BYTE SPLIT: each file's share is reserved",
"before anything renders, and a file under 15% of the top weight gets no source at all,",
"freeing both its bytes and its maxFiles slot. Each fixture records the pre-CG-10",
"`baseline`, the interim `afterCG10`, and the current `afterCG12`.",
"",
"`groups` partitions the files explore rendered into `answer` (what the query is",
"actually about) and `incidental` (what wins the envelope today on name collisions).",
"Assertions are on the DELIVERED envelope unless suffixed `Allocated`; delivered is",
"what the agent got, allocated is what the render loop chose before the hard ceiling.",
"Shares are fractions of the whole response, meta-text included, so they never sum to 1.",
"",
"CG-36 adds two more fixtures and a per-file `spendShareAtLeast` gate. The share gates",
"above ask which files WON the envelope; that one asks whether a file that won its share",
"then spent it. `starved-cluster` and `dense-header` are the two halves of the same",
"tradeoff and must be read together — one fails if a trivial cluster starves the",
"answer-bearing one, the other fails if the fix for that buries a query's own methods",
"under a dense declaration block."
],
"fixtures": [
{
"id": "payroll-go",
"title": "#1500 — generated Go CRUD beside a hand-written payroll workflow",
"kind": "fixture",
"path": "__tests__/fixtures/payroll-go",
"query": "how does payroll cycle create and calculate payslips?",
"rationale": [
"The reporter's repo shape: a Go service whose generated FKIT CRUD layer sits",
"beside the hand-written use-case that does the real work. The query deliberately",
"does NOT name runPayrollCycleAll / BuildPayslip / Upsert — an architecture",
"question phrased the way a newcomer would phrase it. The generated layer",
"name-collides on every query term (CreatePayslip, PayrollCycleCreateRequest,",
"CalculatePayrollCycleTotals, a second BuildPayslip, a second Upsert), so a",
"scorer that rewards incidental name matches surfaces the CRUD path.",
"Half the generated files carry ORDINARY names and are only detectable by their",
"`// Code generated ... DO NOT EDIT.` header (CG-5), which is what makes this",
"the #1500 case rather than a .pb.go case."
],
"groups": {
"answer": [
"internal/usecase/**",
"internal/store/**",
"internal/transport/**",
"internal/domain/**",
"cmd/**"
],
"incidental": [
"internal/gen/**"
]
},
"assert": {
"answerShareAtLeast": 0.55,
"incidentalShareAtMost": 0.25,
"topFileGroup": "answer",
"mustDeliverBytes": [
"internal/usecase/payroll/cycle.go",
"internal/usecase/payroll/payslip_builder.go"
],
"$mustContainComment": "Needles are chosen to match the HAND-WRITTEN chain only — a bare `BuildPayslip`/`Upsert` also matches the generated collisions, which is the whole point of the fixture.",
"mustContain": [
"runPayrollCycleAll",
"func (s *Service) BuildPayslip",
"s.store.Upsert(ctx, slip)"
]
},
"baseline": {
"measuredOn": "2026-08-03",
"note": "19 files → very-tiny tier (13,000 budget); 23,020 chars allocated against it, cut to 16,011 by the 19,500 hard ceiling.",
"delivered": {
"internal/gen/fkit/payroll/payslip.go": 0.307,
"internal/gen/fkit/payroll/payroll_cycle.go": 0.266,
"internal/domain/payroll/payslip.go": 0.256,
"internal/usecase/payroll/cycle.go": 0.0
},
"verdict": "The workflow file is allocated the single largest slice (30.6%) and delivers ZERO — the hard ceiling drops its whole section. Generated CRUD takes 57.4% of what the agent actually receives; runPayrollCycleAll, BuildPayslip and the real Upsert never reach the response."
},
"afterCG10": {
"measuredOn": "2026-08-04",
"delivered": {
"internal/usecase/payroll/cycle.go": 0.389,
"internal/gen/fkit/payroll/payroll_cycle.go": 0.235,
"internal/domain/payroll/payslip.go": 0.226,
"internal/gen/fkit/payroll/payslip.go": 0.0
},
"verdict": "PASSES answerShareAtLeast (61.5%), incidentalShareAtMost (23.5%), topFileGroup, and the cycle.go + runPayrollCycleAll + real-Upsert needles. The generated files now rank #3/#4 instead of #1/#2 — kind weighting plus a 0.3x generated penalty on BOTH the score and the graph mass, which is the key the comparator sorts on. STILL FAILING for CG-12: payslip_builder.go ranks #6 against the tier's maxFiles of 4, so `func (s *Service) BuildPayslip` never renders."
},
"afterCG12": {
"measuredOn": "2026-08-04",
"note": "19,337 delivered, nothing truncated. Both generated files cliffed to pointers (weight 3.9 and 3.5 against a cliff of 5.4), which frees the two maxFiles slots the hand-written store and builder then take.",
"delivered": {
"internal/usecase/payroll/cycle.go": 0.306,
"internal/domain/payroll/payslip.go": 0.212,
"internal/usecase/payroll/payslip_builder.go": 0.151,
"internal/store/payslipstore/store.go": 0.118,
"internal/gen/fkit/payroll/payroll_cycle.go": 0.0,
"internal/gen/fkit/payroll/payslip.go": 0.0
},
"verdict": "ALL GATES PASS. Answer group 78.7% (from 25.6% at baseline), generated layer 0.0% (from 57.4%). All four hand-written files deliver source, including payslip_builder.go — `func (s *Service) BuildPayslip`, the 'calculate' half of the question, finally reaches the agent. The generated files are still NAMED with their symbols and line numbers under 'Not shown above', so withholding their bytes costs ~100 chars each instead of ~4,500 and stays one follow-up explore away."
}
},
{
"id": "starved-cluster",
"title": "CG-36 — a trivial top-ranked cluster starving the answer-bearing one",
"kind": "fixture",
"path": "__tests__/fixtures/starved-cluster-ts",
"query": "how does a request travel from sendRequest to the socket",
"rationale": [
"django's `db/models/sql/query.py` and okhttp's `RealInterceptorChain.kt`, reduced",
"to a fixture. `chain.ts` holds a one-line `describeChain` helper at the top —",
"trivial, but a direct callee of the query's entry point, so its cluster carries",
"the file's highest per-symbol importance — and, past the cluster gap, the",
"`RequestChain` class that actually answers the question. The helper's cluster wins",
"the one guaranteed-and-shrinkable slot; the class then does not fit the remainder.",
"",
"Before CG-36 the class was dropped WHOLE and the file delivered 1,985 of a 6,904",
"reservation. That is not merely unspent budget: the slack carries forward to",
"lower-ranked files, so the response stays full and every envelope-share gate",
"passes while the answer is missing. Hence `spendShareAtLeast`."
],
"groups": {
"answer": [
"src/pipeline/chain.ts",
"src/transport/**",
"src/app/client.ts"
],
"incidental": [
"src/app/config.ts",
"src/pipeline/framing.ts"
]
},
"assert": {
"topFileGroup": "answer",
"spendShareAtLeast": {
"src/pipeline/chain.ts": 0.6
},
"mustDeliverBytes": [
"src/pipeline/chain.ts"
],
"$mustContainComment": "The two ends of the in-file flow: the chain hop and the transport hop it terminates in. Both live in the cluster that used to be dropped whole.",
"mustContain": [
"async proceed(request: PipelineRequest)",
"private async writeAndRead(request: PipelineRequest)"
]
},
"baseline": {
"measuredOn": "2026-08-06",
"note": "The CG-24 epic tip (76ab1fe), before CG-36. 3,725 chars of source delivered in total.",
"delivered": {
"src/pipeline/chain.ts": 1985,
"src/app/client.ts": 997,
"src/pipeline/types.ts": 743
},
"verdict": "FAILS spendShareAtLeast and both needles. chain.ts spends 1,985 of its 6,904 reservation (28.8%) — it keeps the `describeChain` cluster and drops the `RequestChain` cluster whole, so neither `proceed` nor `writeAndRead` reaches the agent. Nothing else in the response is wrong: the file still ranks #1 by score and is still reserved the largest slice."
},
"afterCG36": {
"measuredOn": "2026-08-06",
"note": "10,802 chars of source delivered in total, nothing truncated.",
"delivered": {
"src/pipeline/chain.ts": 9062,
"src/app/client.ts": 997,
"src/pipeline/types.ts": 743
},
"verdict": "ALL GATES PASS. The `RequestChain` cluster is now SHRUNK into the remainder by the same whole-member rule the first cluster already used, instead of being dropped whole, so chain.ts delivers 9,062 chars including `proceed`, `advance` and `writeAndRead` — the whole in-file flow the question asks for."
}
},
{
"id": "dense-header",
"title": "CG-36 — the Session.swift shape density-first ranking exists for",
"kind": "fixture",
"path": "__tests__/fixtures/dense-header-ts",
"query": "how does perform create a URLRequest and start the task",
"rationale": [
"The counterweight to `starved-cluster`, and the reason CG-36 did NOT touch cluster",
"ranking. `session.ts` opens with a 60-line property list and a run of trivial",
"accessors — many adjacent, individually worthless declarations, i.e. the densest",
"block in the file — while `perform`, `didCreateURLRequest` and `task`, which the",
"query names, sit ~200 lines below it.",
"",
"Ranked on density alone the header block takes the file's whole budget and the",
"methods are buried; that is Alamofire's Session.swift, the case the",
"importance-then-density order was built for. Any future change to selection or",
"shrinking has to keep this passing as well as `starved-cluster` — they pull in",
"opposite directions, which is exactly why both are here."
],
"groups": {
"answer": [
"src/net/**",
"src/core/request-builder.ts",
"src/core/task-factory.ts"
],
"incidental": [
"src/core/queue.ts"
]
},
"assert": {
"topFileGroup": "answer",
"answerShareOfSourceAtLeast": 0.8,
"spendShareAtLeast": {
"src/net/session.ts": 0.6
},
"$mustContainComment": "All three named symbols are deep in the file, past the dense header block. If density ever outranks importance again, these are the first thing to go.",
"mustContain": [
"async perform(url: string, method: string",
"didCreateURLRequest(request: URLRequest)",
"task(request: URLRequest, identifier: number)"
]
},
"afterCG36": {
"measuredOn": "2026-08-06",
"note": "11,695 chars of source delivered, BYTE-IDENTICAL to the CG-24 epic tip (76ab1fe) — this fixture pins behaviour CG-36 deliberately left alone.",
"delivered": {
"src/net/session.ts": 9007,
"src/core/types.ts": 1957,
"src/core/task-factory.ts": 731
},
"verdict": "ALL GATES PASS, on the epic tip and on CG-36 alike. session.ts spends 9,007 of its 9,009 reservation and the response carries all three named methods from the bottom of the file. The dense header block is not what won the budget."
}
},
{
"id": "self-query",
"title": "This repo — incidental `explore`/`BUDGET` matches in the agent-eval scripts",
"kind": "self",
"path": ".",
"query": "how does explore allocate its output budget across files",
"rationale": [
"The same failure mode with no generated code in sight. `scripts/agent-eval/*.mjs`",
"mention `explore` and `BUDGET` incidentally — they are eval harnesses, not the",
"allocator — and they are small enough to ship WHOLE, while src/mcp/tools.ts (which",
"carries getExploreOutputBudget and the render loop, and scores 4x higher on every",
"signal) is large enough to be clipped at maxCharsPerFile. Allocation follows file",
"size, not relevance.",
"",
"Unlike payroll-go this fixture reads THIS repo's live index, so its exact numbers",
"move as the repo changes (indexed file count crossing 500 flips the budget tier).",
"The assertions are therefore relative — answer-vs-incidental, not fixed percentages."
],
"groups": {
"answer": [
"src/mcp/**"
],
"incidental": [
"scripts/**"
]
},
"assert": {
"$answerShareComment": [
"Denominated in DELIVERED SOURCE, not in the whole envelope (CG-26). The",
"envelope-denominated form of this gate moved for reasons that have nothing",
"to do with allocation: it fell when the epilogue stopped being discarded,",
"and it fell again when a fifth ADMITTED file finally got paid its",
"reservation instead of being dropped by the ceiling. Both are the",
"improvements this epic exists to make, and a gate that reads them as",
"regressions is measuring the denominator. The fixture's own rationale",
"already says the assertions are relative, answer-vs-incidental, not fixed",
"percentages. 0.5 is unchanged; only what it is a share OF."
],
"answerShareOfSourceAtLeast": 0.5,
"incidentalShareAtMost": 0.25,
"topFileGroup": "answer",
"mustDeliverBytes": [
"src/mcp/tools.ts"
]
},
"baseline": {
"measuredOn": "2026-08-03",
"note": "493 files → small tier (18,000 budget); 27,518 chars allocated against it, cut to 19,749 by the 25,000 hard ceiling.",
"delivered": {
"scripts/agent-eval/offload-eval-hook.mjs": 0.25,
"scripts/agent-eval/offload-eval-metrics.mjs": 0.236,
"scripts/agent-eval/parse-session.mjs": 0.232,
"src/mcp/tools.ts": 0.185,
"scripts/agent-eval/offload-eval-cost.mjs": 0.0
},
"verdict": "The script corpus takes 71.8% of the delivered envelope (79.4% of what was allocated) against tools.ts's 18.5%, despite tools.ts scoring 46 vs 10, carrying 2.3x the graph mass and 3x the distinct term hits."
},
"afterCG10": {
"measuredOn": "2026-08-04",
"delivered": {
"src/resolution/memory-budget.ts": 0.512,
"src/mcp/tools.ts": 0.329
},
"verdict": "PASSES incidentalShareAtMost: every scripts/agent-eval/*.mjs file is gone (0.0%), which is CG-10's acceptance bar — their sole match was an unused file-scope `explore`/`BUDGET` constant, worth 0.08x weight, and the relative floor (8.2) then cut them. tools.ts ranks #1. STILL FAILING for CG-12: memory-budget.ts scores 18 to tools.ts's 41 yet takes 51.2% of the envelope to tools.ts's 32.9%, purely because it is small enough to ship whole while tools.ts is clipped at maxCharsPerFile. Allocation still follows file size, not relevance."
},
"afterCG12": {
"measuredOn": "2026-08-04",
"note": "18,134 delivered, nothing truncated. tools.ts scores 58 here (it grew by the allocator this task added), memory-budget.ts 18.",
"delivered": {
"src/mcp/tools.ts": 0.606,
"src/resolution/memory-budget.ts": 0.172,
"src/resolution/lru-cache.ts": 0.111
},
"verdict": "ALL GATES PASS. tools.ts takes 60.6% of the envelope, up from 18.5% at baseline and 32.9% after CG-10 — past the epic's >50% acceptance bar. The reversal is the whole point: memory-budget.ts no longer wins by being small enough to ship whole (it now clusters within its 3.1K reservation), and tools.ts is no longer clipped at maxCharsPerFile (11K reservation, ~3x the old flat cap). Exception to 'no previously-unclipped file becomes clipped': memory-budget.ts was unclipped-whole at 5,672 and is now clipped to its proportional share. That is the epic's own diagnosis of the bug, not a regression — it scored 18 against tools.ts's 58 and was taking the larger slice."
},
"afterCG30": {
"measuredOn": "2026-08-06",
"note": "23,688 delivered of 26,430 allocated, truncated at the 25,000 ceiling. Baseline (main) on the SAME index: 14,851 delivered of 25,221 allocated. tools.ts delivers 8,282 chars in BOTH arms — identical bytes; only the denominator moved.",
"delivered": {
"scripts/agent-eval/parse-run.mjs": 0.361,
"src/mcp/tools.ts": 0.35,
"src/mcp/explore-session-state.ts": 0.147,
"src/resolution/memory-budget.ts": 0.0
},
"verdict": "THREE GATES FAIL — and the cause is not the CG-30 bound. Allocation is unchanged between arms (parse-run.mjs 32.3% here vs 33.9% on main); what changed is that it now DELIVERS. On main its whole 8,548-char section was cut by the hard-ceiling truncation, so the incidental group scored 0.0% by luck, not by design, and the fixture passed on that. Bounding the oversize-member overshoot freed enough headroom that the response no longer truncates the same section away. Every file obeys the new bound on this repo (max ratio 1.40x of spendable, against the 1.5x ceiling). What the failure exposes is real and pre-existing: parse-run.mjs scores 18 against tools.ts's 58 yet is reserved a comparable slice — a low-scoring file taking a top-file share, which is epic CG-24's subject. Fix it there; do not tune the CG-30 bound to restore a pass that depended on truncation. SUPERSEDED by afterCG31 — the diagnosis above is wrong on one load-bearing point, see there."
},
"afterCG31": {
"measuredOn": "2026-08-06",
"note": "23,083 delivered of 23,080 allocated — inside the envelope, nothing truncated. Both arms measured on the SAME clean FULL REBUILD of this repo's index (CG-33: an incrementally-synced index diverges and shifts ranking). CG-30-only arm on that index: 23,692 delivered of 26,410 allocated, TRUNCATED.",
"delivered": {
"src/mcp/tools.ts": 0.359,
"scripts/agent-eval/parse-run.mjs": 0.187,
"src/mcp/explore-session-state.ts": 0.151,
"src/resolution/lru-cache.ts": 0.087
},
"verdict": "ALL FOUR GATES PASS. The afterCG30 verdict called parse-run.mjs over-RESERVED; it was not — its reservation is 4,314 in both arms. It was over-SPENDING: 8,548 chars, drawing on reservations belonging to files the render loop had not reached yet, which is the CG-31 defect. With the displacement guard it renders 4,314, tools.ts's identical 8,282 chars go from 35.0% to 35.9% of a response that no longer overruns, and lru-cache.ts (dropped as memory-budget.ts was on the CG-30 arm) delivers. Note what did NOT change: allocation. This fixture moved because the render loop stopped spending other files' bytes, not because anything was re-ranked."
},
"afterCG26": {
"measuredOn": "2026-08-06",
"note": "24,952 delivered of 24,949 allocated, nothing truncated — against the CG-31 tip's 23,083 on the SAME clean full rebuild of this repo's index. tools.ts delivers 8,282 chars in BOTH arms: identical bytes, unchanged reservation, unchanged rank. Total delivered SOURCE 21,228 against 18,105.",
"delivered": {
"src/mcp/tools.ts": 0.334,
"scripts/agent-eval/parse-run.mjs": 0.174,
"src/mcp/explore-session-state.ts": 0.141,
"src/resolution/memory-budget.ts": 0.126,
"src/resolution/lru-cache.ts": 0.081
},
"verdict": "ALL GATES PASS. The one that changed shape is answerShareAtLeast → answerShareOfSourceAtLeast: on the envelope denominator the answer group reads 47.5% here against 51.0% at the CG-31 tip, and neither number is about allocation. tools.ts's bytes are byte-identical between the arms; what moved is that the response now delivers a FIFTH admitted file (memory-budget.ts, rank 4, paid its full 3,123-char reservation — the CG-31 tip rendered it and then let the hard ceiling drop the whole section) and keeps epilogue prose it used to discard. Answer/incidental separation is unchanged and strong: tools.ts 33.4% against parse-run.mjs's 17.4%, incidental 17.4% (down from 18.7%), top delivered file still tools.ts. Measured in delivered source the answer group is 55.5%."
}
}
]
}