Skip to content

Fix/syncer minor fixes#1410

Open
ervcz wants to merge 4 commits into
mainfrom
fix/syncer-minor-fixes
Open

Fix/syncer minor fixes#1410
ervcz wants to merge 4 commits into
mainfrom
fix/syncer-minor-fixes

Conversation

@ervcz

@ervcz ervcz commented Jun 30, 2026

Copy link
Copy Markdown
Collaborator

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 no recover). 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 uses blang/semver; numeric Flatcar versions are unaffected.

Testing

  • New tests: TestParseOmahaUpdateResponse, TestSelectFloorsInRange,
    TestFloorPreReleaseNotSkipped.
  • Existing floor/syncer tests pass (no regression); go build + go vet clean.
  • Changelog entries added under Unreleased → Bugfixes.

Copilot AI review requested due to automatic review settings June 30, 2026 14:30

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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 thread docs/architecture-decisions.md Outdated
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 thread backend/pkg/api/updates.go Outdated
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
}

ervcz added 2 commits July 1, 2026 10:15
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>
@ervcz ervcz force-pushed the fix/syncer-minor-fixes branch from d2d2d29 to cb2018c Compare July 1, 2026 07:23
Signed-off-by: Ervin Rácz <ervin.racz@protonmail.com>
Copilot AI review requested due to automatic review settings July 1, 2026 11:06

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

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
@ervcz ervcz marked this pull request as ready for review July 1, 2026 11:15
@ervcz ervcz requested a review from a team as a code owner July 1, 2026 11:15
- 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>
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.

2 participants