Repository navigation
fix(reflect): isolate malformed learning overlay entries - #5024
azizur100389 wants to merge 2 commits into
Conversation
Refs Graphify-Labs#5019. Co-Authored-By: OpenAI Codex <[email protected]>
|
Thanks for the pull request, @azizur100389. 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
Hardens load_learning_overlay so a sidecar whose root isn't a JSON object returns {} instead of raising, and one bad entry no longer hides the healthy ones. Entries whose source_file isn't a string are skipped individually, and that guard also drops entries with an explicit null source_file, which were previously kept as non-stale. If the staleness check hits an OSError or ValueError on a path, the entry is kept and marked stale: True; new tests cover non-object roots and a mixed good, malformed and deleted-file sidecar.
No blocking issues surfaced.
Analysis details — impact, health, verification
Impact & health
Graphify review
Impact — 772 functions depend on the 59 functions this change touches.
Health — grade A; 10 existing hotspot(s) in the area this change touches (pre-existing, not introduced here):
_rebuild_code()— 252 callers, 73 callees (high)dispatch_command()— 5 callers, 146 callees (high)main()— 122 callers, 3 callees (high)to_html()— 30 callers, 11 callees (high)aggregate_lessons()— 30 callers, 6 callees (high)run_pipeline()— 8 callers, 13 callees (high)reflect()— 13 callers, 7 callees (high)_run_cli()— 11 callers, 8 callees (high)- …and 2 more
Verification — 772 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: 153 function(s) in the blast radius were not formally verified this run
Test selection
Test selection
18 of 519 test file(s) selected (3%) via static blast radius.
tests/test_benchmark.py— impacttests/test_benchmark_raw_graph.py— impacttests/test_benchmark_real_query.py— impacttests/test_export.py— impacttests/test_export_direction.py— impacttests/test_html_script_breakout.py— impacttests/test_html_theme.py— impacttests/test_labeling.py— impacttests/test_learning_overlay_input.py— impact, changed-testtests/test_mcp_graph_view_cache.py— impacttests/test_pipeline.py— impacttests/test_query_mcp_direction.py— impacttests/test_reflect.py— impacttests/test_report.py— impacttests/test_serve.py— impacttests/test_serve_http.py— impacttests/test_terraform.py— impacttests/test_watch.py— impact
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.
Keep source-less annotations while discarding malformed non-string paths. Refs Graphify-Labs#5019. Co-Authored-By: OpenAI Codex <[email protected]>
…#5020) Follow-up to #5025. The landed guard raised on any non-dict repo value, so a single malformed entry backed up the whole manifest and dropped every tracked repo. Keep the whole-file backup only for an unrecoverable shape (non-dict root or repos map); when repos is a dict, drop just the malformed entries, keep the valid repos, and report which went. Matches the per-entry isolation of #5024. Co-Authored-By: Claude Opus 4.8 <[email protected]>
|
Landed on |
Fixes #5019.
What does this PR do?
A non-string source raises
TypeErrorwhile resolving a path. The MCP loader catches the exception and drops the entire overlay, including healthy entries. A non-object JSON root raisesAttributeErrorbefore entries are read.The reader checks the sidecar's object shape before accessing
nodesand skips entries whosesource_filehas the wrong type. An inaccessible path is marked stale. An explicit null source still represents a source-less annotation.Reproduction
Next to
graph.json, save.graphify_learning.jsoncontaining{"nodes":{"bad":{"source_file":["app.py"]},"good":{"status":"preferred","score":2}}}. Callgraphify.reflect.load_learning_overlaywith the graph path. A second reproduction is a sidecar containing JSONnullor[].Verification
uv sync --all-extras --frozenon Python 3.12.python -m pytest -q --tb=short tests/test_learning_overlay_input.py— 5 passed. The new failure cases reproduce on unchangedv8at59b5ab11.python -m ruff check .,python -m pre_commit run --all-files, and all fivepython -m tools.skillgenchecks passed.