Skip to content

fix(cli): name the global --fields in the overflow note of generated commands - #219

Merged
ysyneu merged 1 commit into
mainfrom
fix/generated-narrowing-note
Oct 11, 2026
Merged

ysyneu merged 1 commit into
mainfrom
fix/generated-narrowing-note

Conversation

@ysyneu

@ysyneu ysyneu commented Oct 11, 2026

Copy link
Copy Markdown
Contributor

Problem

When a structured list overflows the 16384-byte budget, the note and the irreducible-overflow error say "this command declares no flag that narrows the output" for every generated command, although the global --fields projects their output (projection runs before bounding, so --fields does return the full page).

Change

  • declaredNarrowing derives the projection flag for a command whose --fields is the root's persistent flag (compared by flag identity, not name). One rule covers every generated command; no per-command declarations.
  • A command that defines its own --fields shadows the global flag and still names it only if it declares it, so monit rule-update-fields (a write selector) is not misdirected.
  • A rows flag is still named only where a command declares it. The spec does not say whether a generated command's --limit bounds the rows (some ignore it), so the generator keeps emitting no rows declaration; its comment is updated.

Tests

Generated-verb tests now assert the note and error name --fields and never --limit; a new table test covers inherited, shadowed, declared and absent --fields.

make fmt, make lint (0 issues), go test ./..., make check-cards, make build pass. Generated files are unchanged.

…commands

The structured-output overflow note and error only named flags a command
declared via declareOutputNarrowing, and generated commands declare none, so
they claimed no flag narrows the output even though the global --fields
projects every structured record they print.

declaredNarrowing now derives the projection flag for a command whose --fields
is the root's global flag, identified by flag identity rather than name, so a
command defining its own --fields (monit rule-update-fields, a write selector)
still gets no advice unless it declares one. A rows flag is still offered only
where a command declares it: the spec does not say whether a generated
command's --limit bounds the rows.
@ysyneu
ysyneu merged commit c5fc946 into main Oct 11, 2026
12 checks passed
@ysyneu
ysyneu deleted the fix/generated-narrowing-note branch October 11, 2026 04:50
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