Repository navigation
fix(skill): a dispatched file with no coverage entry is unread, not complete - #4680
Kalessin-Roke wants to merge 1 commit into
Conversation
…omplete Step B3.5 (Graphify-Labs#2225) compares each file's reported coverage with its real length, so a file the subagent never reported was not checked at all. A subagent that never opened a file could still emit nodes for it, guessed from its name; those were merged, cached as a complete entry and stamped, so no later --update retried the file. Add graphify.cache.drop_unreported_chunk_sources(): a dispatched, non-empty, non-image file with no positive coverage count is unread. What the chunks attribute to it is dropped by source_file (never by id, since a file that was read can mint the same deterministic id); edges and hyperedges from read files are dropped only when they point at an id no kept chunk node, AST node or cached node still carries. A chunk with no coverage map at all is not judged. Step B3.5 calls it and writes partly read and unread files to .graphify_partial.txt in one write, so the existing partial/unstamped path retries them. Both extraction-spec variants now ask for a coverage entry for every FILE_LIST path (0 = never opened, with nothing emitted), forbid nodes derived from a file name, and ask for pages read for a PDF. Follow-up to Graphify-Labs#3987. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Thanks for the pull request, @Kalessin-Roke. A maintainer will review it soon. Want to talk it through while it is in review? Come join us on our Discord server. For longer-form discussion there is also GitHub Discussions. A couple of things that speed up review: make sure the test suite passes on Python 3.10 and 3.13, and that the change keeps extraction deterministic. |
There was a problem hiding this comment.
Graphify reviewed this change.
No issues found by static checks — no coupling regressions or blocking issues in the code graph. That is not the same as safe to merge: see what was not checked.
Not checked: tests were not run; no formal proof of the changed code.
Graphify review — findings
Adds drop_unreported_chunk_sources, which treats a dispatched, non-empty, non-image file with no positive coverage entry as never opened. It drops the nodes, edges and hyperedges guessed for that file from the chunk JSON, and returns the file so it is re-dispatched on the next --update. Items are matched by source_file rather than id, files in chunks that carry no coverage map are left unjudged, and with no coverage map anywhere the check does nothing, so older producers are unaffected. Wires the check into the coverage step of every platform skill template (agents, amp, claw, kilo, kiro and the rest) and the matching generated fragments and expected outputs. The snippet merges unread files into .graphify_partial.txt, prints a separate warning with the dropped-item count, and suppresses the "Coverage OK" message when anything was unread. Replaces the old note that unreported files are "not counted as partial" with the #2225 behaviour, and updates the skillgen tests to match the regenerated skill text.
Review partial — this diff was larger than one review pass covers, so later files were not reviewed; some findings may be missing.
Analysis details — impact, health, verification
Impact & health
Graphify review
Impact — 3609 functions depend on the 1060 functions this change touches.
Health — this change adds coupling hotspots:
- new:
_unreported_fixture()— 6 callers, 4 callees - new:
drop_unreported_chunk_sources()— 5 callers, 4 callees - new:
test_an_unreported_file_is_retried_instead_of_cached_as_complete()— 0 callers, 6 callees
Verification — 3609 functions in the blast radius were not formally verified this run (proofs are advisory here).
Gate & verification
graphify gate
PASS — objectively clean (no health regressions, tests not run — proofs not run this pass (advisory)). Grounded, not self-assessed.
Advisory (not blocking):
- verification_scope: 2300 function(s) in the blast radius were not formally verified this run
Test selection
Test selection
443 of 443 test file(s) selected (100%) via static blast radius.
Escalated to a full run for safety — the selection is not trustworthy on its own (see below). CI should run the whole suite.
tests/pi.test.ts— full-run-safetytests/test_affected_cli.py— full-run-safetytests/test_affected_defines.py— full-run-safetytests/test_affected_member_seed.py— full-run-safetytests/test_affected_overrides.py— full-run-safetytests/test_agents_platform.py— full-run-safetytests/test_alias_folding.py— full-run-safetytests/test_analyze.py— full-run-safetytests/test_anthropic_custom_endpoint.py— full-run-safetytests/test_antigravity_install.py— full-run-safetytests/test_apm_fallback_version.py— full-run-safetytests/test_architecture_doc.py— full-run-safetytests/test_astro_extraction.py— full-run-safetytests/test_astro_import_ids.py— full-run-safetytests/test_atomic_canvas_export.py— full-run-safetytests/test_atomic_version_stamp.py— full-run-safetytests/test_atomic_writes.py— full-run-safetytests/test_backend_env_isolation.py— full-run-safetytests/test_backend_extras.py— full-run-safetytests/test_backend_opt_in.py— full-run-safetytests/test_benchmark.py— full-run-safetytests/test_benchmark_raw_graph.py— full-run-safetytests/test_benchmark_real_query.py— full-run-safetytests/test_blade_extractor.py— full-run-safetytests/test_build.py— full-run-safetytests/test_build_located_semantic_identity.py— full-run-safetytests/test_build_merge_dedup_scope.py— full-run-safetytests/test_build_merge_hyperedges_and_prune.py— full-run-safetytests/test_build_merge_shrink_guard.py— full-run-safetytests/test_builtin_global_type_refs.py— full-run-safetytests/test_c_include_resolution.py— full-run-safetytests/test_cache.py— impact, full-run-safetytests/test_cache_stale_import_target.py— impact, full-run-safetytests/test_callflow_html.py— full-run-safetytests/test_cargo_introspect.py— full-run-safetytests/test_cargo_missing_manifest.py— full-run-safetytests/test_carried_hyperedge_remap.py— full-run-safetytests/test_case_sensitive_resolution.py— full-run-safetytests/test_charmap_encoding.py— impact, full-run-safetytests/test_chunking.py— impact, full-run-safetytests/test_cjs_module_extension.py— full-run-safetytests/test_claude_cli_backend.py— full-run-safetytests/test_claude_md.py— full-run-safetytests/test_cli_broken_pipe.py— full-run-safetytests/test_cli_export.py— full-run-safetytests/test_cli_help.py— full-run-safetytests/test_cloud_cta.py— full-run-safetytests/test_cluster.py— full-run-safetytests/test_cluster_ambiguous_scale.py— full-run-safetytests/test_cluster_exclude_hubs.py— full-run-safety- … and 393 more
non-code file(s) changed (
graphify/skill-agents.md,graphify/skill-amp.md,graphify/skill-claw.md,graphify/skill-codex.md,graphify/skill-copilot.md…) → running the full suite for safety (a code graph can't see config/fixture/data deps)
changed code file(s) with no mapped test (
graphify/skill-agents.md,graphify/skill-amp.md,graphify/skill-claw.md,graphify/skill-codex.md,graphify/skill-copilot.md…) — a coverage gap or a missing link — running the full suite rather than only the selected tests
Selection is safe under the controlled-regression assumption; always-run tests + a periodic full run are the backstops. Advisory — it never changes the check verdict.
Docs that may be stale (advisory)
BENCHMARKS.md§ Harness (lines 37-57): references changed symbolskeyBENCHMARKS.md§ INFERRED cross-file edge precision (FastAPI demo corpus) (lines 152-166): references changed symbolsedgeCHANGELOG.md§ 0.9.94 (2026-10-22) (lines 5-26): references changed symbolsedge,nodeCHANGELOG.md§ 0.9.93 (2026-10-20) (lines 27-53): references changed symbolskeyCHANGELOG.md§ 0.9.90 (2026-10-13) (lines 93-111): references changed symbolsnodeCHANGELOG.md§ 0.9.88 (2026-10-12) (lines 126-150): references changed symbolsfull,nodeCHANGELOG.md§ 0.9.87 (2026-10-12) (lines 151-173): references changed symbolsnodeCHANGELOG.md§ 0.9.86 (2026-10-11) (lines 174-195): references changed symbolsnodeCHANGELOG.md§ 0.9.85 (2026-10-10) (lines 196-218): references changed symbolsedge,nodeCHANGELOG.md§ 0.9.81 (2026-10-08) (lines 254-272): references changed symbolsnode
…and 10 more.
· 3 grounded finding(s) anchored inline below.
| return saved | ||
|
|
||
|
|
||
| def drop_unreported_chunk_sources(out_dir: Path, root: Path) -> tuple[list[str], int]: |
There was a problem hiding this comment.
drop_unreported_chunk_sources()
high coupling complexity (Ca·Ce = 20).
Grounded coupling-delta finding (deterministic), not an LLM guess.
| # chunks attribute to that file by source_file and flags it partial so it is retried | ||
| # (graphify.cache.drop_unreported_chunk_sources). | ||
|
|
||
| def _unreported_fixture(tmp_path: Path) -> dict: |
There was a problem hiding this comment.
_unreported_fixture()
6 callers depend on it (afferent coupling).
Grounded coupling-delta finding (deterministic), not an LLM guess.
| assert len(flagged) == len(set(flagged)), f"a file was flagged twice: {flagged}" | ||
|
|
||
|
|
||
| def test_an_unreported_file_is_retried_instead_of_cached_as_complete(tmp_path, capsys, monkeypatch): |
There was a problem hiding this comment.
test_an_unreported_file_is_retried_instead_of_cached_as_complete()
fans out to 6 callees (efferent coupling).
Grounded coupling-delta finding (deterministic), not an LLM guess.
…ge step #4680 was authored before the #4762 injection hardening, so its B3.5 Python block passed a quoted `Path('INPUT_PATH')` literal to drop_unreported_chunk_sources. That is the exact substitution pattern #4762 removed: a scan root whose name holds a quote or `$()` could break out and run as code. Use the `INPUT_PATH` variable the block already reads from the trusted graphify-out/.graphify_root sidecar, and regenerate the skill artifacts. Caught by test_skillgen_input_path_injection. Co-Authored-By: Claude Opus 4.8 <[email protected]>
|
Landed on v8 as dcf438f via authorship-preserving cherry-pick, released in graphify 0.9.109. Thanks @Kalessin-Roke. (Maintainer follow-up: the B3.5 step was updated to read the scan root from .graphify_root rather than a quoted INPUT_PATH literal, to keep the #4762 injection hardening.) |
|
Follow-up now that this shipped in 0.9.109 (thanks for landing it). One case this PR left open on purpose, and I now think that was the wrong call: a chunk file with no Minimal fixture against 0.9.123: three 3-line files; Why I'd now treat those files as unread:
Suggested change: drop the |
What does this PR do?
Follow-up to #3987 (landed in 0.9.93 for #2225), as discussed in #3987 (comment).
Step B3.5 compares each file's reported
coveragewith its real length, so a file a subagent never reported is not checked ("A file a subagent did not report at all is not counted as partial"). That is the failure I hit in practice: a subagent never opened 4 of 12 files and still emitted 19 INFERRED nodes for them, guessed from their file names. Those nodes were merged, cached as a complete entry and stamped, so no later--updateretried the files.Changes:
graphify.cache.drop_unreported_chunk_sources(out_dir, root)(new). Every dispatched file in.graphify_uncached.txtthat is not an image (graphify.detect.IMAGE_EXTENSIONS), is non-empty on disk and has no positivecoveragecount is unread. What the chunk files attribute to it is dropped bysource_file, not by id (a file that was read can mint the same deterministic id). Edges/hyperedges from read files are dropped only when they point at an id that no kept chunk node, AST node (.graphify_ast.json) or cached node (.graphify_cached.json) still carries. It returns the unread files..graphify_partial.txtin the same write. The existing fix(skill): a partly-read file is no longer a silent, permanent loss #3987 partial/unstamped path then retries them. Because it is one script, there is no new step to run in the right order.A chunk that has no
coveragemap at all (a producer predating the contract, or a subagent that ignored it entirely) is not judged: its files keep their items, as before. Only a missing entry in a run that does report coverage is treated as unread.Type of change
Verification & Invariants
Invariant: a file whose text no subagent read must not end up cached or stamped as complete, and nothing guessed from its name may enter the graph. Items from files that were read, including ones sharing an id with an unread file, are untouched.
origin/v8steps (B3.5 + merge + cache) with the test fixture: the guessed node is in the merged output, and on the next runcheck_semantic_cachere-dispatches only the 0-count file, so the never-reported file stays cached as complete. With this PR both are re-dispatched and the guessed items are gone.tests/test_skillgen.py(the step tests execute the rendered python, like the existing Skill-path extraction silently truncates files >2000 lines; replace-on-re-extract then deletes the unread tail #2225 tests):test_drop_unreported_chunk_sources_drops_by_source_file_and_returns_unread: never-reported and 0-count files returned; image, empty and deleted files not; shared-id node from the read file kept; AST-target edges kept, including one whose id the unread file also guessed; idempotent...._without_a_dispatch_list_is_a_no_op,..._ignores_chunks_without_a_coverage_contract,..._leaves_a_chunk_without_coverage_unjudged.test_coverage_step_flags_unreported_files_alongside_partly_read_ones: one write holds both kinds of flag, each once.test_an_unreported_file_is_retried_instead_of_cached_as_complete: end to end through the real B3.5, merge andsave_semantic_cache/check_semantic_cache.test_extraction_specs_require_a_coverage_entry_for_every_file: both spec variants.Limitations / not in this PR
int()on every count)..graphify_partial.txtcan name a file twice if the FILE_LIST spelling and the.graphify_uncached.txtspelling of its path differ; harmless, since both resolve to one file downstream.tests/test_partial_cache.py) if you prefer a different home.How was this tested?
Windows 11, Python 3.12 (uv,
--all-extras), branch offupstream/v8at c588b72.These 7 failures fail identically on a clean
v8checkout on this Windows machine (watch/memoization/hooks/C-include tests); none touch the changed code. Not run on Python 3.10 / 3.13 or on Linux/macOS locally.Graphify-specific checklist
uv run python -m tools.skillgen --bless) when changing their source fragments.🤖 Generated with Claude Code