Repository navigation
feat(5225): link YAML values to the scripts and local files they name - #5342
Deepjyoti-Sarmah wants to merge 5 commits into
Conversation
|
Thanks for the pull request, @Deepjyoti-Sarmah. 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.11 and 3.13, and that the change keeps extraction deterministic. |
There was a problem hiding this comment.
Graphify code review 
Review completed · 8efe0ee85551
Warning
Merge confidence: 3/5 · Review before merging · 🟠 High impact
1 P2 bug checked against the code
The change extracts literal script and local-file references from selected YAML workflows and Compose volume declarations.
Full summary
The change extracts literal script and local-file references from selected YAML workflows and Compose volume declarations. A resolver later links those references to matching files or package script keys in the scanned corpus.
Bugs (1)
P2 · Update workflow detection in value_refs to recognize relative .github/workflows/ paths: otherwise, eligible run references in workflow YAML files are omitted. Inspect source
Detailed review · checked against the code
Relative scans skip workflow value references
When a repository is scanned using relative paths, workflow YAML files may not be recognized, so their script and file references are not extracted.
Expected: Workflow detection selects _workflow_refs, which extracts eligible script or file references for later resolution.
Actually: The path check misses the relative workflow path, so value_refs returns no workflow references unless the document also has a top-level services key.
For a relative workflow path such as .github/workflows/check.yml, Path.as_posix() does not contain the substring /.github/workflows/. The workflow branch therefore does not call _workflow_refs; unless the YAML also has a top-level services key, value_refs returns an empty mapping. extract_yaml calls value_refs for each document and records only the returned entries, so workflow run values do not yield references on this path.
-
Independent source review: Inspected the YAML extraction caller and the value-reference resolver. The caller records references only from
value_refsresults; the resolver can link references only after they have been recorded. The inspected tests cover YAML structure and workflow key spelling, but do not test workflow value-reference extraction. -
Some lookups asked for files or lines that do not exist; the review was told and carried on.
What this review covered
- Some lookups asked for files or lines that do not exist; the review was told and carried on.
- One review pass used all of its turns for reading code, so it reported from what it had already read.
- 6 of 6 changed files inspected. This is scope, not a correctness guarantee.
Code graph and static checks · 5389 functions depend on this change
Impact & health
Impact — 5389 functions depend on the 558 functions this change touches.
Health — this change adds coupling hotspots:
- worse:
extract()— 1284 callers, 78 callees - worse:
extract_yaml()— 20 callers, 11 callees - worse:
collect_files()— 24 callers, 7 callees - new:
_refs()— 11 callers, 3 callees - worse:
walk()— 1 callers, 6 callees
Formal checks — 5389 functions this change can affect weren't formally checked in this review. Formal checks are informational only.
Gate & verification
✅ PASS — objectively clean (no health regressions, tests not run — proofs not run this pass (advisory)). Grounded, not self-assessed.
Advisory (not blocking):
- verification_scope: 4682 function(s) in the blast radius were not formally verified this run
Test selection
594 of 594 test file(s) selected (100%) via static blast radius.
Escalated to a full run for safety (
uncovered-code) — the selection is not trustworthy on its own (see below). CI should run the whole suite.
tests/pi.test.ts— full-run-safetytests/test_4874_jvm_resolution.py— impact, full-run-safetytests/test_4909_reference_binding_scale.py— full-run-safetytests/test_4978_reconcile_cost.py— impact, full-run-safetytests/test_4992_ts_import_types.py— impact, full-run-safetytests/test_5072_splittable_under_cap_retry.py— 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— impact, full-run-safetytests/test_affected_path_file_node.py— full-run-safetytests/test_affected_seed_reference_forms.py— full-run-safetytests/test_agents_platform.py— full-run-safetytests/test_alias_folding.py— impact, full-run-safetytests/test_analyze.py— impact, 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— impact, full-run-safetytests/test_astro_import_ids.py— impact, 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_binary_media_words.py— impact, full-run-safetytests/test_blade_extractor.py— impact, full-run-safetytests/test_build.py— impact, full-run-safetytests/test_build_located_semantic_identity.py— impact, full-run-safetytests/test_build_merge_dedup_scope.py— impact, full-run-safetytests/test_build_merge_ghost_fold_4955.py— impact, full-run-safetytests/test_build_merge_hyperedges_and_prune.py— impact, full-run-safetytests/test_build_merge_shrink_guard.py— impact, full-run-safetytests/test_builtin_global_type_refs.py— impact, full-run-safetytests/test_c_include_resolution.py— impact, full-run-safetytests/test_cache.py— impact, full-run-safetytests/test_cache_long_paths.py— impact, full-run-safetytests/test_cache_stale_import_target.py— impact, full-run-safetytests/test_cache_windows_case_4925.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— impact, full-run-safetytests/test_case_only_decl_ids_4904.py— impact, full-run-safetytests/test_case_sensitive_resolution.py— impact, full-run-safety- … and 544 more
⚠️ changed code file(s) with no mapped test (graphify/yaml_resolution.py) — 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)
CHANGELOG.md§ 0.9.97 (2026-10-27) (lines 303-328): references changed symbolsrecordCHANGELOG.md§ 0.9.1 (2026-06-28) (lines 1734-1744): references changed symbolsrecordCHANGELOG.md§ 0.8.51 (2026-06-28) (lines 1750-1762): references changed symbolsrecordCHANGELOG.md§ 0.8.42 (2026-06-18) (lines 1837-1843): references changed symbolsrecordCHANGELOG.md§ 0.8.36 (2026-06-08) (lines 1924-1935): references changed symbols_normCHANGELOG.md§ 0.8.16 (2026-05-22) (lines 2101-2108): references changed symbols_normdocs/superpowers/plans/2026-05-04-incremental-updates-dedup.md§ Task 2: Create graphify/dedup.py — entropy gate + MinHash/LSH + Jaro-Winkler (lines 71-468): references changed symbols_normdocs/superpowers/plans/2026-05-04-incremental-updates-dedup.md§ Task 5: Add --dedup-llm tiebreaker to dedup.py (lines 912-1072): references changed symbols_normworked/rsl-siege-manager/GRAPH_REPORT.md§ Community 19 - "Community 19" (lines 242-245): references changed symbols_get
Every flagged function
extract()ingraphify/extract.py:11750· 1284 callers, 78 callees: fans out to 78 callees (efferent coupling); 1284 callers depend on it (afferent coupling)collect_files()ingraphify/extract.py:13904· 24 callers, 7 callees: fans out to 7 callees (efferent coupling); 24 callers depend on it (afferent coupling)extract_yaml()ingraphify/extractors/yaml_config.py:185· 20 callers, 11 callees: fans out to 11 callees (efferent coupling); 20 callers depend on it (afferent coupling)_refs()intests/test_yaml_value_refs.py:20· 11 callers, 3 callees: 11 callers depend on it (afferent coupling)walk()ingraphify/extractors/yaml_config.py:272· 1 callers, 6 callees: fans out to 6 callees (efferent coupling)
What does this PR do?
Closes #5225. A workflow's
run: pnpm run checknow links to thecheckscript inpackage.json, and a compose bind mount./settings.yaml:/etc/demo/settings.yamllinks tosettings.yaml. Before this, the YAML extractor kept keys only, so the issue's repro had no edge other thancontains.The extractor never looked at values:
Reading the value is not enough on its own. The extractor sees one file at a time, so it cannot know whether
settings.yamlwas scanned or whetherpackage.jsondeclarescheck. That is answered after every file is extracted, the way Markdown code-span mentions already are:What is read, and what is left alone
run: npm|pnpm|yarn|bun run NAMEpackage.jsonin the step's working directoryscripts.NAMErun: ./x.sh,bash x.sh,python x.py, ..../host:/container[:mode]{type: bind, source: ./host}The working directory follows GitHub's precedence: step
working-directory, then jobdefaults.run, then workflowdefaults.run, then the repository root (the folder holding.github).Nothing is guessed. These get no edge:
${{ }}expressions,$VAR, pipes,&&/;chains, named volumes, absolute host paths, URLs, a missing script, and a file that exists but was not scanned (ignored, excluded, or outside the root).command: --config ./settings.yamlis not linked. It runs inside the container, against the container's working directory, so./settings.yamlthere is a container-side path, which the issue asks not to guess. In the repro it names the same file the bind mount does, and the mount already gives that edge. A test pins this.Five commits
The tests go in first and fail.
17d58f63records the references and skips them in the call pass, but creates no edges, so reverting95acae48turns the feature off and leaves the graph as it is on v8.Type of change
Verification & Invariants
Invariant: a
referencesedge out of a YAML value exists only when the value spells the target literally and the target is a scanned node.Merge Danger
Door: two-way. Reverting
95acae48and8efe0ee8removes every new edge. The cache schema goes 48 → 49 so cached YAML extractions re-run and pick up the newraw_calls.Blast Radius: small.
.github/workflows/*files and YAML with a top-levelservices:are read for values; other YAML gives the same output as v8.referencesedges withcontext: "yaml_value"andconfidence: EXTRACTED.Limitations
runkeys share one node. The existing walk ids every step'srunkey the same way (<file>_steps_run), so all steps of a workflow hang their edges off one node. Twenty steps callingpnpm run checkgive one edge, not twenty.package.jsonmust be in the working directory itself. npm and pnpm search upwards for the nearest one; that search is not followed, sorun: pnpm run checkfrom a folder without its ownpackage.jsongets no edge.run:line is read as one plain command. A line with shell syntax is skipped as a whole, includingpnpm run check && pnpm run build.uses: ./.github/actions/x, composeenv_file,build.context, GitLab CI and other CI formats. Each could follow the same path.How was this tested?
The issue's script, before and after:
tests/test_yaml_value_refs.py, 23 cases, run end to end throughextract():YAML tests (
test_yaml_value_refs.py+test_yaml_extraction.py) at each commit:7a779fb0tests9ab5447bcollector17d58f63raw_calls95acae48resolver8efe0ee8perfI measured three designs against the same tests, plus a 2,000-file corpus (500 × workflow, compose, settings, package.json), warm cache, min of 3:
extract_yaml, like bashsourcevar_tmp_..._outside_yaml);builddrops them, but the extraction JSON carries them8efe0ee8load_all+compose_allon the second parseRelated suites (
-k "yaml or markdown or cache or registry or json or extract"): 1847 passed, 7 failed. All 7 also fail on v8340268a7in the same environment:test_hook_bash_read,test_hook_compact,test_markdown_sectionsCLI, and twotest_skill_*cached-run tests, all subprocess based.Not tested: the full suite (only the related suites above), and Windows. Targets are joined and normalised with
posixpath, and file-node paths have\turned into/first.