Skip to content

Fix leaked milestone queries and expand core C API coverage - #412

Merged
zeth merged 9 commits into
mainfrom
test/core-capi-history-coverage
Nov 8, 2026
Merged

zeth merged 9 commits into
mainfrom
test/core-capi-history-coverage

Conversation

@zeth

@zeth zeth commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

Description

Milestone readers leaked their outer SQLite statement when loading a milestone's dates threw. This can keep a failed query and its database connection alive. Give all four readers scoped statement ownership so their queries are finalized on success and exceptions. A regression test reproduced one leaked statement before the fix and now verifies cleanup for card, epoch-range, instant-range and calendar-day reads.

Expand core coverage through the generated C API, checking returned records and persisted behavior: history and restore, atomic recovery rejection, encrypted snapshots and missing keys, private storage bindings, project ordering, card placement, search, Trash, local Git sync, remote failures, signing callbacks and database reports. Milestone write-failure tests also verify that the caller's transaction preserves the original data.

The only production-code change is the milestone statement cleanup. No new coverage exclusions or dependencies are introduced.

Validation

  • Full local ./make.sh coverage: 821/821 tests passed; HTML and JSON reports generated successfully.
  • Line coverage: 92.7% → 97.4%; function coverage: 91.8% → 99.2% on GCC/gcov 15.2 and lcov 2.0.
  • Every generated public C entry point is exercised.
  • Targeted regression tests were run throughout; the milestone cleanup test failed before the fix and passed afterward.
  • git diff --check passed.

Contribution Checklist

Licensing

  • I confirm that I have the right to submit this contribution under the project's GPL licence.
  • I agree that this contribution may be distributed under the project's GPL licence.
  • I have read and agree to the terms in CLA.md.

Code Quality

  • I tested these changes locally.
  • I added or updated tests where appropriate.
  • I ran the project's formatting/linting tools where applicable.
  • I kept the change focused and avoided unrelated refactoring.

Security & Dependencies

  • I have not added unnecessary dependencies.
  • Any new dependencies are appropriately licensed and justified (none added).

Documentation

  • I updated relevant documentation where needed (regression test explains the cleanup invariant).

@zeth
zeth merged commit 2f05118 into main Nov 8, 2026
70 checks passed
@zeth
zeth deleted the test/core-capi-history-coverage branch November 8, 2026 23:36
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