Skip to content

feat(output): --select adds non-summary fields as columns, in select order - #455

Merged
neilmartin83 merged 2 commits into
fix/page-select-projectionfrom
feat/select-extra-columns
Oct 29, 2026
Merged

neilmartin83 merged 2 commits into
fix/page-select-projectionfrom
feat/select-extra-columns

Conversation

@neilmartin83

@neilmartin83 neilmartin83 commented Oct 25, 2026 •

Copy link
Copy Markdown
Member

Stacked on the --page projection PR, which is stacked on #453.

Problem

Table, csv and plain output on a list command is a curated summary row. A --select path outside it was dropped without a word, and the only route to the field was -o json | jq:

$ jamf-cli pro computer-inventory list --select name,serial,general.mdmCapable.capableUsers -o csv
name,serial

Columns were also always alphabetical, so --select name,serial,x wrote x before serial.

Change

  • output.AddSelectColumns resolves a --select path the summary does not carry against the full record and adds a column headed by the path. A path no record carries adds nothing.
  • An array of scalars is joined with "; ". Objects and arrays of objects stay compact JSON.
  • The formatter names a --select path that matched no field even when other paths matched, for rows and for parsed JSON lists.
  • Table, csv and plain follow --select's order (orderBySelect). Output change: with --select, columns were alphabetical and now follow the order given. Without --select nothing changes.
  • registry.OutputFormatter gains SelectPaths(); the Pro and Platform list templates pass it to selectTableColumns / platform.SelectTableColumns. Generated files are regenerated.

Not covered

Hand-written renderers (pro report, pro overview, config list) are #358. No --array-sep or per-element expansion.

Verification

  • go test ./..., golangci-lint run, gofumpt clean.
  • Live on pro-nmartin (two computers with capable users):
name,serial,general.mdmCapable.capableUsers
FVFZCAK0LYWH,Z4HDVQQPQ6,username
ZTNR9F6XJ0,ZTNR9F6XJ0,username

Table output matches. The "; " join for several users is covered by unit tests only.

🤖 Generated with Claude Code

Related

neilmartin83 and others added 2 commits October 28, 2026 18:17
table, csv and plain output on a list command is a curated summary, so a
--select path outside it was dropped without a word and the only route to the
field was -o json | jq. AddSelectColumns resolves such a path against the full
record and adds a column headed by the path; an array of scalars is joined
with "; ". A path no record carries adds nothing, and the formatter now names
a --select path that matched no field even when other paths did, for parsed
JSON lists as well as rows.

The OutputFormatter interface gains SelectPaths so the generated list
commands can read the paths.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The renderers sorted columns alphabetically, so --select name,serial,x wrote
x before serial and a consumer reading columns by position got the wrong one.
columnKeys now orders by the select paths when one is set; a path naming an
object keeps its flattened keys together.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@neilmartin83
neilmartin83 force-pushed the feat/select-extra-columns branch from 8d9a985 to eed3483 Compare October 28, 2026 18:17
@neilmartin83
neilmartin83 merged commit b45cdf1 into main Oct 29, 2026
5 checks passed
@neilmartin83
neilmartin83 deleted the feat/select-extra-columns branch October 29, 2026 16:41
neilmartin83 added a commit that referenced this pull request Oct 29, 2026
…ckage (#458)

## Problem

Jamf Pro computes no hash for some large packages even after
`cloudTransferStatus` is `READY` (reported in
grahampugh/jamf-upload#418). Wire-checked on a Jamf Pro tenant reporting
MD5 only:

| | 300 MB | 2 GB |
|---|---|---|
| create | `md5` populated within the first polls | `READY`, every hash
field empty, never filled |
| replace (300 MB → 2 GB, same filename) | | old `md5` kept ~6 min
during transfer, then cleared when `size` flipped; no new hash |

Before this change `pro packages upload` polled for the full 10 minutes
and ended on a generic "timed out" warning, exit 0.

## Change

- Once the package is `READY` at the new file's size and no matching
hash is present, allow a 20s grace (`verifyGrace`), then report the
upload as **unverified** instead of waiting out `verifyTimeout`.
- The warning distinguishes create, replace (previous hash cleared or
left stale), and a replace where old and new sizes are identical, which
size cannot confirm.
- Exit code is unchanged (0, the file was uploaded). A hash mismatch
still fails as before.
- `previousHashes` records the record's prior `size`; `fileHashes`
carries the local byte length.

## Stacked

Based on `feat/select-extra-columns` (#455) so the `termSafe(err)`
change on the same `WARNING:` line in #453 does not conflict. Merge
after #455; the diff here is only `pro_packages_upload.go` and its test.

## Testing

- `TestVerifyPackageUpload_UnverifiedWhenREADYAtTheRightSize` covers the
three cases and asserts the wait ends at the grace, not the timeout.
- `go test -count=1 ./internal/commands`, `make lint` (0 issues), `make
fmt` clean.
- Live, with a binary built from this branch at its first commit (45s
grace, before it was shortened to 20s), against random 300 MB and 2 GB
files (test packages since deleted). Poll counts below are at 45s; the
warnings and the verified paths are unaffected by the shorter grace,
which was not re-run live:
- **Create 2 GB:** "READY and its size matches (2147483648 bytes), but
Jamf Pro computed no hash for it; integrity NOT verified", after 7
polls.
- **Replace 2 GB with an identical-size file:** "replaced by a file of
identical size (2147483648 bytes), so the replace cannot be confirmed by
size, and Jamf Pro computed no new hash; integrity NOT verified", after
6 polls.
- **Replace 300 MB with 2 GB:** "…computed no hash for it (the previous
hash was cleared or left stale by the replace); integrity NOT verified".
The old MD5 lingered ~12 polls while READY, which is why the grace only
starts once the size matches.
- **Replace 2 GB with 300 MB:** verified normally ("Verified: server
hash matches local hash") on the first poll, no warning.
  - **Create 300 MB:** verified on the first poll.
  - All exited 0 and none waited out the 10-minute timeout.
- Grace is 20s because both 300 MB cases were verified on the first
poll. Only a 300 MB size was measured on one tenant (MD5-only,
S3-style); mid sizes between 300 MB and 1 GB are unmeasured.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
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.

2 participants