Repository navigation
Commit 0d2ce06
The test gate touches only the edited definitions and labels every test with its evidence (#1707)
* The test gate touches only the edited definitions and labels every test with its evidence
code.test_gate picked its seeds from hunk-header names and new-side hunk spans,
read no classes, and listed a touched definition as `untested` whenever the
static graph held no test edge to it. Against SWE-bench Verified gold patches
and per-test coverage that list flagged tested and untested code alike.
- The touched definitions are the innermost function or class holding a
changed old-side line (the revision the index holds). A hunk sent without
its lines changes what its header's old range says, so the hooks' zero-context
headers read the same. A header name is used only for a definition the index
holds no body extent for. code.impact's diff shape shares the rule.
- A class's callers credit its `__init__` and `__new__`, and the callers of a
function credit the functions nested in it.
- Each test row says its kind of evidence in `why`: `changed_test`, `coverage`,
`static_call`, `file_neighbor` (new: the test files calling other definitions
of the edited files, one grouped read), `test_map`. `graph_hop` and
`stem_partner` are gone.
- `untested` holds only definitions a verified coverage run measured
unexecuted. `unlinked` holds the ones no run measured and no call chain links
a test to; a file-level row never clears it, and it is no obligation.
- `epistemic` is `measured` or `lower_bound`, never `exact`.
- The plugins say "the index links no test to" for `unlinked`, "measured
unexecuted at <commit>" for `untested`, ask for a test only for the latter,
and ask for file neighbours only up to four tests in all.
Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
* A hunk shorter than its header counts ends at the next file header
A diff whose hunk carries fewer lines than its counts, followed by another
file's `---`/`+++` header, read that header as a removed and an added line and
lost the file. The header is now recognised when a hunk header follows it, or
when the hunk has no line yet.
The operations guide lists the evidence kinds instead of adding a table, so
the cell positions of the page's other tables stay where its translations
expect them.
Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
* File neighbours fill a short test-gate list, and a coverage run is read against a definition's body
The gate listed up to `limit` file neighbours ahead of the test map, so thirty
neighbour files pushed every map row off a default page, and a plugin of the
previous release took each of them for a test to run. Neighbours say nothing
about a touched definition: the server lists them only while the other kinds
leave fewer than four rows. `stem_partner` is a kind again, and a test file a
call chain links keeps that row ahead of a file-level map row, because a test
file is listed once and the call-chain row names the test and the definition.
On an index with an imported coverage run, rows in a covering test's file are
97% for `coverage`, 91% for `static_call`, 53% for `stem_partner` and 31% for
`test_map`.
A coverage run is read against every tier row's extent of a definition that is
wider than one line. A compiler row may be the declaration line only; testing
that line marked a function whose body ran as unexecuted under
`epistemic: measured`. A definition with no wider extent is not measured.
Text added directly above a definition touches it only when the added lines
are all decorators, which needs the diff's lines; a new function added there
is a change no definition answers for. In Python, lines appended as deep as
the line above continue the definition that line ends.
A file's removed ranges are merged before one walk, so the cost of a
headers-only diff follows the file's extent and not what its hunk headers
claim.
`measured` also needs every changed source file to touch a definition, and
`causes` keeps the call graph's causes under either answer.
The hop-only `confidence` of a `static_call` row is gone: it came from two
repositories and ignored the edge's own tier. A neighbour's `callees` counts a
definition both tiers hold once.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
* A hunk header names the nearest same-named definition above it, found by bisection
The fallback for a hunk whose lines sit in no definition walked every row of
the file for each hunk. Rows are grouped by bare name in line order, so a
headers-only diff of thousands of hunks costs a bisection each.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
* The test gate reads a coverage run against a definition's body lines, keeps same-named definitions apart and orders coverage rows by call chain and specificity
- A coverage run is read against the lines after the first of every extent a
tier holds of a definition at the run's commit. The first line is the
declaration, which runs when the module is imported, under whichever test
imports it first. The extents are matched by id in the read that carries
their parsing commit, so tiers parsed at different commits are measured on
the extent the run's commit holds.
- Touched rows are no longer folded by qualified name. The store already
folds the two tiers' rows of one definition where their spans coincide; rows
that share a name and sit apart (a property's getter and setter) are
different definitions, touched and measured apart.
- A `coverage` row carries the specificity of its test-map row as
`confidence`, and the test name, `hop`, `callers` and `via` of a call chain
that links the file too. Within a kind a chain-linked file is first, then
the more specific row.
- `truncated` is also a cause when the read of the coverage rows was cut.
- The wire comment, the feature page and the skill reference say that a
`static_call` test is linked by a call chain and usually, not always, runs
the definition, and that a change of test files only is `lower_bound` with
no cause.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
* A run added below a definition's last line and indented less than it is documented as not placed
The index holds no column for a definition. Where a class and its last method
end on one line, text added below that line and indented less than it may be
the method's (a statement after its last nested block) or the class's (a new
method), and the two indents the diff shows cannot tell which. The run touches
neither and counts in unmapped_changes, so the answer is lower_bound. The
operations page and the docstring say so, and a test holds the three cases.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
---------
Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com>1 parent ddebfd6 commit 0d2ce06
42 files changed
Lines changed: 5646 additions & 4023 deletions
File tree
- docs
- features/code-index
- reference
- operations
- integrations
- claude-code-plugin
- .claude-plugin
- hooks
- lib
- skills/loom-code
- tests
- codex-plugin
- .codex-plugin
- hooks
- lib
- skills/loom-code
- sdk
- python/loom
- ruby/lib/clickhouse/loom/generated
- rust
- src
- tests
- typescript/src/generated
- server
- cli
- code
- api
- app
- symbol
- domain/index
- store/index
- transport
- tests
- analyzer
- cases
- unit
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
403 | 403 | | |
404 | 404 | | |
405 | 405 | | |
406 | | - | |
| 406 | + | |
407 | 407 | | |
408 | 408 | | |
409 | 409 | | |
| |||
436 | 436 | | |
437 | 437 | | |
438 | 438 | | |
439 | | - | |
| 439 | + | |
440 | 440 | | |
441 | 441 | | |
442 | 442 | | |
| |||
459 | 459 | | |
460 | 460 | | |
461 | 461 | | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
462 | 535 | | |
463 | 536 | | |
464 | 537 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
234 | 234 | | |
235 | 235 | | |
236 | 236 | | |
237 | | - | |
| 237 | + | |
238 | 238 | | |
239 | 239 | | |
240 | 240 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
873 | 873 | | |
874 | 874 | | |
875 | 875 | | |
876 | | - | |
877 | | - | |
| 876 | + | |
| 877 | + | |
878 | 878 | | |
879 | 879 | | |
880 | 880 | | |
| |||
889 | 889 | | |
890 | 890 | | |
891 | 891 | | |
892 | | - | |
| 892 | + | |
893 | 893 | | |
894 | 894 | | |
895 | 895 | | |
| |||
1720 | 1720 | | |
1721 | 1721 | | |
1722 | 1722 | | |
1723 | | - | |
| 1723 | + | |
1724 | 1724 | | |
1725 | 1725 | | |
1726 | 1726 | | |
| |||
1732 | 1732 | | |
1733 | 1733 | | |
1734 | 1734 | | |
1735 | | - | |
| 1735 | + | |
1736 | 1736 | | |
1737 | | - | |
| 1737 | + | |
1738 | 1738 | | |
1739 | 1739 | | |
1740 | 1740 | | |
1741 | | - | |
1742 | | - | |
| 1741 | + | |
| 1742 | + | |
| 1743 | + | |
1743 | 1744 | | |
1744 | | - | |
1745 | | - | |
| 1745 | + | |
| 1746 | + | |
1746 | 1747 | | |
1747 | 1748 | | |
| 1749 | + | |
1748 | 1750 | | |
1749 | 1751 | | |
1750 | | - | |
1751 | | - | |
1752 | | - | |
| 1752 | + | |
| 1753 | + | |
| 1754 | + | |
| 1755 | + | |
1753 | 1756 | | |
1754 | 1757 | | |
1755 | 1758 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
| 4 | + | |
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| |||
0 commit comments