Skip to content

Handle partial printer profile updates - #230

Open
PedroBMR wants to merge 1 commit into
mainfrom
codex/update-save_printer_profile-to-merge-settings
Open

Handle partial printer profile updates#230
PedroBMR wants to merge 1 commit into
mainfrom
codex/update-save_printer_profile-to-merge-settings

Conversation

@PedroBMR

Copy link
Copy Markdown
Owner

Summary

  • add a JSON settings column and calibrate_next_print field to the printer profile schema while keeping migrations compatible
  • extend the store helpers with printer profile CRUD support that merges partial updates before normalising and persists the calibrate flag in both places
  • cover partial printer profile updates with a regression test to ensure unspecified fields are preserved

Testing

  • pytest tests/test_db_store.py

https://chatgpt.com/codex/tasks/task_e_68da94e47ca4832c9ee0f3e759382f8b

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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

Comment thread db/store.py
Comment on lines +253 to +257
with contextlib.closing(get_conn(database)) as conn:
row = conn.execute(
"SELECT settings FROM printer_profiles WHERE name = ?",
(name,),
).fetchone()

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[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 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant