Repository navigation
Conversation
Prints a product's utilization report from the server: how its devices authenticate, the recommended features in use as a score, and optional ones. Supports --verbose, --color and -o json, and says so when the server is too old to have the report. Claude-Session: https://claude.ai/code/session_012eH1p6xCoKP74cPEdpGiXX
Rummager review of
|
| Before | After |
|---|---|
![]() |
![]() |
Before the PR nh checklist is an unknown command. After, it shows the bold header with the (5/13) score, Shared Secret in orange, LocalCert in green and NervesKey 0 dimmed, the coloured marks, and doc links only under recommended features that are todo or attention.
Verbose checklist report
| Before | After |
|---|---|
| none | ![]() |
With --verbose every feature, the optional ones included, gets a dimmed description and doc link indented under it; there is no before because the command does not exist on base.
Older server message
| Before | After |
|---|---|
| none | ![]() |
This is the upgrade error printed when /utilization returns 404 but the product itself is found; base has no such command, so there is no before.
- Note: There was no NervesHub server to use, so the real
nhbinaries (built from base and head) talked to a small local mock API serving a made-up thermostat report (4 Shared Secret / 124 LocalCert devices). The coloured--color alwaysoutput was then drawn in an HTML terminal window for the screenshot.
rummager · prompts 885379605730 · automated, verify before acting.
u7d-bot
left a comment
There was a problem hiding this comment.
Inline findings for 80284583bb. The summary is in the rummager comment.
| - opens with the score (recommended features in use, such as `(5/13)`) and how | ||
| the product's devices authenticate: `Shared Secret` in orange, `LocalCert` | ||
| and `NervesKey` in green |
There was a problem hiding this comment.
[WARNING] The README ties each colour to an authentication method, but authMethods colours by the server's level and device count. Prose, comments and docs · definite
In authMethods, a method with 0 devices is dimmed, so the NervesKey 0 in the test fixture is not green. A shared secret whose server level is good (each device has its own secret, per the UtilizationAuthMethod.Level comment) prints green, not orange.
| - opens with the score (recommended features in use, such as `(5/13)`) and how | |
| the product's devices authenticate: `Shared Secret` in orange, `LocalCert` | |
| and `NervesKey` in green | |
| - opens with the score (recommended features in use, such as `(5/13)`) and how | |
| the product's devices authenticate: a method to move away from, such as a | |
| secret shared by the whole product, in orange, the others in green and unused | |
| ones dimmed |
| It opens with the score, the recommended features in use out of those the | ||
| server offers, and how the product's devices authenticate: a shared secret is | ||
| marked as one to move away from, and certificates (LocalCert, NervesKey) as | ||
| where to be. Then each recommended feature, and after those the optional ones, | ||
| which are situational and don't count towards the score. |
There was a problem hiding this comment.
[WARNING] The help text says a shared secret is always marked as one to move away from, but the server rates per-device secrets good. Prose, comments and docs · likely
This assumes the UtilizationAuthMethod.Level comment matches the server: it says a shared secret is good when each device has its own secret. In that case the CLI shows the method as fine, which this help text contradicts.
| It opens with the score, the recommended features in use out of those the | |
| server offers, and how the product's devices authenticate: a shared secret is | |
| marked as one to move away from, and certificates (LocalCert, NervesKey) as | |
| where to be. Then each recommended feature, and after those the optional ones, | |
| which are situational and don't count towards the score. | |
| It opens with the score, the recommended features in use out of those the | |
| server offers, and how the product's devices authenticate: a secret shared by | |
| the whole product is marked as one to move away from, and certificates | |
| (LocalCert, NervesKey) or per-device secrets as where to be. Then each | |
| recommended feature, and after those the optional ones, which are situational | |
| and don't count towards the score. |
| recommended := itemsIn(report.Items, api.UtilizationGroupRecommended) | ||
| fmt.Fprintf(&b, "\n%s %s\n", | ||
| style.paint(ansiBold, "Recommended"), | ||
| style.paint(ansiDim, fmt.Sprintf("(%d/%d)", doneCount(recommended), len(recommended)))) | ||
| writeItems(&b, recommended, width, style) |
There was a problem hiding this comment.
[WARNING] The Recommended section's (done/total) uses len(recommended) as the total, so it counts unavailable items that the headline score leaves out. Correctness · likely
The code's own docs say an unavailable feature is not available on the server and is not scored. With the test fixture this prints Recommended (1/3) even though only 2 of those features can be adopted, so the section suggests the product is further behind than the headline score does. Divide by the number of recommended items whose status isn't api.UtilizationUnavailable (giving (1/2) here) and update the expected test output to match.
| f, ok := w.(*os.File) | ||
| return ok && term.IsTerminal(int(f.Fd())), nil |
There was a problem hiding this comment.
[SUGGESTION] useColor writes its own terminal check for stdout instead of reusing the existing stdoutIsTerminal helper in cmd/login.go. Code quality · definite
stdoutIsTerminal already does this check, and tests can replace it. Because useColor has its own copy, no test can reach the --color auto branch that colours terminal output or check that NO_COLOR turns colour off. Pass cmd instead of w and call stdoutIsTerminal(cmd) here, then add a test for terminal output under auto and one for NO_COLOR.
- The Recommended section's total leaves out features the server can't offer, as the score does. - --color auto uses the shared stdoutIsTerminal check, with tests for a terminal, a pipe and NO_COLOR. - The help and README describe authentication colours as the server rates them: per-device secrets are fine, unused methods are dimmed. Claude-Session: https://claude.ai/code/session_012eH1p6xCoKP74cPEdpGiXX




Prints a product's utilization report from the server: how its devices authenticate, the recommended features in use as a score, and optional ones. Supports --verbose, --color and -o json, and says so when the server is too old to have the report.