From 061bf35756159715754b2693aeab9e58b8c477ae Mon Sep 17 00:00:00 2001 From: swapnil Date: Thu, 1 Oct 2026 07:05:31 -0700 Subject: [PATCH] impact: keep the direct callers and every link grep cannot make, each saying what it is Agents on the trial build read the collapsed form as a missing direct section: an implementation listed among grep's confirmed callers, a call across a process boundary folded into one line, 'reached through the ones above' with nothing above. A direct place now drops to the grep line only when it is a plain resolved call, read or write that spells the name, and the first three direct callers keep their code even then; an override, an implementation, an injection, a hand-off as a value or a cross-process call keeps its code and carries its reason in the tag. Co-authored-by: axiomcode-bot[bot] <334110751+axiomcode-bot[bot]@users.noreply.github.com> --- .../skills/axiomcode/scripts/ax_blocks.py | 31 +++++++++++++++---- tests/front_door.py | 8 ++--- 2 files changed, 29 insertions(+), 10 deletions(-) diff --git a/plugins/axiomcode/skills/axiomcode/scripts/ax_blocks.py b/plugins/axiomcode/skills/axiomcode/scripts/ax_blocks.py index 78559617..127cab8b 100644 --- a/plugins/axiomcode/skills/axiomcode/scripts/ax_blocks.py +++ b/plugins/axiomcode/skills/axiomcode/scripts/ax_blocks.py @@ -20,6 +20,8 @@ CAP = 10 # places shown; the rest are counted FAR = 8 # places more than one hop away, named without code +DIRECT_CODE = 3 # direct callers shown with code even when a word grep also finds them +PLAIN_WHY = ('calls it', 'reads it', 'writes it', 'writes/reads it', 'references it', 'instantiates it') WHOLE = 14 # a function this short is shown whole AROUND = 3 # else: its header, then this many lines either side of the line that matters FENCE = {'.py': 'python', '.java': 'java', '.ts': 'typescript', '.tsx': 'tsx', '.js': 'javascript', '.jsx': 'jsx', @@ -107,10 +109,27 @@ def render(verb, doc, repo): plain = [] names = target_names(doc) if verb == 'impact' and os.environ.get('AXIOMCODE_GREP_AID', '1').lower() not in ('0', 'off', 'false') else [] if names: - spelled = lambda p: all(any(re.search(r'(? 8 else '')) other = grep_others(repo, names, {(p['f'], n) for p in plain for n in p['marks']}) if other: out.append(f" {other} other line(s) grep matches for that name are NOT this declaration (another symbol of the same name, or text)") diff --git a/tests/front_door.py b/tests/front_door.py index 58ff997a..c175b99b 100644 --- a/tests/front_door.py +++ b/tests/front_door.py @@ -99,8 +99,8 @@ def main(): rc, out, err = cli(repo, 'find', 'how is the invoice total computed') check('find: numbered places, each with its code in a fenced block', rc == 0 and places(out) and 'def invoice' in out, out[:600] + err[-300:]) rc, out, err = cli(repo, 'impact', 'vat_rate') - check('impact : its caller, which spells the name, by location on the grep line (no code)', rc == 0 and 'grep -nw vat_rate' in out and 'shop/pricing.py:6' in out - and 'return net * (1 + vat_rate())' not in out, out[:600] + err[-300:]) + check('impact : its direct caller as a numbered place with its code', rc == 0 and places(out) and 'shop/pricing.py:6' in out + and 'return net * (1 + vat_rate())' in out, out[:600] + err[-300:]) check('impact : the test that reaches it is one of the places', 'tests/test_pricing.py' in out, out[:800]) rc, out, err = cli(repo, 'path', 'invoice', 'vat_rate') check('path: every hop a numbered place with the code at the call', rc == 0 and places(out) @@ -111,7 +111,7 @@ def main(): first = out.lstrip().split('\n', 1)[0] check('impact with no name: the answer starts with "your edits:" and names the edited declaration', rc == 0 and first.startswith('your edits:') and 'vat_rate' in first, out[:600] + err[-300:]) - check('impact with no name: then what the edit reaches, its grep-visible caller by location', 'shop/pricing.py:6' in out, out[:600]) + check('impact with no name: then what the edit reaches, as places with their code', places(out) and 'shop/pricing.py:6' in out, out[:600]) rc, out, err = cli(repo, 'tests') last = [l for l in out.splitlines() if l.strip()][-1:] or [''] check('tests: the reached test as a numbered place with its code', rc == 0 and places(out) and 'tests/test_pricing.py' in out, out[:600] + err[-300:]) @@ -124,7 +124,7 @@ def main(): check('MCP: every tool takes at most two parameters', bool(tools) and all(len(p) <= 2 for p in tools.values()), tools) text = lambda i: ''.join(c.get('text', '') for c in got.get(i, {}).get('content', [])) check('MCP path answers as numbered places with their code', places(text(3)), text(3)[:600]) - check('MCP impact names the caller grep also finds, by location', 'shop/pricing.py:6' in text(4) and 'grep -nw vat_rate' in text(4), text(4)[:600]) + check('MCP impact answers as numbered places with their code', places(text(4)) and 'shop/pricing.py:6' in text(4), text(4)[:600]) # ── c. controls: the same question anywhere else gets the verb's own answer ────────────────────────────────── r = subprocess.run(['bash', AX, 'impact', 'vat_rate', repo], cwd=repo, capture_output=True, text=True, timeout=600, env=ENV)