Skip to content

A failing TypeScript member keeps the other members' rows - #1973

Open
KaloyanNaumov wants to merge 114 commits into
ClickHouse:mainfrom
KaloyanNaumov:pr/ts-member-failure-isolation
Open

KaloyanNaumov wants to merge 114 commits into
ClickHouse:mainfrom
KaloyanNaumov:pr/ts-member-failure-isolation

Conversation

@KaloyanNaumov

@KaloyanNaumov KaloyanNaumov commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor

Related: #1961
Related: #1782
Depends on: #1704

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):

With a TypeScript project list or an umbrella root, one project whose indexer exits with an error no longer fails the whole pass: the other projects' files are updated, and the failed project's files keep their rows, marked stale, until a later pass converts them. An indexer killed by a signal (out of memory, say) still fails the pass, so the next pass retries it (a member that runs out of memory on every pass still fails every pass, as before), and LOOM_CODE_SCIP_STOP_ON_FAILED_DOCUMENT still fails the pass on any member failure.

Why

Case 4 of #1961. run_typescript_delta.sh runs one scip-typescript process per member under set -e, so one member that exits non-zero failed the pass for every member, the watermark stayed, and the next pass failed the same way. On typescript-eslint at 90497319, the first member fails with TS5023 Unknown compiler option 'stableTypeOrdering' and the pass exits 1 after 0.8 s.

The harness now logs the member and its exit status and goes on. scip_merge_indexes.py merges the parts that succeeded and, with --failed-project, writes every TypeScript file each failed member owns: a file whose preferred owners include a failed member and whose document no part the merge kept holds. Sibling tsconfigs in one directory share a scope, so a sibling that indexed a file stands in for one that failed. The converter's new --failed-files takes that list. The files of it that the delta converts (the window's, or all of them on a full pass) are skipped the way #1704 skips a document it cannot read: one scip_to_delta: warning: skipped document line each, which the tier logs at warning level, a count in stats.skipped_failed, and an entry in skipped_files, so the server keeps their rows and marks them stale.

A file of another member that refers to an arrow-function constant of a failed member is skipped the same way, also when the constant's file is not in the window. The converter makes such a reference a calls edge only when the index holds the constant's definition (_ts_prepass), so converting the file would drop edges the stored rows have; the full list of the failed member's files tells it which definitions are missing. With the real scip-typescript, members src, src/infra and pkg/b, pkg/b's indexer failing and src/foo.ts, src/infra/net.ts and pkg/b/b.ts changed: main exits 2 with no delta; the branch writes src/foo.ts and lists pkg/b/b.ts and src/infra/net.ts (which calls twice from pkg/b) in skipped_files, delta_version 2. That run was made before the full list; the unit test test_a_caller_whose_callee_file_is_outside_the_window_is_skipped covers a window without the callee's file.

Only an error of the member's own is isolated. scip-typescript exits 1 when it cannot load a tsconfig or indexes no file, and node exits 1 on an uncaught exception. An exit above 128 means the indexer was killed by a signal: a V8 heap abort is 134 (--max-old-space-size exceeded, measured with node 22), a SIGKILL from the kernel's OOM killer is 137. Such a pass fails, so the watermark stays and the next pass retries the member. A member that runs out of memory on every pass therefore fails every pass, as before this change; NODE_HEAP_MB or the sandbox memory limit is the remedy. A timeout kills the whole harness and fails the pass, as before.

A pass in which every member failed still fails, so a member that fails on every pass keeps the watermark of windows that touch it alone, as before; the first window that also selects a healthy member moves it.

Scope and risk

scripts/scip_harness/run_typescript_delta.sh (the member loop in index_workspace), scip_merge_indexes.py (owned_by, --failed-project, --paths, --failed-paths), scip_to_delta.py (--failed-files, _ts_symbol_file, _ts_needs_failed_kind), the harness README, the architecture page's TypeScript row, and tests.

Stacked on #1704 (at 817ed0c83; #1963 is merged): until #1704 merges, this diff also shows its commits. Merge after it. skipped_files, delta_version 2 and the stale marks come from #1704. Without a failed member nothing changes: the loop, the merge and the converter take the same path as before, and no --failed-* argument is passed.

A failed member's files stay stale until a later delta converts them while the member indexes: a window that changes them, a config rebuild, or a full pass. The TypeScript tier has no scheduled full pass; it runs one only without a watermark, on its first run or after the window's base commit is gone. That is the stale state #1704 gives a skipped document.

An error of the indexer that is not the member's own but exits 1 (a full disk, say) is treated as a member failure, and the window's files of that member stay stale as above.

Compatibility, rollout and rollback

Tests

  • tests/unit/test_run_typescript_delta_umbrella.py::test_a_failing_member_leaves_the_others_and_lists_its_files: a full pass with packages/lib's indexer exiting 1; exit 0, the log names the member, the converter gets packages/lib/src/b.ts as failed. Fails on Skip a SCIP document that fails to decode or convert; its file keeps its rows, marked stale #1704's head (exit 1).
  • test_a_failing_member_in_a_delta_lists_every_file_it_owns: the converter gets b.ts and c.ts of the failed member, though the window changed only b.ts. Fails on Skip a SCIP document that fails to decode or convert; its file keeps its rows, marked stale #1704's head.
  • test_a_member_killed_by_a_signal_fails_the_pass[134|137]: the pass exits with the member's status, no converter run, no delta.
  • test_a_pass_whose_every_member_failed_fails, test_the_stop_switch_fails_the_pass_on_a_failing_member: the pass fails, no converter run, no delta.
  • tests/unit/test_scip_merge_indexes.py::test_a_failed_member_owns_the_paths_the_merge_would_take_from_it: nested members, a generated target, a root-level member. test_a_failing_sibling_tsconfig_fails_only_the_files_no_sibling_indexed: root tsconfig.app.json and tsconfig.node.json, either one failing; only the files the other did not index are listed.
  • tests/unit/test_scip_to_delta_skip.py::test_failed_files_are_listed_as_skipped: a full run lists them, a window only its own. test_a_document_that_calls_into_a_failed_member_is_skipped_too: with the definition in the index the file has the calls edge to helper; without it and with --failed-files, the file is skipped and listed. Both fail on Skip a SCIP document that fails to decode or convert; its file keeps its rows, marked stale #1704's head. test_a_caller_whose_callee_file_is_outside_the_window_is_skipped: the window holds the caller and another file of the failed member; the caller is skipped and only the window is listed. test_failed_files_are_warned_about_and_counted: one warning line per failed file the delta converts, counted in skipped_failed. test_a_failed_file_whose_name_is_not_utf8_does_not_stop_the_run: the list as the merge writes it, with a name that is not UTF-8; the run succeeds and lists the other file.
  • Run on the branch: test_scip_to_delta_skip.py, test_scip_to_delta_cli.py, test_run_typescript_delta_umbrella.py, test_scip_merge_indexes.py, test_code_delta_stream.py, test_scip_relationship_edges.py, test_code_scip_ts_delta_worker.py, test_scip_harness_windows.py, test_scip_typescript.py, test_code_scip_skipped_documents.py, test_run_typescript_delta_projects.py, test_scip_ts_projects.py, test_tunable_constants.py and test_public_copy.py (270 passed), test_code_scip_stale_mark.py against a local ClickHouse (16 passed), and the unit tests of Skip a SCIP document that fails to decode or convert; its file keeps its rows, marked stale #1704's callers, impact, epistemic and Go worker changes. ruff check and ruff format --check on the touched files, the function-length gate (52, baseline 52), scripts/gates/mypy_gate.py (0 errors), shfmt 3.10.0 on the harness and Prettier on the page and the harness README pass; mypy on the two harness modules alone reports 58 errors, as on Skip a SCIP document that fails to decode or convert; its file keeps its rows, marked stale #1704's head. 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.

  • 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: none are affected.
  • A new migration is additive and numbered after the latest on main; no merged migration is edited: no migration.
  • 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 TypeScript row of docs/architecture/code-index-architecture.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
