fix(graph): admit impact grounding records before callers and source - #238
Conversation
|
CI note: |
Pin the other half of mex-memory#225: at the smallest accepted output budget the impact response carries no grounding records, stays within budget, and is still marked truncated. Record why grounding is admitted before callers and source, and name the accepted cost in the CHANGELOG.
|
Thanks @chiliec, this is the right fix. Verified end to end: the new test fails on I pushed Looks good to merge. |
What
mex impactadmits grounding records right after the target'sdefinesrecords, before transitive callers and source ranges, instead of last. Adds a regression test and a CHANGELOG entry.Why
closes #225
ledger.tryAddfails once the budget is spent. Grounding was the last record type added to the ledger, so any target with a moderate number of callers lost its knowledge links at the default 1,500-token budget. Grounding records are ~20 tokens each and are the one thingimpactreturns that no other command does; a caller fact costs ~50. The emitted order (target,defines,caller…,source…,grounding…) is unchanged — only the admission order moves, so the existing order-asserting test still passes.truncatedis still set when callers are cut.Type of change
How to test
npx vitest run test/graph-cli-agent.test.ts -t "exhaust the default budget"mainthe new test fails: a target with 60 callers and 6 groundings at the default budget returns 15 callers and only 1 of 6 grounding records. With this change all 6 come back andtruncatedstaystrue.Checklist
npm test) —npm run typecheckclean;test/graph-cli-agent.test.ts12/12, plusgraph-cli-*,graph-140-fixes,graph-grounding,cli-smoke(75 passed, 1 skipped). In the fullnpm teston my machine the only failures are 15 s vitest timeouts in the two-clone Relay / real-Git integration tests, which are unrelated toimpact(none of them touchcli-agent.ts).Code-graph changes
mainLanguageExtractororFrameworkResolverinterfacecore / discuss-firstissue is linked above