Skip to content

fix(store): persist periodic SQLite cleanup and retry failed deletes - #2344

Merged
DeliciousBuding merged 2 commits into
masterfrom
fix/sqlite-periodic-cleanup
Sep 6, 2026
Merged

DeliciousBuding merged 2 commits into
masterfrom
fix/sqlite-periodic-cleanup

Conversation

@DeliciousBuding

@DeliciousBuding DeliciousBuding commented Sep 6, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • Persist SQLite's periodic retention deletes instead of removing runs and evidence only from memory.
  • Keep failed cleanup commits pending for the next timer tick, even when no more runs expire; preserve the existing in-memory-on-write-failure contract and LastPersistError reporting.
  • Stop and join both constructor-owned background loops before final shutdown persistence/database close.
  • Reuse the existing persistence machinery and fixture helpers; update the stable store lifecycle documentation. No new constructor seam, schema or storage abstraction.

Closes #2343

Verification

Four focused tests use real SQLite with testing/synctest virtual time to drive the constructor's unchanged production cadence: durable deletion before close, retry after SQL trigger failure, close flushing pending cleanup and close waiting for owned work. The reopen helper deliberately bypasses final Close/Flush persistence, so shutdown cannot conceal a missing background commit. Unrelated queued run/checkpoint data is retained.

Three temporary negative controls each failed for the intended behavioral reason and were restored byte-for-byte:

  • Disable periodic persistence: six expired rows survive and reappear after reopen.
  • Discard pending retry state: next tick leaves the six rows and the observed persist error.
  • Remove shutdown join: close returns and the DB closes before owned work is released.

Passed locally using Go 1.26.5:

  • Windows, CGO_ENABLED=0: go test -p 2 ./internal/store ./internal/api -count=1 -cpu=4 -timeout=10m.
  • Linux, CGO_ENABLED=1: go test -race -p 2 ./internal/store ./internal/api -count=1 -cpu=4 -timeout=10m.
  • go vet -p 2 ./internal/store ./internal/api; staticcheck ./internal/store ./internal/api; gofmt clean.
  • Existing verify-doc-ssot.py, verify-project-skills.py, verify-real-e2e-contract.py, OpenAPI YAML parse and git diff --check. Skills-specific checks report their existing absent-root skip/trivial-pass boundary; this is not real E2E.

Boundaries / pending

The 5-minute cadence, 24-hour terminal TTL, 50-per-thread cap, terminal states, cascade membership, public API, SQL/schema, connection pool, PRAGMAs and WAL policy are unchanged. No runtime configuration, deployment, restart or real workspace-file deletion. This is local SQLite durability/fault-injection evidence, not a production-load, real process-kill, live-login or packaged Desktop claim. All seven required checks passed on df01b0e1cc8eefba209e6125af2205407233cd66; checks workflow 34034111396 completed successfully. Frontend-only lanes were intentionally path-filtered. CodeRabbit reported Review skipped; this is not an automated review approval.

DeliciousBuding and others added 2 commits September 6, 2026 20:18
Refs #2343. Exercise a real cleanup timer and durable reopen without final persistence masking the missing write.

Co-authored-by: Codex <codex@vectorcontrol.tech>
Commit background retention deletes, retry a failed transaction on later cleanup ticks, and finish owned workers before final persistence and database close. Cover durable reopen, SQL fault recovery and shutdown ordering with production-cadence synctest regressions.

Co-authored-by: Codex <codex@vectorcontrol.tech>
@coderabbitai

coderabbitai Bot commented Sep 6, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Team

Run ID: 09a5371a-d173-4a98-8267-3c4c42e819ee

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@DeliciousBuding
DeliciousBuding merged commit 81e02d4 into master Sep 6, 2026
41 checks passed
@DeliciousBuding
DeliciousBuding deleted the fix/sqlite-periodic-cleanup branch September 6, 2026 12:54
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.

fix(store): persist periodic SQLite cleanup and retry failed deletes

1 participant