fix(graph): skip malformed hallway records - #2271
Draft
fallenmi wants to merge 1 commit into
Draft
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
_load_hallwaysThe root cause was that
_load_hallwaysvalidated neither the envelope payload nor individual records. Consumers then performed dict access, entity sorting, count sorting, room iteration, and UTF-8 persistence on arbitrary decoded JSON values, so one malformed row could block every valid hallway behind it and surface through MCP as an internal tool error.Read-only calls do not rewrite the sidecar. A later successful delete or recomputation naturally persists only the valid set through the existing atomic envelope write path. An unsuccessful delete preserves the original file bytes, and unsupported roots are not destructively repaired.
Closes #2270
How to test
.venv/bin/python -m pytest -q tests/test_hallways.py tests/test_cli_hallways.py— 40 passed.venv/bin/python -m pytest -q tests/test_mcp_server.py -k hallway— 7 passed.venv/bin/python -m pytest -q --ignore=tests/test_init.py --deselect=tests/test_mcp_server.py::TestStaleLibraryGate::test_startup_baseline_survives_module_reload— 4303 passed, 31 skipped.venv/bin/pre-commit run --all-filesThe split full-suite invocation keeps cwd/import-path tests in their intended installed-package context; together the two pytest runs cover all 4312 executed tests.
Checklist