Skip to content

feat(output): auto-right-align numeric columns in the no-view fallback path - #96

Merged
jpage-godaddy merged 1 commit into
mainfrom
auto-right-align
Aug 18, 2026
Merged

feat(output): auto-right-align numeric columns in the no-view fallback path#96
jpage-godaddy merged 1 commit into
mainfrom
auto-right-align

Conversation

@jpage-godaddy

Copy link
Copy Markdown
Collaborator

Summary

  • Adds auto-detection to the no-view (dynamic) column catalog used by render_array: a field that's a JSON number on every row it appears in (nulls/missing don't disqualify it, but any other value type anywhere does) now renders right-aligned automatically, matching what a registered view gets from TableColumn::align(Alignment::Right) (feat(output): add TableColumn::align for right-aligned table columns #94).
  • Registered views are unaffected — they still default to Alignment::Left and must opt in explicitly, since a view author may have a numeric-looking column (an opaque ID, say) that shouldn't be right-aligned.
  • Fixes two existing tests whose expected strings encoded the old left-aligned/ragged numeric output for no-view arrays.
  • Documents the behavior in docs/concepts.md.

Fixes DEVEX-1020

Test plan

  • cargo fmt --all --check
  • cargo clippy --all-targets -- -D warnings
  • cargo test --all-targets
  • RUSTDOCFLAGS='-D warnings' cargo doc --no-deps
  • New unit tests: numeric-on-every-row right-aligns, mixed-type column stays left, all-null column stays left
  • New integration test in tests/exhaustive_output.rs reproducing this end-to-end with no registered view

🤖 Generated with Claude Code

…k path

A command with no registered view renders through the dynamic column
catalog (dynamic_columns), which always built Alignment::Left columns
with no way to opt into right-alignment the way a registered view's
TableColumn::align can. Detects a field that's a JSON number on every
row it appears in (nulls/missing don't disqualify it, but any other
type anywhere does) and right-aligns that column automatically.
Registered views are unaffected: they still default to Alignment::Left
and must opt in explicitly, since a numeric-looking field there (an ID,
say) may not be a real measurement.

Fixes DEVEX-1020

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@jpage-godaddy
jpage-godaddy merged commit e4106c5 into main Aug 18, 2026
2 checks passed
@jpage-godaddy
jpage-godaddy deleted the auto-right-align branch August 18, 2026 15:18
@github-actions github-actions Bot mentioned this pull request Aug 18, 2026
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