Fix/syncer minor fixes#1410
Open
ervcz wants to merge 4 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR tightens Nebraska’s multi-step update (“floor packages”) behavior for syncers by making floor handling consistent across single- and multi-manifest Omaha responses, adding pagination/version-tracking when only floors are returned, and improving robustness when parsing Omaha XML responses. It also consolidates the ADR documentation by moving the Multi-Step Updates ADR content into the central architecture decisions document.
Changes:
- Fix syncer behavior so floor marking isn’t skipped for single-manifest responses; add safe Omaha response parsing and additional syncer tests.
- Split syncer responses into
floors+target(target can be nil when more floors remain) and update Omaha handler + API plumbing accordingly. - Consolidate ADR docs: remove standalone ARD-001 file and add ADR-002 section to
docs/architecture-decisions.md.
Reviewed changes
Copilot reviewed 11 out of 12 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| docs/ARD-001-multi-step-updates.md | Removes the standalone ADR document (content is consolidated elsewhere). |
| docs/architecture-decisions.md | Adds ADR-002 for floor packages and minor formatting changes. |
| backend/pkg/syncer/syncer.go | Makes update processing floor-aware even for single-manifest responses; adds safe Omaha parsing; tracks highest floor when no target is present. |
| backend/pkg/syncer/syncer_parse_test.go | Adds unit tests for Omaha update response parsing (guards against panics / nil updatecheck). |
| backend/pkg/syncer/syncer_multimanifest_test.go | Refactors setup and adds coverage for floor pagination/version tracking and single-manifest floor cases. |
| backend/pkg/omaha/omaha.go | Changes syncer response composition to send floors and target separately; updates multi-manifest response building accordingly. |
| backend/pkg/omaha/omaha_floors_test.go | Updates floor scenario tests and adds pagination tests around max floors per response. |
| backend/pkg/omaha/helpers_test.go | Adds a shared helper for building syncer Omaha requests in tests. |
| backend/pkg/api/updates.go | Adjusts update selection to return first floor vs target; updates syncer API to return (floors, target); updates floor/target helper semantics. |
| backend/pkg/api/packages.go | Minor SQL formatting change in DeletePackage pre-check. |
| backend/pkg/api/packages_floors.go | Reworks required-floor selection to support limit detection + semver ordering (via in-memory selection helper). |
| backend/pkg/api/packages_floors_test.go | Updates tests for new floor API shape and adds targeted coverage for floor range/ordering/limit semantics. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+113
to
+117
| - If package 3602.2.0 requires 3510.2.0 as prerequisite | ||
| - Later, 3815.0.0 is released WITHOUT prerequisites if prerquisit is not inherited | ||
| - Clients can jump directly to 3815.0.0, bypassing 3510.2.0 | ||
|
|
||
| This means ALL future packages would need to inherit prerequisites, even for unrelated changes. Floor-based semantics solve this by making checkpoints a channel policy, not a package property. This way we have a central management of update path instead of tracking prerequisits for all later packages individually. |
Comment on lines
+411
to
+412
| // Get required floors using LIMIT+1 to detect if more floors remain | ||
| // This is more efficient than a separate COUNT query |
Comment on lines
+225
to
229
| allFloors, err := api.GetChannelFloorPackages(channel.ID) | ||
| if err != nil { | ||
| return nil, err | ||
| return nil, false, err | ||
| } | ||
|
|
An upstream reply with no <app>, or an <app> without <updatecheck>, caused an index-out-of-range / nil dereference that crashed the syncer. Parse the response defensively and return an error instead. Signed-off-by: Ervin Rácz <ervin.racz@protonmail.com>
Floor selection compared versions in SQL with the pre-release/build suffix stripped, so a release floor could be skipped for an instance on a pre-release of the same version. Select the range with blang/semver. Signed-off-by: Ervin Rácz <ervin.racz@protonmail.com>
d2d2d29 to
cb2018c
Compare
Signed-off-by: Ervin Rácz <ervin.racz@protonmail.com>
Comment on lines
+224
to
+230
| allFloors, err := api.GetChannelFloorPackages(channel.ID) | ||
| if err != nil { | ||
| return nil, err | ||
| } | ||
|
|
||
| lteExpr, err := versionCompareExpr("p.version", "<=", targetVersion) | ||
| floors, _, err := selectFloorsInRange(allFloors, instanceVersion, channel.Package.Version, limit) | ||
| return floors, err |
- Record floor status for single manifests that are channel targets - Prevent downstream clients from skipping floor packages Signed-off-by: Ervin Rácz <ervin.racz@protonmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two small, independent bug fixes in the floors/syncer area.
Syncer crash on a malformed upstream response
An Omaha reply with no
<app>, or an<app>without<updatecheck>, caused an index-out-of-range / nil dereference that crashed the whole Nebraska process (the syncer goroutine has norecover). The response is now parsed defensively and returns an error instead.Mandatory floor skipped for pre-release instances
Floor selection compared versions in SQL with the pre-release/build suffix stripped, so a release floor (
2000.0.0) was skipped for an instance on a pre-release of the same version (2000.0.0-rc1). Selection now usesblang/semver; numeric Flatcar versions are unaffected.Testing
TestParseOmahaUpdateResponse,TestSelectFloorsInRange,TestFloorPreReleaseNotSkipped.go build+go vetclean.