Repository navigation
code.impact, code.edit_context and code.coverage_claim name the tests the test gate links, and a module's own test file leads the examples - #1725
Merged
Conversation
… the test gate links, and a module's own test file leads the examples Each op had its own legs, so they disagreed about one definition: `impacted_tests` read only the test map, which no measured index holds; the coverage claim walked `calls` edges its own way and found a Python test only beside its source; the edit context cut its 50 example candidates in path order before ranking them. - `link_tests` and `build_gate` are the one builder. `impacted_tests` holds the gate's rows for the same change. A definition with no test call site carries the first three rows as `tests` and a `test_link_state`. The coverage claim's call-chain leg lists the links a call or a fixture use makes, in the links' order. - `mirror_test_paths` finds the test modules named after a Python module among the index's test paths, wherever the repository keeps them. Their call sites are read into the example cut first and ranked first, and they join the conventional sibling paths as the coverage claim's sibling files. - The plugin's blast line counts a test as reaching the change only when its row is about the touched definitions. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 3 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit e6153fb. Configure here.
…eep their rank Review fixes for the shared test links. - The walk records, per node, the shortest chain of `calls` and `fixture_use` edges that links it to a touched definition and what that chain ends at. The coverage claim lists those nodes only: a test that calls an override of the subject is not evidence, and a test an override reached first is listed by the chain of calls a later hop finds. - A test that calls only the function a nested function is defined in is weak evidence (`calls_edge_2`, `short_name_grep`): it cannot make `covered_by` or pass the control. A test that builds the class of a constructor stays exact. Every call-chain row says what its chain ends at. - Test examples are ranked by the key they had. The test modules named after the definition's module are still read into the candidate cut first. - `code.impact` walks its test links at the gate's default depth whatever depth the radius is asked at, so `impacted_tests` is the gate's answer. - A directory that holds a module names no test after it, and a mirror row of the claim says which rule matched. - The bounded numbers this change names say why they are not settings, and the list of older ones drops the three that are gone. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
6 of 10 tasks
Merges main up to the commit the branch's two changes were last checked on. The two plugin manifests conflicted on the version line; both keep the branch's bump, one above main's version. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
….2.84 Main's manifests moved to 1.2.83, so the branch's plugin change takes the next free version. The Rust wire models are regenerated from the merged registry. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
…e is named after no module A diff that also edits a test file seeded the test links of code.impact with that file's functions, so impacted_tests listed the tests that call a changed test helper and code.test_gate did not. The diff shape now hands the links the definitions of source files only; the radius is still seeded by every touched function. A Python file under testdata/, fixtures/, __fixtures__/ or __snapshots__/ matched the mirror rule by its name or its directory and could lead the test modules named after a source module. The rule now names no payload file after a module, as is_test_unit_path already reads those trees. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Related: #1707
Changelog category (leave one):
Changelog entry (one or two sentences a user of Loom can read without the diff; the release pull request collects these into the release notes):
code.impactimpacted_testsholds the test filescode.test_gatelists for the same change, each with itswhy, where it held test-map rows only;code.edit_contextreturnstestsandtest_link_statefor a definition with no test call site to show;code.coverage_claimreads the same call-chain links and, for Python, the test modules named after the source module. Test examples come first from the test module named after the definition's module.Why
Four ops answered "which tests go with this definition" from four different reads, so they disagreed about one definition and three of them were often empty. Measured on Python repositories at the revision the index holds, against two kinds of ground truth: changes with a known fix and the tests that fix makes pass, and repositories whose own suite ran with per-test coverage.
code.impact.impacted_testscame from the test map alone. No measured index holds one, so the list was empty for every definition asked.code.coverage_claim. Its call leg walkedcallsedges its own way: no constructor credit, a second hop only when the first found fewer than three tests, rows in path order. Its sibling leg looks for a Python test beside the source or under asrc/-mirroringtests/tree. That finds the test module of 4 of 461 source modules that have one in the six development repositories, which keep tests in a top-level tree, and of 707 of 902 in the six held-out ones, four of which keep tests beside the package.code.edit_context. 59% of edited definitions got no test example and nothing that said why. The 50 example candidates were cut in(tier, confidence, path, line)order before ranking, so the alphabetically first test paths filled the cut.What changes:
link_testsandbuild_gate, whichcode.test_gatealready uses, feed the other three ops.impacted_testsis the gate'stestsfor the same change. A definition with no test call site carries the gate's first three rows astestsand its status astest_link_state. The coverage claim's call leg lists the test files a call or fixture-use chain reaches, in the gate's order.mirror_test_pathsreads the index's own test paths and returns the Python test modules named after a source module, wherever the repository keeps them: a file a test affix names after it (test_app.py,app_test.py), then a directory named after it, then a file with the bare name. Their call sites are read into the example cut first and ranked first. They join the conventional sibling paths as the coverage claim's sibling files.Decisions taken on the development repositories, each by a rule stated before its run:
code.test_gateis unchanged.overridesandinherits. With those, one of 23 definitions no test executes moved fromunknowntocovered_by(two test classes override it). The claim's leg keeps the links acallsorfixture_useedge makes: 0 of 23, and 17 of 199 executed definitions move tocovered_by.test_unittest.pyas a test ofunit. Reading one affix finds the test file that the fix makes pass first for 14 of 79 definitions against 10.tests/<app>/models.py) is support code more often than a test. Ranked last, the five listed files hold a module's owntest_<stem>.pyfor 355 of 358 modules of the largest development repository against 322.One decision came from the held-out file layouts, after the held-out answers were read:
Results. Development figures were used to design the change; held-out figures were read once, at a frozen commit.
code.impactimpacted_tests, names nothingcode.edit_contextexamples, names nothingcode.edit_contextexamples ortests, names nothingcode.coverage_claim, names nothingcode.impactimpacted_tests, firstcode.edit_contextexamples ortests, firstcode.coverage_claim, firstcode.coverage_claimverdictcovered_by, executed definitionscovered_by, definitions no test executescode.coverage_claimhas a call-chain row exactly whencode.impacthas one for 79 of 79 development and 31 of 31 held-out definitions (47 and 17 before). Of the definitionscode.edit_contextcallsunlinked, neither op has a call-chain row for any.What got worse:
impacted_testsnames a test file for 17 of 23 such development definitions and 20 of 20 held-out (0 before); 4 and 8 of those have a row about the definition (static_call), the rest arefile_neighborrows.code.coverage_claimnames one for 19 of 23 and 20 of 20 (1 and 2 before), aspath_conventionrows that change no verdict.test_link_stateisunlinkedfor 66 of 100 executed held-out definitions andlinkedfor 7 of 20 unexecuted ones: it says what the index holds, not whether a test runs the code, and the field's description says so.Scope and risk
code.impact,code.edit_context,code.coverage_claim, the example read ofcode.symbolwithtest_examples_only, and one line of the plugins' blast-radius text.code.test_gate's answers (the handler now calls the shared helpers; its rows are the same on every measured change),code.callers, what the index stores, the test map and its worker. No migration, no setting, no re-index.code.impact12.3 to 17.2,code.edit_context25.7 to 30.4,code.coverage_claim10.1 to 13.5.code.impactwalks the callers twice, once for its radius and once for the links, because the two walks differ in seeds and overlay; that is left for a follow-up. The mirror read is one key-range read ofloom.code_filesper request.testsblock is read after the examples come back empty, inside its owncode_enrich_timeout_s. The measurement ran with a 30 s deadline on a loaded machine; how many blocks the default 0.5 s drops on an unloaded server is not measured.models.py,base.pyorutils.pymany test files carry the name and five are listed.code.test_gatelists the calleeunlinkedalthough alone it is linked through the caller (2 of 77 development definitions): the walk skips an edge between two touched definitions.Compatibility, rollout and rollback
code.impact.impacted_testsrows arecode.test_gatetestsrows:{test_path, why, evidence, run, run_unknown}pluslinks_to,hop,callers,via,confidence,src_pathorcalleesbywhy. A test-map row keepssrc_pathandconfidenceand gainswhy: "test_map"; rows of other kinds carry nosrc_path. At most 30 rows.blast_radius_scorestill counts test-map rows.code.edit_context. A definition with no test call site gainstests(at most three{test_path, why, evidence, hop, run}) andtest_link_state(executed,unexecuted,linked,unlinked). Both are absent whenexamplesis non-empty.code.coverage_claim.calls_edgeandcalls_edge_2rows read<test> reaches it in N hop(s); equal tier and confidence keep the links' order instead of path order; Pythonsibling_filerows readnamed after <source path>.impacted_testsrows other thanfile_neighborandstem_partneras "tests reaching it". A plugin of the previous release against this server counts every row there.Tests
first_pathsandtest_paths_namedstatements,link_state, the symbol-shaped links against the gate's answer for the same definition,impacted_testsagainst the gate's rows, thetestsblock, and the coverage claim's legs. Six fakes ofcode.impacttests gained the two reads the links make.test_impacted_tests_follow_the_read_order_on_a_tiebecametest_impacted_tests_are_in_a_total_order_on_a_tie: the order is the gate's, which is total.test_depth_two_is_skipped_when_the_first_hop_has_enoughis replaced, since the claim reads both hops as the gate does.main.ruff format --check,ruff check, the mypy gate, the function-length gate and every generator--checkpass.tests/analyzer/shapes.txtgains two shapes; both statements ran against a real index.AI assistance in the code (leave one; writing this description with AI is fine):
AI-generated (an agent wrote most of the diff): Claude Code. The measurements above were run and read by the agent; no human has reviewed the diff yet.
I can explain every line of this diff and how it interacts with the rest of Loom.
Checklist
make test-unitand applicable integration results are reported by CI; a full local run is not required before pushing.docs/reference/configuration.mdand thedocs/reference/tables (python scripts/codegen/docs_reference.py), the reach manifest,schemas/schema.sql(make schema-dump) and the Codex plugin copies (python3 scripts/codegen/agent_plugin_sync.py).main; no merged migration is edited.hooks/,lib/,bin/,skills/,.mcp.json, the Codexplugin-defaults.json) bumps both plugin manifests' version, and no other open PR uses that version.npm --prefix frontend run build) and its tests pass, iffrontend/changed.docs/describe the system as it now is, and this description names any operator steps and wire changes.tests/unit/test_public_copy.py).git commit -s), as CONTRIBUTING.md asks.🤖 Generated with Claude Code
Note
Medium Risk
Changes response shapes and test-identification logic for several public code-intelligence ops; behavior shifts for API consumers but leaves indexing, test_gate row rules, and storage unchanged per scope notes.
Overview
Unifies how Loom names tests across
code.impact,code.edit_context,code.coverage_claim, andcode.test_gateby routing them through shared helpers intest_links.py(link_tests,gate_of,definition_links).code.impactimpacted_testsis now the same orderedtestsrowscode.test_gatewould return (withwhy, evidence, hop, run, etc.), not bare test-map{test_path, src_path, confidence}rows.The reverse call-graph walk tracks call chains (
call_hop,call_viafor constructor/fixture/enclosing) and usescalls/fixture_useonly for coverage-claim call evidence (override/inherit edges no longer imply execution).Python test discovery adds mirror naming (
mirror_stem,mirror_test_paths,test_paths_named) so tests named after a module are found beyond sibling paths; example enrichment prioritizes those modules viafirst_pathson edge reads. Edit context addstests+test_link_statewhen there are no test call-site examples.Claude/Codex blast-radius rendering excludes
file_neighbor/stem_partnerfrom “tests reaching it.” Docs, MCP descriptions, SDK types, and plugin version 1.2.84 follow the new wire shapes.Reviewed by Cursor Bugbot for commit 34dc256. Bugbot is set up for automated code reviews on this repo. Configure here.