Repository navigation
fix(catalog): store unsigned 64-bit stat identities on Windows - #24
Closed
jason-murray wants to merge 1 commit into
Closed
jason-murray wants to merge 1 commit into
jason-murray wants to merge 1 commit into
Conversation
On Windows, Python reports st_dev (volume serial) and st_ino (file ID) as unsigned 64-bit integers. When either exceeds 2**63 - 1, binding it to the catalog's INTEGER columns raises OverflowError, which the refresh loop records as scan_failed, so every root on that volume reports a root error and nothing is indexed. Fold both values into SQLite's signed INTEGER range before storing them and before comparing against stored rows, so incremental refresh keeps detecting unchanged files. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WW649bqoSmoitkj96NB5WB
|
🔴 Contributor eligibility requirements not met for @jason-murray.
See the contributor eligibility policy. Closing this PR because these requirements were not met. This policy is intended to reduce spam from AI agents; it is not an assessment of the quality of your change. |
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.
Problem
On Windows,
smigrate catalog refreshreports a root error for every root and indexes nothing:catalog roots listshows each root aserrorwithlast_error = scan_failed.Cause
Python 3.12+ on Windows reports
st_dev(the volume serial number) andst_ino(the file ID) as unsigned 64-bit integers. On the affected machine,os.stat(...).st_devforC:is11573954572006337284, which is above SQLite's INTEGER maximum (2**63 - 1). Binding it in_upsert_session/_upsert_virtual_sessionraises:The broad
except Exceptionin_refresh_root/_refresh_opencode_rootrecords that asscan_failed, so it happens on every root on the volume (Claude and OpenCode here). Roughly half of volume serials are at or above2**63, so plenty of Windows users will hit this. ReFS / Dev Drive file IDs can overflowst_inothe same way.Fix
A
_sqlite_inthelper folds an unsigned 64-bit value into the signed INTEGER range (two's complement). It is applied:device/inodeare bound in both upsert statements, and_refresh_root, so incremental refresh still matches stored rows.Values already in range are unchanged, so existing catalogs on Linux/macOS are unaffected. No schema change.
Testing
test_refresh_stores_unsigned_64_bit_stat_identitiesfakesdevice = 2**64 - 1andinode = 2**63 + 7, then checks that the first refresh indexes the session with no root errors and the second reports it unchanged. It fails onmainand passes with this change.ruff check .andruff format --check src tests scripts .github/scripts .github/testspass.python -m unittest discover .github/testspasses.pytestwas run on Windows only (no Linux machine available). Three native test modules can't be imported there (termios), and many target-integration tests fail on Windows for unrelated reasons. I compared failing test IDs betweenmainand this branch: the sets are identical (1181 each), with no new failures. I'm relying on CI for the Linux run.catalog refreshon the affected machine indexes 108 files withroot_errors: 0, and a second refresh reports 107 unchanged.A possible follow-up (not in this PR):
scan_failedhides the underlying exception type, which made this hard to diagnose. Recording the exception class name (no content) inlast_errorwould have shown the cause right away.🤖 Generated with Claude Code
https://claude.ai/code/session_01WW649bqoSmoitkj96NB5WB