Changes compiler-tier indexing, versioned delta apply, and staleness semantics that affect caller/impact epistemics; mixed-version rollout is documented but apply paths and git edge cases are subtle.

Overview
Extends the compiler-tier pipeline so partial indexer failures no longer wipe or block unrelated files, and downstream answers treat skipped/stale compiler coverage as a lower bound.

TypeScript umbrella / multi-project runs: One member whose scip-typescript exits with an ordinary error no longer fails the whole pass. Successful members are merged; files owned by the failed member are passed to the converter as --failed-files, emitted in skipped_files as delta_version 2, and left in the index with stale marks until a later pass converts them. Shared projects, signal kills (OOM/SIGKILL), “every member failed”, and LOOM_CODE_SCIP_STOP_ON_FAILED_DOCUMENT still fail the pass. scip_merge_indexes.py gains failed-member path ownership; plans and file lists move to NUL-terminated encoding so paths with tabs/newlines are not dropped.

SCIP delta conversion (all tiers): scip_to_delta.py skips documents that fail parse/convert (optional fail-fast via env/setting), lists them in skipped_files, bumps delta_version to 2 when any are skipped, and avoids emitting partial edges when constructors or TypeScript definitions live in skipped/failed files. Harness scripts (lib.sh, C++, Go MODULES_FILE, TS plan I/O) adopt NUL-separated git_paths consistently.

Server apply & reads: Delta parsing/apply understands skipped_files and version gating; compiler passes retire stale marks via scip_applied:* state and retire_published_marks; code.callers / impact epistemic adds scip_stale_files when the namespace has marked-skipped files; constructor-call completeness checks respect stale marks. Docs, config schema, and rolling-upgrade rule 78 document N vs N-1 behavior for version-2 deltas and mark retirement.

Reviewed by Cursor Bugbot for commit 4cfab66. Bugbot is set up for automated code reviews on this repo. Configure here.

KaloyanNaumov and others added 30 commits November 28, 2026 13:16
…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>
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>
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>
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>
The constructor-coverage probe cached the bit and the stale-mark read
together for an hour, so a process that answered `exact` after a clean
full run kept answering `exact` after a later delta marked an edge-free
file stale. The cache now holds only the `code_index_state` read (the
`scip_ctor_calls` bit and the parser stamp); while the bit is set, the
marks are read on each call, which happens only for a constructor seed
with no edges. A mark is then seen on the next answer, and so is its
clearing by a converting delta. A failed marks read lowers that one
answer and is not cached.

Signed-off-by: Kaloyan Naumov <knaumov@gmail.com>
Conflicts in tests/unit/test_code_delta_stream.py: main checks that the
delta file is closed with _delta_is_open; this branch passes tier="clang"
to apply_delta. Both are kept. tests/analyzer/shapes.txt takes main's
removal of a code_context_packs shape and keeps this branch's
code_index_state shape.

Signed-off-by: Kaloyan Naumov <knaumov@gmail.com>
The previous build applies version-1 deltas and never empties a mark. When
it converts a file this build marked, it refreshes the file's compiler rows
and moves the watermark, and the mark kept the file stale and constructor
coverage incomplete with no later pass to clear it.

scip_stale_paths and scip_stale_marks now count a mark only while no
compiler-tier symbol or edge row of its file has a higher version: a delta
that applies or deletes the file writes one, whichever build runs it. The
integration test applies a skipped document with this build, then a clean
delta with the apply the previous build runs, and checks that the file reads
fresh and coverage complete, and that a mark written after the refresh
counts again.

Signed-off-by: Kaloyan Naumov <knaumov@gmail.com>
…he mark [allow-secret]

The `_marks_in_force` docstring and the `SCIP_STALE_PREFIX` comment said a
delta that applies or deletes a file always writes a compiler-tier row. The
key diff writes no row for a file whose conversion equals the rows it holds,
and deleting a file that has no compiler rows writes none either. In both
cases the mark keeps counting, which fails closed. Comments only.

Signed-off-by: Kaloyan Naumov <knaumov@gmail.com>
…ocument-r20

