Skip to content

Revert Windows private-file ACL restriction (broke main) - #158

Merged
Zongwei9888 merged 1 commit into
mainfrom
fix/revert-windows-acl
Aug 6, 2026
Merged

Revert Windows private-file ACL restriction (broke main)#158
Zongwei9888 merged 1 commit into
mainfrom
fix/revert-windows-acl

Conversation

@Zongwei9888

@Zongwei9888 Zongwei9888 commented Aug 6, 2026

Copy link
Copy Markdown
Collaborator

Why

576ed69 (from #148, merged in #156) broke the Windows lifecycle job on main:

sqlite3.OperationalError: attempt to write a readonly database
core\persistence\database.py:160

Root cause

_restrict_windows_acl() runs two icacls calls in sequence:

  1. /inheritance:r — strips every inherited ACE
  2. /grant:r <user>:F — re-grants the current user

The sequence is not atomic, and the except branch returns without undoing step 1. If the grant fails or has not taken effect, the file is left with no usable ACE at all — every caller of private_storage, including the SQLite database, then fails closed. That is not the best-effort degradation the docstring claims.

It is also intermittent: the same tree passed this job on the PR branch and failed on main. A single green run does not clear it.

Scope

  • Reverts 576ed69 (core/private_storage.py and its test file)
  • Drops tests/test_private_storage_windows.py from the Windows CI step, since the revert removes that file

Everything else from #156 stays: the ensure_ascii fix (#139), the Job Object sandbox backend (#149), and the Windows CI coverage.

Follow-up

The fix is to grant before stripping inheritance, and to leave inheritance alone when the grant fails — worst case then is permissions not tightened, rather than a file nothing can open. That will come back as its own PR, with repeated Windows runs to cover the intermittency.

@raymondginger2018-sudo — your #149 is unaffected and stays in. Sorry for the churn on #148; the idea is right, the ordering just needs to fail safe.

…user"

This reverts 576ed69. It broke the Windows lifecycle job on main:

  sqlite3.OperationalError: attempt to write a readonly database
  core\persistence\database.py:160

_restrict_windows_acl() runs two icacls calls in sequence:

  1. /inheritance:r        strips every inherited ACE
  2. /grant:r <user>:F     re-grants the current user

The sequence is not atomic, and the except branch returns without undoing
step 1. If the grant fails or has not taken effect, the file is left with no
usable ACE at all — every caller of private_storage, including the SQLite
database, then fails closed. That is not the best-effort degradation the
docstring claims.

It is also intermittent: the same tree passed this job on the PR branch and
failed on main, so a single green run does not clear it.

Also drops tests/test_private_storage_windows.py from the Windows CI step,
since the revert removes that file.

The fix is to grant before stripping inheritance, and to leave inheritance
alone when the grant fails — worst case then is permissions not tightened,
rather than a file nothing can open. That will come back as its own PR with
repeated Windows runs to cover the intermittency.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@Zongwei9888
Zongwei9888 merged commit 64ffd65 into main Aug 6, 2026
10 checks passed
@Zongwei9888
Zongwei9888 deleted the fix/revert-windows-acl branch August 6, 2026 16:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant