report and trees open the database read-only: mode=ro, query_only(1), the same busy timeout, no journal_mode. The scan connection settings are unchanged.
scan switches the database back to rollback-journal mode whenever it closes it, so between scans the database file alone holds the database.
README.md §Database states what report and trees need and how the switch meets a running report.
What the diff does not show
The connection change alone is not enough: a read-only connection to a WAL database fails when it cannot create -wal and -shm, and in a writable directory it leaves them behind. Hence the switch, as the plan comment suggested.
The switch needs the database to itself. If a report has it open when scan closes, scan warns and leaves it in WAL mode until the next scan; the -wal and -shm files stay, with the database file's permissions, so read-only reports keep working. A test covers this.
A scan that starts while a report is still mid-read now waits up to the 10-second busy timeout to enter WAL mode, then fails. Before, that case never waited.
In TestRunFatalAfterOpenClosesDatabase the leftover-file check now proves the close only for scan; its comment says so.
Disclosures
Judgement call: switch modes at close rather than keep -wal/-shm permanently, or open readers with immutable=1, which is unsafe during a scan.
Judgement call: a refused switch is a warning (exit 0), not fatal.
The two permission tests skip as root, which ignores file permissions.
Model: opus-5-5
Implements https://git.eeqj.de/sneak/sfdupes/issues/8.
## What changed
- `report` and `trees` open the database read-only: `mode=ro`, `query_only(1)`, the same busy timeout, no `journal_mode`. The `scan` connection settings are unchanged.
- `scan` switches the database back to rollback-journal mode whenever it closes it, so between scans the database file alone holds the database.
- `README.md` §Database states what `report` and `trees` need and how the switch meets a running report.
## What the diff does not show
- The connection change alone is not enough: a read-only connection to a WAL database fails when it cannot create `-wal` and `-shm`, and in a writable directory it leaves them behind. Hence the switch, as the plan comment suggested.
- The switch needs the database to itself. If a report has it open when `scan` closes, `scan` warns and leaves it in WAL mode until the next scan; the `-wal` and `-shm` files stay, with the database file's permissions, so read-only reports keep working. A test covers this.
- A `scan` that starts while a report is still mid-read now waits up to the 10-second busy timeout to enter WAL mode, then fails. Before, that case never waited.
- In `TestRunFatalAfterOpenClosesDatabase` the leftover-file check now proves the close only for `scan`; its comment says so.
## Disclosures
- Judgement call: switch modes at close rather than keep `-wal`/`-shm` permanently, or open readers with `immutable=1`, which is unsafe during a scan.
- Judgement call: a refused switch is a warning (exit 0), not fatal.
- The two permission tests skip as root, which ignores file permissions.
Model: opus-5-5
report and trees now connect read-only (mode=ro, query_only, the same
busy timeout) and no longer set the journal mode, which is a write. A
read-only connection to a WAL database still needs its -wal and -shm
files, or write access to the directory to create them, so scan now
switches the database back to rollback-journal mode whenever it closes
it: between scans the file alone holds the database. If a report has
the database open at that moment the switch is refused; scan warns and
the database stays in WAL mode, with its -wal and -shm files, until the
next scan. README §Database states what readers need.
Model: opus-5-5
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Implements #8.
What changed
reportandtreesopen the database read-only:mode=ro,query_only(1), the same busy timeout, nojournal_mode. Thescanconnection settings are unchanged.scanswitches the database back to rollback-journal mode whenever it closes it, so between scans the database file alone holds the database.README.md§Database states whatreportandtreesneed and how the switch meets a running report.What the diff does not show
-waland-shm, and in a writable directory it leaves them behind. Hence the switch, as the plan comment suggested.scancloses,scanwarns and leaves it in WAL mode until the next scan; the-waland-shmfiles stay, with the database file's permissions, so read-only reports keep working. A test covers this.scanthat starts while a report is still mid-read now waits up to the 10-second busy timeout to enter WAL mode, then fails. Before, that case never waited.TestRunFatalAfterOpenClosesDatabasethe leftover-file check now proves the close only forscan; its comment says so.Disclosures
-wal/-shmpermanently, or open readers withimmutable=1, which is unsafe during a scan.Model: opus-5-5
Review passed.
Model: opus-5-5
7e1deb25f7to89a861a989Rebased onto
next; only theTODO.mdentry conflicted.Model: opus-5-5