Repository navigation
fix: chunk 1 — files and import safety #136
Copy link
Copy link
Closed
Milestone
Description
Part of the fix track (parent issue linked in the sidebar). These items change behaviour on purpose; each final answer was decided on 2026-10-16. The test checklist at the bottom is one hardware session.
Owners after the rewrite: config/json-store.ts (+ policies), nodes/mapping-store.ts, config/config-transfer.ts, config/config-file.ts, app/bootstrap.ts.
| Item | Today | After |
|---|---|---|
| D5 / M6 + X13 durable saves | node-mapping.json: temp + rename, no fsync, no backup, a damaged file becomes an empty cockpit. config.json and calibration-cache.json: plain writes, errors swallowed |
One JSON-store policy for all three files: fsync before rename, keep a .bak, fall back to it when the file is unreadable, and log an event row when the fallback is used |
| M11 read retry | One transient read error makes the mapping read-only for the whole run | Retry on next access and show the reason |
| D3 / C1 import as written, reject malformed | Any object passes for a known section; "nodeMapping": {} wipes every adopted board, app: {} resets settings |
Membership (added + adopted) imported as written, this machine keeps its own lastSeen; a malformed or incomplete section is rejected and listed as skipped. Links to a PDU outside the cockpit import as No power zone and the preview says so |
| S4 membership preview | Added vs adopted import differently; preview never shows boards joining or leaving the cockpit | One membership rule; the preview lists joins and leaves |
| C2 / M10 one import transaction | Mapping, then calibration, then settings written in turn; later failures leave a half-applied import that reports success | Validate and stage every target, commit together or roll back, report honestly. Failure-injection tests |
| NEW (user 2026-10-17) automatic backups list | The backup taken before an import is a timestamped file in <userData>/backups/ that nothing in the UI points to |
Settings › Configuration › Automatic backups: up to 5, newest first, each with date, the file it was taken before, sections, and Restore… (opens the import review titled “Restore backup”; restoring backs up first). Show in Finder/Explorer opens the folder. Only the newest 5 are kept on disk. Each backup records the file it came before, inside the backup. Success line points to the list. Design: Settings board › Configuration |
| D4 / M5 single instance | Two instances overwrite each other's files | requestSingleInstanceLock; a second launch focuses the running window |
Tests that change on purpose: config-file.test.ts C1 case; the F19 "import keeps this machine's added" cases (node-hub, config-file, mapping-rules tests).
Hardware/desk test (one session)
- Damage
node-mapping.jsonby hand while the app is closed, then launch: the cockpit comes back from.bakand the Log shows a notice - Import a file with
"nodeMapping": {}: refused, listed as skipped, cockpit untouched - Export, change boards, import the export: the cockpit matches the export; the preview listed the joins/leaves
- Import with an unwritable target (e.g. read-only
config.json): nothing applied, failure reported - Launch the app twice: the second launch focuses the first window
- Import twice with the backup box ticked: both backups listed with date + source file; Show in Finder opens the folder
- Restore… a backup: review titled “Restore backup”, applying it backs up the current setup first
- After 6 imports only 5 backups remain on disk
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
Activity
fix(app): a second launch with every window closed opens one, as acti…
fix(app): single app instance, a second launch brings the running win…
fix(config): durable saves with fsync, backup and fallback for every …
fix(config): rollback restores each file and its .bak byte for byte; …
fix(config): strict import validation, membership as written, one imp…
fix(config): plain wording for file errors, and warning rows labelled…
feat(config): automatic backups list with restore, keeping the newest…