Signed-off-by: Kaloyan Naumov <knaumov@gmail.com>
A round inserts its symbols and its edges separately. A retry of a skipped
file whose edge insert failed after its symbol insert left a symbol row
newer than the mark, so the reads dropped the mark although the edges and
the watermark were never written, and constructor coverage read complete.

A refresh now retires a mark only once the mark's tier has also moved its
watermark after the file's newest compiler row. Every build writes the
watermark after the whole apply, so the previous build's completed refresh
still retires the mark. The integration test fails the edge insert of a
retry and checks the mark still counts, then completes the refresh and
moves the watermark.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Kaloyan Naumov <knaumov@gmail.com>
scip_merge_indexes.py parsed each member's index as one scip.Index, and
python-protobuf refuses a whole message when any string in it is not
UTF-8. scip-typescript writes such strings, so one document failed the
merge, and the pass, after every member had been indexed.

The merge now reads the top-level records and each document's
relative_path with the converter's reader, applies the same ownership
rule, and writes the kept records out byte for byte. Nothing is decoded,
the parts are memory-mapped, and the converter decides what to do with a
document it cannot read.

The output is written beside its target and swapped in with os.replace,
so --output may name one of the inputs while those are still mapped.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Kaloyan Naumov <knaumov@gmail.com>
git_paths prints a name as the tree stores it, and scip_ts_projects.py read
the window lists as strict UTF-8. One file name with a Latin-1 byte anywhere
in the window, a Markdown file included, raised UnicodeDecodeError, so the
TypeScript pass exited 1 and the watermark stayed where it was on every pass.

The lists are decoded with os.fsdecode, as Python decodes argv, so a path
compares equal to a member path given on the command line; the selected
members are written back with os.fsencode, byte for byte.

The harness test commits a TypeScript edit beside caf\xe9.md and expects
only the edited member to be indexed; the helper test reads and prints a
member whose name is not UTF-8 with a strict stdout.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Kaloyan Naumov <knaumov@gmail.com>
Any later watermark write of the tier retired a mark over the rows of an
apply that failed part way: a completed apply that did not name the file,
a window with nothing to apply, or the delta after a failed full run,
which holds only the files changed since the watermark.

Every apply now reads the tier's marks and writes those still in force
again with the commit they hold, and each delta worker does the same
before it moves the watermark over a window with nothing to apply. The
failed apply's rows stay older than the mark, so the watermark no longer
retires it. `scip_stale_marks` returns each mark's commit for that write.
The previous build writes no marks, so its watermark write still does.
The integration tests run the three orders against ClickHouse.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Kaloyan Naumov <knaumov@gmail.com>
The Go worker moved its watermark after the module loop even when the
harness skipped every module and wrote no delta. No apply ran, so
nothing wrote the tier's marks again, and the watermark retired the mark
of an earlier failed apply. It now writes the marks in force again before
that watermark write when no delta was applied, as the other three delta
workers do on their no-change path.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Signed-off-by: Kaloyan Naumov <knaumov@gmail.com>
Signed-off-by: Kaloyan Naumov <knaumov@gmail.com>
The test wrote caf\xe9.md into the working tree, which macOS rejects with
Errno 92 before the filter runs. It now stores the name in a commit built
with hash-object, update-index --cacheinfo, write-tree and commit-tree, so
no file with that name is created and git_paths prints it from the tree as
in production. It still fails on main (UnicodeDecodeError in the filter)
and passes with the fix.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Signed-off-by: Kaloyan Naumov <knaumov@gmail.com>
_top_level_records cut a record to the bytes that were left when its
declared length ran past the end of the data. The merge then wrote a
fresh header for the shorter slice, so a truncated or damaged part came
out as a valid document where the whole-index parse had refused it. The
converter read the same slice and converted it.

