Repository navigation
fix(skill): pin extraction source_file + root the full build so --update stops duplicating - #1366
Conversation
…eleted-only Completes the source_file convention fix begun in Graphify-Labs#1344 (build_merge replace-on-re-extract) and Graphify-Labs#1361 (pass root= to build_merge in the --update runbook). Two gaps still let the full build and incremental --update emit different source_file bases for the same file, so the source_file-keyed replace missed and duplicates accumulated: 1. extraction-spec(.md/-compact.md): the subagent's source_file slot was an unpinned "relative/path", so it invented a base per run (and the node id, derived from the same path, drifted too). Pin it to the verbatim FILE_LIST path so _norm_source_file(root) canonicalizes every run identically. 2. core.md: the full build called build_from_json WITHOUT root=, so Graphify-Labs#1361's update-side root= had no matching base on the full-build side. Pass root='INPUT_PATH' at both sites (Step 4 export, Step 5 report) so the full build and --update relativize to the same base. update.md prune_sources = deleted only. Changed files are replaced by build_merge (Graphify-Labs#1344); once root= aligns the bases, leaving `changed` in prune_sources would delete the freshly re-extracted nodes. Engine (build.py) unchanged. Regenerated all skill artifacts via tools/skillgen/gen.py. Adds test_build_merge_root_collapses_convention_drift. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
|
Merged to v8 in Your diagnosis is exactly right, and it's more consequential than the PR framing suggests: I verified that after #1361 added So Validation on merge: clean merge onto v8, Because this is a regression in the current 0.8.41 release, I'll cut a prompt 0.8.42 with it. Really appreciate the rigorous writeup. |
Keep Solidity feat in CHANGELOG Unreleased alongside upstream fixes (Graphify-Labs#1363, Graphify-Labs#1366, Graphify-Labs#1369, Graphify-Labs#1373). In walk_calls, retain both the Solidity call/instantiate handling and Java object_creation_expression (Graphify-Labs#1373). Co-authored-by: Cursor <[email protected]>
…raphify-Labs#1367) Upstream released 0.8.42 and moved Graphify-Labs#1363/Graphify-Labs#1366/Graphify-Labs#1369/Graphify-Labs#1373 out of Unreleased. Keep the Solidity feat under Unreleased only. Co-authored-by: Cursor <[email protected]>
…so --update stops duplicating After Graphify-Labs#1361 added root= to the --update build_merge call, build_merge's prune (which runs after the merge) began matching freshly re-extracted changed-file nodes and deleting them — a regression in 0.8.41 where --update on a changed file wiped its nodes. This drops `changed` from prune_sources (replace-on- re-extract from Graphify-Labs#1344 already reconciles changed files), passes root= to the full build's build_from_json so its node-key base matches the update side, and pins the extraction-spec source_file to the verbatim path so the two runs never drift. Re-blessed skillgen expected/ snapshots. Co-Authored-By: RelywOo <[email protected]> Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
…ify-Labs#2217) The skill path has told agents since Graphify-Labs#1366 to copy source_file from the FILE_LIST "character-for-character". The native/API prompt said nothing: it showed `"source_file":"relative/path"` in the schema and left provenance to the model's judgement. That is the upstream half of Graphify-Labs#2217 — a DeepSeek run reconstructed a plausible repo path out of a node id quoted inside a document, because nothing told it not to. Adds the rule to `_EXTRACTION_SYSTEM`: copy from the enclosing <untrusted_source path="..."> block, never infer from a label, node id, citation, basename or import, and omit rather than reconstruct. The test asserts against the RULE PARAGRAPH, not the whole prompt. Matching the whole prompt proves nothing here: the base prompt already contains "<untrusted_source>" (the SECURITY paragraph), "node id" ("Node ID format: ...") and "citation" ("EXTRACTED: relationship explicit in source (import, call, citation, ...)"), so a rule saying the exact opposite — "pick whatever source_file seems most plausible (basename is fine)" — passed a whole-prompt assertion green. Verified by mutation: that inverted rule now fails the test. Split out because it carries a cost the code fix does not: - prompt fingerprint f33081f95084 -> 850648cc0d13, so every existing semantic cache entry falls out of its namespace and the next run re-extracts the corpus for real money (Graphify-Labs#1939 working as designed — this IS a prompt change — but it is a one-time bill for every user on upgrade) - +490 chars (~122 tokens) on every extraction request If that trade is not worth it for a given release, drop this commit and keep the first; the graph stays correct either way, it just keeps paying to filter fabrications instead of asking for fewer. Commit 1 passes the suite standalone. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Problem
After #1344 (build_merge replace-on-re-extract) and #1361 (pass
root=tobuild_mergein the--updaterunbook), the full build and an incremental/graphify --updatecould still emit differentsource_filebases for the same file (e.g.docs/wiki/overview.mdfrom one run vs basenameoverview.mdfrom another). Becausebuild_merge's replace keys on thesource_filestring, the mismatch made it miss the stored node, so re-extraction accumulated duplicates instead of replacing. Two gaps remained:extraction-spec(.md/-compact.md)— the subagent'ssource_fileslot was an unpinned"relative/path", so it invented a base per run. The node id (derived from the same path) drifted too.core.md— the full build calledbuild_from_jsonwithoutroot=, so /graphify --update: build_merge called without root= → prune_sources never matches, graph inflates on every update #1361's update-sideroot=had no matching base on the full-build side; the two halves never agreed.Fix (engine
build.pyunchanged)source_fileto the verbatimFILE_LISTpath — no basename, no re-relativize, no separator change._norm_source_file(root)then canonicalizes every run identically.root='INPUT_PATH'at bothbuild_from_jsonsites (Step 4 export, Step 5 report), matching /graphify --update: build_merge called without root= → prune_sources never matches, graph inflates on every update #1361's update-side root so full build and--updaterelativize to the same base.prune_sources = deletedonly. Changed files are already replaced bybuild_merge(fix(build_merge): replace re-extracted files instead of accumulating stale edges #1344); onceroot=aligns the bases, leavingchangedinprune_sourceswould delete the freshly re-extracted nodes.All skill artifacts regenerated via
python tools/skillgen/gen.py.Test
Adds
test_build_merge_root_collapses_convention_drift: a drifted relative base with no root leaves 3 nodes (stale + duplicate); the verbatim path +root=collapses to 1 canonical node and drops the stale node.tests/test_build.py— 35 passed.Builds on #1344 and #1361 (same bug family).