Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

AST-only update drops EXTRACTED code→semantic edges (watch.py sem_edges filter)

Aperta Adatta ai principianti
#3,763 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à
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
86/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
python
Ambito
devtools

Direzione di ricerca

Inizia in graphify/watch.py, nella fusione AST-only utilizzata da graphify update, quindi riproduci il problema con l’arco code-to-semantic EXTRACTED documentato. Aggiorna il comportamento di conservazione degli archi semantici e verifica che l’arco sopravviva a una ricostruzione AST-only senza perdere la gestione esistente dei nodi.

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

Descrizione

Summary

On an AST-only rebuild (graphify update / the watch path), watch.py preserves semantic nodes (any node with file_type != "code") but only preserves edges whose confidence is INFERRED/AMBIGUOUS or whose both endpoints are non-code. As a result, EXTRACTED edges that connect a code node to a preserved semantic node (e.g. a script node → an external service/database node) are silently dropped on every update, even though both endpoints remain in the graph.

Impact

Cross-file semantic relationships (script → external system, code → doc concept) vanish on the next graphify update, so the graph loses information the semantic pass had already extracted. They only come back after another full semantic run. This is easy to miss because the update still prints a successful rebuild.

Reproduction

  1. Build a graph with a semantic pass that adds, for example:
    • node Salient_Cloud_SFTP with file_type: document (any non-code type)
    • edge script_py -> Salient_Cloud_SFTP with confidence: EXTRACTED
  2. Run graphify update ..
  3. The node survives; the edge is gone.

sem_nodes keeps anything non-code, so the node persists. sem_edges requires source not in code_ids and target not in code_ids, so a code→semantic edge fails the predicate and is discarded.

Relevant code

graphify/watch.py (AST-only merge, preserving semantic nodes/edges):

code_ids = {n["id"] for n in existing.get("nodes", []) if n.get("file_type") == "code"}
sem_nodes = [n for n in existing.get("nodes", []) if n.get("file_type") != "code"]
sem_edges = [e for e in existing.get("links", existing.get("edges", []))
             if e.get("confidence") in ("INFERRED", "AMBIGUOUS")
             or (e.get("source") not in code_ids and e.get("target") not in code_ids)]

Suggested fix

Keep any edge attached to a preserved semantic node:

code_ids = {n["id"] for n in existing.get("nodes", []) if n.get("file_type") == "code"}
sem_nodes = [n for n in existing.get("nodes", []) if n.get("file_type") != "code"]
sem_ids = {n["id"] for n in sem_nodes}
sem_edges = [e for e in existing.get("links", existing.get("edges", []))
             if e.get("confidence") in ("INFERRED", "AMBIGUOUS")
             or e.get("source") in sem_ids
             or e.get("target") in sem_ids
             or (e.get("source") not in code_ids and e.get("target") not in code_ids)]

I verified locally that this keeps code→semantic EXTRACTED edges across an AST-only rebuild.

Related observations

  • graphify/validate.py::validate_extraction only warns and never coerces or rejects invalid values, and graphify/build.py prints only real_errors[0]. So many invalid file_type values can accumulate and stay invisible. In one real corpus the single reported error hid 83 issues (71 invalid file_type, 6 missing file_type, 6 edges missing source_file).
  • The shipped skill prompt defines file_type as code|document|paper|image (e.g. skill-windows.md, skill-codex.md, skill-trae.md). That vocabulary omits rationale, which the validator accepts, and is not enforced, so models emit ad-hoc values (python, doc, concept, service, database). Aligning the prompt with VALID_FILE_TYPES (and mentioning rationale) would prevent most of these.
Lingua principale
Python
Stelle
124k
Fork
11.9k
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

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 Graphify-Labs/graphify

Tutte le issue di Graphify-Labs/graphify

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.