The reader now raises ValueError naming the offset and how far the record
overruns. The merge stops with the part's name for that error and for a
part that ends inside a record header.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Signed-off-by: Kaloyan Naumov <knaumov@gmail.com>
A round writes its symbols and its edges in separate inserts, so neither a
compiler row of the file nor a later watermark write shows that an apply of
the file completed. The previous build writes both and never writes marks, so
its watermark write could retire a mark over a retry that failed between the
two inserts. A mark now counts while it is set; only this build's apply of the
file empties it, after every round has landed. The re-stamp before each
watermark write is no longer needed and is removed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Kaloyan Naumov <knaumov@gmail.com>
_top_level_records bounds-checked length-delimited records only. A
fixed32 or fixed64 field cut short was skipped by moving past the end of
the data, so a part whose valid records were followed by one payload byte
merged and converted with exit 0 where the protobuf parser refuses the
index.

The reader now refuses what the parser refuses and raises ValueError in
the existing form: fixed32 and fixed64 spans that run past the end, a
varint or tag that runs off the end or exceeds ten bytes, field number 0,
and unbalanced or mismatched groups and wire types 6 and 7. A closed
group in an unknown field is skipped, as the parser skips it. The merge's
IndexError branch is gone because the reader no longer raises it.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Signed-off-by: Kaloyan Naumov <knaumov@gmail.com>
The merge put `scip_stale=bool(marked)` into `handle_code_impact` and took the
function to 201 lines, past the 200 the ratchet allows for a function with no
baseline entry (`function_length_gate`: "1 function(s) over 200 lines (baseline
0)"). `server/code/app/symbol/impact.py` at upstream main is 200 and clean, so
the regression is the union, not either side.

The co-change gap block (its precision-floor note, the nested import and the
call) moves into `_co_change_gaps`, which is what the ratchet asks for. No
behaviour change: same call, same floor, same rows.
Both sides added a boolean setting, so the generated `boolean` count in
`docs/reference/status.md` moves from 56 to 57. `scripts/codegen/docs_reference.py`
regenerated it; no other page changed.
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.
…ation

One conflict, and one generated snapshot the auto-merge got wrong.

server/code/app/symbol/coverage.py: upstream names a failed constructor-state
read's kind (`caller_text`) and serves it in `degraded` on every answer that
reads the lowered answer from the cache; this branch splits the read into
`_ctor_state`, cached, with the stale-marks check on every call outside it.
The split stays and the failure kind rides in the cache's third field, so a
cached lowered answer is still named.

docs/architecture/rolling-upgrades.md: upstream has not touched the file since
dea732e, so the list stands at 1..73, one copy of each number. Rule 73 (a
SCIP delta that lists skipped files) and the operations-doc pointer to it are
unchanged.

tests/analyzer/shapes.txt: regenerated (`python -m tests.analyzer.corpus
--write`), never hand-edited. The applied-record exclusion this branch added to
the code_index_state read had never been written to the snapshot; the merge
otherwise kept the old line.
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.
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 sibling-reference case now keeps the independent result. The tab-separated plan still truncates member 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 shell formatting fix is present. Tab-containing TypeScript member paths are still split, and the Go harness still loses a trailing newline from a module directory. Either can advance the index without that member’s rows. TypeScript finding Go finding

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 degraded-exception inventory reports the worker enrollment challenge on the clean CI base and this merge. The same test passes on current main with the merged inventory fix. The unit job also reports four remaining SCIP inventory entries. Unit job · Merged fix #2132.

# Conflicts:
#	docs/operations/upgrades.md
#	server/code/app/symbol/coverage.py
# Conflicts:
#	docs/architecture/rolling-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.
A member directory is a path: it may hold a space, a tab or a newline, and none of
them is a field break. The plan was tab-separated, so `packages/li<TAB>b` was read as
target `packages/li` with a stray `b` in the own field; the indexer ran a directory git
does not hold, the pass exited successfully with no skip record for the member, and the
worker retired the compiler rows that member's files held. discover and filter printed
one path per line, which cuts a directory whose name holds a newline.

`write_plan` returns records of fields and `main` writes every field NUL-terminated;
discover and filter print one NUL-terminated name per record. The harness reads the plan
with `read -r -d ''` per field (a record cut short stops the pass rather than indexing a
truncated target) and the lists with `mapfile -t -d ''`.

