[Bug]: a virtual-workspace-root Cargo.toml is re-reported as "produced zero nodes" and re-extracted on every run
Symptom
In a virtual Cargo workspace — root Cargo.toml declares [workspace] members and no [package] — every graphify update . prints this pair, verbatim, forever:
AST extraction: 1/1 uncached files (100%)
warning: 1 source file(s) produced zero nodes and are absent from the graph: Cargo.toml. A re-run will retry them (empties are no longer cached); if it persists, please report the file(s) (#1666).A second run prints the same two lines. In a fresh corpus the file is not recorded in manifest.json at all, while the crate manifests are:
$ python3 -c "import json;m=json.load(open('graphify-out/manifest.json'));[print(repr(k),repr(v['ast_hash'])) for k,v in m.items()]"
'crates/a/Cargo.toml' 'e5669eadddf158022994cfc50f79ec52'
'crates/a/src/lib.rs' 'ba96bc9d26fd26c2697e47c67e3d3c65'In a corpus that has been through older versions the entry survives as the one and only un-hashed entry — measured on a 12-crate workspace:
$ python3 -c "import json;m=json.load(open('graphify-out/manifest.json'));print([k for k,v in m.items() if not v.get('ast_hash')])"
['Cargo.toml']The empty result is intentional
manifest_ingest.py::_parse_cargo emits nothing for a virtual workspace root, on purpose:
A virtual workspace root (
[workspace], no[package]) declares no package of its own — emit nothing rather than a fabricated node.
So the ingest is right and the reporting is what collides:
- A file that is empty-by-design is indistinguishable from a file whose extraction silently failed, so the #1666 bucket can never be empty. That bucket is the only place a genuinely dropped file would surface — a permanent, unsolvable entry in it teaches the reader to skip the line, which is the opposite of what it is for.
- "empties are no longer cached" (post-#2543/#3679) turns that into permanent work: the file is re-detected and re-extracted on every single run and never reaches a cached state, so
AST extraction: N/N uncached files (100%)is the steady state in any workspace of this shape.
Minimal repro (0.9.67, Python 3.14, Linux)
$ mkdir -p m/crates/a/src && cd m
$ printf '[workspace]\nmembers = ["crates/a"]\nresolver = "2"\n' > Cargo.toml
$ printf '[package]\nname = "a"\nversion = "0.1.0"\nedition = "2021"\n' > crates/a/Cargo.toml
$ printf 'pub fn f() -> u32 { 1 }\n' > crates/a/src/lib.rs
$ graphify update .
AST extraction: 1/1 uncached files (100%)
warning: 1 source file(s) produced zero nodes and are absent from the graph: Cargo.toml. ...
[graphify watch] Rebuilt: 3 nodes, 1 edges, 2 communities
$ graphify update . # and again, and again
AST extraction: 1/1 uncached files (100%)
warning: 1 source file(s) produced zero nodes and are absent from the graph: Cargo.toml. ...Measured on a real repo
tessella (Rust, 12-crate workspace, 0.9.67): 3771 nodes / 9096 links (links, not edges).
- No node in
graph.jsonhassource_file == "Cargo.toml". The 12crates/*/Cargo.tomlfiles each contribute exactly 1 package node, and all 28depends_onlinks come from them. Net value of the root manifest in the graph: 0 nodes, 0 links. - The single un-hashed
manifest.jsonentry in the whole corpus is that file (see above), in this workspace and in a second workspace of the same shape (musivum).
Workaround we are shipping
A .graphifyignore entry /Cargo.toml, which removes the permanent warning and the permanent re-extraction at a measured cost of 0 nodes / 0 links (verified by diffing graph.json before/after — the only change is that the warning disappears). We would rather delete that line when this is fixed.
Ask
- Suppress the zero-node warning for paths that
is_package_manifest_path()recognises and that the ingest deliberately leaves empty —manifest_ingestknows the difference; the warning path does not. - Or split the bucket into "no extractable content (by design)" vs "extraction produced nothing (suspect)" and cache the former so it is not re-extracted every run.
- Either way,
AST extraction: N/N uncached files (100%)should not be the permanent steady state for a repo that is fully extracted.
Source: Graphify-Labs/graphify