Repository navigation
A compiler tier the tree calls for runs beside the producers an entry names - #2128
VanshajPoonia wants to merge 25 commits into
Conversation
… names Signed-off-by: Vanshaj Poonia <vanshajtheunique@gmail.com>
Signed-off-by: Vanshaj Poonia <vanshajtheunique@gmail.com>
Signed-off-by: Vanshaj Poonia <vanshajtheunique@gmail.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
zlareb1
left a comment
There was a problem hiding this comment.
Two focused probes confirmed that an excluded tier can still block commit coverage and that an explicitly excluded Python tier can still run through the manual upload path.
Signed-off-by: Vanshaj Poonia <vanshajtheunique@gmail.com>
Signed-off-by: Vanshaj Poonia <vanshajtheunique@gmail.com>
Signed-off-by: Vanshaj Poonia <vanshajtheunique@gmail.com>
Signed-off-by: Vanshaj Poonia <vanshajtheunique@gmail.com>
…d-compiler-tiers The Go and Rust wire models are main's copies with every generator rerun on the merged tree. Signed-off-by: Vanshaj Poonia <vanshajtheunique@gmail.com>
|
Thank you for the probes. All three are fixed, each with a test that fails on 6daaf55. The crossref pass had the same ownership read as the third, so it gets its own commit too.
Main is merged in 68685c1. The Go and Rust wire models were the only conflicts, so they are main's copies with every generator rerun. Checked locally after the merge: ruff, the mypy gate, the function length gate, every generator |
zlareb1
left a comment
There was a problem hiding this comment.
A compiler tier that stops matching the tree can leave commit coverage waiting on a watermark that can no longer advance.
| tiers = compiler_tiers(cfg.scip_producer, state, lags) | ||
| # The entry's own tier is the headline; every tier with a watermark is listed but | ||
| # one the entry drops. An entry naming no producer defers to whichever is set. | ||
| tiers = compiler_tiers(cfg.scip_producer, state, lags, dropped(cfg)) |
There was a problem hiding this comment.
P2 — This filters explicit exclusions but still requires a tier whose build marker disappeared. If a clang entry auto-detects Go at A and commit B removes its last go.mod, the Go worker stops while this status and the coverage watch still wait on Go's watermark at A. Use the current tier selection for readiness and test a detected tier losing its last marker.
There was a problem hiding this comment.
Thank you for the go.mod case. Fixed in 0fada47 and 1897c48. compiler_tiers now takes the tiers the entry runs, and every caller passes runnable_producers(cfg, tree) over the tree as indexed now. That is the rule worker_owns applies, so the status, commit_coverage and the coverage watch drop a tier on the same pass its worker stops. The status reads the tree once and shares it with compiler_candidates and compiler_tier_rules. The watch op reads it once per call and the notify pass once per namespace. A failed tree read keeps every tier the entry may run, so it never makes a commit ready early.
code.index_status with a commit served its tiers from the cached status, which can be an hour old on a quiet web process. 1897c48 rebuilds them from that call's state and tree, as the watch does. Without it the answer kept waiting on Go until the cache refreshed, and a tier whose go.mod came back was not waited on at all. 33b59f0 and 6dd8436 take scip_producer, scip_commit, scip_lag and scip_commit_py from that call too. a9db222 keeps each namespace's tree for LOOM_CODE_STATUS_TTL_S, so a poller reads it once per status TTL and not on every call.
Tests in test_code_status_ops.py:
test_a_tier_whose_last_build_file_went_holds_back_no_commitis your case: a clang entry with Go at A and no go.mod left at B. It also checks thatworker_ownsstops the Go worker for that tree. On 68685c1 the status answeredreadyfalse withwaiting_on['Go'].test_a_commit_is_judged_on_the_tiers_the_tree_calls_for_now_not_the_cached_oneskeeps one cached status while the go.mod goes and comes back. Before 1897c48 the second call still waited on Go.test_a_tree_the_status_cannot_read_keeps_every_tier_the_entry_may_runcovers the failed read.test_a_poller_reads_the_tree_once_per_status_ttlcounts one tree read for a status and three polls. There were four before a9db222.
test_a_tier_whose_last_build_file_went_holds_back_no_watch in test_code_coverage_watch.py waits on Go while the tree has a go.mod, then removes it and runs notify_once. On 68685c1 that pass delivered nothing.
The same rule covers a tier the entry stops naming in scip_producer or scip_extra_producers when the tree does not call for it either.
zlareb1
left a comment
There was a problem hiding this comment.
The isolation walk cannot build the worker approval and enrollment requests on the clean CI base or this merge. The same test passes with the existing fixture fix in an authenticated ClickHouse stack. Failed job · Fixture fix #2142.
The status and the coverage watch kept every tier with a watermark the entry did not exclude. When a clang entry's last go.mod went, the Go worker stopped at its old watermark and readiness waited on it for good. Both paths now take their tiers from runnable_producers over the tree as indexed now, the rule the workers use. A tree read that fails keeps every tier the entry may run, so it never makes a commit ready early. Signed-off-by: Vanshaj Poonia <vanshajtheunique@gmail.com>
The identity step answered "none" only for an entry naming no producer. A clang entry whose tree has no Python build file and that does not name python fell through to the manual path and moved scip_commit_py for a tier the workers and the status do not run. It now asks worker_owns for every entry, so the script, the workers and the status agree on the Python tier. An operator who wants that tier names it in scip_extra_producers. Signed-off-by: Vanshaj Poonia <vanshajtheunique@gmail.com>
The TypeScript, Go and Python workers said they run an entry whose scip_producer names their tier. They run every entry worker_owns gives them, which since this change includes a tier the tree calls for beside a named one. Signed-off-by: Vanshaj Poonia <vanshajtheunique@gmail.com>
code.index_status with a commit served its coverage from the cached status and refreshed only the heads and the watermarks of the tiers already in it. The cache can be an hour old on a quiet web process. A tier whose last go.mod went kept the commit waiting until the next refresh, and a tier that came back was not waited on at all. The commit branch now rebuilds the tiers from this call's state and the tree as indexed now, as the coverage watch does. A failed state read keeps the cached tiers as before. Signed-off-by: Vanshaj Poonia <vanshajtheunique@gmail.com>
The skip named the entry's scip_producer as the tier whose worker owns the entry. Since a tree's tiers run beside the named one, an entry is skipped because it does not run clang: not named, excluded, or no root CMakeLists.txt. For an entry that excludes clang no worker owns that tier, and for one naming no producer the message printed "inferred" as a tier. Signed-off-by: Vanshaj Poonia <vanshajtheunique@gmail.com>
It said a tier the tree starts calling for begins with no watermark and indexes in full. That holds only for a tier that never ran. One that ran before resumes from its old watermark, and a commit waits on it until it catches up. The guide also says a code.repo.add entry has no exclusion list, and the paragraph is wrapped like the rest of the page again. Signed-off-by: Vanshaj Poonia <vanshajtheunique@gmail.com>
…y may run Test only. The status and the coverage paths read a failed tree read as every tier the entry may run, so a commit never turns ready early on it. read_tree and runnable_producers each had a unit test, and this one runs the whole code.index_status call with the read failing. Signed-off-by: Vanshaj Poonia <vanshajtheunique@gmail.com>
…d-compiler-tiers The Go wire models are main's copy with every generator rerun on the merged tree. Signed-off-by: Vanshaj Poonia <vanshajtheunique@gmail.com>
A commit poll on code.index_status read the tree on every call, and in a repository with no root go.mod that read scans the namespace's file paths for one below the root. read_tree now keeps each namespace's answer for LOOM_CODE_STATUS_TTL_S, which the status, the coverage watch op and the notify pass share. A failed read is not kept. The compiler tier workers still read the tree on their own passes. Signed-off-by: Vanshaj Poonia <vanshajtheunique@gmail.com>
The commit branch of code.index_status rebuilt the tier cards but left scip_producer, scip_commit and scip_lag at the cached status's values, so an entry naming no producer whose Go tier stopped could answer Go as its primary next to a Python-only card list. Those fields now come from the rebuilt primary. A card also keeps its cached lag only while its watermark is the commit that lag was counted from, as published_lags does, so a moved watermark reads -1 instead of the old count. Signed-off-by: Vanshaj Poonia <vanshajtheunique@gmail.com>
The identity step asked worker_owns up to twice and kept dropped() for its excluded case, the helper's last caller. It now asks once: an entry that does not run the tier is excluded when its list names python, else none. A tier the entry names still runs even when it is also excluded, and the owner table gains that case. Signed-off-by: Vanshaj Poonia <vanshajtheunique@gmail.com>
Rewording which entries each worker runs left lines past 90 columns beside short ones. Text unchanged. Signed-off-by: Vanshaj Poonia <vanshajtheunique@gmail.com>
The commit branch refreshed the tier cards and the primary's fields but left scip_commit_py and scip_py_lag at the cached status's values, so a Python entry could answer a fresh Python card next to an older scip_commit_py. The field now comes from this call's state, and its lag reads -1 once the watermark has moved, as the cards' lags do. Signed-off-by: Vanshaj Poonia <vanshajtheunique@gmail.com>
Test only. read_tree keeps an empty answer, which a truthiness check would drop, so a repository with no build files would be read on every poll. A failed read is not kept, so the next call reads again. Signed-off-by: Vanshaj Poonia <vanshajtheunique@gmail.com>
|
Thank you for the go.mod case and for pointing to #2142.
The isolation walk failure is not from this PR. Checked locally after the merge: ruff, the mypy gate, the function length gate, the secrets gate, every generator |
zlareb1
left a comment
There was a problem hiding this comment.
A ready watch can fire before a compiler tier that returns to the tree has caught up. The existing removal test clears the cache between heads and misses this case.
| their own); None when the read fails. A status or coverage answer then waits on every | ||
| tier the entry may run, so a failed read never makes a commit ready.""" | ||
| key = (cfg.org, cfg.namespace) | ||
| if (tree := _trees.get(key)) is not None: |
There was a problem hiding this comment.
P1 — A ready watch can fire before a returning tier catches up. Cache the tree while go.mod is absent and the Go watermark is A. If Fast and Clang publish B with go.mod before the cache expires, this hit hides Go and the watch permanently delivers B as ready. Tie the producer lookup to the indexed head used for coverage and test a tier returning with a warm cache.
There was a problem hiding this comment.
Thank you for checking the returning tier with a warm cache. Fixed in 47bc75e. read_tree now keeps its cache per (org, namespace, git_head). Each caller passes the git_head of the state it judges coverage on: the status, the commit poll, the watch op and the notify pass. A new indexed head misses the cache and reads the tree again. A tier that head calls for is then waited on from its first answer. Polls at one head still share one read per LOOM_CODE_STATUS_TTL_S.
Tests:
test_a_tier_whose_build_file_returns_holds_back_the_watchintest_code_coverage_watch.pyis your case. The watch op reads the tree at A with no go.mod and Go's watermark at A. Then the fast and C++ tiers publish B with a go.mod while that read is still cached. Before the fixnotify_oncedelivered B. Now it waits on Go and delivers once Go reaches B.test_a_tier_whose_last_build_file_went_holds_back_no_watchno longer clears the cache. The head moves from B to C as the go.mod goes. The first pass at C delivers.test_a_commit_is_judged_on_the_tiers_the_tree_calls_for_now_not_the_cached_onesintest_code_status_ops.pypollscode.index_statuswith a commit across three heads and never clears the cache. Before the fix the second head still waited on Go.test_a_tree_read_is_kept_but_a_failed_one_is_notalso checks that a new head reads the tree again.
The three behaviour tests fail on the merged branch without the fix and pass with it.
An ingest writes a commit's file rows before it moves git_head. A read inside that window can see the next commit's build files under the old head. That is what an uncached read sees at the same moment, and the next head gets its own entry.
Drafted with AI help and reviewed by me manually.
zlareb1
left a comment
There was a problem hiding this comment.
The read-scope isolation test cannot build the worker approval and enrollment requests on this run or on the earlier main run. #2156 adds those request fields and keeps the refusal assertion. The failed run still blocks this head. PR job · Main job · Merged fix
…d-compiler-tiers The Go and Rust wire models were the only conflicts. They are main's copies with every generator rerun on the merged tree. Main brings ClickHouse#2156, which the read-scope isolation gate needs. Signed-off-by: Vanshaj Poonia <vanshajtheunique@gmail.com>
|
Thank you for tracing the isolation failure to #2156. Main is merged in ae0cb33, which brings #2156 in. The Go and Rust wire models were the only conflicts. They are main's copies with every generator rerun on the merged tree. The status, coverage watch, compiler tier, delta upload, tunable constant, SDK parity and docs tests pass on the merge (193). |
zlareb1
left a comment
There was a problem hiding this comment.
The returning-tier finding still applies. The indexed head can advance before the namespace-keyed detection cache expires, so a ready watch can fire without waiting for the returning tier. GitHub also reports a merge conflict in the generated Go and Rust models.
…d-compiler-tiers The Go and Rust wire models are main's copies with every generator rerun on the merged tree. notify_once keeps main's derived_once block and reads the running tiers once per namespace inside it. Signed-off-by: Vanshaj Poonia <vanshajtheunique@gmail.com>
…r is waited on at once Signed-off-by: Vanshaj Poonia <vanshajtheunique@gmail.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
Reviewed by Cursor Bugbot for commit 47bc75e. Configure here.
| logger.debug("compiler inference unavailable for %s: %s", cfg.namespace, e) | ||
| return None | ||
| _trees.put(key, tree) | ||
| return tree |
There was a problem hiding this comment.
Tree cache binds the wrong head
High Severity
read_tree caches the live index under the git_head it was given, but that head is not the tree it just read. _repo_status saves git_head, then awaits mirror lag, and only then fills the cache, so a newer commit's manifests can be stored for the previous head for the whole status TTL. A coverage check or watch still on that head can omit a tier the tree required, and a ready watch is not asked again.
Additional Locations (2)
Reviewed by Cursor Bugbot for commit 47bc75e. Configure here.
|
Thank you for the re-review.
CI on ae0cb33: the Python SDK adapter jobs are the dependency pin #2164 fixed, which this merge brings in. Drafted with AI help and reviewed by me manually. |
zlareb1
left a comment
There was a problem hiding this comment.
The tree read still races publication of the indexed head, as described in the existing thread. The status response also mixes two tree reads. GitHub reports conflicts with main.
|
|
||
| head = state_value(state, "git_head") | ||
| runs = runnable_producers(cfg, await read_tree(CodeRepo(), cfg, head)) | ||
| _fresh_heads(st, state, cfg.scip_producer, runs) # Never a cached head or tier |
There was a problem hiding this comment.
P2 — With a warm status cache, removing the last go.mod refreshes the tier cards and coverage but leaves Go in compiler_tier_rules and compiler_candidates. Compute the selection fields and compiler warnings from the same tree read as coverage. Extend the warm-cache removal test to check those fields.


Closes: #2119
Related: #1609
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 code repository entry that names
scip_producernow also runs every compiler tier its tree has a build file for. A newscip_excluded_producerslist drops a tier whose build file is incidental, so add it before upgrading for such an entry: each tier that starts costs build time and memory (about 4 GB for each Go module job).code.index_statusnames the rule behind each tier incompiler_tier_rules.Why
An entry that names
scip_producerended the tree inference:worker_ownsanswered from the named producers alone. A tree that gained ago.modafter the entry was written kept only its fast tier for the Go files.code.index_statuslistedgoincompiler_candidatesand nothing ran it. Anyone who named one producer and later added another language hit this, and only a warning showed it.Now a tier runs when the entry names it or when the tree calls for it and the entry does not exclude it.
scip_producerstill names the primary tier and its checkout.scip_extra_producersstill adds a tier the tree has no build file for. The newscip_excluded_producersis the way out for a build file that only serves tooling, which is the case the explicit producer was used for before.Scope and risk
worker_owns(server/code/app/index/producer_inference.py) answers true for a named tier and false for an excluded one without reading the tree. For any other tier it reads the tree as an entry naming no producer already did, which is one membership read of a few file names (plus one for ago.modbelow the root). An entry that names a producer did no tree read before, so each compiler worker pass now reads once for it. A named tier wins over the exclusion list.appliesis removed.selected_bycarries the rule andworker_ownsand the status both use it.runnable_producersnow names every tier's checkout but the excluded ones, as it did for an entry naming no producer.code.index_statusskips the "available for this tree but has not run" warning for an excluded tier. It still warns for a selected tier that has not run.code_index_state, whether the entry excludes it or the tree loses its last build file for it.compiler_tierstakes the tiers the entry runs,runnable_producersover the tree as indexed now, which is the ruleworker_ownsapplies. A tier outside them gets no card and is never the primary of an entry naming no producer, so neithercommit_coveragenor a coverage watch waits on it.code.index_statuswith a commit rebuilds the tiers, the primary's fields andscip_commit_pyfrom that call's state and tree instead of the cached status's. The status, the coverage watch op and the notify pass read a namespace's tree at most once perLOOM_CODE_STATUS_TTL_S(read_tree). When that read fails, they keep every tier the entry may run.run_python_delta.shgives ownerexcludedto a Python tier the entry excludes andnoneto an entry that does not run the Python tier, and skips both. Before,nonecovered only an entry naming no producer, so a clang entry took the manual path with Python excluded or with no Python build file in its tree.loom code scip-fullsays the entry does not run the clang tier when it skips one, instead of naming the entry's producer as the owner.run_tierand the crossref pass read ownership inside the per-entry failure boundary. A failed tree read is that entry's error and the pass goes on to the next entry. Inrun_tierit writes or drops no health record.checkout_for, so a detected tier works in<scip_checkout_dir>.<producer>, and the named primary tier and its card incompiler_tiers.code.repo.add) gets the same rule but has no exclusion list, as it has no extra producers.compiler_tier_rulesyet. Its types are unchanged.index_status.py.Compatibility, rollout and rollback
code.index_statusreturns a newcompiler_tier_rulesmap (producer to rule,{}by default). The Python, TypeScript, Rust and Go SDKs, the operation reference and the Rust contract test are regenerated. The Rust diff is mostly renumbereddefault_NNNNhelpers. An entry inLOOM_CODE_REPOS_JSONtakesscip_excluded_producers, a list or a comma separated string likescip_extra_producers. A build that does not know the key ignores it.compiler_tierslists only the tiers the entry runs over its current tree, and its description in the operation reference says so. No field is added or removed for this.scip_excluded_producersto each entry that names a producer and whose tree has a build file for another tier it should not run. Otherwise that tier starts on the next pass after the upgrade. The Go tier takes about 4 GB for each module job (LOOM_CODE_SCIP_GO_JOBS). An entry that names another producer and runsrun_python_delta.shon a tree with no Python build file addspythontoscip_extra_producers, or the script skips it.code_index_stateand their checkouts stay until the sweep removes them. No migration and no new table.Tests
worker_owns, the entry JSON key, the status rules and warnings, and the sweep keeping a detected tier's checkout while removing an excluded one's. A tier excluded after it ran holding back commit coverage or a coverage watch, a clang entry running an excluded Python tier on the manual path, and a failed ownership read ending a compiler or crossref pass each have a test that fails on the round's base. So do a detected tier whose last build file went holding back commit coverage or a coverage watch, a cached status judging a commit on its old tier list, a clang entry with no Python build file getting the manual Python pass, and theloom code scip-fullskip message.python -m pytestover 104 unit test files that reach the compiler tiers, the status, coverage watches, crossref, the scip CLI, the shell harnesses and the docs, after merging main: 2,746 passed and 35 skipped. Ten fail on this Mac for reasons outside this diff: twotest_mirrors.pyrepack tests inside their git-only fixture (3 packs where it expects 56), fourtest_scip_harness_windows.pycases that fail on a cleanupstream/maincheckout too, threetest_code_delta_stream.pycases that read/proc/self/fd, which macOS lacks, andtest_no_new_tunable_constanton_MAX_GENERATIONfrom main, which test_tunable_constants passes on main: the worker setup generation bound says why it is not a setting #2138 fixes.test_run_python_delta_upload_mode.pyandtest_scip_harness_checkout_path.pyneed bash 4 or newer. They pass with bash 5 and fail with macOS's bash 3.2 (_HARNESS_ON_EXIT[@]: unbound variable), the same onupstream/main.tests/unit/test_doc_links.py,test_public_copy.py, the SDK and codegen tests,test_package_contracts.pyandtest_code_extractor_stamp.pypass (729 in that run, with the same 9 failures from the shell harness file).scripts/gates/mypy_gate.pyreports 0 errors andmypy --strict sdk/python/loomis clean.scripts/gates/function_length_gate.pyis at its baseline.python -m scripts.codegen.<gen> --checkis clean for the Python, TypeScript, Rust (and its fixtures) and Go SDK generators, the docs reference and the reach census.ruff format --checkandruff checkare clean. Prettier 3.9.9 is clean on the four edited pages.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 wrote the diff and ran the checks listed under Tests.
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).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.Note
High Risk
Backward-incompatible indexing behavior: upgrades can start new compiler workers (notably Go ~4GB/module) on repos that only named one producer unless
scip_excluded_producersis set first; coverage and worker ownership logic changed broadly.Overview
Breaking change: A repo entry that sets
scip_producerno longer limits indexing to that tier alone—it also runs every compiler tier implied by build manifests in the tree (go.mod, rootpackage.json,CMakeLists.txt, Python manifests, etc.), unless you opt out.Adds
scip_excluded_producerson registry entries so incidental manifests (e.g.pyproject.tomlonly for tests on a C++ repo) can suppress a tier without reverting to “named producer only” behavior. A tier listed in bothscip_producer/scip_extra_producersandscip_excluded_producersstill runs (explicit naming wins).worker_ownsand tier scheduling are rebuilt aroundselected_by,runnable_producers, andtier_rulesinstead of the oldapplieshelper. Named tiers skip a tree read; detected tiers read manifests; excluded tiers never own the checkout. Mirror sweep and compiler workers userunnable_producersso checkout dirs match what actually runs.code.index_statusexposescompiler_tier_rules(producer →scip_producer,scip_extra_producers,tree, orscip_excluded_producers).compiler_tiersand commitcommit_coverage/ coverage watches only wait on tiers the entry runs now—stale watermarks from stopped tiers no longer block “ready.” Tree reads are cached pergit_headviaread_tree; failed reads conservatively treat all possible tiers as running. Per-commit status refreshes tier cards from live state, not the stale cache.Operational tweaks:
run_python_delta.shskips excluded Python tiers distinctly;loom code scip-fullexplains clang skip in terms of “entry does not run clang tier”; compiler/crossref passes isolate tree-read failures to one repo. Docs and SDK types include the new field and rules map.Reviewed by Cursor Bugbot for commit 47bc75e. Bugbot is set up for automated code reviews on this repo. Configure here.