Repository navigation
fix(affected): resolve absolute-path seed via graph-derived root (#2706) - #2750
ousamabenyounes wants to merge 1 commit into
Conversation
…phify-Labs#2706) `affected` anchored an absolute-path seed to the current working directory, so it only resolved when cwd happened to be the analysed repo root — the case no editor or script integration can guarantee. `resolve_seed` then matched nothing and printed an empty blast radius with exit 0, indistinguishable from a genuine zero or a typo. Derive the repo root from the graph's own location (<root>/graphify-out/graph.json) and anchor the seed there instead of cwd, completing the ./-relative seed fix shipped in Graphify-Labs#2707. A non-path query, or an absolute path outside the derived root, is unchanged; the root argument defaults to cwd so every other caller keeps its behaviour.
There was a problem hiding this comment.
Graphify reviewed this change.
Worth a look — the grounded gate found no coupling regressions or blocking issues, but 1 advisory finding(s) below merit a look before merge.
Formal verification. 1 change(s) tested, no difference found (not proven).
Graphify review — findings
This PR adds an optional root parameter to the affected command's seed-resolution path (_as_repo_relative, resolve_seed, and format_affected) so that absolute-path seeds are anchored to a repo root rather than the current working directory. In the CLI's dispatch_command, it derives this root from the loaded graph's own file location (the parent of the graphify-out output directory, or the graph's directory when pointed at directly). It also adds a test verifying an absolute-path seed resolves when the command is run from outside the repo root, and appends a corresponding CHANGELOG entry. The remaining changed symbols are CHANGELOG version entries and pre-existing test/helper functions in the touched files.
Worth a look
- graph_root derivation wrong when --graph points to a symlink or non-standard path parent —
graphify/cli.py:1119· Escalate · medium- agreed by 2 of 2 members but NOT verified (no proof, no reproducing execution) — consensus is not a verdict; needs human review Execution auto-disposal is off for this run; enable it (with sandbox isolation) to have Graphify try to confirm or refute this automatically.
Analysis details — impact, health, verification
Impact & health
Graphify review
Impact — 454 functions depend on the 276 functions this change touches.
Health — grade A; 5 existing hotspot(s) in the area this change touches (pre-existing, not introduced here):
dispatch_command()— 2 callers, 117 callees (high)resolve_seed()— 11 callers, 4 callees (high)_stale_graph_sources()— 7 callers, 6 callees (high)_run_hook_guard()— 3 callers, 6 callees (medium)test_poisoned_manifest_is_healed()— 0 callers, 6 callees (medium)
Verification — 454 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: 411 function(s) in the blast radius were not formally verified this run
Formal verification
Could not verify: Could not verify \_as\_repo\_relative.
The verifier did not have enough to check \_as\_repo\_relative, so it is saying so rather than guessing. No false assurance is the whole point.
Guarantee: No guarantee either way, this is an honest abstention, not a pass.
Note: Reason: parameter `root` is annotated `Path | None` — outside the synthesizable primitive/collection set
No difference found (not proven): No behavior difference found in format\_affected (not a proof).
The verifier ran both versions of format\_affected on many inputs and saw identical behavior every time. Strong evidence the change is safe, but evidence, not a proof.
Guarantee: Empirical: differential testing (both versions run on many generated inputs). A divergence on an untested input remains possible, so this is 'no counterexample found', not 'proven equivalent'.
Note: An input the sampler did not try could still differ.
Could not verify: Could not verify resolve\_seed.
The verifier did not have enough to check resolve\_seed, so it is saying so rather than guessing. No false assurance is the whole point.
Guarantee: No guarantee either way, this is an honest abstention, not a pass.
Note: Reason: parameter `root` is annotated `Path | None` — outside the synthesizable primitive/collection set
Could not verify: Could not verify dispatch\_command.
The verifier did not have enough to check dispatch\_command, so it is saying so rather than guessing. No false assurance is the whole point.
Guarantee: No guarantee either way, this is an honest abstention, not a pass.
Note: Reason: not verifiable: all 23 sampled inputs raised on both versions — the function never executed, so 'no divergence' would be vacuous (mostly SystemExit — names the real obstacle, not a sampling gap)
|
Landed in v0.9.44, just published to PyPI. I cherry-picked this onto |
Fixes #2706.
affectedresolved an absolute-path seed only when the working directory happened to be the analysed repo root:resolve_seedanchored an absolute path toPath.cwd(), so from anywhere elserelative_to(cwd)raised and the query was compared verbatim — matching no stored (repo-relative)source_file. The result was an empty blast radius with exit 0, indistinguishable from a genuine zero or a typo. An absolute path is exactly what an editor integration or a script passes, and neither can guarantee cwd is the repo root.This is the follow-up the maintainer noted when the
./-relative case shipped in #2707:The change
<root>/graphify-out/graph.json, so the root is the output dir's parent (GRAPHIFY_OUT_NAME); a graph pointed at directly by--graphfalls back to its own directory.rootthrough_as_repo_relative→resolve_seed→format_affected, and anchor an absolute seed to it.rootdefaults to the current directory, so every existing caller and the label/non-path branches are unchanged. An absolute path outside the derived root is still left verbatim — no basename guessing.Scope is the
affectedseed path only;explain/shortest_pathand the shared scoring helper are untouched.Test verification (RED → GREEN)
New test
test_affected_absolute_seed_resolves_via_graph_root_off_cwdruns the CLI end-to-end with the graph under<root>/graphify-out/graph.json, cwd set to a different directory, and an absolute seed.RED — new test on the branch with only the two production files reverted to
v8:GREEN — full
affectedsuite with the fix:Full local suite
uv run --frozen pytest tests/ -q— 4465 passed, 3 failed, 7 skipped. The 4465 is the pre-fix 4464 plus the new test; the 3 failures are the pre-existingtests/test_ollama.py::test_detect_backend_*cases (local ollama env), identical before and after this change.ruffand thetools.skillgenguards (--check,--audit-coverage,--schema-singleton,--monolith-roundtrip,--always-on-roundtrip) are green.