Skip to content

feat(rps): display structured per-component activation result#1349

Draft
madhavilosetty-intel wants to merge 1 commit into
2.x.xfrom
feat/2665-structured-provisioning-result
Draft

feat(rps): display structured per-component activation result#1349
madhavilosetty-intel wants to merge 1 commit into
2.x.xfrom
feat/2665-structured-provisioning-result

Conversation

@madhavilosetty-intel
Copy link
Copy Markdown
Contributor

Parse and surface the structured per-component provisioning result that RPS now sends (rps#2665). When the success message includes the additive Components object, log each component (Activation, Wired/ Wireless Network, TLS, CIRA Proxy/Connection) with its result and details, logging failures at error level. When Components is absent (older RPS), fall back to the existing flat status lines, so behavior against older servers is unchanged.

Refs device-management-toolkit/rps#2665

@madhavilosetty-intel madhavilosetty-intel marked this pull request as draft June 3, 2026 02:16
@madhavilosetty-intel madhavilosetty-intel force-pushed the feat/2665-structured-provisioning-result branch from 63d1686 to d327bce Compare June 3, 2026 02:24
Parse and surface the structured per-component provisioning result that
RPS now sends (rps#2665). When the success message includes the
additive Components object, log each component (Activation, Wired/
Wireless Network, TLS, CIRA Proxy/Connection) with its result and
details, logging failures at error level. When Components is absent
(older RPS), fall back to the existing flat status lines, so behavior
against older servers is unchanged.

Refs device-management-toolkit/rps#2665
Copy link
Copy Markdown

Copilot AI left a comment

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 updates the RPS client activation-status reporting to parse and surface the new structured, per-component provisioning results returned by newer RPS versions, while keeping legacy logging behavior for older RPS responses.

Changes:

  • Parse and log the new Components object in RPS “success” status messages, logging each component result individually.
  • Add new message types (ComponentResult, ComponentResults) to represent structured activation results.
  • Add tests covering structured-success parsing and basic structured/legacy logging paths.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
internal/rps/rps.go Replaces flat status logging with structured per-component logging when Components is present, with legacy fallback.
internal/rps/rps_test.go Adds tests for structured success handling and for calling the new logging helper without panics.
internal/rps/message.go Extends StatusMessage with Components and introduces structured component result structs.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread internal/rps/rps.go
Comment on lines +267 to +271
if statusMessage.Components != nil {
c := statusMessage.Components
logComponentResult("Activation", c.Activation)
logComponentResult("Wired Network", c.WiredNetwork)
logComponentResult("Wireless Network", c.WirelessNetwork)
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.

Looks to be valid suggestion. Please check

Comment thread internal/rps/rps.go
Comment on lines +291 to +294
line := label + ": " + result.Result
if result.Details != "" {
line += " (" + result.Details + ")"
}
Comment thread internal/rps/rps_test.go
Comment on lines +242 to +245
func TestLogStatusMessageStructured(t *testing.T) {
// Structured Components present: per-component lines are logged, no panic.
statusMessage := StatusMessage{
Status: "Admin control mode.",
Copy link
Copy Markdown
Contributor

@sudhir-intc sudhir-intc left a comment

Choose a reason for hiding this comment

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

Please do address the copilot review comments

Comment thread internal/rps/rps.go
Comment on lines +267 to +271
if statusMessage.Components != nil {
c := statusMessage.Components
logComponentResult("Activation", c.Activation)
logComponentResult("Wired Network", c.WiredNetwork)
logComponentResult("Wireless Network", c.WirelessNetwork)
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.

Looks to be valid suggestion. Please check

Comment thread internal/rps/rps.go
if result.Result == "Failure" {
log.Error(line)
} else {
log.Info(line)
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.

I tried your PR and don't see new info lines getting logged.

I see the following output, which is same as 2.x.x branch. Am I missing something here ?

sudo ./rpc-2665 activate -u wss://10.190.213.16/activate -n  --profile acmProfileCloud --tls-tunnel --password <password>
time="2026-06-03T14:53:26+05:30" level=info msg="connecting to wss://10.190.213.16/activate"
time="2026-06-03T14:53:26+05:30" level=info msg="connected to wss://10.190.213.16/activate"
time="2026-06-03T14:54:43+05:30" level=info msg="Status: Admin control mode."
time="2026-06-03T14:54:43+05:30" level=info msg="Network: Wired Network Configured"
time="2026-06-03T14:54:43+05:30" level=info msg="CIRA: Configured"
time="2026-06-03T14:54:43+05:30" level=info msg="TLS: unconfigured"

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.

4 participants