Repository navigation
Conversation
Every badge (active tab, header, key hints, warning banner, selected row) always used black text, on the assumption that black reads fine against any theme's accent/highlight/danger color. Reported unreadable live against a real theme; contrastingBadgeText now computes the WCAG contrast ratio of black vs. white against that specific background and picks whichever wins, per badge, per theme β instead of one guess applied everywhere. Both options are base ANSI codes (0/15), not 256-color codes, so the choice itself renders correctly even on a 16-color-only terminal (unlike the theme palette values, which do get approximated there β see the TERM=xterm README note from earlier). scripts/check-theme-contrast.py now mirrors the same picker and checks against a stricter 4.5:1 (WCAG AA normal text, not just the 3:1 large- text floor) for every theme's three badge backgrounds β all 11 already clear it comfortably once the pick is per-background instead of fixed. Added the Go-side equivalent test. Note: for the current 11 themes this always resolves to black (their accent/highlight/danger values are all bright/mid-tone enough), so this alone may not be the full story behind what was seen live β the TERM=xterm downsampling issue documented in the README remains the leading suspect for that specific report, since it changes what these color codes actually render as, which no amount of ratio math on the assumed-standard palette can predict.
Reset: the settings screen gets a trailing 'Reset keybindings to defaults' row β enter restores every rebindable action to what it shipped with, in one step, instead of having to remember and re-type each original key by hand if a round of rebinding goes wrong (or you just want to start over). Defaults are captured once at package init, before ApplyKeybindingOverrides (called from NewApp, well after init) ever gets a chance to load a saved config over them. Filter hint: esc closes the list's live filter without applying it β already correct behavior, just not discoverable (the '?' help screen had it, but nothing showed while actually filtering). Now the status line reads 'esc: close without filtering enter: apply filter' for as long as FilterState() == Filtering.
go test ./... only ever covered unit tests and tests that call Panel methods directly -- neither touches bubbletea's actual render pipeline, so a bug that only exists in what's really drawn to the terminal can't be caught by either. e2e/ closes that gap: it builds the actual pkgtui binary and drives it through a real pty (github.com/creack/pty, already a dependency), feeding the output into a real VT100/xterm emulator (github.com/hinshun/vt10x) and asserting on the resulting screen content instead of internal Go state. This was built specifically to chase down a live report: the settings screen supposedly not showing a keybinding's new value right after rebinding it. A first version of this harness reconstructed "the current frame" by hand, splitting raw bytes on the last cursor-home escape sequence -- and appeared to reproduce the report. But bubbletea redraws incrementally, not with a full-screen home-and-rewrite on every keystroke, so that heuristic could (and did) pick up a stale frame and mistake it for a current one. Swapping in vt10x, which applies every escape sequence the way a real terminal would and so always knows the actual current screen state, made the exact same test pass cleanly and consistently, every run. Conclusion: the real pkgtui output is correct. The live report is very likely something in the reporter's specific terminal client's own rendering -- outside anything running inside the pty can observe or fix. Wired into ci.yml as its own step (go test -tags e2e ./e2e/...), excluded from the plain go test ./... via its build tag since it compiles a fresh binary and needs a real pty -- same 'build' job the ruleset already requires, so a failure here blocks merging exactly like every other check, with no ruleset changes needed.
Adds real-pty/real-terminal-emulator coverage (same harness as the
settings-rebind test) for the app's other main flows:
- startup_test.go: launch renders the Installed list, tab bar, legend,
footer.
- search_test.go: "/" catalog search, opening details, esc back.
- filter_test.go: local list filter, esc cancels without narrowing the
list (the exact behavior the "esc: close without filtering" hint from
an earlier fix documents).
- navigation_test.go: apt/snap backend switch, the "?" help screen, and
"q" actually exiting the process (not just changing internal state).
- theme_test.go: the settings theme picker's left/right browsing,
including wrapping from the first entry to the last.
- install_test.go: the full privileged-action flow β confirm dialog,
the live pty output box, ctrl+c interrupting the child (not pkgtui),
the red "failed" box staying up until a keypress, dismiss. Interrupts
immediately after the box appears and never lets the install actually
finish, so it can't leave a package behind or need passwordless sudo
to be deterministic, in this environment or CI's.
Also fixed two more instances of the same class of bug the rebind test
already ran into (matching a search string against the wrong text
entirely, mistaking it for the thing actually being waited on):
- waitReady() was matching "β " against the *legend line* ("β
installed β² upgrade available ...", static chrome rendered before any
real data loads), not an actual installed-package row, so tests could
send input while the list was still loading and have it silently
dropped. Fixed by waiting for the loading spinner's own text to
disappear instead β unambiguous, since it's only ever shown while
actually loading.
- A search-result assertion was matching "cowsay" against the search
box's own echo of the typed query ("π cowsay", rendered above the
results) instead of the actual result row. Fixed with a helper that
requires a status symbol (β/β²/β) on the line, which only real rows
have.
All 9 e2e tests pass consistently across repeated runs (go test -count=2).
Failed on a real GitHub Actions run: the Installed list's initial dpkg query apparently takes longer there than in this sandbox, and 5s wasn't enough β worth noting it was already cutting it close locally too (some runs used nearly the whole budget). Bumped to 20s; a normal run still finishes in a couple of seconds regardless; this only matters for the slow tail.
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
esccloses it without applying,enterapplies it.Test plan
gofmt -l .cleango vet ./...cleango test ./...passinggo test -tags e2e ./e2e/...passing, stable across repeated runsgo build ./...clean