Conversation
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The implementation is functionally sound; remaining feedback concerns minor documentation, spelling, and test cleanup.
Review effort: Balanced
Findings: 1
Open (5)
What changed in this PR
Adds version metadata for kernel module and firmware trees, enabling future regeneration when layouts become stale.
Changes:
- Records generator version metadata after successful tree creation.
- Detects missing, corrupt, older, and newer metadata versions.
- Adds unit and spread coverage.
| File | Description |
|---|---|
kernel/kernel_drivers.go |
Implements metadata recording and version checking. |
kernel/export_test.go |
Exposes metadata test helpers. |
kernel/kernel_drivers_test.go |
Tests metadata and write failures. |
tests/core/basic20plus/task.yaml |
Verifies metadata on Core systems. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #17680 +/- ##
==========================================
+ Coverage 78.35% 78.39% +0.04%
==========================================
Files 1416 1417 +1
Lines 200464 200741 +277
Branches 2502 2503 +1
==========================================
+ Hits 157070 157369 +299
+ Misses 33972 33940 -32
- Partials 9422 9432 +10
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
cae70a5 to
8a66a70
Compare
…version Introduce versioning of the organization of the kernel modules & firmware trees. The patch adds a helper to record the version of the layout and another helper to check and compare indicating whether the tree was set up by older version of the code. Both are essential for being able to determine if the tree needs to be rebuilt/updated when updating snapd. Signed-off-by: Maciej Borzecki <maciej.borzecki@canonical.com>
Signed-off-by: Maciej Borzecki <maciej.borzecki@canonical.com>
8a66a70 to
ffeae86
Compare
|
Thu Sep 24 15:08:06 UTC 2026 No spread result artifacts foundNo spread results JSON artifacts were available for this workflow run, so spread failures (if any) could not be reported. |
pedronis
left a comment
There was a problem hiding this comment.
did a pass, some minor comments
| func readDriversTreeGeneratorMeta(destDir string) (driversTreeMeta, error) { | ||
| data, err := os.ReadFile(driversTreeMetaPath(destDir)) | ||
| if errors.Is(err, fs.ErrNotExist) { | ||
| return driversTreeMeta{}, nil |
There was a problem hiding this comment.
should this have:
GeneratorVersion: 0
to be explicit?
| var meta driversTreeMeta | ||
| if err := json.Unmarshal(data, &meta); err != nil { | ||
| // Treat unparseable metadata the same as missing: needs a check, or | ||
| // could be corrupted? |
There was a problem hiding this comment.
should this emphasize that the likely result of that is rebuilding the tree?
There was a problem hiding this comment.
could also make it an error and turn into false a level above for clarity?
| // DriversTreeNeedsCheck returns true when the kernel modules & firmware tree at | ||
| // destDir was built by an older version of the generator code, indicating it | ||
| // may need to be checked or rebuilt. | ||
| func DriversTreeNeedsCheck(destDir string) (bool, error) { |
There was a problem hiding this comment.
/NeedsCheck/Outdated perhaps?
| stat /run/systemd/system/"sysroot-writable-system\x2ddata-snap-$device\x2dkernel-"* | ||
|
|
||
| # Check the generator version | ||
| gojq '.["generator-version"]' /var/lib/snapd/kernel/"$device"-kernel/x1/kernel.json | \ |
There was a problem hiding this comment.
x1? I'm prob missing something but I don't see where this test installs a local kernel.
There was a problem hiding this comment.
this is the core suite, so running on UC and we repack the kernel in prepare, so it's always unasserted AFAIU
There was a problem hiding this comment.
garden:ubuntu-core-26-64 .../tests/core/basic20plus# snap list pc-kernel
Name Version Rev Tracking Publisher Notes
pc-kernel 7.0.0-38.38r1 x1 - - kernel,components[13]
| // A tree marked with a version *newer* than what is currently running (e.g. | ||
| // after a snapd revert) is deliberately NOT considered outdated: rebuilding | ||
| // it with older, possibly-buggy logic could regress a fix already applied | ||
| // by the newer generator. Only consider the kernel tree to be outdated of |
There was a problem hiding this comment.
| // by the newer generator. Only consider the kernel tree to be outdated of | |
| // by the newer generator. Only consider the kernel tree to be outdated if |


Introduce versioning of the organization of the kernel modules &
firmware trees. The patch adds a helper to record the version of the
layout and another helper to check and compare indicating whether the
tree was set up by older version of the code.
Both are essential for being able to determine if the tree needs to be
rebuilt/updated when updating snapd.
Cherry picked from #17646
Related: SNAPDENG-37501