Repository navigation
fix: refuse a missing index and stop hiding pending-refs check failures (#111, #110) - #123
Open
inth3shadows wants to merge 3 commits into
Open
inth3shadows wants to merge 3 commits into
inth3shadows wants to merge 3 commits into
Conversation
…es (#111, #110) #111: sqlite3.connect creates a missing file, so a mistyped --db left an empty database behind and failed later with `no such table: files`. db.connect now raises IndexMissing; select and export print "no CodeGraph index at <path>" and exit 2, creating nothing. #110: the pending-refs check sat under `except Exception: pass`, so a missing table or a locked database disarmed the mid-resolution guard silently. It now catches sqlite3.Error only and adds a warning, which turns an empty NONE into UNKNOWN. Non-sqlite errors propagate. Closes #111 Closes #110
…at a matching pin Review round 1 on #123: - connect opens with mode=ro and refuses a path that is not a file or has no `files` table, so the 0-byte file the old bug left behind, a directory, or any non-index sqlite file is refused with exit 2, and nothing can create one. - a missing unresolved_refs table or status column BLOCKS when the schema pin matches; it warns only when the schema is unpinned or differs. - messages: "check the path" before "codegraph init"; a missing table and a missing column are worded apart.
This was referenced Oct 16, 2026
Open
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.
Summary
sqlite3.connectcreates a missing file. A mistyped--dbused to leave a 0-byte database behind, and the run then died withno such table: files.db.connectnow raisesIndexMissing(aFileNotFoundError) and creates nothing.selectandexportprintno CodeGraph index at <path>and exit 2.:memory:still opens.except Exception: passhides every failure of the pending-refs check #110. The pending-refs check sat underexcept Exception: pass. A missingunresolved_refstable, a missingstatuscolumn or a locked database switched off the mid-resolution guard without any message. It now catches onlysqlite3.Errorand adds a warning, soselectreports an empty answer as UNKNOWN rather than NONE. Any non-sqlite error is a testgraph bug, so it now propagates instead of being reworded as a warning.Both issues were labelled
needs-verification. Both reproduced onmainbefore this fix: a typo'd--dbleft a 0-byte file, and withunresolved_refsdropped,check()returned no blocking entries and no warnings.Testing
python3 -m unittest discover -s tests:Ran 484 tests ... OK(477 before, 7 new).connectexistence check,MissingIndexTestsgaveFAILED (failures=1, errors=1). With the silentpassback,IntegrityTestsgaveFAILED (failures=4). Without theIndexMissingcatch inselect.main,FAILED (errors=1).select --db <missing>exits 2 with the message, and no file is created.Closes #111
Closes #110
Review round 1 (dual review), fixed in 7f235f8
connectnow opens withmode=ro, so nothing can create an index. It refuses a path that is not a file or that has nofilestable. That covers the 0-byte file the old bug left behind, a directory passed as--db, and any sqlite file that isn't an index.unresolved_refstable orstatuscolumn now blocks. A warning only demotes an empty answer to UNKNOWN, so a non-empty journey list would still have read as confident. It still warns when the schema is unpinned or differs.codegraph init. A missing table and a missing column are worded differently.Ran 493 tests ... OK.selectreturns OK on testgraph, honeyslate and signedintake.The remaining findings are filed as #126, #127, #128 and #129.
Review round 2 (verify): NOT clean, so not merged yet
Open defects in 7f235f8, to fix before merge:
codegraph init. On an existing index, init does nothing; the advice should becodegraph index <repo>.connect'sexcept sqlite3.DatabaseErroraround thefilesprobe reports a lock, or a read-only directory with no-shm, as "not a CodeGraph index". Only "not a database", "malformed" or nofilestable should mean that.OperationalErrorraised by the open itself (for example achmod 000file) escapes as a traceback with exit 1.PRAGMA table_info/sqlite_masterinstead.found == schema_pinin the new condition is redundant.