fix(state): let sqlite raise the canonical error for a directory db_path

The owner-only pre-create helper ran before sqlite3.connect() and turned
a directory-as-state.db misconfiguration into IsADirectoryError instead
of the sqlite OperationalError the open path (and its lock-patience
classifier) expects. A directory leaks no row data, so skip it and let
sqlite fail canonically. Also map the salvage carry-commit author email
for the attribution gate.
This commit is contained in:
teknium1
2026-09-12 18:40:20 -07:00
committed by Teknium
parent 3966e5de94
commit d21913b09c
2 changed files with 5 additions and 0 deletions

View File

@@ -0,0 +1 @@
rohitsabu

View File

@@ -248,6 +248,10 @@ def _secure_state_db_files(db_path: Path, *, create_main: bool = False) -> None:
fd = os.open(path, flags, 0o600)
except FileNotFoundError:
continue
except IsADirectoryError:
# Not a database file at all; sqlite3.connect() raises the
# canonical error for this, and a directory leaks no row data.
continue
try:
os.fchmod(fd, 0o600)
finally: