Skip to content

test(storage-sqlite): skip a file that goes between the listing and the read - #1113

Merged
eliseong merged 1 commit into
mainfrom
test/sqlite-secure-delete-file-race
Nov 23, 2026
Merged

eliseong merged 1 commit into
mainfrom
test/sqlite-secure-delete-file-race

Conversation

@LeeroyHannigan

@LeeroyHannigan LeeroyHannigan commented Nov 18, 2026 •

Copy link
Copy Markdown
Collaborator

What

The SQLite secure-delete test, a_pass_leaves_no_catalog_key_and_no_old_ciphertext_in_the_files, reads every file in the catalog directory after its pool closes. Its helper files() now skips a file that SQLite deletes between the listing and the read. Any other read error still fails the test.

Why

The test failed in CI on #1003 with read a file: ... NotFound (run 44224988341, attempt 2). SQLite deletes the WAL and its shared-memory index when the last connection closes. pool.close() can return before that.

A file that goes holds no bytes that the test must search. The store checkpoints and truncates the WAL after each overwrite (PRAGMA wal_checkpoint(TRUNCATE)), so a WAL that goes holds no page.

Follows #1003, which added the test. Closes #1132, which reports the same failure on #1130.

Testing done

  • The test alone, 15 runs: 15 passed.
  • The test alone, 30 more runs, with two lines added to print whether the two files existed right after close() returned. The commit does not have those lines. 30 passed. In 1 run, the WAL and its index were still there after close() returned.
  • The three management_store::secret_rows tests of extenddb-storage-sqlite: 3 passed.
  • cargo fmt --all -- --check, and cargo clippy -p extenddb-storage-sqlite --all-targets -- -D warnings under the toolchain CI pins: clean.

Checklist

  • I have read CONTRIBUTING.md
  • All tests pass (cargo test --workspace)
  • Code is formatted (cargo fmt --check)
  • Clippy is clean (cargo clippy -- -W clippy::pedantic)
  • I have added or updated tests for new functionality
  • I have updated documentation if behavior changed
  • Breaking changes are noted below (if any)
  • If this changes the wire protocol, Storage trait, auth model, on-disk
    format, or public CLI surface, an RFC has been accepted or is linked
    below. Otherwise, an ADR captures the decision (link below).

ADR / RFC: n/a


By submitting this pull request, I confirm that my contribution is made under
the terms of the Apache License 2.0 and I agree to the Developer Certificate of
Origin (DCO). See CONTRIBUTING.md for details.

…he read

SQLite deletes the WAL and its index when the last connection closes, and pool.close() can return before that. In 30 local runs, both files were still there right after close() returned in 1 run. The secure-delete test lists the catalog directory and then reads each file, so a file that went in between failed the test with NotFound.

The store checkpoints and truncates the WAL after each overwrite, so a WAL that goes holds no page. The helper now skips a file that is gone, and it still fails on any other read error.

@eliseong eliseong left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

I built this head as a SQLite server and ran a_pass_leaves_no_catalog_key_and_no_old_ciphertext_in_the_files twenty times: all green. files() now skips a file that returns NotFound between the listing and the read, and still fails on any other read error, which keeps a real retained-secret file from passing silently. cargo fmt --check and cargo clippy -p extenddb-storage-sqlite --all-targets -- -D warnings are clean.

The change is 15 commits behind main, but the file has not moved upstream since this branch's base, so it rebases clean.

This resolves #1132. The body has no closing keyword, so #1132 will not close on merge; add Closes #1132 if you want that.

@eliseong

Copy link
Copy Markdown
Collaborator

Correction to my review: the body already has Closes #1132, and the PR is linked to close #1132 on merge. My note that it would not close was wrong, from a keyword check that missed the reference. No change needed.

@eliseong
eliseong added this pull request to the merge queue Nov 23, 2026
@LeeroyHannigan

Copy link
Copy Markdown
Collaborator Author

@eliseong Your first note was right. The body had no closing keyword when you reviewed it. I added Closes #1132 at 22:33 UTC, after your review.

Merged via the queue into main with commit 44cd436 Nov 23, 2026
58 checks passed
@eliseong
eliseong deleted the test/sqlite-secure-delete-file-race branch November 23, 2026 23:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Test a_pass_leaves_no_catalog_key_and_no_old_ciphertext_in_the_files fails when a database file goes away between the listing and the read

2 participants