Tests: `test_a_member_directory_holding_a_tab_is_indexed_whole` (red: the indexer ran
`packages/li`; green: the run's target is the whole directory), through the real script
with a stub indexer. `test_filter_reads_and_prints_names_that_are_not_utf8` and the
`write_plan` cases follow the record shape.
`$(dirname -- "$m")` strips the trailing newlines of a module directory, so a tracked
directory whose name ends in a newline was `cd`-ed as a missing path: the module was
skipped, and the worker advanced the watermark with no delta for it. `${m%/*}` keeps the
name; a module at the checkout root has no separator and stays `.`.

The selected-module list could not carry such a directory either: `_harness_env` joined
it with newlines into `MODULES`. It now writes the list beside the deltas, NUL-separated,
and sets `MODULES_FILE`; the harness reads that file first (`MODULES` stays for a human
at a terminal).

Tests: `test_a_module_directory_ending_in_a_newline_is_indexed` (red: scip-go never ran
in `svc/e\n`, the pass skipped it; green: it runs, and the delta lands) and
`test_selected_modules_reach_the_harness_nul_separated` (red: `MODULES_FILE` unread, the
harness discovered every module; green: only the selected two), through the real script
with stub scip-go/go/converter. `_harness_env`'s test asserts the file's bytes.
The merge that took upstream main's rules 73-75 renumbered this branch's rule to
76; the pointer in the code-index operations table still said 73.
… reads are listed

`_marked_stale` and `_ctor_edge_coverage` serve a smaller answer on a failed marks read
(the answer falls to a lower bound, the ctor claim drops) and recorded nothing: the
inventory test found four unnoted broad handlers in the SCIP paths on this head. Both now
call `degradations.partial("code_index", "scip_stale_marks_unread", caller_text(e))`
beside the note they already returned. `_gone_at` and `retire_published_marks` are reads
of the apply pass with no response path, so they join `degraded_unnoted.txt` as
`logged_only_nonanswer` with that reason.

`test_degraded_unnoted.py` passes (was 4 missing entries); the ctor/mark-retirement suites
are unchanged and green.
@KaloyanNaumov

Copy link
Copy Markdown
Contributor Author

Merged main (5301f2920) and answered both remaining findings at c00d8e05e.

Tab in a TypeScript member path. The index plan is now a NUL-separated field file instead of a newline-separated one: the writer emits os.fsencode(field) + b"\0" and every read site takes NUL-delimited fields, so a target containing a tab survives plan -> argv -> the indexer's raw bytes. The red case produced packages/li where the target was packages/li\tb.

Go trailing newline. The module list is written beside the deltas NUL-separated and read through MODULES_FILE; a module svc/e\n is now carried rather than skipped with a zero exit.

Also on this head: the inventory job records a partial degradation where a coverage write is missing, and the doc rule moved to 76 to sit after main's 73-75.

…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`.

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

Failed members can still lose compiler rows. The stack also carries the Go retry gap. GitHub reports a conflict in the rolling-upgrade guide. Please reconcile it with main.

scripts/scip_harness/scip_merge_indexes.py:171 — P2 — A document under a project with non-UTF-8 path bytes loses its owner. The document key uses replacement decoding while the selected project argument retains the original bytes. A protobuf fixture with one owned document and one reference under distinct non-UTF-8 paths keeps neither. Use the same lossless decoding for both keys.

*" ${pair_run[i]} "*) ;;
*) continue ;;
esac
case "$failed_members" in

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 — The failed-member list conflates a member with a newline-separated part of another member's path. A real harness run failed both packages/long\npackages/lib and packages/lib, then listed only the longer member's file in skipped_files. The shorter member's prior rows can be retired. Deduplicate by whole path and cover both failed members.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed in 19e2b98. The failed members were collected in a newline-separated string, so a member whose path holds a newline contained another member as a line. They are now kept in an array keyed by the whole path, and each reaches the merge as its own argument. test_a_failed_member_is_not_conflated_with_a_line_of_another_members_name fails both members as in your run and checks that the files of packages/lib and of packages/long\npackages/lib are both listed.

Comment thread server/code/store/index/symbols.py Outdated
record to a mark it was not written for. One insert for both families."""
values = {f"{SCIP_STALE_PREFIX}{tier}:{p}": "" for p in paths}
values.update({f"{SCIP_APPLIED_PREFIX}{tier}:{p}": "" for p in paths})
await self.set_states_batch(org, ns, values)

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 — Clearing stale marks can exceed ClickHouse's 128 KiB limit for a bound form field. Encoding 200 distinct 334-byte paths with the pinned driver yields 141,200 bytes. Batch the clear by encoded size so a recovery can finish.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This is fixed by #1704's commits 29d0998 and 18a8cdb, which cut the clear and the applied record by rendered size, and which this branch carries (merged at 635abb6). test_a_clear_of_a_round_of_long_paths_never_renders_a_field_past_the_bound in tests/unit/test_code_scip_stale_field_bound.py clears 200 paths of 334 bytes and checks that no field passes 128 KiB. It passes on this head, and this branch adds no code for it.

One conflict: docs/architecture/rolling-upgrades.md. Main now holds rules 75
(read receipts), 76 (the session's run on a run row) and 77 (worker copies), so
this branch's rule for a SCIP delta that lists skipped files is rule 78. The
pointer in docs/operations/code-index-operations.md follows it.

Assisted-by: Claude Code:claude-sonnet-5-5
Signed-off-by: Kaloyan Naumov <knaumov@gmail.com>
The harness collected the failed members in a newline-separated string and skipped
a member whose name appeared in it as a line. A member whose path holds a newline
(`packages/long` + newline + `packages/lib`) contains the line `packages/lib`, so when
both members failed the shorter one was never passed to the merge, and its rows
could be retired as if it had not failed.

The seen-set is now an associative array keyed by the whole member path. The members
still reach the merge as separate arguments, so no byte of a path is altered.

Test: test_a_failed_member_is_not_conflated_with_a_line_of_another_members_name
(red: only the longer member's file was listed as failed).

Assisted-by: Claude Code:claude-sonnet-5-5
Signed-off-by: Kaloyan Naumov <knaumov@gmail.com>
… 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>
…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>
`_run_repo` now syncs submodule URLs through the compiler tier's own `git` (ClickHouse#2080), which
the test's temporary checkout cannot run, so test_a_window_with_nothing_to_apply_keeps_the_mark
failed before it reached the window. The test stubs `update_submodules` beside `git`.

Assisted-by: Claude Code:claude-sonnet-5-5
Signed-off-by: Kaloyan Naumov <knaumov@gmail.com>
@KaloyanNaumov

Copy link
Copy Markdown
Contributor Author

Rolling-upgrade guide: reconciled with main. Main now holds rules 75 to 77, so this branch's rule is 78, and the pointer in the operations doc follows it.

The non-UTF-8 owner in scip_merge_indexes.py: fixed by #1704's commits 1b07f07 and 18a8cdb, which decode a member's name and its documents' paths as one key; merged at 635abb6. test_merge_keeps_a_document_of_a_member_whose_directory_is_not_utf8 in tests/unit/test_scip_path_encoding.py covers it and passes on this head.

The Go retry gap: it arrives with #1704's head (41352d5), which this branch now carries.

Two things beyond the findings: the status.md count is regenerated after the merge, and test_a_window_with_nothing_to_apply_keeps_the_mark stubs the submodule sync that main added in #2080, since the test's temporary checkout cannot run it.

@zlareb1 please take another look.

@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 4cfab66. Configure here.

continue
owners = _preferred_owners(known_projects, path)
if any(_member_id(owner) in failed for owner in owners):
out.append(path)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Kept paths still marked failed

Medium Severity

owned_by skips a path only when it is already in kept, but the candidate list is decoded with surrogateescape while merge_indexes returns replace-decoded keys. A non-UTF-8 path a sibling actually indexed fails that check, is written to the failed list, and the converter marks it skipped instead of using the merged document.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 4cfab66. 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 whole-path deduplication and stale-mark batching address the earlier TypeScript findings. This head includes the Go failure-record parser from the SCIP stack. A module directory containing the parser's delimiter can still disappear from the retry map. The stack's mixed-version recovery and downstream coverage findings also remain.

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.

2 participants