Repository navigation
feat(app): run config migrations at start-up, document backups - #307
Conversation
Mira PR WalkthroughThis PR adds config migration support to the app's startup process. It automatically runs migrations when loading the config, creates backups before applying changes, and properly handles version mismatches (rejecting newer configs). Documentation is updated to explain backup recovery procedures. 3 files reviewed
|
|
/mira pause |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
Mira Review Summary
The PR adds config migration at startup with backup support. Found a bug where the version 0 migration throws a generic Error instead of RangeError, causing incorrect error handling. Also, the test expects the wrong error code for version 0 config. Added suggestions for JSDoc and error handling clarity.
Key Issues
| Issue | Location | |
|---|---|---|
| 🔴 | Migration for version 0 incorrectly throws generic Error, causing misleading error messages | src/app-config.js:70 |
| 🔴 | Test expects CONFIG_INVALID for version 0 but migration may throw CONFIG_TOO_NEW | test/app-config.test.js:194 |
|
Thanks Mira. Went through each point:
|
9b264fb to
42ec0fb
Compare
|
Review-lane note on Mira's migration warning: the current behavior is intended, don't apply its suggestion. A version-0 file was never released, so it should fail as damaged/out-of-date (CONFIG_INVALID via the deliberate fall-through in migrateAppConfig), not as "saved by a newer NowPlaying" - Mira's own comment admits that message would be inaccurate. The test asserting CONFIG_INVALID for version 0 documents the intended contract. |
Closes #120
loadAppConfignow runs the existing migration store (feat: add versioned config migration core #182/feat: back up config before migration #183) before reading the config.CONFIG_VERSION = 1. Future format changes only need a new entry inCONFIG_MIGRATIONS, and the store backs up toconfig.json.backup-<time>before replacing the file with a validated result.CONFIG_TOO_NEWstart-up error and a plain message. The file isn't touched.CONFIG_INVALID/CONFIG_LOAD_FAILEDmessage.