A C++ full run claims ctor_calls although its constructor scan skipped a document
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 40/100
Direzione di ricerca
Read scripts/scip_harness/scip_to_delta.py, especially _prepare and DeltaStream.tail, then follow how features are applied in server/code/app/index/scip_delta.py and read constructor coverage in server/code/app/symbol/coverage.py. Start by running the reproduction against #1704's head and compare its output with the case where the skipped document is listed in changed.txt. The reported claim-withholding fix has tests in a follow-up pull request; the separate question of clearing previously recorded state still needs a maintainer decision.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
TL;DR: On #1704's head, DeltaStream.tail claims the ctor_calls feature whenever the window's skipped_files is empty, and ignores _run.ctors_complete. A C++ --full run passes --changed-files, so a document the constructor scan skipped outside that list never reaches skipped_files, and the apply records the namespace as carrying constructor calls. I found no input where this makes an answer wrong; the claim is wider than the scan behind it, and the recorded bit is never withdrawn.
Company
Independent
Component
Code index
Describe the situation
This is a follow-up to #1704, which adds the code it concerns. Cursor Bugbot raised the first part on that pull request (thread r4765529741). All line numbers are on #1704's head 226a92c4a638f6f0a985950d33bdeafd6e5163b1; upstream/main at 82dc31216fd252db028fa57eca570fe87258e64a has neither _Skips nor ctors_complete.
_prepareruns the constructor scan_ctor_overloadsover every document in the index and setsctors_completeto false when that scan skipped one (scip_to_delta.py:1054-1058).DeltaStream.taillists asskipped_filesonly the skipped documents inside the window (:1339-1343), then claimsctor_callswhenself._claims_ctor_calls and not skipped(:1354). It never readsself._run.ctors_complete.- The C++
--fullharness runs--fulltogether with--changed-filesset to every trackedsrc/*,base/*andprograms/*file (run_delta.sh:100-105,:178-183), sochangedis notNoneand_Skipsis not inwholemode (:1302). A document outside those paths that fails to decode, a header undercontrib/for example, is counted inskipped_failedand warned on stderr, but is not inskipped_files, anddelta_versionstays 1. apply_deltarecordsscip_ctor_callswhenever the feature is present (server/code/app/index/scip_delta.py:293-302)._ctor_edge_coveragethen reads the compiler tier as carrying constructor calls unless a compiler-tier file is marked stale (server/code/app/symbol/coverage.py:183-199), and_ctor_edges_absentis false for a compiler-covered seed (:231-243), so an emptycode.callersanswer for a constructor has noctor_edges_absentcause.
What I could not show is a wrong answer. A factory call in a window file whose type's constructors the scan missed is itself skipped and listed (_OverloadsIncomplete, :732 and :1194-1197; test_a_factory_caller_keeps_its_rows_when_the_overload_scan_misses_a_document), and in a C++ --full run every tracked source file is in the window. So the constructor answer rests on a scan that is known to be incomplete, but I have no input where an edge is missing from a converted file because of it.
A second part is open: scip_ctor_calls has one write site on the server (scip_delta.py:298) and nothing clears it. A later run that withholds the claim, with this change or because a window file was skipped and marked, leaves the bit an earlier clean run set. Only a stale mark in the window lowers the answer again (coverage.py:195-199); a scan that misses a document outside the window does not.
Does it reproduce on the latest release or main?
Yes, on #1704's head. The code does not exist on main yet.
How to reproduce
From a checkout of #1704's head, with the server's virtualenv. An index of two C++ documents, one inside the window and one outside it whose text field is not valid UTF-8:
mkdir -p root/src && echo 'int x;' > root/src/a.cpp
python3 - "$PWD/root" t.scip <<'PY'
import importlib.util, 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()
index.metadata.project_root = "file://" + sys.argv[1]
for path, text in (("src/a.cpp", "ok"), ("contrib/bad.h", "ZZBADUTF8ZZ")):
doc = index.documents.add()
doc.relative_path, doc.text = path, text
doc.symbols.add().symbol = "cxx . . $ DB/A#"
raw = index.SerializeToString().replace(b"ZZBADUTF8ZZ", b"\xff\xfeBADUTF8ZZ")
open(sys.argv[2], "wb").write(raw)
PY
printf 'src/a.cpp\n' > changed.txt && : > deleted.txt
python3 scripts/scip_harness/scip_to_delta.py --index t.scip --commit abc --full \
--changed-files changed.txt --deleted-files deleted.txt --source-root root --dry-run out.json
python3 -c "import json; d = json.load(open('out.json')); print({k: d.get(k) for k in ('delta_version', 'skipped_files', 'features', 'stats')})"
{'delta_version': 1, 'skipped_files': [], 'features': ['ctor_calls'], 'stats': {'factory_ctor_edges': 0, 'skipped_generated': 0, 'skipped_failed': 1}}
With contrib/bad.h added to changed.txt, the delta has skipped_files ['contrib/bad.h'], delta_version 2 and no features.
Expected behavior
tailclaimsctor_callsonly whenself._claims_ctor_calls and self._run.ctors_complete and not skipped, so a scan that missed any document withholds the claim. With the feature absentapply_deltawrites noscip_ctor_calls, andcode.callersreads a constructor's empty answer aslower_boundwithctor_edges_absent; no server change is needed. I have this as a follow-up pull request for after #1704 merges, with two tests: the converter withholds the claim when the scan skipped a document outside its files, and the converter-to-apply-to-code.callerspath ends inlower_bound.- Open: whether a run that withholds the claim should clear
scip_ctor_calls, for example by the apply writing the state0when a full run's delta lacks the feature. Today the bit stays set after a clean full run until a mark lowers it. This needs a maintainer decision, since it makes the apply write state for a delta that does not name a feature.
Environment
#1704 head 226a92c4a638f6f0a985950d33bdeafd6e5163b1; Loom main at 82dc31216fd252db028fa57eca570fe87258e64a for the comparison.
Python 3.12, python-protobuf, the vendored scip_pb2; scip_to_delta.py in --dry-run mode, no ClickHouse and no scip-clang.
Related issues and pull requests
Related: https://github.com/ClickHouse/loom/pull/1704
Additional context
How this was found
Found and reproduced with AI assistance.
Redaction
- I removed tokens, keys, passwords and personal or customer data from everything above.
- Lingua principale
- Python
- Stelle
- 263
- Fork
- 47
- Merge medio
- 14h 21m
- PR unite (30g)
- 873
Preparare l'ambiente
Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.
- Include un Dockerfile o un file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di ClickHouse/loom
-
Difficoltà 1/5 1-3 ore Idoneità per principianti 76/100
ClickHouse/loom#2014 ·
I maintainer di solito rispondono entro 1 giorno
-
Options of loom period-digest, reextract, reconcile-status and demote-activity-narration print no help textForse già presa @VanshajPoonia l’ha presa oggi. Apertabug good first issue help wanted up-for-grabs
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
ClickHouse/loom#1988 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
A compiler-tier checkout fetch from a shallow mirror never records its headForse già presa @KaloyanNaumov l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 35/100
ClickHouse/loom#2016 ·
I maintainer di solito rispondono entro 1 giorno
-
Delta workers fetch the compiler-tier checkout under a hard-coded 600 s limitForse già presa @KaloyanNaumov l’ha presa oggi. Aperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 35/100
ClickHouse/loom#2012 ·
I maintainer di solito rispondono entro 1 giorno
-
loom participant retire cannot retire an orphaned participant after container replacement or host rebootForse già presa @l0K1ngg l’ha presa oggi. Apertabug help wanted up-for-grabs
Difficoltà 4/5 3-5 giorni Idoneità per principianti 48/100
ClickHouse/loom#2007 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di ClickHouse/loom
Issue simili
-
Ubuntu for Debian DevelopersApertaDMB documentation good first issue help wanted
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
ubuntu/ubuntu-project-docs#921 ·
I maintainer di solito rispondono entro 1 giorno
-
⏳ Pending feedback 🐛 Bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
jumpserver/jumpserver#18282 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
accepted
Difficoltà 2/5 1-3 ore Idoneità per principianti 67/100
future-agi/future-agi#5274 ·
I maintainer di solito rispondono entro 1 giorno
-
needs-triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
I maintainer di solito rispondono entro 2 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
GenericMappingTools/pygmt#5014 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno