Skip to content

audit: a capped report says so, and the long reports page like git - #49

Merged
bukershok merged 1 commit into
mainfrom
audit-pager
Aug 13, 2026
Merged

audit: a capped report says so, and the long reports page like git#49
bukershok merged 1 commit into
mainfrom
audit-pager

Conversation

@menitasa

Copy link
Copy Markdown
Contributor

What

Two halves of one reported complaint: jit audit --since 3d printed 50 events · 15:06–17:34, and the reader reasonably concluded three days of history had been deleted by an upgrade. Nothing was deleted — the default --limit 50 had cut the view, and the header then described its own page while appearing to describe the query.

The header speaks for the query

  • The full match set is measured before the cap: the header shows 50 of 214 events, the query's true span, and failed/denied/decoy tallies that include rows the cap cut.
  • The trailer's first hint becomes the way out: jit audit --limit 0 all 214 events.
  • An uncapped report renders byte-identical to before (tested).

The long reports page, git-style

jit audit and jit scan now page through the user's pager on a terminal: $JIT_PAGER$PAGERless, with LESS=FRX set only when unset (color through, one-screen output prints inline and stays in scrollback). --no-pager or PAGER=cat opt out.

Design points:

  • The pager writer fronts only the command's output streamos.Stdout is untouched, so fatih/color still sees a terminal and termtext.Width() still reads the real window. Color and full-width layout survive into less -R for free.
  • Spawned lazily on the first report byte, so scan's stderr progress trail stays visible instead of a blank pager screen.
  • A typo'd $PAGER warns on stderr and prints straight through — the report must never vanish into a broken pipe.
  • Piped or redirected output is byte-identical to before: the pager engages only on a real tty. --follow stays direct (a pager buffering an endless tail shows nothing).
  • ctrl-C belongs to the pager while it owns the terminal (less uses it to interrupt a search), restored on close.

Testing

  • New tests: capped/uncapped header contract, pager resolution precedence, stream-through via a real spawned pager, missing-pager fallback.
  • Full go test -race ./..., gofmt, vet, staticcheck, gosec, go mod verify/tidy clean; docs regenerated.
  • Exercised live under a pty: pager engages on a tty, --no-pager overrides, pipes never spawn it, missing pager falls back with a warning.

🤖 Generated with Claude Code

https://claude.ai/code/session_01TXiT8qiEHcUyKDbSkofwT5

Two halves of one complaint: jit audit --since 3d printed '50 events ·
15:06–17:34' and the reader concluded three days of history had been
deleted by an upgrade. Nothing was deleted — the default --limit 50
had cut the view, and the header then described its own page while
appearing to describe the query.

The header now measures the FULL match set before the cap: a '50 of
214 events' count, the query's true span, and failed/denied/decoy
tallies that include rows the cap cut. The trailer's first hint
becomes the way out (--limit 0, with the full count). An uncapped
report renders byte-identical to before.

And because 'all 2006 events' is only useful if you can read them,
jit audit and jit scan now page through the user's pager on a
terminal, git-style: $JIT_PAGER then $PAGER then less, LESS=FRX so
one-screen output prints inline, --no-pager and PAGER=cat to opt
out. The pager writer fronts only the command's output stream —
os.Stdout itself is untouched, so color still sees a terminal and
width still reads the real window. Spawned lazily on the first
report byte, so scan's stderr progress trail stays visible; a
typo'd $PAGER warns and prints straight through rather than feeding
the report to a broken pipe. Piped or redirected output is
byte-identical to before: the pager engages only on a real tty.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TXiT8qiEHcUyKDbSkofwT5
@bukershok
bukershok merged commit a3e19da into main Aug 13, 2026
3 checks passed
@menitasa
menitasa deleted the audit-pager branch August 13, 2026 06:14
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