Skip to content

client: introduce seams for onboarding loop#5956

Draft
eriknordmark wants to merge 2 commits into
lf-edge:masterfrom
eriknordmark:client-refactor-seams
Draft

client: introduce seams for onboarding loop#5956
eriknordmark wants to merge 2 commits into
lf-edge:masterfrom
eriknordmark:client-refactor-seams

Conversation

@eriknordmark
Copy link
Copy Markdown
Contributor

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, UUID
file, 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/hostname call. The
existing implementations move into adapter types. Production wiring in
Run is 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

  • 16.0-stable: No.
  • 14.5-stable: No.
  • 13.4-stable: No.

Checklist

  • I've provided a proper description
  • I've written the test verification instructions

eriknordmark and others added 2 commits May 13, 2026 23:26
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>
@codecov
Copy link
Copy Markdown

codecov Bot commented May 14, 2026

Codecov Report

❌ Patch coverage is 0% with 159 lines in your changes missing coverage. Please review.
✅ Project coverage is 20.91%. Comparing base (d093be1) to head (cca7e67).
⚠️ Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
pkg/pillar/cmd/client/client.go 0.00% 124 Missing ⚠️
pkg/pillar/cmd/client/adapters.go 0.00% 35 Missing ⚠️
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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

1 participant