fix(cli): render full-fidelity values for cluster read/subscribe/invoke - #104
Merged
Merged
Conversation
formatTLVContainer applied the same first/last-element elision to struct fields that it applied to array elements, so a named attribute the user explicitly read (e.g. GeneralDiagnostics/NetworkInterfaces) could silently drop fields like HardwareAddress in --format table output. Introduce a tlvFidelity parameter (compact vs full) threaded through formatAttrValue/decodeTLVValue/formatTLVElement/formatTLVContainer and buildReadRecords: cluster read, subscribe, and invoke now render with no elision or truncation at any level, while tree -L 4 keeps today's compact, scannable rendering unchanged. Fixes #95 Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
There was a problem hiding this comment.
🟢 Approval recommended
The fidelity policy is consistently applied, preserves existing tree behavior, and has focused regression coverage.
Pull request overview
Adds explicit TLV display fidelity so targeted CLI operations show complete values while tree previews remain compact.
Changes:
- Threads compact/full fidelity through TLV formatting.
- Uses full fidelity for read, subscribe, and invoke; compact fidelity for
tree -L 4. - Expands tests for containers, nested structures, strings, bytes, and native values.
File summaries
| File | Description |
|---|---|
cli/cluster.go |
Implements fidelity-aware TLV formatting and updates consumers. |
cli/subscribe.go |
Enables full-fidelity subscription displays. |
cli/tree.go |
Preserves compact tree previews. |
cli/output/read.go |
Documents fidelity-dependent display behavior. |
cli/cluster_test.go |
Tests compact and full TLV formatting. |
cli/cluster_read_test.go |
Tests display fidelity without affecting native values. |
Review details
- Files reviewed: 6/6 changed files
- Comments generated: 0
- Review effort level: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
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.
Summary
--format tableoutput forcluster read,subscribe, andinvokenow renders decoded TLV values at full fidelity: struct fields and array elements are never elided, and scalar leaves (long strings, byte-array hex dumps) are never middle-truncated.tlvFidelity(fidelityCompact/fidelityFull), threaded explicitly throughformatAttrValue → decodeTLVValue → formatTLVElement → formatTLVContainer → truncateMiddleandbuildReadRecords, so the elision/truncation policy is an explicit per-consumer choice instead of one shared 40-character budget.tree -L 4's per-attribute preview keeps today's compact, elided rendering unchanged — it's the one remaining consumer that opts intofidelityCompact.--format json/--format yamloutput is unaffected; it already rendered the untruncated nativeValue.Test plan
TestDecodeTLVValue_Containersextended to run existing cases (short array, struct) under both fidelities, plus new cases: long array (compact truncates / full shows everything), array-of-structs (compact elides fields / full shows every field), wide struct >40 chars (compact elides / full shows every field), and long scalar leaves — string and byte-array (compact middle-truncates / full prints in full).TestBuildReadRecords_TruncationIsDisplayOnlysplit into compact/full subtests; both still assertValueis always the untruncated native original.mise run test— full suite passes.mise run lint— clean./code-review(parallel Standards + Spec sub-agents against issue cluster read table output cuts fields out of long struct values #95): 0 hard standards violations, 0 spec discrepancies.Fixes #95
🤖 Generated with Claude Code