Repository navigation
feat(benchmark): --questions reports whether query_graph shows the right file - #4342
rohit-jsfreaky wants to merge 2 commits into
Conversation
|
Thanks for the pull request, @rohit-jsfreaky. 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; formal verification proved 0 of 2 changed function(s) (1 sampled, not proven, 1 not verified).
Formal verification. PR-changed functions: 1/2 verified (0 proven, 1 may-equivalent, 0 distinguished) · 1 not verified (1 vacuous).
Not verified on this run: dispatch\_command (vacuous: never exercised).
Graphify review — findings
Adds an answer-quality mode to graphify benchmark: with --questions FILE (a JSON list or JSON Lines of {"question", "files"}), it runs query_graph on each question the way the MCP tool does (BFS, depth 3, ~2000-token budget) and reports how often an expected file appears among the first 1, 3 and 5 files shown, or anywhere. It also reports median answer size and how many answers query_graph kept past its budget. --depth, --budget and --json tune the query and emit raw per-question results; without --questions the command still runs the token-reduction benchmark, but now exits with an error on unknown options or non-integer depth/budget values.
No blocking issues surfaced. 1 lower-confidence candidate did not survive cross-model review.
Analysis details — impact, health, verification
Impact & health
Graphify review
Impact — 444 functions depend on the 132 functions this change touches.
Health — this change adds coupling hotspots:
- worse:
dispatch_command()— 2 callers, 133 callees - new:
run_answer_benchmark()— 4 callers, 5 callees
Verification — 444 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: 444 function(s) in the blast radius were not formally verified this run
Test selection
Test selection
368 of 368 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/test_affected_cli.py— impact, full-run-safetytests/test_affected_defines.py— full-run-safetytests/test_affected_member_seed.py— full-run-safetytests/test_agents_platform.py— impact, 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_benchmark.py— impact, full-run-safetytests/test_benchmark_answers.py— impact, changed-test, full-run-safetytests/test_benchmark_raw_graph.py— impact, 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_cache.py— full-run-safetytests/test_cache_stale_import_target.py— 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— full-run-safetytests/test_chunking.py— 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— impact, full-run-safetytests/test_cluster.py— full-run-safetytests/test_cluster_ambiguous_scale.py— full-run-safetytests/test_cluster_exclude_hubs.py— full-run-safetytests/test_cobol_extractor.py— full-run-safetytests/test_codebuddy.py— impact, full-run-safetytests/test_community_hub_labels.py— full-run-safetytests/test_community_labels_skill.py— full-run-safetytests/test_confidence.py— full-run-safety- … and 318 more
non-code file(s) changed (
docs/how-it-works.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 (
docs/how-it-works.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)
graphify/skill-agents.md§ Part B - Semantic extraction (parallel subagents) (lines 204-367): references changed symbolshitsgraphify/skill-aider.md§ Part B - Semantic extraction (parallel subagents) (lines 222-363): references changed symbolshitsgraphify/skill-amp.md§ Part B - Semantic extraction (parallel subagents) (lines 204-367): references changed symbolshitsgraphify/skill-claw.md§ Part B - Semantic extraction (parallel subagents) (lines 204-370): references changed symbolshitsgraphify/skill-codex.md§ Part B - Semantic extraction (parallel subagents) (lines 204-367): references changed symbolshitsgraphify/skill-copilot.md§ Part B - Semantic extraction (parallel subagents) (lines 204-370): references changed symbolshitsgraphify/skill-devin.md§ Part B - Semantic extraction (parallel subagents) (lines 235-426): references changed symbolshitsgraphify/skill-droid.md§ Part B - Semantic extraction (parallel subagents) (lines 204-367): references changed symbolshitsgraphify/skill-kilo.md§ Part B - Semantic extraction (parallel subagents) (lines 204-370): references changed symbolshitsgraphify/skill-kiro.md§ Part B - Semantic extraction (parallel subagents) (lines 204-370): references changed symbolshits
…and 10 more.
Formal verification
No difference found (not proven): No behavior difference found in \_run\_cli (not a proof).
The verifier ran both versions of \_run\_cli 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 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: no capturable inputs from the test suite; property tier: not verifiable: all 40 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)
· 1 grounded finding(s) anchored inline below; 1 more finding(s) on lines outside this diff (see the check run).
| return files | ||
|
|
||
|
|
||
| def run_answer_benchmark( |
There was a problem hiding this comment.
run_answer_benchmark()
high coupling complexity (Ca·Ce = 20).
Grounded coupling-delta finding (deterministic), not an LLM guess.
Addressed in 48fc3fd: per-question scoring moved to @Graphify-Labs please re-review. |
48fc3fd to
954df3f
Compare
…right file Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01B8gwEpjajiWHVW3c9smuKf
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01B8gwEpjajiWHVW3c9smuKf
954df3f to
0b1f76a
Compare
What does this PR do?
Closes #4341.
graphify benchmarkmeasured token reduction only.graphify benchmark [graph.json] --questions FILEnow measures answer quality:load_benchmark_questionsreads a JSON list or JSON Lines of{"question": "...", "files": ["pkg/module.py"]}(paths normalized; an item without a question or files is an error naming it).run_answer_benchmarkloads the graph withserve._load_graphand asks_query_graph_texteach question with the MCP tool's defaults (BFS, depth 3, ~2000 tokens;--depth/--budgetoverride). It reads the files of theNODElines in the order the answer shows them, and records the position of the first expected file, the answer size (~3 chars/token, the budget's own rule) and whetherquery_graphprinted its "Complete answer over budget" notice.--jsonprints the per-question results.--questions,graphify benchmarkis unchanged (token reduction). Unknown options now error instead of being taken as the graph path.docs/how-it-works.mdgets an "Answer-quality benchmark" section;graphify --helplists the flags.Type of change
Verification & Invariants
Invariant: the report describes what
query_graphshows an agent for each question, nothing re-implemented.Checked against an independent harness over the same 177 SWE-bench Lite questions (title as question, files of the real fix as answer): identical counts, e.g. django 31 / 39 / 40 / 60 of 114 (first / first 3 / first 5 / anywhere), pytest 5 / 7 / 7 / 15 of 17.
tests/test_benchmark_answers.py, 11 tests (question loading and validation, files read in shown order, rank and hit counts on a small graph, the CLI's--json, bad input and the unchanged token mode).Limitations: scores BFS
query_graphonly (notexplain,get_neighborsor DFS); a file counts when any node from it is shown; questions files are brought by the user (no dataset is shipped).How was this tested?
Graphify-specific checklist
🤖 Generated with Claude Code
https://claude.ai/code/session_01B8gwEpjajiWHVW3c9smuKf