Repository navigation
Conversation
A killed writer can leave an empty extra string in a node row. json_extract then raised SQLite malformed-JSON and crashed every get_all_files caller: build, status, visualize, watch (tirth8205#864, follow-up to tirth8205#861). Gate the extraction with json_valid and compare on truthiness via COALESCE so a false-virtual row stays visible to reconciliation instead of being immortal. Regression inserts rows with empty, false-virtual, and true-virtual extra and asserts the split.
code-review-graph reviewOverall risk: 0.30 (LOW) — 4 changed function(s)/class(es), 0 affected flow(s), 1 test gap(s) Risk-scored changes
Test gaps
Token savings: this graph-backed report used ~40,278 fewer tokens (~98%) than reading every changed file in full (estimated, chars/4 approximation). Powered by code-review-graph — local-first analysis; no code leaves the CI runner. |
|
Integrated on |
|
Merged into |
…in get_all_files Port the reviewed token-efficiency implementation with targeted regression coverage. Source-PR: tirth8205#870
Summary
Follow-up to #861 (noted while merging it, #864): a killed writer can leave
extra=''in a node row.get_all_filesranjson_extract(extra, '$.virtual')over every non-File row, so SQLite raisedmalformed JSONand crashed every caller — build, status, visualize, watch.Two changes in the WHERE clause:
extra IS NULL OR json_valid(extra) = 0keeps a row with empty/truncatedextrain the file inventory instead of aborting the query.COALESCE(json_extract(extra, '$.virtual'), 0) != 1. Previously the presence of the key alone hid a row, soextra='{"virtual": false}'was invisible to reconciliation and immortal; now onlyvirtual: true(resolver-managed, e.g. Spring Event markers) stays out of the inventory.Testing
test_get_all_files_survives_malformed_extra_and_false_virtual: inserts rows withextra='',{"virtual": false}, and{"virtual": true}, then asserts the split — malformed and false-virtual paths are returned, true-virtual stays excluded. Fails against the previous query (verified by checkout mutation:OperationalError: malformed JSON), passes with the fix.pytest tests/test_graph.py tests/test_incremental.py— 176 passed (2 symlink-privilege tests deselected, a pre-existing Windows-environment limitation, same as fix(incremental): reconcile reverted file content #860/fix(graph): purge orphan rows during reconciliation #861).ruff check code_review_graph/graph.py tests/test_incremental.py— all checks passed.Fixes #864