Skip to content

Skip a SCIP document that fails to decode or convert; its file keeps its rows, marked stale - #1704

Open
KaloyanNaumov wants to merge 57 commits into
ClickHouse:mainfrom
KaloyanNaumov:pr/scip-skip-bad-document
Open

KaloyanNaumov wants to merge 57 commits into
ClickHouse:mainfrom
KaloyanNaumov:pr/scip-skip-bad-document

Conversation

@KaloyanNaumov

@KaloyanNaumov KaloyanNaumov commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

Closes: #1701

Changelog category (leave one):

  • Bug Fix (user-visible misbehavior in a release)

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=true fails the pass on such a document instead.

Why

_stream_documents parses each document with ParseFromString, 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_delta in lib.sh and runs its harness through compiler_tier.run_harness, so each change below covers C++ and its full run, Python, TypeScript and Go alike.

  1. The converter skips a document whose parse or conversion raises, whatever the exception. All its passes over the index read through _stream_documents; _ctor_overloads now does too, instead of parsing records itself. The skipped documents are kept per run (_Skips, created by each DeltaStream), not in module state.
  2. Each skipped document is named once on stderr. The delta counts them in stats.skipped_failed and the summary line, and lists in skipped_files those 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.
  3. The server never treats a skipped document as gone. gone_documents leaves the skipped paths out, so a full TypeScript or Python run keeps their rows, as a window does.
  4. The file is marked stale. Each worker passes its tier to apply_delta (an upload's is the tier whose watermark its producer moves). The apply writes one code_index_state row 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 .cu file 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 in deleted_files that 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 decides scip_stale_files for code.callers and code.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_status and code.repos) leave these rows out. A mark counts on every read while it is set (_marks_in_force, which scip_stale_paths and scip_stale_marks share). 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 failed code_scip_apply batch (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 by code_scip_apply, has no mirror to check and keeps the mark until this build applies the file.
  5. run_harness logs the first five warning lines and the count. Before, only the exit code was read on success, so no tier logged them.
  6. One switch: code_scip_stop_on_failed_document (default false). run_harness passes it to the harness as SCIP_STOP_ON_FAILED_DOCUMENT, and convert_delta adds --stop-on-failed-document, which re-raises the first failure, as main does.
  7. The boundary: _top_level_records raises 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_path returns "" 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.
  8. The Go harness converts each module in an xargs job, whose convert_delta … | tail -1 took tail's status, so a failed conversion dropped the module and the watermark moved. run_module sets pipefail and 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.
  9. A delta that lists a skipped file is delta_version 2; 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_apply applies both. A build without this change applies version 1 only and ignores skipped_files, so it refuses such an upload instead of applying it without the marks.
  10. A full C++ conversion that skipped a document, in the window or anywhere in the constructor scan, makes no ctor_calls claim (DeltaStream.tail needs _Run.ctors_complete as well as an empty skipped_files, which holds the window's files only; the harness's --full run always passes a window): the skipped file may hold the only factory call, and with the claim set and no edge for it, code.callers would 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_coverage counts the compiler tier as not carrying constructor calls, so an empty constructor answer from code.callers, code.callees or code.verify stays a lower_bound with ctor_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 the scip_ctor_calls bit 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's scip_stale: keys in code_index_state only.
  11. The constructor scan (_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 in skipped_files when the delta converts it, so it keeps its rows and is marked stale. Documents without a factory call convert as before.
  12. code.callers and code.callees read 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 a lower_bound with scip_stale_files, not exact. 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_sample stops 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 the code.symbol uses block are a lower_bound with scip_stale_files, and code.test_gate lists 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.
  13. A delta file kept for scip-full --apply-delta is read by open_delta, which now refuses a delta_version the build does not apply (DELTA_VERSIONS, in scip_delta.py, which code_scip_apply reads 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 of blob_paths_at, and blob_ids), the code_scip_apply version check, scip_stale_paths, scip_stale_marks, scip_stale_sample and scip_marks_retirable in the store, the constructor-coverage probe and the stale read of the seed paths in coverage.py and graph.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 are code_index_state rows, 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 a lower_bound until, 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, one git cat-file --batch-check when 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 is exact: the price of not knowing which seed the skipped document calls. code.impact and code.test_gate read the marks only: as on main, neither compares its seed paths with the fast tier's rows. A code.callees walk 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 stays exact until a delta converts the file.

Compatibility, rollout and rollback

  • Wire: the delta gains skipped_files and stats.skipped_failed, and one that lists a skipped file is delta_version 2. An older server ignores the two fields and refuses version 2.
  • Rollout: the build before this one applies version 1 only. While it runs the workers, and after a rollback, it fails a version-2 upload (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's scip-full --apply-delta is 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.
  • Operator steps: none. LOOM_CODE_SCIP_STOP_ON_FAILED_DOCUMENT=true restores the old failure.
  • Rollback: reverting restores the old failure. The older version has no prefix filter, so every 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 and code.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_listed runs the command line on a two-document index whose second document carries invalid UTF-8: exit 0, only the good document in files, skipped_files == ["src/bad.cpp"], the count in the stats and the summary line, one warning, delta_version 2. On main it exits 1 on the DecodeError.
    • test_the_switch_stops_the_run_on_a_failed_document: with --stop-on-failed-document the run exits non-zero on the DecodeError and writes no delta.
    • test_the_harness_passes_the_switch_to_the_converter runs convert_delta from lib.sh with SCIP_STOP_ON_FAILED_DOCUMENT at 1 and 0: it fails and writes nothing, or succeeds and writes the delta. The 0 case fails on main.
    • test_a_document_that_fails_to_convert_is_skipped_and_listed makes _convert_document raise for one document: the other converts and the warning names the path and the error; a module prefix applies to skipped_files; a second DeltaStream leaves the first one's record as it was. On main the KeyError escapes.
    • 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_line pins 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 in src/foo.h, which fails to decode, outside a window of the factory caller src/a.cpp and src/ok.cpp. The caller is listed in skipped_files and only src/ok.cpp converts; a full run lists both failed files. With a readable header the caller has its DB::Foo::Foo edge. 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. Without pipefail in run_module the 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 skipped web/bad.ts retires only web/gone.ts and writes scip_stale:typescript:web/bad.ts. On main it retires web/bad.ts too.
  • tests/unit/test_code_scip_skipped_documents.py:
    • run_harness logs the first five warning lines and the count (on main it logs none) and passes the switch.
    • One apply marks and clears its tier's files in one insert, under its tier for an unowned suffix too, and never marks an out-of-scope or refused path.
    • A C++ delta that deletes a .py file, applied beside a Python delta that skips another, leaves both Python marks; the store fake lets both reads land before either write.
    • An upload applies for the tier whose watermark its producer moves.
    • test_a_skipped_path_that_files_or_deleted_files_name_keeps_its_rows_and_is_marked: a delta whose files or deleted_files and skipped_files both 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 (in tests/unit/test_scip_to_delta_skip.py): a full C++ conversion with source whose only factory caller fails to convert lists it in skipped_files, has no factory edge and carries no features. On the head before it, it carried ctor_calls.
    • test_a_full_run_whose_constructor_scan_skipped_a_document_outside_its_files_makes_no_claim (same file): a --full run with a window of src/ok.cpp while src/foo.h fails to decode lists nothing in skipped_files and carries no features; with a readable header it carries ctor_calls. On the head before it, it carried ctor_calls.
    • test_a_skipped_file_withdraws_the_claim_a_clean_full_run_made (in tests/unit/test_code_ctor_call_edges.py): with scip_ctor_calls set and one compiler-tier file marked stale, code.callers on a constructor with no edges is a lower_bound with ctor_edges_absent. Before, it was exact.
    • test_a_mark_written_after_the_probe_is_cached_withdraws_exact (same file): three code.callers calls on a constructor with no edges in one process, with no cache clear: exact after a clean full run, a lower_bound with ctor_edges_absent once a later delta marks a file stale, and exact again once the mark clears, all through one state read. On the head before it, the second call was exact.
    • test_a_delta_version_the_build_does_not_apply_is_refused (in tests/unit/test_code_delta_stream.py): open_delta reads versions 1 and 2 and refuses 0 and 3 with unsupported delta_version. Before, it read any.
    • test_an_upload_that_skipped_a_document_waits_for_a_worker_that_marks_it stages 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 with unsupported delta_version 2 and 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 in scip_stale_paths after the watermark moved, and fresh again once a delta applies it; all_state and all_state_many leave the marks out. On main it 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 skipped src/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_marks names it and _ctor_edge_coverage claims 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 refreshes src/bad.py and moves scip_commit_py, and an apply whose edge insert fails writes src/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 of src/bad.py, which rewrites no symbol or edge row, and moves scip_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): through code_scip_apply, an upload marks src/bad.py, the next batch changes it and fails on its edge insert, and a later batch for src/other.py moves 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 for src/bad.cpp lands 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 of src/a.cpp and a moved watermark; src/bad.cpp still 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_index with the harness stubbed converts both files and fails the edge insert, so scip_full_at moves and the watermark stays; a delta that applies only src/a.cpp then moves the watermark, and src/bad.cpp still reads stale.
    • test_a_window_with_nothing_to_apply_keeps_the_mark: after the failed retry, the C++ delta worker's _run_repo meets 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 marks src/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.cpp holds caller and callee with no edges, exact both ways; a delta skips the revision that adds caller's first call to callee. code.callees on caller and code.callers on callee are then a lower_bound with scip_stale_files naming the file. On the head before it, both stayed exact.
    • test_a_first_caller_in_another_skipped_file_is_not_exact: callee in src/a.cpp and caller in src/bad.cpp are covered and nothing calls callee; a delta skips src/bad.cpp for the revision that adds the call. src/a.cpp does not read stale and no edge comes back, yet code.callers and code.impact on callee are a lower_bound with scip_stale_files, and exact again once a delta applies src/bad.cpp. On the head before it, both stayed exact.
  • tests/unit/test_run_go_monorepo_delta_modules.py::test_a_failed_module_directory_is_named_whole: the real harness over a repository whose go mod download fails in a directory ending in a newline (also with a literal backslash and a carriage return); Unmasked names the module whole, so its failure is recorded and its retry kept.
  • 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_limit reads them through _marked_stale and expects every query to carry LIMIT {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_read expects the same bound and the line lower_bound (scip_stale_files); test_a_failed_read_still_counts_as_a_mark expects the unread placeholder; test_stale_note_marks_that_there_are_more_files_only_when_a_fourth_is_sampled expects no ellipsis for three files and one for four. The first two failed on the head before it (the query had no LIMIT). In tests/integration/test_code_scip_stale_mark.py, test_the_bounded_mark_read_stops_at_its_limit_and_skips_a_cleared_mark sets 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.
  • A file marked stale elsewhere in the namespace lowers the grep neighbours' callers (test_a_file_marked_stale_anywhere_makes_the_callers_a_lower_bound), the code.symbol uses block (test_exact_only_when_every_seed_file_is_compiler_indexed) and adds the cause to code.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 list scip_stale_files, and the store stand-ins of the incoming-answer test files take a scip_stale_sample, and the callers note no longer counts files, since a sample cannot. tests/unit/test_code_stale_marks_note.py drives 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.
  • tier is a required keyword of apply_delta: every test call passes one, the apply_delta stand-ins of four worker test files and the tier-health test take it, the batched-state test expects the scip_stale: filter of all_state_many, the store stand-ins of four test files take scip_stale_sample, and the converter stubs of two test files follow its new signatures.
  • Run here on the branch merged with main at e89cc858f, 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 (main at 67fdb366b merges 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 the delta_file.py header 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' --check runs 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 merges main at 583acb7b7, 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 --check runs pass. On 20ccead39, 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. On a0f86605e, 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. On 60417d589, 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. On c3ae72247, 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. On b792baa8b, 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

  • Local format, lint, type checks and focused tests pass. The full make test-unit and applicable integration results are reported by CI; a full local run is not required before pushing.
  • Generated files are regenerated in this PR, not by hand: the new setting's reference, schema, example file and defaults snapshot.
  • A new migration is additive and numbered after the latest on main; no migration is added.
  • A behaviour change to any file a plugin ships (hooks/, lib/, bin/, skills/, .mcp.json, the Codex plugin-defaults.json) bumps both plugin manifests' version: no plugin file changed.
  • The frontend builds (npm --prefix frontend run build) and its tests pass, if frontend/ changed: it did not.
  • Docs under docs/ describe the system as it now is, and this description names any operator steps and wire changes: the failure model in docs/operations/code-index-operations.md and scripts/scip_harness/README.md, and rule 70 in docs/architecture/rolling-upgrades.md.
  • Repository text has no dates, people, host names, internal namespaces, ticket or decision numbers; the history goes in this description (tests/unit/test_public_copy.py).
  • Commits are signed off (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.py skips the bad document (or fails the run when LOOM_CODE_SCIP_STOP_ON_FAILED_DOCUMENT is set), keeps existing compiler rows, and emits delta_version 2 with skipped_files when any window file was skipped. code_scip_apply applies v1 and v2; older builds refuse v2 uploads.

apply_delta now takes a tier, writes scip_stale:<tier>:<path> marks, records scip_applied after successful rounds, and clears marks via retire_published_marks (plus deleted/missing-file and Go unbuilt-module rules). Skipped factory-call sites and incomplete constructor scans withhold the ctor_calls namespace claim and can skip dependent files.

code.callers, code.impact, test gate, PR pack, and symbol uses treat namespace stale marks as lower_bound with scip_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.

@vercel

vercel Bot commented Nov 28, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
loom-docs Ready Ready Preview Dec 5, 2026 2:02am UTC
loom-telemetry Ready Ready Preview Dec 5, 2026 2:02am UTC

Request Review

@zlareb1 zlareb1 self-assigned this Nov 28, 2026

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

Comment thread scripts/scip_harness/scip_to_delta.py Resolved
Comment thread server/code/app/index/scip_delta.py Resolved

@zlareb1 zlareb1 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread server/code/app/index/compiler_tier.py Resolved
Comment thread server/code/workers/scip_apply.py Resolved
@zlareb1

zlareb1 commented Nov 28, 2026

Copy link
Copy Markdown
Member

The format job fails on the adoption page with the same formatter output on clean main. The pinned formatter passes locally with the repair. PR job · Main job · Repair #1706

@KaloyanNaumov

Copy link
Copy Markdown
Contributor Author

Both points are addressed:

  1. Full-run cleanup: 4c2b16c fails a full run before apply when a failed document's path cannot be read, a path that is not UTF-8 included.
  2. Queued uploads: 695be37 writes a delta that lists skipped files as delta_version 2, which an N-1 worker refuses and leaves for N; rule 67 in the rolling-upgrade doc.

376a163 fixes the three unit failures CI found (a test stand-in without the tier keyword, a test that did not expect the scip_stale: filter) and realigns the operations guide's failure table for Prettier. The format job's biome failure is docs/pages/adoption.astro from main, which this PR does not touch.

…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>
@KaloyanNaumov
KaloyanNaumov force-pushed the pr/scip-skip-bad-document branch from 376a163 to 8bc15ff Compare November 28, 2026 14:10
@KaloyanNaumov

Copy link
Copy Markdown
Contributor Author

Rebased onto main at 07df22c95, which had taken rolling-upgrade rule 67 in the meantime, so this PR's rule is now 68. The commits named in the replies above are now 2da9227 (a full run fails on a document whose path cannot be read), 3ac33f5 (delta_version 2) and 8bc15ff (the test stand-in and the failure table). Nothing else changed.

@zlareb1 zlareb1 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread server/code/app/index/scip_delta.py Resolved

@zlareb1 zlareb1 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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>
@KaloyanNaumov

Copy link
Copy Markdown
Contributor Author

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 zlareb1 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread server/code/app/index/scip_delta.py Resolved
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 zlareb1 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@KaloyanNaumov

Copy link
Copy Markdown
Contributor Author

A path in both deleted_files and skipped_files is no longer deleted by the upload path: skipped wins, as in the full run, and the file is marked stale. The red jobs on this head also fail on main: unit part 4 is test_no_new_tunable_constant on main's DOCSTRING_MAX_LINES, and integration part 1 is the rename fixture you repaired in #1719.

@zlareb1 zlareb1 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread scripts/scip_harness/scip_to_delta.py Resolved
Comment thread docs/architecture/rolling-upgrades.md Resolved
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>
KaloyanNaumov added a commit to KaloyanNaumov/loom that referenced this pull request Dec 3, 2026
@KaloyanNaumov

Copy link
Copy Markdown
Contributor Author

Steady point: dfd154565 — this is the head I propose merging, and I'd rather bargain on it than keep growing it.

It carries main (bd58b7b65) merged, and the three findings from your last review:

  1. A gitlink at a marked path counts as gone. The blob filter sits in gitrepo, so ls_tree, ls_tree_blobs, bootstrap, the backfill's retirement and reconcile all read a gitlink path as absent — one verdict, four readers, instead of a special case inside _gone_at.
  2. The fixture builds its entry in the index (hash-object + update-index --cacheinfo, argv bytes), so no raw filename ever hits the filesystem. I also fixed a second macOS offender you did not name: test_scip_path_encoding.py wrote and renamed src/caf\xe9.ts; its rename is index-level now. Your claim held only with that one included.
  3. The tree lookup keeps the name read before a truncated record, so selection uses it and the document's own parse fails per document and is skipped under bad.py.

Evidence: red 4 failed, 15 passed (ValueError: record at 10 runs 61 bytes past the end, assert {'src/gone.cc'} == set()) → green 33 passed over the three files and 503 passed over the nineteen that touch both listings and both modules; ruff, ruff format, function-length and mypy_gate clean. On a host without ClickHouse the ClickHouse-backed state tests skip (4 passed, 14 skipped here).

One thing you should know rather than discover: main moved again while I was pushing (30440ee80), and the only conflict is tests/analyzer/shapes.txt — a generated snapshot. I did not hand-edit it. Regenerating the corpus resolves it, one command at merge time.

If a finding on this one is not blocking the merge, say so and I will take it as a follow-up issue rather than another round.

@zlareb1 zlareb1 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two paths still lose their identity when a project directory contains a byte that cannot be decoded as UTF-8. Both reproduce in the conversion tools on this head.

Comment thread scripts/scip_harness/scip_to_delta.py Resolved
Two findings from the review of ClickHouse#1704, both a project directory whose name holds a
byte that is not UTF-8.

`scip_to_delta.py` read the module's directory from argv, where Python hands back a
lone surrogate for that byte, and every window name as the `replace` decoding of
git's bytes. The two never compared equal: a deleted file under the module carried
the prefix twice (`caf\udce9/caf\ufffd/gone.ts`) and named no row, and the module's
own changed document was not the changed one. `_path_text` is now the one decode —
bytes, or a `str` re-encoded with `surrogateescape` — used for the document path,
the window lists, the directory as the delta keys it, and the Go scope name; the
checkout's own name still opens the source reads.

The merge compared the plan's member name — argv text, surrogate-escaped — with a
document's `replace`-decoded path, so a selected member whose directory is not UTF-8
owned nothing: the merge wrote an index without its documents and the converter
could not mark the member's document stale. `owner_key` (was `_key`, the same
decode) is applied to both sides; the plan still hands the raw name to the indexer
runs, which open the checkout.

Both sides of each comparison now decode through one function, so two paths that
differ only by a malformed byte stay distinct, as the earlier key ruling requires.

Signed-off-by: Kaloyan Naumov <knaumov@gmail.com>
@KaloyanNaumov

Copy link
Copy Markdown
Contributor Author

Steady point: 1b07f07f0 — both findings fixed, and they had one root: the project's own name and its documents' paths were being decoded in different places with different rules.

What changed. A single _path_text(path) in scip_to_delta.py is now the one decode — bytes, or a str re-encoded with surrogateescape, both through replace. It backs _document_path, _path_list, the module directory as the delta keys it, and the Go scope name; the checkout's own name still feeds the source reads. scip_merge_indexes.py gets owner_key (same decode) applied to both the plan's member name and the document path before ownership — the plan still hands raw names to the indexer runs, so nothing downstream changes.

Red → green, on the real conversion:

  • a deleted file under caf<e9>: deleted_files was caf\udce9/caf\ufffd/gone.ts — the prefix twice — and the module's document was absent from files; now ["caf\ufffd/gone.ts"] and ["caf\ufffd/a.ts"].
  • a merge over caf<e9>/a.ts: the output was metadata only (file:///repo and nothing else); it now holds the document.

Two tests added to test_scip_path_encoding.py; the existing assertions are untouched. pytest -k scip → 790 passed, plus the five harness files outside that selector → 88 passed; ruff check and format --check clean; mypy_gate 0.

@zlareb1 zlareb1 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread server/code/store/index/symbols.py Resolved
)
return declined, scip_paths, False, stale_paths
else:
declined, scip_paths, stale_paths = await asyncio.gather(

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread tests/analyzer/shapes.txt Resolved
@KaloyanNaumov

Copy link
Copy Markdown
Contributor Author

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 src/B.cpp at the moment of a depth-two walk. We agree the answer should not claim exactness when a skipped downstream file hides its first outgoing call, but the trigger is narrow enough that we would rather not spend a round on it, and this PR is the oldest thing we have open.

Being fixed here: the 128 KiB bound-parameter overflow in store/index/symbols.py — that one is not an edge case, a commit touching 200 files is an ordinary rename sweep, and it is being bounded properly rather than papered over. Plus the shapes.txt regeneration, which is what made test_shapes_file_matches_builders fail on the combined tree.

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>
KaloyanNaumov added a commit to KaloyanNaumov/loom that referenced this pull request Dec 4, 2026
…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`.

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

Comment thread server/code/store/index/symbols.py Resolved
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 zlareb1 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 zlareb1 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Comment thread docs/architecture/rolling-upgrades.md Resolved

@zlareb1 zlareb1 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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`.
@KaloyanNaumov

Copy link
Copy Markdown
Contributor Author

Merged main (5301f2920) and answered the three findings at 03570a96a.

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 chunks_multi under the same 64 KiB FIELD_BYTES discipline - the clear writes each path's mark and its applied record per group, and the read unions the fresh paths. The red case is that exact 200 x 334-byte set.

Raw-path ownership. Documents are keyed on raw bytes and ownership is compared in surrogateescape against the spelling the harness was given, so one member can no longer clear the mark for another member's file through a different spelling of the same path.

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 MODULES_FILE, the same shape #1973 uses for the same finding. A real run fed by the harness's own file indexed ['.', 'svc/api', 'svc/e\n'] with MODULES unset.

Also on this head: the doc rule moved to sit after main's 73-75, and the operations doc's cross-reference follows it.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

Reviewed by Cursor Bugbot for commit 03570a9. Configure here.

@zlareb1 zlareb1 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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>
@KaloyanNaumov

Copy link
Copy Markdown
Contributor Author

The downstream call coverage case (a skipped file hiding the first outgoing call of a symbol a depth-two code.callees walk expands) and the mixed-build stale mark (a file the previous build refreshes keeps its mark until this build applies it) are limits of this PR as it stands; the PR body states the first, and rule 71 and the body's Rollout paragraph state the second. @zlareb1 will you take the PR with those two limits stated, or would you rather close it and keep them as follow-up issues?

KaloyanNaumov added a commit to KaloyanNaumov/loom that referenced this pull request Dec 5, 2026
…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>
KaloyanNaumov added a commit to KaloyanNaumov/loom that referenced this pull request Dec 5, 2026
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 zlareb1 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

return found.group(1) if found else line
if not found:
return line
return _LINE_ESCAPE.sub(lambda m: _UNESCAPED.get(m.group(1), m.group(0)), found.group(1))

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 — This parser still truncates a module directory containing : scip-go failed. For a failed module in services/a: scip-go failed/b, it returns services/a, which the worker discards because it did not select that directory. The real module is then missing from the retry map. Encode the directory so it cannot contain the record delimiter and cover a path containing that delimiter.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

One SCIP document that cannot be read fails the whole compiler-tier pass

2 participants