Repository navigation
Stored data schema versioning (ROADMAP 2.10) - #28
Merged
Merged
Conversation
…(ROADMAP 2.10) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… rows (ROADMAP 2.10) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… test (ROADMAP 2.10) - Move the unknown config.json key warning out of prepare_data() into warn_unknown_settings(), called only from the server's startup. Both run.py and the server ran prepare_data, so the warning printed twice. - Switch pre-upgrade DB backups to journal_mode=DELETE, so opening a backup doesn't leave -wal/-shm files in data/backups/. - Test that a backup includes writes still in the WAL file (a connection held open with autocheckpoint off), which the earlier test couldn't reach because closing the connection checkpointed the WAL. - README: an existing config.json gets its version on the next Settings save, backups are named after the database file, and quit any running copy before starting a newer one (the check only notices one on the same port). - ROADMAP: record why a newer session_state.json is refused even when it says no walk is active. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Merged
SeanathanVT
added a commit
that referenced
this pull request
Oct 30, 2026
* feat(storage): version and migrate stored data, refuse newer formats (ROADMAP 2.10) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(storage): refuse unusable schema versions cleanly, stamp imported rows (ROADMAP 2.10) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(storage): single unknown-key warning, non-WAL backups, WAL backup test (ROADMAP 2.10) - Move the unknown config.json key warning out of prepare_data() into warn_unknown_settings(), called only from the server's startup. Both run.py and the server ran prepare_data, so the warning printed twice. - Switch pre-upgrade DB backups to journal_mode=DELETE, so opening a backup doesn't leave -wal/-shm files in data/backups/. - Test that a backup includes writes still in the WAL file (a connection held open with autocheckpoint off), which the earlier test couldn't reach because closing the connection checkpointed the WAL. - README: an existing config.json gets its version on the next Settings save, backups are named after the database file, and quit any running copy before starting a newer one (the check only notices one on the same port). - ROADMAP: record why a newer session_state.json is refused even when it says no walk is active. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Every format WalkingDad stores on disk now declares its version. Older data is upgraded in order, and data written by a newer WalkingDad is refused instead of risked. The original ROADMAP entry was written when history was still JSON; this PR re-scopes it to the SQLite database plus the two JSON files.
walkingdad.db(meta.schema_version)data/backups/<db>.v<old>-<timestamp>, then upgraded one step at a time, each in its own transactionconfig.jsonsession_state.jsonEvery past
config.jsonandsession_state.jsonchange was additive (checked in git history), so all existing files are v1 and no JSON migrations exist yet.Changes
storage.py:init_db(path, backup_dir)is now a migration runner (_MIGRATIONS, first step = v3 profiles table).journal_mode=DELETE.DataVersionError.sessions.schema_version.config.py:prepare_data()is the single startup data step: relocate legacy files, version-check both JSON stores, then create or upgrade the DB.migrate()is the in-memory upgrade hook for the JSON stores.warn_unknown_settings()logsconfig.jsonkeys it doesn't recognize, e.g.max_speed_kph.run.py: sets up logging, then runsprepare_data()right aftercheck_port()and before launching Waitress. A refusal or failed upgrade exits with a clear message instead of a child-process traceback and a dead browser tab. Running it after the port check means a newer copy can't upgrade the DB under an older one still running on that port.app.py: startup callsprepare_data()as a backstop for launchingwaitress-servedirectly._write_configmigrates, then stampsschema_version. The session-state snapshot carriesschema_version.[Unreleased], and a README "Data format versions" section covering recovery from a backup.Deliberate choices
session_state.jsonis refused even when it says no walk is active. That field can't be trusted in an unknown format, and misreading it would let the startup sweep close a recoverable walk..shortcutfile.Test plan
pytestpasses on Python 3.10, 3.12, 3.13 (500 tests);ruff check .cleanbackup()is swapped for a file copy)run.pyagainst a copy of a v99 DB: refusal printed, Waitress never launchedpython run.pycreatesdata/backups/walkingdad.db.v2-*and history still showsWindows: backup and file-locking behavior during an upgrade is untested (the maintainer doesn't run Windows).
🤖 Generated with Claude Code