client: introduce seams for onboarding loop#5956
Draft
eriknordmark wants to merge 2 commits into
Draft
Conversation
A comment claimed zedclient would fall back to the legacy /config endpoint when the /uuid endpoint fails. The fallback was never wired up — the /uuid path is the only one taken at runtime. Remove the unreachable helpers and the comment. No behavior change. Signed-off-by: eriknordmark <erik@zededa.com> Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Refactor zedclient so the onboarding loop is testable in isolation. Runtime state previously held in package globals — server URL, the onboard and device TLS configs, the UUID/hardwaremodel output paths — moves onto the clientContext. The post-loop publishing logic (hostname, UUID file, hardwaremodel file, OnboardingStatus) becomes a method. Four small interfaces front the runtime boundaries the loop crosses: the controller request/verify surface, the controller-cert checkpoint store, ledmanager pattern updates, and the /bin/hostname call. The existing implementations move into adapter types. Production wiring in Run is unchanged at the behavior level; tests can swap any seam. No behavior change. Signed-off-by: eriknordmark <erik@zededa.com> Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2 tasks
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #5956 +/- ##
==========================================
+ Coverage 20.50% 20.91% +0.41%
==========================================
Files 487 498 +11
Lines 90131 91797 +1666
==========================================
+ Hits 18482 19202 +720
- Misses 70095 70857 +762
- Partials 1554 1738 +184 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
6 tasks
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.
Description
Refactor zedclient so the onboarding loop is testable in isolation, in
preparation for unit tests that follow in a separate PR. Runtime state
previously held in package globals — the server URL, the onboard and
device TLS configs, and the UUID / hardwaremodel output paths — moves
onto
clientContext. The post-loop publishing logic (hostname, UUIDfile, hardwaremodel file, OnboardingStatus) becomes a method.
Four small interfaces front the boundaries the loop crosses: the
controller request/verify surface, the controller-cert checkpoint
store, ledmanager pattern updates, and the
/bin/hostnamecall. Theexisting implementations move into adapter types. Production wiring in
Runis unchanged at the behavior level; tests can swap any seam.Depends on #5954.
How to test and validate this PR
Onboard a device against any controller and confirm UUID retrieval,
hardwaremodel write, and ledmanager transitions match the previous
behavior. No new automated test in this PR.
Changelog notes
No user-facing changes.
PR Backports
Checklist