Repository navigation
Skip a SCIP document that fails to decode or convert; its file keeps its rows, marked stale - #1704
KaloyanNaumov wants to merge 59 commits into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
zlareb1
left a comment
There was a problem hiding this comment.
The full-run cleanup needs to distinguish a missing file from a document whose path could not be recovered. Queued uploads also need a rollout path that preserves skipped-file state when an older worker is still serving.
|
The format job fails on the adoption page with the same formatter output on clean |
|
Both points are addressed:
376a163 fixes the three unit failures CI found (a test stand-in without the |
…its rows, marked stale One document python-protobuf refuses (a string that is not UTF-8) or that fails to convert no longer fails the compiler-tier pass. The converter names it once on stderr, lists it in the delta's `skipped_files` and counts it; `run_harness` logs the warning for every tier. A full run does not retire a skipped file, and `apply_delta` marks it stale (`scip_stale:<path>` in `code_index_state`) until a delta applies or deletes it, which `scip_stale_paths` reads. `code_scip_stop_on_failed_document` fails the pass on such a document instead. An index that cannot be read to its end still fails. Signed-off-by: Kaloyan Naumov <knaumov@gmail.com>
…ith the stop switch A tier's stale files are one `code_index_state` row, `scip_stale:<tier>`, rewritten in one insert by an apply that changes it, and left out of the whole-namespace state reads. A skipped path the entry's scope or denylist refuses is not marked. `run_module` in the Go harness sets `pipefail` and returns 1 on a failed conversion. `run_harness` logs the first five skipped documents and the count. A conversion failure carries the document's place in the index, and the server's warning prefix is pinned to the converter's. Signed-off-by: Kaloyan Naumov <knaumov@gmail.com>
…the delta `apply_delta` takes the delta's tier from every caller (an upload's is the tier whose watermark its producer moves) and writes `scip_stale:<tier>:<path>` rows: each skipped file marked at the delta's commit, and each of that tier's marked files the delta applied or deleted emptied, in one insert. A tier reads and writes only its own marks, so tiers applying side by side keep each other's. `scip_stale_paths` reads the marks by prefix; the whole-namespace state reads leave them out. Signed-off-by: Kaloyan Naumov <knaumov@gmail.com>
…ped files it converts `scip_stale_paths` looks up each asked path's mark under each tier instead of scanning every mark of the namespace. `skipped_files` holds only the failing documents among the files the delta converts, so a document outside a window is counted but not marked again. `tier` is a required keyword of `apply_delta`. Signed-off-by: Kaloyan Naumov <knaumov@gmail.com>
Split the harness README's spliced sentence about a skipped document in two, and add the window rule to the failure-table row. Signed-off-by: Kaloyan Naumov <knaumov@gmail.com>
A run over every document lists each skipped document's path in `skipped_files`, and the TypeScript and Python workers retire the live files such a delta does not name. A document whose path could not be read was only counted, so its file landed in that deletion set. The converter now fails such a run before anything is applied; a window, which names its own files, still counts it and converts. A path that is not UTF-8 is one that cannot be read: it is no longer decoded with replacement characters into a name no file has. Signed-off-by: Kaloyan Naumov <knaumov@gmail.com>
An upload is applied by whichever build leads the workers. Build N-1's `code_scip_apply` ignores `skipped_files`, so it would apply such a delta, move the watermark and write no stale mark, and N would then read the old rows as current. The converter now writes `delta_version` 2 when the delta lists a skipped file, and 1 otherwise; the version goes last, since a document that fails to convert is known only once the files are written. N's worker applies both versions. N-1's applies version 1 only, so it fails such a batch and leaves the watermark. The rolling-upgrade rules gain the entry. Signed-off-by: Kaloyan Naumov <knaumov@gmail.com>
The `apply_delta` stand-in of the tier-health test takes the `tier` keyword, and the batched-state test expects the `scip_stale:` prefix parameter that `all_state_many` binds to leave the marks out. Prettier realigns the operations guide's failure table after its widened row. Signed-off-by: Kaloyan Naumov <knaumov@gmail.com>
376a163 to
8bc15ff
Compare
|
Rebased onto |
zlareb1
left a comment
There was a problem hiding this comment.
The full conversion now stops on an unreadable path, and version 2 keeps an older worker from applying a batch without stale marks. Applying an incomplete file can still retire its existing compiler rows.
zlareb1
left a comment
There was a problem hiding this comment.
The rename report integration test fails at the same assertion on this head and on clean main. The tagged fixture describes a naming claim, so the planner returns about_naming. The same test passes with the fixture repair. PR job · Main job · Repair #1719
Two documents can cover one path, one converting and one failing. The delta then names the path in `files`, holding only the converted document's symbols, and in `skipped_files`. The apply took it through the key diff, which tombstoned each symbol only the failed document defined, and then marked the file stale. `apply_delta` now leaves such a path out of the files it applies, as it does a path that only `skipped_files` names: its rows stay as they are and the file is marked stale until a delta converts it whole. Also fix a comment: `scip_stale_paths` reads the marks by key. Signed-off-by: Kaloyan Naumov <knaumov@gmail.com>
|
The overlap case is fixed in 03041ef: a file that one document converted and another failed is no longer applied at all. Its rows stay as they are and the file is marked stale until a delta converts it whole. The integration failure in the rename report is the one you traced to main; nothing here touches it. |
zlareb1
left a comment
There was a problem hiding this comment.
The new guard keeps rows when a path appears in both files and skipped_files. An uploaded delta can still delete rows for a path it declares skipped.
A path listed in both `deleted_files` and `skipped_files` went to the writer as a deletion and was then marked stale. The apply now leaves a deleted path that the delta also skips out of the files it applies, as the full run's deletions already do, so its rows stay and the mark is written. Signed-off-by: Kaloyan Naumov <knaumov@gmail.com>
zlareb1
left a comment
There was a problem hiding this comment.
The tunable-constant check reports the same duplicate coverage limit on this head and on clean main. The coverage repair moves the bound report to the store. The same check passes on main with both the coverage and docstring repairs applied. PR job · Main job · Coverage repair #1722 · Docstring repair #1706
|
A path in both |
zlareb1
left a comment
There was a problem hiding this comment.
The overlap test confirms that neither files nor deleted_files can retire a skipped path. Two remaining gaps affect complete graph answers and replay during an upgrade.
A full C++ conversion that skipped a document still listed `ctor_calls` in its features, so applying it set the namespace's coverage bit. If the skipped file was the only factory caller and had no prior edge, `code.callers` had no edge to check for staleness and read the empty answer as exact. The claim is now withheld when the delta lists a skipped file. Signed-off-by: Kaloyan Naumov <knaumov@gmail.com>
The streamed reader behind `scip-full --apply-delta` read a delta file without checking its `delta_version`, so a version this build does not apply was read as one it does. It now refuses it, as the worker does for an upload, and the list of applied versions lives in one place. Rule 68 says a kept version-2 file is applied with the CLI of the build that wrote it during a rollout or a rollback, since the previous build's CLI applies it without its skipped files. Signed-off-by: Kaloyan Naumov <knaumov@gmail.com>
…s stale Withholding `ctor_calls` from a delta that skipped a document does not undo a claim an earlier clean full run already made: the coverage bit stays set. A later run that skips a new file with no prior edge left `code.callers` with an empty answer it still read as exact, since the staleness read looks at served edges and this file has none. The coverage probe now counts the compiler tier as not carrying constructor calls while any file it holds is marked stale, so the answer is a lower bound until a delta converts the file and clears its mark. Rule 68 now says what the previous build's CLI does with a kept version-2 file: a skipped file's partial entry replaces its rows and no stale mark is written. Signed-off-by: Kaloyan Naumov <knaumov@gmail.com>
|
Steady point: What changed. A single Red → green, on the real conversion:
Two tests added to |
zlareb1
left a comment
There was a problem hiding this comment.
The gitlink and deleted-path cases pass the Git probe. The current head still has three failures in project ownership and stale-edge reporting. GitHub reports a merge conflict in the rolling-upgrade notes.
| ) | ||
| return declined, scip_paths, False, stale_paths | ||
| else: | ||
| declined, scip_paths, stale_paths = await asyncio.gather( |
There was a problem hiding this comment.
P2 — A depth-two callees walk can return exact coverage when a skipped downstream file hides its first outgoing call. With A in src/A.cpp, a stored A-to-B edge and a stale mark on src/B.cpp, the walk expands B but checks staleness only for A's file. Check the defining paths of expanded symbols, or report lower-bound coverage when a mark could hide their edges.
|
On the depth-two callees finding: we are declining it as an edge case, and stating that plainly rather than letting it sit. The shape it needs is a stored A→B edge plus a stale mark on Being fixed here: the 128 KiB bound-parameter overflow in If you want the depth-two case carried regardless, tell us and it goes back on the list. |
…field A 200-path round of 192-byte paths bound its marks — four a path, 800 strings — as one HTTP form field of 171,000 bytes, past `http_max_field_value_size` (128 KiB by default). clickhouse-connect sends every parameter longer than 4 KiB as such a field, so ClickHouse refused the statement, and the staleness answer it carries fell open to "every asked path is stale" for every walk of that size. The path list alone rendered 39,200 bytes. `scip_stale_paths` now reads the asked paths in groups where both of the statement's list parameters render within `FIELD_BYTES`: the paths, and each path's mark under every tier. The two are cut together — a mark bound apart from its path reads that path fresh in the statement that lacks it. Its sibling `scip_covered_paths` is cut the same way; at 340-byte paths a 200-path round rendered 68,800 bytes, past the 64 KiB the statement is written to. `server/core/ch_params.py` gains `chunks_multi`, which takes a value's width per list parameter, and `rendered_width`; `chunks` is the one-parameter case. Both reads answer every path they are given: the `[:200]` truncations are gone, and a path past that bound read fresh before this change. tests/analyzer/shapes.txt is regenerated for the state read that now excludes both `scip_stale:` and `scip_applied:`. Signed-off-by: Kaloyan Naumov <knaumov@gmail.com>
…ation Two conflicts, both unions of what each side carries. docs/architecture/rolling-upgrades.md: upstream added rule 71 (a `/help` address) and rule 72 (an agent's usage label names its run and principal); this branch's skipped-files rule moves to 73 behind them. The branch also carried a second copy of rule 70 (a TypeScript delta's held edges), appended by an earlier merge of ClickHouse#1704's head: dropped, so the list runs 1..73 with one copy of each number. `docs/operations/code-index-operations.md` follows the renumbering (rule 73). server/code/api/models_symbol.py: `ReaderImpactOutput.causes` keeps this branch's `scip_stale_files` beside upstream's `unmapped_changes`, `new_side_unread` and `new_side_failed`.
server/code/app/symbol/coverage.py: the split-versus-failure-kind conflict. Resolved as in ClickHouse#1973: `_ctor_state` keeps the cached code_index_state read and carries the failed read's kind, so `degraded` names it on every answer served from the cache; `_ctor_edge_coverage` keeps the stale-marks check on every call the bit is set, outside that cache. tests/analyzer/shapes.txt: no conflict. Regenerated (`python -m tests.analyzer.corpus --write`) and byte-identical to the merged snapshot, 2383 shapes.
9b914b3 left the `while IFS= read -r -d ''` body at eight spaces, where every other block in the harness sits at its own depth. `shfmt -w` moves the three lines; no byte of the NUL-delimited path handling changes.
zlareb1
left a comment
There was a problem hiding this comment.
The stale-mark read now batches its parameters. The clear path still binds all state keys in one form field, and project ownership still conflates distinct raw paths. GitHub reports a merge conflict in server/code/app/symbol/coverage.py.
…ove out The 201st line was the precision-floor note above the co-change call, so function_length_gate read the function as a regression past the 200 the ratchet allows and asked for a split. The shape that pays it already exists: ClickHouse#1973 landed `_co_change_gaps` for this same function on wip/ts-retire-r37 (4879af4). The note becomes the helper docstring, the nested import and the call move with it, and the call site keeps its `if diff_shaped:` guard. Both functions are identical in the two trees, so nothing is second-guessed here. No behaviour change: same call, same floor, same rows.
zlareb1
left a comment
There was a problem hiding this comment.
The stale-mark read is batched. Clearing the marks still binds the full set as one field, which exceeds the default limit with 200 paths of 334 bytes and stops the worker before indexing. The raw-path ownership and Go newline findings also remain. Existing review
zlareb1
left a comment
There was a problem hiding this comment.
The refusal test cannot build the worker approval request, and the unit inventory flags the worker approval bigint bound. Both failures reproduce on this run's clean base. The same targeted tests fail on current main and pass with the existing fixes. Isolation job · Fixture fix #2142 · Unit job · Bound fix #2138.
# Conflicts: # docs/operations/upgrades.md # server/code/app/symbol/coverage.py
…mpares raw paths, and a Go module directory keeps a trailing newline A round of 200 334-byte paths rendered the clear as one 141 KB keys field, past the servers 128 KiB: the worker stopped before indexing. The clear and the applied record now go in as many statements as one bound list carries, each paths mark and record together. The merge compares project ownership on the raw path bytes (surrogateescape), so two member directories that replace-decode alike stay two owners. The Go harness cuts a go.mod name with a parameter expansion, since dirname in a command substitution drops a trailing newline and the module was skipped. Item numbers after main read-receipts rule are renumbered, status.md regenerated.
…directory ending in a newline keeps its delta
The harness cut a `go.mod` name with `${m%/*}` already, but `_harness_env` still joined
the selected modules with newlines. A module directory whose name ends in one arrived as
a path that does not exist: its `cd` missed, the run skipped the module, and the worker
advanced the watermark without its delta. The list now goes beside the deltas,
NUL-separated, in `out_dir/modules`, and the harness reads `MODULES_FILE` first with
`mapfile -t -d ''` (`MODULES` stays for a human at a terminal). The shape is ClickHouse#1973's
(`wip/ts-member-r39`, `550c65eb8`), ported rather than reinvented; the discovery cut and
the script's other lines are unchanged.
Tests: `test_selected_modules_reach_the_harness_nul_separated` (red at `18a8cdb43`:
`MODULES_FILE` unread, so the harness discovered all three modules and the list was
`['.', 'svc/api', 'svc/e\n']` instead of `['svc/api', 'svc/e\n']`; green: only the
selected two run, and scip-go runs in `svc/e\n`), `test_a_module_directory_ending_in_a_newline_is_indexed`,
and `_harness_env`'s test, which asserts the file's bytes `svc\0svc/e\n\0`.
|
Merged The clear bound. The stale-mark read was batched, but the clear still bound every path in one statement: 200 paths of 334 bytes rendered 141,200 bytes across two fields, past the field limit, and the statement failed before indexing began. Both paths now chunk through Raw-path ownership. Documents are keyed on raw bytes and ownership is compared in The Go newline. It was fixed at discovery only; the worker still exported a newline-joined module list, so a module whose path contains a newline was dropped. The list is now written NUL-separated beside the deltas and read through Also on this head: the doc rule moved to sit after main's 73-75, and the operations doc's cross-reference follows it. |
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 03570a9. Configure here.
zlareb1
left a comment
There was a problem hiding this comment.
The downstream call coverage and mixed-build stale-mark findings still apply. I also reproduced the existing Go retry finding on this head. A failed module in a directory ending with a newline reaches the indexer, but the result parser records neither the module nor a retry and the healthy delta can advance the watermark. Preserve the full module path in the result channel.
… whatever its directory holds The harness printed a failed module as one `skip <dir>: ... failed: ...` line, so a directory ending in a newline broke it in two: the worker read neither a failed module nor a retry for it, and the healthy delta advanced the watermark. The harness now writes a backslash, a newline and a carriage return in the directory as `\\`, `\n` and `\r`, and `failed_dir` reads them back, so the module is recorded, shown and retried under its real name. Assisted-by: Claude Code:claude-sonnet-5-5 Signed-off-by: Kaloyan Naumov <knaumov@gmail.com>
|
The downstream call coverage case (a skipped file hiding the first outgoing call of a symbol a depth-two |
…he TypeScript member failure isolation This branch carries ClickHouse#1704. Its head supplies the stale-mark clear cut under the bound field (29d0998, 18a8cdb) and ownership that reads a member's name and its documents' paths as one key (1b07f07, 18a8cdb), so the review's two matching findings are answered by those commits and this branch adds no code for them. Conflicts: the rolling-upgrades rule stays this branch's 78, the same text ClickHouse#1704 holds as its own rule; coverage.py takes ClickHouse#1704's docstring; test_run_go_monorepo_delta_modules.py takes ClickHouse#1704's final file. Assisted-by: Claude Code:claude-sonnet-5-5 Signed-off-by: Kaloyan Naumov <knaumov@gmail.com>
Regenerated with scripts/codegen/docs_reference.py after the merge of main and ClickHouse#1704: the count of boolean settings that load false is 58. Assisted-by: Claude Code:claude-sonnet-5-5 Signed-off-by: Kaloyan Naumov <knaumov@gmail.com>
zlareb1
left a comment
There was a problem hiding this comment.
The Go harness preserves trailing newlines in failure lines. Another legal directory name still breaks the retry map. The mixed-version recovery and downstream coverage threads remain open.
…its line framing The failure line is read back at its first `: scip-go failed` or `: go mod download failed`, so a module directory holding that text was cut short: for `services/a: scip-go failed/b` the worker read `services/a`, which this run did not select, and the real module was missing from the retry map. Escaping one more substring only moves the collision. The harness now writes the directory in every line it prints as a token of `A-Za-z0-9._/+@~-` and `%XX` bytes, which holds no space, colon or line break, and `failed_dir` decodes it to the exact bytes, so any directory name is carried whole and no name can spell a failure line of its own. Assisted-by: Claude Code:claude-sonnet-5-5 Signed-off-by: Kaloyan Naumov <knaumov@gmail.com>
`failed_dir` decoded the harness token with `os.fsdecode`, while `_module_dirs` decodes `git ls-files -z` as UTF-8 with `replace`, and `_known_retry` keeps only keys that list spells. A module directory that is not UTF-8 therefore left the retry map. The token's bytes are now decoded the way `_module_dirs` decodes, so the two names are equal. Assisted-by: Claude Code:claude-sonnet-5-5 Signed-off-by: Kaloyan Naumov <knaumov@gmail.com>
|
@zlareb1 thanks for the careful rounds on this one. I'd like to get #1704 merged. The delimiter finding is fixed in 5cf07d0: the Go harness writes a module directory as a The two remaining threads I'd keep out of this PR:
Neither is worse than We can open issue for the leftover edge cases. Can we, please merge #1704? It's already huge and it's time for it to go. The current state is good, and much better than main's handling. |

Closes: #1701
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 compiler-tier pass no longer fails on one SCIP document that cannot be decoded or converted, such as one with a string that is not UTF-8: the document is skipped and logged, the rest of the index is applied, and the file keeps its compiler rows, marked stale.
LOOM_CODE_SCIP_STOP_ON_FAILED_DOCUMENT=truefails the pass on such a document instead.Why
_stream_documentsparses each document withParseFromString, and nothing caught a failure, so one bad document ended the run. The tier wrote no delta and kept its watermark, and the next pass indexed the same tree and hit the same document. scip-typescript can write a string field that is not UTF-8, which python-protobuf refuses (DecodeError: String field had bad UTF-8). One file that cannot be processed should not fail the whole repository's pass.Every tier converts through
convert_deltainlib.shand runs its harness throughcompiler_tier.run_harness, so each change below covers C++ and its full run, Python, TypeScript and Go alike._stream_documents;_ctor_overloadsnow does too, instead of parsing records itself. The skipped documents are kept per run (_Skips, created by eachDeltaStream), not in module state.stats.skipped_failedand the summary line, and lists inskipped_filesthose among the files it converts (the window's, or every file in a full run). A failing document outside the window is warned about and counted, but not listed, so no later delta marks it again. A document whose path cannot be read (a path that is not UTF-8 among them) is counted by its place in the index, so two of them are two. In a run over every document (the TypeScript and Python full runs, which name no files), such a document fails the run before anything is applied: the worker retires the live files a full delta does not name, and this one's file would be among them.gone_documentsleaves the skipped paths out, so a full TypeScript or Python run keeps their rows, as a window does.apply_delta(an upload's is the tier whose watermark its producer moves). The apply writes onecode_index_staterow per skipped file,scip_stale:<tier>:<path>holding the delta's commit, and empties the row of each file of that tier this delta applied or deleted. All of these go in one insert per apply. The mark is filed under the applying tier, so a path no tier's suffixes name (a.cufile in a C++ index) is marked under the tier that skipped it. A tier reads and writes only its own marks, so two tiers applying side by side keep both. A file both converted and skipped (two documents of one path, one of them failing) is not applied: its rows stay as they are, marked stale, since the converted document alone would drop what the failed one defined. A path indeleted_filesthat is also skipped is not deleted either, as in the full run. A skipped path the entry's scope or path denylist refuses is never marked, since no delta would clear it.scip_stale_paths, which already decidesscip_stale_filesforcode.callersandcode.callees, reads the marks of the asked paths by key (each path under each tier) and treats a marked file as stale. Before, a moved watermark made those rows read as current. The whole-namespace state reads (all_state,all_state_many, behind the as-of block,code.index_statusandcode.repos) leave these rows out. A mark counts on every read while it is set (_marks_in_force, whichscip_stale_pathsandscip_stale_marksshare). This build empties it when it applies the file, after every round of that apply has landed, or, for an entry whose tier this build's worker runs, when a pass of that worker finds a later apply of the file published (retire_published_marks): the tier's watermark holds another blob of the file than the mark's commit in the entry's mirror. A Python, TypeScript or C++ worker moves its watermark only after a whole apply of the window, and the previous build fails a run on a document it cannot read, so that watermark is a completed apply whichever build wrote it, whether or not the apply rewrote a row of the file (a change to a function body alone rewrites none). An upload batch whose apply fails leaves the watermark to a later batch that does not apply its files, so the pass keeps every mark older than the namespace's newest failedcode_scip_applybatch (scip_marks_retirable); batch records expire after 30 days. The Go worker passes a module it could not fetch without a retry, so a Go mark also needs a compiler-tier row of the file written after it. A namespace fed by uploads alone, applied bycode_scip_apply, has no mirror to check and keeps the mark until this build applies the file.run_harnesslogs the first five warning lines and the count. Before, only the exit code was read on success, so no tier logged them.code_scip_stop_on_failed_document(default false).run_harnesspasses it to the harness asSCIP_STOP_ON_FAILED_DOCUMENT, andconvert_deltaadds--stop-on-failed-document, which re-raises the first failure, asmaindoes._top_level_recordsraises when a record's length runs past the end of the data. Before, the slice came back short and the parse of that last document failed, so a truncated index failed by accident; with per-document skipping it would have converted._document_pathreturns""for a payload it cannot read, and for a path that is not UTF-8, which it no longer decodes with replacement characters into a name no file has.xargsjob, whoseconvert_delta … | tail -1tooktail's status, so a failed conversion dropped the module and the watermark moved.run_modulesetspipefailand returns 1 on a failed conversion. With the switch on, the Go run now fails like the others. With it off, a conversion that fails as a whole (a truncated index, a crash outside the per-document skip, a killed converter) now fails the Go pass and keeps the watermark, where before it dropped the module.delta_version2; one that lists none stays 1. The converter writes the version last, since a document that fails to convert is known only once the files are written.code_scip_applyapplies both. A build without this change applies version 1 only and ignoresskipped_files, so it refuses such an upload instead of applying it without the marks.ctor_callsclaim (DeltaStream.tailneeds_Run.ctors_completeas well as an emptyskipped_files, which holds the window's files only; the harness's--fullrun always passes a window): the skipped file may hold the only factory call, and with the claim set and no edge for it,code.callerswould read the empty answer as exact. A claim an earlier clean full run already made is withdrawn on read: while any compiler-tier file is marked stale,_ctor_edge_coveragecounts the compiler tier as not carrying constructor calls, so an empty constructor answer fromcode.callers,code.calleesorcode.verifystays alower_boundwithctor_edges_absent. That lifts once this build converts the file; the claim itself comes back with the next full run that skips none. The probe caches thescip_ctor_callsbit an hour per namespace, but reads the marks on every call while the bit is set, so a new mark or its retirement shows on the next answer. That read is one query per empty constructor answer, over the tier'sscip_stale:keys incode_index_stateonly._ctor_overloads) reads every document, the window's and the rest. When it skips one, that document may declare a type's only constructor, or one more overload of a type the scan found, so a factory call converted without it would lose its edge and the apply would retire the edge the file had. A document with a factory call is then skipped as well (_OverloadsIncomplete): it is listed inskipped_fileswhen the delta converts it, so it keeps its rows and is marked stale. Documents without a factory call convert as before.code.callersandcode.calleesread staleness for the paths of the edges they return and for the seed's own path when the compiler tier covers it. A seed in a skipped file with no edge, such as a function whose first call, or its first caller in the same file, came in the skipped revision, is alower_boundwithscip_stale_files, notexact. An incoming answer also reads the namespace's marks once per query (_marked_stale): a marked file may hold the seed's first caller although it is neither a seed path nor the path of a returned edge. The read is bounded, since a full pass can mark a whole source tree:scip_stale_samplestops at a LIMIT of three paths, enough to say that a mark exists and to name files in the note, and the PR pack's line and the constructor probe, which need only a boolean, ask for one. A cleared mark, an empty row, is not in the sample either. While any mark is set,code.callers,code.impact, the grep neighbours' callers, the PR pack's callers line and thecode.symboluses block are alower_boundwithscip_stale_files, andcode.test_gatelists the cause beside its other graph causes. The callers note names up to three marked files. A failed read of the marks counts as a mark.scip-full --apply-deltais read byopen_delta, which now refuses adelta_versionthe build does not apply (DELTA_VERSIONS, inscip_delta.py, whichcode_scip_applyreads too), as the worker does for an upload. The previous build's CLI applies a retained version-2 file as version 1: a skipped file's partial entry replaces its rows and no stale mark is written. Rule 70 says to apply a kept file with the CLI of the build that wrote it during a rollout or a rollback.Scope and risk
The converter,
lib.sh, the Go harness,compiler_tier.py(_attempt),delta_file.py,scip_delta.py(retire_published_marks),gitrepo.py(a strict read ofblob_paths_at, andblob_ids), thecode_scip_applyversion check,scip_stale_paths,scip_stale_marks,scip_stale_sampleandscip_marks_retirablein the store, the constructor-coverage probe and the stale read of the seed paths incoverage.pyandgraph.py, the namespace's marks read by every incoming answer (impact.py,gate.py,neighbours.py,packs.py,symbol_uses.py), one setting, docs and tests. A run without--changed-files(a TypeScript or Python full run, Go--full, a direct upload) fails, and keeps its watermark, on a failed document whose path cannot be read, until the indexer writes a readable one; a window does not. A skipped document is never repaired: its parser-tier rows are unaffected, its compiler rows stay as the last successful conversion left them and read as stale until a delta converts the file again. The stale marks arecode_index_staterows, one per skipped file, so no migration is needed. A cleared mark stays as an empty row, which no read returns. A refresh that fails between its symbol and edge inserts leaves the mark counting until an apply of the file by this build completes; no watermark write retires it, whether from a completed apply that does not name the file, a window with nothing to apply, or the delta after a failed weekly C++ full run. The previous build never empties a mark, so a file it refreshes, during a rollout or after a rollback, stays stale and keeps constructor answers alower_bounduntil, for an entry this build's tier worker runs, its next pass finds the refresh published, or until it applies the file itself. A failed upload batch newer than a mark keeps it until this build applies the file, and a Go refresh that rewrites no row of the file keeps it too. A namespace fed by uploads alone keeps the mark until this build applies the file. A Go tier keeps its marks while it owes a module retry, a mirror that lacks the watermark's commit or cannot answer keeps them all, and one that lacks a mark's commit keeps that mark. A marked file that the previous build deletes is never applied by this build again, so each apply of the tier also empties the marks of paths that have no blob at the delta's commit in the entry's mirror (_gone_at, onegit cat-file --batch-checkwhen marks are set); a mirror that cannot be read, or lacks the commit, keeps the mark. Namespace removal and the purge drop them with the namespace's other state. An index that cannot be read to its end now fails the Go tier too. An index that cannot be read to its end still fails the run, with or without the switch. A converter bug that broke most documents would skip them all and mark them stale rather than fail; an operator who wants such a run to fail sets the switch. While one document of a C++ index fails to decode, every changed file with a factory call is skipped and marked stale too, until the indexer writes that document again. A seed in a file the fast tier rewrote after the compiler tier's last run now reads stale in both directions, as its edges already did. While one file of a namespace stays marked, no incoming answer in that namespace isexact: the price of not knowing which seed the skipped document calls.code.impactandcode.test_gateread the marks only: as onmain, neither compares its seed paths with the fast tier's rows. Acode.calleeswalk of depth two reads staleness for the seed's file and the files of the edges it returns, not for the file of a symbol it expands, so a marked downstream file can hide its first outgoing call and the answer staysexactuntil a delta converts the file.Compatibility, rollout and rollback
skipped_filesandstats.skipped_failed, and one that lists a skipped file isdelta_version2. An older server ignores the two fields and refuses version 2.unsupported delta_version 2) and leaves the tier's watermark, so no old rows read as current;loom code scip-retry <batch_id>applies it once this build runs them. A delta with no skipped file stays version 1, which both apply. When the previous build applies one that converts a file this build marked, it leaves the mark and moves the watermark past the refresh; its rows cannot show that both inserts landed, so this build reads the file stale until, for an entry this build's tier worker runs, its next pass finds the refresh published (the watermark holds another blob of the file than the mark's commit, and no upload batch of the namespace has failed since the mark), or until it applies the file itself. A namespace fed by uploads alone keeps the mark until this build applies the file. The in-server tiers apply the deltas their own build's harness writes. A kept delta file read by the previous build'sscip-full --apply-deltais applied without its skipped files, so it is applied with the CLI of the build that wrote it. The rolling-upgrade rules gain this as rule 70.LOOM_CODE_SCIP_STOP_ON_FAILED_DOCUMENT=truerestores the old failure.scip_stale:row, emptied ones included, comes back in its whole-namespace state reads: the as-of block, coverage,code.repos, the tier-health sweep andcode.index_status. Before or after the revert, remove them with a lightweight delete; no request waits on it:DELETE FROM loom.code_index_state WHERE startsWith(state_key, 'scip_stale:').Tests
tests/unit/test_scip_to_delta_skip.py:test_a_document_with_a_string_that_is_not_utf8_is_skipped_and_listedruns the command line on a two-document index whose second document carries invalid UTF-8: exit 0, only the good document infiles,skipped_files == ["src/bad.cpp"], the count in the stats and the summary line, one warning,delta_version2. Onmainit exits 1 on theDecodeError.test_the_switch_stops_the_run_on_a_failed_document: with--stop-on-failed-documentthe run exits non-zero on theDecodeErrorand writes no delta.test_the_harness_passes_the_switch_to_the_converterrunsconvert_deltafromlib.shwithSCIP_STOP_ON_FAILED_DOCUMENTat 1 and 0: it fails and writes nothing, or succeeds and writes the delta. The 0 case fails onmain.test_a_document_that_fails_to_convert_is_skipped_and_listedmakes_convert_documentraise for one document: the other converts and the warning names the path and the error; a module prefix applies toskipped_files; a secondDeltaStreamleaves the first one's record as it was. OnmaintheKeyErrorescapes.test_a_window_lists_only_its_own_failed_documents: a window that does not hold the bad document counts it but lists nothing, and its delta is version 1.test_a_run_over_every_document_fails_on_one_whose_path_cannot_be_read: the bad document's path is not UTF-8. A full run exits non-zero, names the document and writes no delta; a window counts it and converts. Before, the run exited 0 and listed the path with a replacement character.test_the_server_logs_the_converters_warning_linepins the server's prefix to the converter's.test_a_factory_caller_keeps_its_rows_when_the_overload_scan_misses_a_document:Foo's only constructor is declared insrc/foo.h, which fails to decode, outside a window of the factory callersrc/a.cppandsrc/ok.cpp. The caller is listed inskipped_filesand onlysrc/ok.cppconverts; a full run lists both failed files. With a readable header the caller has itsDB::Foo::Fooedge. On the head before it, the caller converted without the edge and nothing was listed.tests/unit/test_scip_harness_windows.py::test_with_the_stop_switch_a_failed_document_fails_the_run, for the Python, TypeScript and Go harnesses over a real git window: with the switch on, a document that does not parse fails the run and writes no delta. Withoutpipefailinrun_modulethe Go case exits 0 with no delta.tests/unit/test_code_scip_ts_delta_worker.py::test_a_full_run_keeps_a_skipped_documents_rows_and_marks_the_file_stale: a full run whose delta skippedweb/bad.tsretires onlyweb/gone.tsand writesscip_stale:typescript:web/bad.ts. Onmainit retiresweb/bad.tstoo.tests/unit/test_code_scip_skipped_documents.py:run_harnesslogs the first five warning lines and the count (onmainit logs none) and passes the switch..pyfile, applied beside a Python delta that skips another, leaves both Python marks; the store fake lets both reads land before either write.test_a_skipped_path_that_files_or_deleted_files_name_keeps_its_rows_and_is_marked: a delta whosefilesordeleted_filesandskipped_filesboth name one path hands the writer only its other files, and marks the path and clears the mark of the applied ones. On the head before this test, the path went through the key diff or was deleted.test_a_full_run_that_skipped_a_document_does_not_claim_constructor_calls(intests/unit/test_scip_to_delta_skip.py): a full C++ conversion with source whose only factory caller fails to convert lists it inskipped_files, has no factory edge and carries nofeatures. On the head before it, it carriedctor_calls.test_a_full_run_whose_constructor_scan_skipped_a_document_outside_its_files_makes_no_claim(same file): a--fullrun with a window ofsrc/ok.cppwhilesrc/foo.hfails to decode lists nothing inskipped_filesand carries nofeatures; with a readable header it carriesctor_calls. On the head before it, it carriedctor_calls.test_a_skipped_file_withdraws_the_claim_a_clean_full_run_made(intests/unit/test_code_ctor_call_edges.py): withscip_ctor_callsset and one compiler-tier file marked stale,code.callerson a constructor with no edges is alower_boundwithctor_edges_absent. Before, it wasexact.test_a_mark_written_after_the_probe_is_cached_withdraws_exact(same file): threecode.callerscalls on a constructor with no edges in one process, with no cache clear:exactafter a clean full run, alower_boundwithctor_edges_absentonce a later delta marks a file stale, andexactagain once the mark clears, all through one state read. On the head before it, the second call wasexact.test_a_delta_version_the_build_does_not_apply_is_refused(intests/unit/test_code_delta_stream.py):open_deltareads versions 1 and 2 and refuses 0 and 3 withunsupported delta_version. Before, it read any.test_an_upload_that_skipped_a_document_waits_for_a_worker_that_marks_itstages a converted delta that skipped a document as an upload. Under a worker that applies version 1 only, as the build before does, the batch fails withunsupported delta_version 2and no mark or watermark is written; under this build's it applies, marks the file and moves the watermark.tests/integration/test_code_scip_stale_mark.py, against ClickHouse: a file whose document a delta skipped reads stale inscip_stale_pathsafter the watermark moved, and fresh again once a delta applies it;all_stateandall_state_manyleave the marks out. Onmainit reads fresh.test_a_refresh_by_the_previous_build_keeps_the_mark_until_this_build_applies_the_file(same file): this build applies a delta that skippedsrc/bad.cpp, then a clean delta for it goes through the apply without_mark_stale, which is what the previous build runs, and the watermark moves. The file still reads stale,scip_stale_marksnames it and_ctor_edge_coverageclaims no constructor calls. This build's apply of the file then retires the mark, and a mark written after that counts again.test_a_pass_of_this_build_retires_a_mark_the_previous_build_published(same file): with a two-commit mirror, the previous build refreshessrc/bad.pyand movesscip_commit_py, and an apply whose edge insert fails writessrc/other.py, which is unchanged. One pass of the Python worker with nothing to index empties the first mark and keeps the second. On the head before it both marks stayed.test_a_pass_retires_a_mark_the_previous_build_published_without_rewriting_a_row(same file): the previous build applies a body-only change ofsrc/bad.py, which rewrites no symbol or edge row, and movesscip_commit_py; one pass of the Python worker empties the mark. On the head before it the mark stayed.test_a_failed_upload_keeps_the_mark_past_a_later_batch_that_moves_the_watermark(same file): throughcode_scip_apply, an upload markssrc/bad.py, the next batch changes it and fails on its edge insert, and a later batch forsrc/other.pymoves the watermark; the pass keeps the mark. On the head before it the mark was emptied.test_a_watermark_write_by_the_previous_build_keeps_the_mark_over_a_failed_apply(same file): after a skip and a moved watermark, a retry forsrc/bad.cpplands its symbol insert and fails its edge insert; then the previous build's step for a window with no C++ change, the watermark write alone. The file still reads stale with coverage incomplete, and this build's later apply of the file retires the mark. On the head before it, the reads after that watermark write were fresh and complete.test_a_failed_apply_keeps_the_mark(same file): the same failed retry with the watermark unmoved keeps the file stale, and so does the previous build's retry that then lands both inserts and moves the watermark.test_an_apply_of_another_file_keeps_the_mark_over_a_failed_apply: after the failed retry, a completed apply ofsrc/a.cppand a moved watermark;src/bad.cppstill reads stale, and a completed apply of the file retires it.test_a_failed_full_run_then_a_delta_without_the_file_keeps_the_mark:full_indexwith the harness stubbed converts both files and fails the edge insert, soscip_full_atmoves and the watermark stays; a delta that applies onlysrc/a.cppthen moves the watermark, andsrc/bad.cppstill reads stale.test_a_window_with_nothing_to_apply_keeps_the_mark: after the failed retry, the C++ delta worker's_run_repomeets a window whose harness writes no delta and moves the watermark; the file still reads stale.test_a_mark_for_a_file_the_previous_build_deleted_is_emptied_by_the_next_apply: over a two-commit git mirror, this build markssrc/bad.cpp, the previous build deletes it, and this build's apply of another file at a commit the mirror lacks, or at one that still holds the file, keeps the mark; its apply at the commit without the file empties it and constructor coverage is complete again. Before, the mark stayed and coverage stayed incomplete for the whole namespace.test_a_seed_in_a_skipped_file_with_no_edges_is_not_exact:src/bad.cppholdscallerandcalleewith no edges,exactboth ways; a delta skips the revision that addscaller's first call tocallee.code.calleesoncallerandcode.callersoncalleeare then alower_boundwithscip_stale_filesnaming the file. On the head before it, both stayedexact.test_a_first_caller_in_another_skipped_file_is_not_exact:calleeinsrc/a.cppandcallerinsrc/bad.cppare covered and nothing callscallee; a delta skipssrc/bad.cppfor the revision that adds the call.src/a.cppdoes not read stale and no edge comes back, yetcode.callersandcode.impactoncalleeare alower_boundwithscip_stale_files, andexactagain once a delta appliessrc/bad.cpp. On the head before it, both stayedexact.tests/unit/test_run_go_monorepo_delta_modules.py:test_a_failed_module_directory_is_named_wholeruns the real harness over ten directory shapes (among themservices/a: scip-go failed/b, a newline and a non-UTF-8 byte);Unmaskednames each module whole, so its failure is recorded and its retry kept.test_a_directory_cannot_forge_a_failure_line_in_the_other_linescovers a directory spelling a failure line inside thedoneline, andtest_a_failed_non_utf8_module_dir_is_spelled_as_the_worker_lists_itthe retry key's spelling. The harness writes a module directory in its output as a token ofA-Za-z0-9._/+@~-and%XXbytes, so no directory name can collide with the line's framing.tests/unit/test_code_stale_marks_bounded.py: a store fake holds 5000 marks, as a full pass can leave.test_a_namespace_marked_whole_is_read_with_a_limitreads them through_marked_staleand expects every query to carryLIMIT {limit:UInt32}with a limit of at most four, and a sample of exactly four (the note names three);test_the_pack_line_stays_a_lower_bound_over_a_bounded_readexpects the same bound and the linelower_bound (scip_stale_files);test_a_failed_read_still_counts_as_a_markexpects the unread placeholder;test_stale_note_marks_that_there_are_more_files_only_when_a_fourth_is_sampledexpects no ellipsis for three files and one for four. The first two failed on the head before it (the query had no LIMIT). Intests/integration/test_code_scip_stale_mark.py,test_the_bounded_mark_read_stops_at_its_limit_and_skips_a_cleared_marksets six marks and gets four from the sample and one when asked for one, then clears them one by one: the sample never returns a cleared mark and is empty after the last.test_a_file_marked_stale_anywhere_makes_the_callers_a_lower_bound), thecode.symboluses block (test_exact_only_when_every_seed_file_is_compiler_indexed) and adds the cause tocode.test_gate(test_a_cut_coverage_read_is_a_cause_and_a_test_only_change_has_none); each failed on the head before it. The two constructor tests above now also listscip_stale_files, and the store stand-ins of the incoming-answer test files take ascip_stale_sample, and the callers note no longer counts files, since a sample cannot.tests/unit/test_code_stale_marks_note.pydrives the PR pack's callers line (exact with no mark, a lower bound with one, absent when the read fails) and the callers note when the marks cannot be read.tieris a required keyword ofapply_delta: every test call passes one, theapply_deltastand-ins of four worker test files and the tier-health test take it, the batched-state test expects thescip_stale:filter ofall_state_many, the store stand-ins of four test files takescip_stale_sample, and the converter stubs of two test files follow its new signatures.mainate89cc858f, every extra installed: the skipped-document, delta-stream, constructor-call, constructor-remainder, apply-round, entry-lock, the four compiler-tier worker, converter-skip, harness-window, callers-candidate, epistemic-envelope, structural-verdict, pre-merge-input, batched-state, tier-health, any-namespace and scope-enforcement tests, 502 passed and 1 skipped, and the tunable-constant, public-copy and doc-link tests, 292 passed, on the commit before the last; on the final head the touched unit files give 493 passed. On the final head (mainat67fdb366bmerges without conflict and is not merged in), the nine stale-mark integration tests pass against ClickHouse 26.12, and the converter, constructor-call, envelope, delta-stream and Python and TypeScript converter unit files give 225 passed; a wider set of eighteen unit files gave 653 passed before the last converter edit, which limits the completeness count to the C++ constructor scan.ruff check,ruff format --check, the function-length gate, the mypy gate (no errors:main's Streamed SCIP headers use their model field annotations #1915 fixed thedelta_file.pyheader adapter), the secrets check and the analyzer corpus (no change) pass; this round changes no setting, and the settings, docs-reference and reach-census generators'--checkruns passed on the earlier head; the SDK generators were not run here (CI runs them), and the change touches no wire shape. On the head that mergesmainat583acb7b7, the ten stale-mark integration tests pass against ClickHouse 26.12, the Go worker file gives 90 passed, and 168 unit files around the graph answers, the envelope, the converter, the stale marks, the delta workers and the rolling-upgrade tests give 3056 passed and 43 skipped.ruff check,ruff format --check, the function-length and mypy gates, the secrets check and the settings, docs-reference and reach-census--checkruns pass. On20ccead39, the two new tests and the eight converter, delta-stream, entry-lock and constructor-call unit files around them give 229 passed, the ten stale-mark integration tests pass again against ClickHouse 26.12, and the lint, format, function-length, mypy and secrets gates, the tunable-constant, public-copy and doc-link tests pass. Ona0f86605e, the three bounded-read unit tests and the eleven stale-mark integration tests pass against ClickHouse 26.12, 379 tests across sixteen unit files around the graph answers, the stale marks, the delta workers and the constructor calls pass, and the lint, format, function-length, mypy and secrets gates pass. On60417d589, the converter-skip, converter, constructor-call, constructor-header, constructor-remainder and tunable-constant unit files give 122 passed, and the lint, format, function-length and mypy gates pass. Onc3ae72247, the twelve stale-mark integration tests pass against ClickHouse 26.12, eighteen unit files around the compiler-tier workers, tier health, skipped documents, the entry lock, apply rounds and the stale marks give 621 passed and 1 skipped, and the lint, format, function-length, mypy and secrets gates pass. Onb792baa8b, which changes text only, the doc-link, docs-reference and skipped-document unit tests give 308 passed. The full unit suite was not run here; CI runs it.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 the tests. Checked: I reviewed the whole diff and its tests; the runs listed under Tests are the agent's, the last on
3906e188f.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.main; no migration is added.hooks/,lib/,bin/,skills/,.mcp.json, the Codexplugin-defaults.json) bumps both plugin manifests' version: no plugin file changed.npm --prefix frontend run build) and its tests pass, iffrontend/changed: it did not.docs/describe the system as it now is, and this description names any operator steps and wire changes: the failure model indocs/operations/code-index-operations.mdandscripts/scip_harness/README.md, and rule 70 indocs/architecture/rolling-upgrades.md.tests/unit/test_public_copy.py).git commit -s), as CONTRIBUTING.md asks.Note
Medium Risk
Touches compiler-tier apply semantics, delta wire version 2, and widespread epistemic downgrade logic during mixed-version rollouts; behavior is heavily tested but operators must retry v2 batches after upgrade.
Overview
Compiler-tier indexing no longer fails the whole pass when one SCIP document cannot be decoded or converted (e.g. invalid UTF-8).
scip_to_delta.pyskips the bad document (or fails the run whenLOOM_CODE_SCIP_STOP_ON_FAILED_DOCUMENTis set), keeps existing compiler rows, and emitsdelta_version2 withskipped_fileswhen any window file was skipped.code_scip_applyapplies v1 and v2; older builds refuse v2 uploads.apply_deltanow takes atier, writesscip_stale:<tier>:<path>marks, recordsscip_appliedafter successful rounds, and clears marks viaretire_published_marks(plus deleted/missing-file and Go unbuilt-module rules). Skipped factory-call sites and incomplete constructor scans withhold thector_callsnamespace claim and can skip dependent files.code.callers,code.impact, test gate, PR pack, and symbol uses treat namespace stale marks aslower_boundwithscip_stale_files; seed paths in skipped files count as stale even with no edges.Harness plumbing switches git file lists to NUL-separated paths (no dropped weird paths), adds Go
MODULES_FILE, tightens merge ownership for non-UTF-8 directory names, and logs converter skip warnings. Docs add rolling-upgrade rule 71 and the new failure-model row; generated settings include the new boolean.Reviewed by Cursor Bugbot for commit 41352d5. Bugbot is set up for automated code reviews on this repo. Configure here.