A symbol-stage re-chunk leaves callers that sort before a new definition declined

Aperta
#1,965 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

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
45/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
python
Ambito
backend, databases

Direzione di ricerca

Read ingest_pass._maybe_rechunk, _rechunk_batch in reconcile.heal, and the edge-stage inputs in server/code/domain/extract/extractor_stamp.py; trace how batches change the name table and how dependents are normally re-resolved. Check existing tests for rechunking and dependent resolution, then add coverage for both a newly added name and a removed name. Done means callers reflect the final migrated name table after rechunking completes.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Company

Independent

Component

Code index

Describe what's wrong

When an extractor change moves the symbol stage, the re-chunk (ingest_pass._maybe_rechunk) re-derives every live file in sorted path order, in batches through reconcile.heal (_rechunk_batch). STAGE_INPUTS["edge"] = ("symbol",) (server/code/domain/extract/extractor_stamp.py), so the edge stage re-runs with it, and each file's edges resolve against the name table as it stands when that file's batch runs.

If the new symbol extraction gains a name in some file (a definition the old extractor missed), a caller in another file whose path sorts before it is re-derived while the name is still absent, and its call site is declined unresolved. The definer's batch then adds the name, but nothing re-resolves the caller: the re-chunk does not run the dependents step that a commit and a reconcile heal run over what they changed, and the caller's blob did not move, so no later reconcile finds it stale. The site stays declined until a commit touches the calling file.

A stage move that drops a name has the mirror effect: a caller earlier in path order keeps its edge into the definition until the definer's batch tombstones the symbol, and the edge is then left pointing at a retired symbol.

Does it reproduce on the latest release or main?

Not checked

How to reproduce
  1. Index a namespace whose a/caller.cpp calls helper(), defined in b/lib.cpp in a form the current symbol extractor does not emit, so the call site is declined unresolved.
  2. Change the symbol extractor so it emits helper, which moves the symbol stage's stamp.
  3. Let the worker's re-chunk finish (code_index_state key extractor_stamp reaches its target).
  4. a/caller.cpp still has its declined helper site and no edge into helper; re-ingesting a/caller.cpp by hand binds it.
Expected behavior

After a stage migration completes, every caller resolves against the name table the migration produced, as it would after a full backfill with the new extractor.

Environment

main, code index fast tier.

Related issues and pull requests

Related: https://github.com/ClickHouse/loom/issues/1680

How this was found

An AI tool found it, and I have not reproduced it myself

Additional context

Running the per-commit dependents step after each re-chunk batch is the obvious fix and the wrong one: a whole-repository migration changes many names per batch, so every batch would hit code_closure_repair_max_names (500) and fill code_ingest_dependents_pending_max (5000). One dependents sweep after the cursor completes, over the union of what the batches added and removed, or a second edges-only pass over the files that hold declined sites or edges into names the migration changed, fits the shape better.

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

Apri in Codespaces

Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di ClickHouse/loom

Tutte le issue di ClickHouse/loom

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.