Skip to content

Restart stale services and handle archive schema drift - #14

Merged
ahernsean merged 2 commits into
mainfrom
fix/issue-9-readonly-archive-snapshot
Jul 30, 2026
Merged

ahernsean merged 2 commits into
mainfrom
fix/issue-9-readonly-archive-snapshot

Conversation

@ahernsean

@ahernsean ahernsean commented Jul 29, 2026 •

Copy link
Copy Markdown
Owner

Fixes #9.

Root cause

The failed web request was not SQLite lock contention. A newer one-shot process had migrated the database while the already-running web service still had older schema support loaded. Archive snapshot creation succeeded, but verification rejected the newer schema.

Changes

  • Re-running driving-log install now reloads systemd units and restarts the web service and archive timer when they are active, keeping running code aligned with database migrations.
  • Archive creation checks the snapshot schema before publishing a bundle. If the database is newer than the running application, it publishes no archive and reports that the web service must be restarted.
  • POST /archives converts that mismatch into a clear 503 response instead of an internal-server-error dialog.
  • The speculative read-only snapshot connection change was removed.
  • Deployment documentation now records the update/restart behavior.

Tests

  • Reproduce a live database schema newer than the running application.
  • Verify archive creation rejects it without publishing a .tar.gz bundle.
  • Verify the web endpoint returns 503 with restart guidance.
  • Verify installation reloads units and conditionally restarts active services.

Validation

  • PYTHONPATH=. .venv/bin/pytest -m "not browser" — 86 passed, 1 deselected
  • .venv/bin/ruff check driving_log tests
  • .venv/bin/ruff format --check driving_log tests
  • .venv/bin/mypy driving_log
  • git diff --check

@ahernsean
ahernsean force-pushed the fix/issue-9-readonly-archive-snapshot branch from 5d90d24 to 71f9b16 Compare July 29, 2026 17:05
Comment thread driving_log/archive.py Outdated
@ahernsean ahernsean changed the title Avoid archive snapshot WAL lock contention Restart stale services and handle archive schema drift Jul 29, 2026
@ahernsean
ahernsean merged commit 4846da6 into main Jul 30, 2026
5 checks passed
@ahernsean
ahernsean deleted the fix/issue-9-readonly-archive-snapshot branch July 30, 2026 01:37
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.

Pressing Create verified archive causes an error

1 participant