Repository navigation
Description
Company
Independent
Component
Code index
Describe what's wrong
One SCIP document that python-protobuf cannot decode fails the whole compiler-tier pass, on every pass. scripts/scip_harness/scip_to_delta.py parses each document with ParseFromString, and a document with a string field that is not valid UTF-8 raises DecodeError: String field had bad UTF-8. The converter exits non-zero, the harness fails, the tier writes no delta and its watermark stays where it was. The next pass indexes the same tree and fails on the same document.
We hit it on the TypeScript tier: scip-typescript wrote a few such documents in a large index, and no pass for that repository completed. Every compiler tier and the full index run through the same converter, so any of them can fail this way on one document.
Does it reproduce on the latest release or main?
Yes
How to reproduce
From a checkout of main, with the server's virtualenv:
import importlib.util, subprocess, sys
spec = importlib.util.spec_from_file_location("scip_pb2", "scripts/scip_harness/vendor/scip_pb2.py")
pb = importlib.util.module_from_spec(spec)
spec.loader.exec_module(pb)
index = pb.Index()
for path, name in (("src/a.cpp", "f"), ("src/bad.cpp", "ZZBADUTF8ZZ")):
doc = index.documents.add()
doc.relative_path = path
occ = doc.occurrences.add()
occ.symbol = f"scip-clang cxx . . DB/{name}(aa)."
occ.symbol_roles = pb.SymbolRole.Definition
occ.range.extend([0, 5, 6])
raw = index.SerializeToString().replace(b"ZZBADUTF8ZZ", b"\xff\xfeBADUTF8ZZ")
open("/tmp/bad.scip", "wb").write(raw)
subprocess.run([sys.executable, "scripts/scip_harness/scip_to_delta.py", "--index", "/tmp/bad.scip",
"--commit", "h" * 40, "--source-root", "", "--full", "--dry-run", "/tmp/delta.json"])The run exits 1 and writes no delta, although src/a.cpp is a valid document.
Expected behavior
A file that cannot be processed does not fail the repository's pass. The document that cannot be decoded or converted is skipped and logged, and the delta carries the other documents. The file keeps the compiler rows of its last successful conversion, and they read as stale until a later pass converts it. A full run does not retire them. An index that cannot be read to its end (truncated or corrupt framing) still fails the run. One setting lets an operator fail the pass on such a document instead, as now.
Error message and logs
google.protobuf.message.DecodeError: Error parsing message with type 'scip.Document': String field had bad UTF-8
Environment
Loom 1.3.0 (main 26f8753bc), Python 3.12, protobuf 7.36.2 from the server's virtualenv. Reproduced with the snippet above on main. First seen on a self-managed deployment of the 1.3 line, TypeScript tier, index written by scip-typescript.
How this was found
I found and reproduced it myself
Redaction
- I removed tokens, keys, passwords and personal or customer data from everything above.
Activity