Skip to content

fix(fleet): no-issue: creating a machine with no optional fields - #575

Merged
dannash100 merged 2 commits into
mainfrom
fix/machine-create-empty-update
Sep 18, 2026
Merged

dannash100 merged 2 commits into
mainfrom
fix/machine-create-empty-update

Conversation

@dannash100

@dannash100 dannash100 commented Sep 17, 2026

Copy link
Copy Markdown
Contributor

fleet/machines/create returned 500 and created the machine anyway when every optional field was omitted: it inserts, then applies the rest of the form as an edit, and diesel refuses to build an empty update.

  • Machine::update takes diesel's .optional_empty_changeset(), which also fixes machines/update sent with only machine_id.

  • Application::update had the same case handled by hand, swallowing every QueryBuilderError rather than just the empty one. Now the same call, so it is one idiom and stricter.

  • Guarding in create instead would mean hand-enumerating MachineUpdate's fields away from the struct.

  • Run Review Hero

Comment thread crates/database/src/machines.rs
@review-hero

review-hero Bot commented Sep 17, 2026

Copy link
Copy Markdown

🦸 Review Hero Summary (round 1)
7 agents reviewed this PR | 2 failed | 1 critical | 0 suggestions | 0 nitpicks | Filtering: consensus 3 voters

Local fix prompt (copy to your coding agent)
Fix these issues identified on the pull request. One commit per issue fixed.

-------

`crates/database/src/machines.rs:201`: `.optional_empty_changeset()` is called on the `Result<usize, diesel::result::Error>` returned by `.execute(db).await`, but no such method exists anywhere in the codebase (no trait definition, no import) — this will fail to compile. The sibling `Application::update` in applications.rs (~line 954-961) handles the same 'empty changeset from an all-None update' case manually via `match ... { Err(diesel::result::Error::QueryBuilderError(_)) => {}, ... }`; this PR appears to intend an extension-trait helper for the same pattern but never actually defines it.

@dannash100
dannash100 added this pull request to the merge queue Sep 18, 2026
Merged via the queue into main with commit 0263285 Sep 18, 2026
16 checks passed
@dannash100
dannash100 deleted the fix/machine-create-empty-update branch September 18, 2026 01:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant