Name a non-default database in the TUI footer - #183
Merged
Merged
Conversation
Nothing on screen said which store the TUI had opened. The only place it was ever said is the stderr warning a target/ build prints when it declines an inherited VORO_DB, which the alternate screen paints over before anyone reads it — so an operator following the verify skill could sit on the shared dev store believing it was a scratch one. The footer now carries the store's path, right-aligned against the key line the way the header right-aligns its counts, dim, on all four screens. The condition is the comparison against Store::production_db_path() rather than default_db_path(), which is the crux: the default for a target/ build *is* dev.db, so an indicator keyed on it would fall silent in exactly the case that raises the question. It is the rule db_flag and seed_verb already follow. The operator's own store shows nothing, the reserved width is zero, and the key line has the row entire. The status message still owns the row alone and wraps; the indicator is suppressed rather than right-aligned against moving text. The region never grows a line for it. Verified with cargo test/clippy/fmt and live in tmux: a scratch store names itself on every screen, the same binary with no --db shows ~/.local/share/voro/ dev.db, a store at the production path (XDG_DATA_HOME redirected) shows nothing, and a status message suppresses the indicator. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01C8BCU78Axcxsf3sM7s9VEP
The indicator claimed its width from the row and handed the key line the remainder, which is backwards: the key line has a fixed, documented eleven-slot budget (DESIGN.md §9) and the indicator carries a path of unbounded length. At 110 columns a deep scratch path pushed `? keys · tab tasks · q quit` off the row — `?` being the key that would have said what the line dropped — while every key line the app can produce fits in 110 columns unaided. So draw_status measures the key line first and gives the indicator what is left over. shorten_store_path takes that leftover as its budget rather than a third of the row, which retires MIN_STORE_INDICATOR, and returns an Option: the ladder degrades from the full path through `~`, through leading directories surrendered whole for a `…`, to the bare filename, and then to nothing. The mid-word cut is gone — `…g-store-name.db` names no store, and those columns are the key line's to have back. Absence is not neutral here, since an empty right margin means the operator's own store, so vanishing is the last rung and not the first; a filename longer than the leftover is the one case that loses information, and it is preferable to spending the line's recovery keys on half a name. key_hints and hint_candidates are untouched: below about 107 columns the key line can outgrow the row with no indicator on it at all, and that clip predates this branch. Verified with cargo test/clippy/fmt and live in tmux at 110 columns on a deep scratch path: all four screens keep every slot through `q quit`, the Config screen — the longest line here — degrading to `voro.db`; widening to 130 and 160 columns brings the path back progressively; a no---db dev build shows `…/share/voro/dev.db`; a store at the production path still shows nothing. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01C8BCU78Axcxsf3sM7s9VEP
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.
The TUI footer now names the database this run opened, whenever it is not the
operator's own store.
What changed
draw_status(crates/voro/src/ui.rs) splits its row the waydraw_headersplits its own —
Layout::horizontal([Constraint::Min(0), Constraint::Length(w)])— and renders the store's path dim at the right.
status_heightis untouched;the row never grows a line for it. A status message still returns early and owns
the row whole, wrapped, with the indicator suppressed rather than right-aligned
against text whose margin moves.
Two helpers carry the logic.
db_indicator(path, budget)returnsNonewhen thepath is
Store::production_db_path()and the shortened path otherwise; thecomparison is against the production path rather than
default_db_path(),which is the crux of the change — the default for a
target/build isdev.db, so an indicator keyed on it would stay silent in exactly the case thatmotivated the task. That is the rule
db_flagandseed_verbalready follow.shorten_store_path(path, home, budget)is pure:~for the home directory,then leading directories surrendered whole for a leading
…, so the filenameand its parent — the half that identifies the store — survive.
The budget is not the row. The key line is measured first and the indicator
takes only what is left, because the line's eleven-slot budget is fixed and
documented (DESIGN.md §9) while a store path's length is not, so the occupant
that cannot be bounded is the one that yields. The ladder therefore ends at the
bare filename and then at nothing at all, rather than at a name cut mid-word: a
fragment identifies no store, and those columns are the key line's to have back.
Absence is not neutral — an empty right margin means the operator's own store —
so vanishing is the last rung, and a filename longer than the leftover is the one
case where the row loses information, which is preferable to spending the line's
recovery keys on half a name.
App::db_path()was added besideconfig_path(); nothing new is plumbed throughApp::neworui::draw.key_hintsandhint_candidatesare unchanged.DESIGN.md §9 gains a paragraph on the indicator — what it shows, that it is keyed
on the production path rather than on whichever store the binary defaults to, and
that the row is sized against the key line's budget rather than against the path
— and §5's "Which database a build opens" paragraph gains a cross-reference.
Verification
cargo test --workspace(883 tests),cargo clippy --workspace --all-targets -- -D warnings, andcargo fmt --allare clean. Six new tests: the production pathyields
Nonewhile the dev path and an arbitrary scratch path yieldSome; homesubstitution; shortening into a leftover budget rather than a share of the row;
the bottom of the ladder (bare filename, then
None, never a mid-word cut); aTestBackendrender asserting throughscreen_textthat the footer carries thestore, that a status message displaces it, and that a key line and a store which
both fit are both whole; and a render at 110x24 on the widest key line the app
can produce — a
reviewtask with a branch, a PR and a session, on both screensthat show it — asserting every slot through
q quitsurvives.Verified live with the
verifyskill in tmux. At 110x30 on a deep scratch storeall four screens keep every slot including
? keysandq quit, the Configscreen's longest line degrading the indicator to
voro.db; widening to 130 and160 columns brings the path back progressively (
…/scratch/store/voro.db, then…/jobs/…/store/voro.db). The same binary with no--dbshows…/share/voro/dev.db. A store at the production path — verified by redirectingXDG_DATA_HOME, so the operator's real store was never opened — shows nothing atall, and the key line has the full row. Pressing
oon a ready task puts therefusal on the row alone.
Commits
Two, on
footer-db-indicator:396cac0adds the indicator,9413bcefolds intask #456 (sizing it from the key line's leftover). Both belong to this change
and reach
maintogether.