Handle partial printer profile updates - #230
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting
| with contextlib.closing(get_conn(database)) as conn: | ||
| row = conn.execute( | ||
| "SELECT settings FROM printer_profiles WHERE name = ?", | ||
| (name,), | ||
| ).fetchone() |
There was a problem hiding this comment.
[P1] Preserve legacy values when saving printer profiles
The update path merges incoming settings only with the JSON column retrieved by SELECT settings, ignoring the existing numeric columns. For profiles created before the new settings column existed, that column is NULL while fields like gap_mm and speed still live in their own columns. Calling save_printer_profile with a partial payload therefore normalises everything to the defaults and the subsequent upsert overwrites all other columns with NULL/0, erasing the stored profile the first time a partial update is made after upgrading. Consider populating merged_settings from the current row or backfilling the JSON column during migration to avoid silent data loss.
Useful? React with 👍 / 👎.
Summary
settingscolumn andcalibrate_next_printfield to the printer profile schema while keeping migrations compatibleTesting
https://chatgpt.com/codex/tasks/task_e_68da94e47ca4832c9ee0f3e759382f8b