Repository navigation
Conversation
…est files it leaves out The tests section's first row, kind run_first, holds the first five tests code.test_gate lists for the PR's diff, in the gate's order (must_run first), one per test: rows that share a run command, or a command-less file beside a same-named one, are one test. Each carries why, evidence, run and must_run; left_out and must_run_left_out count the test files under none of them. The row is advice no verdict rests on. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: zlareb1 <lareb.zafar@clickhouse.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: zlareb1 <lareb.zafar@clickhouse.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
…and is one test code.test_gate reads a diff's old side as the revision the index holds, so a merged PR's brief sends it the reversed diff, as it sends code.impact. A row joins the test of its run command before a test of its name. A section of the tests to run first alone stays lower_bound. left_out is documented as a lower bound. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: zlareb1 <lareb.zafar@clickhouse.com>
…ins its script's test wherever it stands Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: zlareb1 <lareb.zafar@clickhouse.com>
…change, and its docs say what code.test_gate lists Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: zlareb1 <lareb.zafar@clickhouse.com>
… full, and every cut is tested GATE_ROWS sits beside the brief's other caps of the op inputs it mirrors. A gate that lists no test holds none, so the row needs no cut-leads arm. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: zlareb1 <lareb.zafar@clickhouse.com>
…ated cause Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: zlareb1 <lareb.zafar@clickhouse.com>
…the count of cut leads when the gate names none Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: zlareb1 <lareb.zafar@clickhouse.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
❌ 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 8e5aa7a. Configure here.
… counts the tests left when every row it read is deleted Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: zlareb1 <lareb.zafar@clickhouse.com>
…g more rows than it returned does not Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: zlareb1 <lareb.zafar@clickhouse.com>
… row cut Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: zlareb1 <lareb.zafar@clickhouse.com>
…prefixes, and the MCP text names a failed drift read Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: zlareb1 <lareb.zafar@clickhouse.com>
…s written Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: zlareb1 <lareb.zafar@clickhouse.com>
…d the docs name run_unknown and where the gate reads its links Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: zlareb1 <lareb.zafar@clickhouse.com>
…ke takes its rows ahead by name Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: zlareb1 <lareb.zafar@clickhouse.com>
…docs say a brief with no run_first row names none Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: zlareb1 <lareb.zafar@clickhouse.com>
…ys why the PR's own diff is read Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: zlareb1 <lareb.zafar@clickhouse.com>
…f's diff cap names the gate's Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: zlareb1 <lareb.zafar@clickhouse.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: zlareb1 <lareb.zafar@clickhouse.com>
… the diff's headers alone, and a test pins the omitted row Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: zlareb1 <lareb.zafar@clickhouse.com>
…its run_first row cut, and a test pins the brief's caps to both reads' inputs Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: zlareb1 <lareb.zafar@clickhouse.com>
…he docs and MCP text say a brief with no diff may list a deleted test Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: zlareb1 <lareb.zafar@clickhouse.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: zlareb1 <lareb.zafar@clickhouse.com>
… no diff Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: zlareb1 <lareb.zafar@clickhouse.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: zlareb1 <lareb.zafar@clickhouse.com>
Signed-off-by: zlareb1 <lareb.zafar@clickhouse.com> # Conflicts: # docs/features/code-index/history-and-prs.md
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: zlareb1 <lareb.zafar@clickhouse.com>
…gate's diff lacks its hunks Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: zlareb1 <lareb.zafar@clickhouse.com>
This branch has not been deployed
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: #2040
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):
A review brief's
testssection now starts with arun_firstrow: at most five tests to run first, incode.test_gate's order, each with the reason it is listed, and counts of the test files it leaves out. The full list stays incode.test_gate.Why
A reviewer that reads the brief and then
code.test_gategets a long list of test files to run. On unsettled PRs that list drove the cost: in one A/B review of a large C++ repository, the PR with the longest list cost 45% more with Loom and ran three times as many test queries. The reviewer asked for a short ranked list (three to five tests), strongest evidence first, with a reason for each.code.test_gatealready orders its rows by evidence and puts everymust_runrow first. The brief now calls it in-process and keeps the head of that list:why,evidenceandmust_runfor its first file, plus, for a test of several files, the first five intest_pathsand their count intest_paths_total.left_outcounts the gate's test files under none of the five, andmust_run_left_outthe ones of those that saymust_run. A file past those rows and a lead the gate cut are counted whatever their run command, and the gate's count of cut leads is a lower bound. The row sayscut: truewhen the gate did not read the whole change, or read a changed source file on another revision: a changed file is missing from the gate'schanged_files(one past the first 50 it is sent whose hunks the diff it reads does not carry, or one past the 200 changed paths it reads), the diff is longer than 200,000 characters, the gate's causes saytruncated(its call-graph walk or coverage read was cut), or a changed source file is drifted (the index holds it at another revision than the diff's old side, so its lines may map onto other definitions) or the drift read failed, or the brief was built with no diff (from its changed paths alone), when its list may name a file the PR deletes. A test a coverage run, a call chain or the named test file ties to the change is never dropped without being counted, unless the row sayscut: then the gate itself did not read it, or read a changed source file on another revision. The gate reads test links at the revision the index holds, as the claim rows do, so the brief of a merged PR built after the index moved past it can name a test added since.The ranking is the gate's, so it is deterministic (the path breaks ties) and each entry can be traced to a gate row. The row is advice: no verdict or decision reads it. If the gate read raises, the brief is served unstored and the verdict does not change. If the request is refused, or the gate lists and counts no test, the row is left out. A gate that names no test, or only deleted ones, but counts other tests or the leads it cut gives a row with no tests and that count. A test file the PR deletes or renames away is no test to run: its row among those the brief reads is neither listed nor counted.
Assumptions about the repository, and why each one is general:
must_runflags: these come from index facts (diff, call graph, coverage runs, test map) for every graphed language.LOOM_CODE_TEST_GATE_RUN_TEMPLATES. With no recipe a test saysrun_unknown, and its files join by directory and name.Scope and risk
Touches the brief's
testssection (one new row, first, so a token budget trims it last), the brief's in-process op table (code.test_gate), pure functions intest_gate.py(run_firstand the grouping it uses, with the constantsRUN_FIRSTand_PATHS_SHOWN),GATE_ROWSbeside the brief's other op-input caps, the brief's file cap renamed fromIMPACT_SEED_FILEStoSEED_FILESbecause both reads share it, anddeleted_paths, a diff parser besidewhole_filesinreview_brief.py. The section's verdict, epistemic and causes are unchanged: they still read only the claim rows, and a section that holds only therun_firstrow stayslower_bound. The gate reads a merged PR's reversed diff, the same diffcode.impactreads, because it reads a diff's old side as the revision the index holds. Each brief build now also runs onecode.test_gateread (a second hop walk besidecode.impact's, bounded by the gate's own read limits). On 12 of the C++ PRs below, each brief built twice in alternating order with and without that read: medianbuild_ms2,466 with it against 2,176 without, largest 7,178 against 5,587.Out of scope: the gate's own rows (stem-partner rows are still listed uncut) and the claim rows' tests. The gate's read of the definitions in the changed files is capped per batch of files, the smallest definitions cut first, and it names that cut in none of its causes, so it is no
cutcause here; that stays a gate limit.Compatibility, rollout and rollback
testssection's rows gain one row kind,run_first. Rows are free-form dicts and readers that do not know a kind ignore it, as they already ignorehome.gapsorunsettledwithbrief:v3, and has norun_firstrow.run_firstrow; its verdict reads only the claim rows, as before.Tests
Unit:
run_firstgrouping, ordering, cut and counts on a made-up repository. That covers a script with its expected output, one Go package with two files, two tests of one name with different commands kept apart, a missing run command, a command-less file joining its script's test wherever it stands, and rows past the gate's limit counted. Also the brief's assembledtestssection, with the merged PR's reversed diff sent to the gate; a section of therun_firstrow alone (lower_bound, no verdict) with an open PR's diff sent as written; and a gate read that raised or was refused (advice: unstored, verdict unchanged), next to the test home. Deleted test files, with a+++ /dev/nullside, only adeleted file modeline or arename fromline, are neither listed nor counted, and a gate whose rows are all deleted files still gives a row that counts its other tests. Eachcutcause and the non-cause (tests_capped), a drifted source file or failed drift read through a whole build (a drifted file of no source kind is no cause), a merged PR's deleted tests read off its own diff (the reversed diff the gate reads shows a deletion with nodeleted file modeline as a change), dotfiles of one directory kept as two tests, a token budget that trims therun_firstrow last, and the brief's file, diff and row caps pinned toCodeImpactInput's andCodeTestGateInput's own.Ran:
pytest tests/unit/test_code_review_brief_sections.py tests/unit/test_code_test_gate.py tests/unit/test_code_review_brief_no_groups.py tests/unit/test_review_brief_rationale.py tests/unit/test_public_copy.py tests/unit/test_ratchet_gates.py tests/unit/test_package_contracts.py tests/unit/test_mcp_listing_budget.py(490 passed);make format-check,ruff checkandpython scripts/codegen/docs_reference.py --checkare clean;mypyon the changed modules reports no error in them (its 7 errors are in three files this PR does not touch).Measurement: this branch's code in-process against the code index, with trace writes stubbed. For each PR a script calls
handle_code_test_gate(limit 200) on the PR's diff and builds the brief withreview_brief_build.build_for_merge(..., store=False)for a merged PR orbuild_briefwithopen=Truefor the open one. A merged PR's diff is reversed for the gate, because the index holds the merge commit. "Before" is what a reviewer had: the gate's list and the brief's claim tests and test-home candidates. "After" is therun_firstrow. The core of the script, run with the server's environment for the index andPYTHONPATHat this checkout (python measure.py <PR,PR,...> out.json <mirror> <org> <namespace>):measure.py (core)
The full script also finds a merge commit by a
Merge pull request #Nsubject, stubs the trace writes (schedule_code_trace) and drops deleted test files before the directrun_firstcall, as the brief does; none of these PRs deletes one.build_mscomes from the brief payload of a run with and without the gate read.A large C++ repository, 24 merged PRs and one open PR (row 1 is the cost outlier the request names; row 2 is the open PR, its diff against its merge base):
A Python and TypeScript repository, 20 merged PRs:
None of these PRs deletes a test file.
cutisyeson 25 of the 44 merged PRs: their list and counts are of what the gate read. On 9 the gate's own causes saytruncated(its call-graph walk reached its read cap), on 3 the diff is longer than 200,000 characters, and on the other 13 a changed source file is drifted: the index has moved past the merge, so it holds the file at another revision than the diff's old side. A drifted file of no source kind (a document, a configuration file) does not setcut. The open PR's row was built from its diff alone, with no drift read. Every row agrees: the brief'srun_firstequalsrun_firstapplied to thecode.test_gateanswer for the same diff (a merged PR's reversed, an open PR's as written). Eachmust_runtest the gate lists is either among the five or counted inmust_run_left_out.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 on this branch, and each counted case was checked against the gate's rows.
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), the Codex plugin copies (python3 scripts/codegen/agent_plugin_sync.py) and the standalone skill bundles (python3 scripts/codegen/standalone_skills.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 review-brief build path (extra test_gate call per build, payload v4) and stored brief shape; verdict logic is unchanged but rebuild/rollout behavior matters for operators.
Overview
Review briefs now lead the
testssection with arun_firstrow: up to five prioritized tests from an in-processcode.test_gatecall (gate order, shared run commands grouped,must_runfirst), plusleft_out/must_run_left_outand optionalcut: truewhen the gate read was partial.run_first/_test_groupsintest_gate.py,deleted_pathsto drop PR-deleted test files, andSEED_FILES/GATE_ROWScaps replaceIMPACT_SEED_FILES.Payload version 4 invalidates stored v3 briefs on rebuild.
code.test_gateis treated likecode.test_homeas advice: gate/home failures do not change section verdicts; a raised gate read still blocks storing the brief. Docs, API comments, and MCP descriptions document the new row.Reviewed by Cursor Bugbot for commit 1f888d1. Bugbot is set up for automated code reviews on this repo. Configure here.