docs/api: document fix-encryption-support - #17702
raimundo-henriques wants to merge 2 commits into
Conversation
Clarify and make small fixes to the request body schema of action fix-encryption-support: - document that the action requires a prior GET request to create a non-stateful pre-install check context; - document that the fix-action values are defined by secboot, indicating that they are returned in availability-check-errors.actions and that an empty string maps to ActionNone; - fix the type of args from array of strings to non-empty object; - document the 500 response on systems-label. As a drive-by change it also fixes the use of backticks.
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
The new action reference contradicts the documented SystemDetails schema.
Get a fresh assessment by requesting another Copilot review.
Review effort: Balanced
Findings: 1
Open (1)
What changed in this PR
Improves OpenAPI documentation for the storage-encryption repair workflow.
Changes:
- Documents prerequisite context, valid fix actions, and argument structure.
- Adds the possible HTTP 500 response.
- Standardizes inline code formatting.
| File | Description |
|---|---|
docs/api/v2/paths/systems-label.yaml |
Documents responses and result variants. |
docs/api/v2/components/schemas/SystemActionInstallGenerateRecoveryKeyResponse.yaml |
Corrects inline code formatting. |
docs/api/v2/components/schemas/SystemActionFixEncryptionSupport.yaml |
Expands the fix-action contract. |
docs/api/v2/components/schemas/SystemActionCheckAuthQualityResponse.yaml |
Corrects inline code formatting. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
Thu Sep 24 17:08:03 UTC 2026 Spread tests skipped |
The description of fix-actions currently treats the actions returned in availability-check-errors.actions as an example of the operations that can be made with this action. Only action "None" is always allowed The "context" that is carried between iterations during error fixing contains the allowed actions based on the errors previously encountered. |
No mention of the ordering of the actions is present. If I understand correctly, this is a wider problem, outside of the spec's scope. I propose addressing it in the surrounding documentation (for now). Excellent question! Look at this: canonical/secboot#454 (comment) and also canonical/secboot#470 So in conclusion, order is critical. This is what you want: https://github.com/canonical/secboot/pull/470/changes#diff-69eda06609ee6462011fbd75e585d6aacd71906b9126db7bfec20b435d87f453R38-R57 |
ernestl
left a comment
There was a problem hiding this comment.
Good additions. Answered open questions. Some comments for your consideration.
| description: Payload to apply a corrective action to fix storage encryption support. | ||
| description: >- | ||
| Payload to apply a corrective action to fix storage encryption support. | ||
| This action can only be performed after a pre-install check context is created |
There was a problem hiding this comment.
Perhaps "after an initial" -> we need to be clear that single GET is required to allow as many iterations of fixes as is required until success/failure.
Perhaps "Actions" instead of "This action" helps clarify multiple iterations?
Just suggestions to help demonstrate my point, if you agree you are welcome to choose better words.
There was a problem hiding this comment.
Good point! Thank you! 'Actions' might be ambiguous, though, as it might be taken to refer to any action, whereas this only applies to iterations fix-encryption-support. But your point still stands, of course. I'll come up with a proposal.
| Payload to apply a corrective action to fix storage encryption support. | ||
| This action can only be performed after a pre-install check context is created | ||
| through a GET request to the same system label. That context is kept in memory | ||
| and is lost after a subsequent GET request, when snapd restarts, or when the |
There was a problem hiding this comment.
Is this specific enough? Its not any GET request, its a very specific request that resets context.
There was a problem hiding this comment.
Also a very fair point. The idea was:
- 'GET request to the same system label' ->
GET /v2/systems/{label} - 'subsequent GET request' -> subsequent GET request to the same system label
But as I type I see that this is far from transparent.
Thanks!
| description: The specific fix to apply. | ||
| description: >- | ||
| The specific fix to apply. Valid values are the action names defined in the secboot | ||
| library, e.g., those in the `storage-encryption.availability-check-errors.actions` |
There was a problem hiding this comment.
There are two points to make here:
- The exhaustive list is defined in secboot here: https://github.com/canonical/secboot/blob/master/efi/preinstall/actions.go
- Which of these are allowed to be used to attempt to fix currently reported errors are determined by secboot and communicated via
storage-encryption.availability-check-errors.actions
Consider separating the points more clearly.
There was a problem hiding this comment.
This overlaps with the question you've also answered separately. You're absolutely right. Thanks for the comment and the context!
ZeyadYasser
left a comment
There was a problem hiding this comment.
Looks really good, Thanks! left tiny nitpicks comments
| description: The specific fix to apply. | ||
| description: >- | ||
| The specific fix to apply. Valid values are the action names defined in the secboot | ||
| library, e.g., those in the `storage-encryption.availability-check-errors.actions` |
There was a problem hiding this comment.
Only the actions from storage-encryption.availability-check-errors.actions are allowed as Ernest highlighted.
There was a problem hiding this comment.
Perfect! I'll update this soon, thanks!
| type: string | ||
| description: The specific fix to apply. | ||
| description: >- | ||
| The specific fix to apply. Valid values are the action names defined in the secboot |
There was a problem hiding this comment.
I wonder if we should mention secboot vs keeping the spec self-contained to avoid people depending on internals of secboot?
There was a problem hiding this comment.
This is a very good question. The problem for me is that we are dependent on secboot. So, if we don't refer to it, then we need to provide more details as to which action names are accepted (for instance). But then we need to maintain it, which sounds like a bad idea... The same applies to errors, for instance. So, while in principle I would defend the self-contained option, in this case I think it's not really maintainable. What do you think?
There was a problem hiding this comment.
I think you make a good point here, if we mention the content of secboot stuff here then we need to ensure it is maintained and up-to-date. Is there any public documentation available for secboot? If so, IMO we should provide a link to the relevant area of documentation, but if not, we may need to provide some of the information here. @ZeyadYasser what do you think?
There was a problem hiding this comment.
Just to clarify, I don't think linking to the secboot source code would be a good solution for this. If we are going to link to it, it should be formatted documentation
There was a problem hiding this comment.
Thanks @Rnfudge02 ! As far as I can tell, there is no secboot documentation. Which left exactly with the dilemma of either not linking at all or linking to the source code. I opted for the former.
The issue I see with providing more secboot-related context is that it will be needed in multiple places. The changes I'm proposing here, for instance, would be a place where we would have to add a lot more context. I see three options:
(A) not mention secboot at all;
(B) mention secboot and let the user do their research if they need more details;
(C) adding more details about secboot (errors, actions, etc.).
I think (A) is unhelpful and (C) unmaintainable, as we would have to constantly keep updating the spec whenever something changes on secboot. So I've landed on (B) although it feels suboptimal.
I guess the best option would be for secboot to have documentation we could link to. Happy to discuss that, but it's definitely outside this PR's scope...
Rnfudge02
left a comment
There was a problem hiding this comment.
A little comment about secboot actions and errors, other than that, LGTM! Thanks!
Enrich the descriptions of fix-encryption-support to: - make it clearer that an initial GET request is required and that multiple iterations of the fix-encryption-support action can be performed; and - indicate that the actions should be performed in the order by which they are returned in the SystemDetails.
|
@ernestl , @ZeyadYasser and @Rnfudge02 thanks for your reviews! I've made some updates to the |
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
The context lifecycle documentation inaccurately equates replacement by a subsequent GET with context loss.
Get a fresh assessment by requesting another Copilot review.
Review effort: Balanced
Findings: 1
Open (1)
Resolved since last review (1)
| check context is lost if another GET request to the same system is made | ||
| (`GET /v2/systems/{label}`), if snapd restarts, or if the system reboots. |
There was a problem hiding this comment.
I'm inclined to accept this formulation.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #17702 +/- ##
==========================================
- Coverage 78.45% 78.39% -0.06%
==========================================
Files 1404 1415 +11
Lines 200464 200582 +118
Branches 2503 2503
==========================================
- Hits 157269 157248 -21
- Misses 33773 33917 +144
+ Partials 9422 9417 -5
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:
|

Problem
Although action
fix-encryption-supportwas already documented, it lacked some details and had some errors:GETrequest to the same systems label was needed before executing it;fix-actionare defined by the secboot library and are returned byavailability-check-errors.actions;argswas wrongly defined as an array of strings;systems-labeldid not document the500response (which actionfix-encryption-supportmight return, for instance when called without a priorGETrequest.Solution
The necessary context was added where needed.
The definition of
argswas fixed: it is now described as a non-empty object.Response
500was added tosystems-label.Open questions
The description of
fix-actionscurrently treats the actions returned inavailability-check-errors.actionsas an example of the operations that can be made with this action.If I understand correctly, as long as the action exists in secboot, then it can be used here, even if it is not explicitly mention in
availability-check-errors.actions.Is this the case? If so, is the current formulation sufficiently clear?
No mention of the ordering of the actions is present. If I understand correctly, this is a wider problem, outside of the spec's scope. I propose addressing it in the surrounding documentation (for now).
Drive-by changes
Fixed the use of back-ticks. A more consistent review of the specs in this regard is, however, in order.
Context
This PR presupposes #17696 and is dependent on its approval.
SNAPDENG-36197