Repository navigation
fix(browse): revert BROWSE_CAP 1000 → 500 - #82
Merged
Merged
Conversation
0.11.0 raised the Nav-rail browse cap 500 → 1000. The rationale was
network-only ("1000 = NetBox's per-request ceiling, so a cap-full browse is
still one round trip"), which was correct but one-sided — it ignored the
render side. The TUI's event loop calls terminal.draw at the top of every
iteration, and the 180ms PreviewTick is always arriving, so render fires
~5.5 Hz while idle; render_home_list builds the full Vec<Row> via
.map(...).collect() over the whole list up to the cap on every draw (not
cached, not windowed). 1000 doubled that idle rebuild cost for rows no one
reads: past a few hundred, the filter narrows, not the cap.
Revert to 500. It's still a single round trip (500 <= MAX_PAGE_SIZE 1000), so
the network cost is identical. The cap encodes the principle durably in code
— the filter is the escape hatch, not a bigger cap — so it doesn't drift back
up. The list-count badge reads 500+ when capped (the cue reads the const).
This does NOT depend on the render-dirty-flag decision: that flag eliminates
idle rebuilds for all list sizes, but every actual change (keypress, result
arrival) still rebuilds the full list, and at 1000 that's 2x the 500 cost at
those moments. So 500 is the right cap regardless; the dirty-flag is a
separate, scheduled, additive win (ROADMAP: medium, battery/SSH not latency).
Verified: gate green (1107 all-features / 1012 no-default-features, clippy -D
warnings, fmt); cap_sized_browse_is_one_round_trip adapted (reads BROWSE_CAP,
now mocks limit=500); live search/browse paths return 200. The 1000+/500+ cue
and the cap-coupled test both read the const, so the revert is a 1-line const
change with auto-adapting downstream.
CHANGELOG [Unreleased] + ROADMAP perf-candidates section updated (1000-row
-> 500 rows post-revert). The 0.11.0 release line is left immutable
(historical fact: 0.11.0 did raise it; the revert is documented in [Unreleased]).
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.
What
Reverts the Nav-rail browse cap from 1000 back to 500 (0.11.0 raised it 500 → 1000).
Why
The 0.11.0 bump's rationale was network-only: "1000 = NetBox's per-request
MAX_PAGE_SIZEceiling, so a cap-full browse is still one round trip." Correct, but one-sided — it ignored the render side:terminal.drawat the top of every iteration; the 180msPreviewTickis always arriving →renderfires ~5.5 Hz while idle.render_home_listbuilds the fullVec<Row>via.map(...).collect()over the whole list up to the cap on every draw (not cached, not windowed).500 is still a single round trip (500 ≤
MAX_PAGE_SIZE1000), so the network cost is identical. The cap encodes the principle durably — the filter is the escape hatch, not a bigger cap — so it doesn't drift back up.Independent of the dirty-flag decision
The ROADMAP's
TUI render dirty-flagfix would eliminate idle rebuilds for all list sizes — but it does not argue for keeping 1000. Every actual change (keypress, result arrival) still rebuilds the full list, and at 1000 that's 2× the 500 cost at those moments. So 500 is the right cap regardless; the dirty-flag is a separate, scheduled, additive win (ROADMAP: medium, battery/SSH not latency).Change
One-line const:
pub const BROWSE_CAP: usize = 1000→500, with an expanded rationale comment. Downstream auto-adapts:1000+/500+truncation cue reads the const (ui.rsif n >= BROWSE_CAP { format!("{}+", BROWSE_CAP) }) → badge now reads500+.cap_sized_browse_is_one_round_tripreads the const (let n = BROWSE_CAP) → now mockslimit=500, passes unchanged.Verification
fmt --check,clippy --all-targets --all-features -- -D warnings,test --all-features(1107 pass),test --no-default-features(1012 pass) — all green, counts unchanged.cap_sized_browse_is_one_round_tripadapted and passed.1000pagination tests calllist_all(.., 1000)directly (testing the paging mechanism with an arbitrarymax), notbrowse/BROWSE_CAP— untouched.Docs
CHANGELOG.md[Unreleased]→### Changedentry (revert + rationale + dirty-flag independence note).ROADMAP.mdperf-candidates section:1000-row Vec<Row>→500 rows post-revert, was 1000.[Unreleased]).Files
src/netbox/browse.rs— const 1000 → 500 + rationale comment.CHANGELOG.md,ROADMAP.md— doc updates.