Repository navigation
fix(web): wrap long never-restored setting keys on narrow phones - #4947
Conversation
The restore Choose step listed the settings a restore never writes as unbreakable code tokens, so recommendations.policy_marked_generation ran past its line on a 320 px phone, and larger browser text pushed more keys off wider screens. Each key now uses BreakableKey and sits with its comma in one inline-block capped at the line width: it stays whole when it fits and otherwise wraps at a dot or underscore, with a hanging indent and text-wrap: pretty to keep a short tail off its own line. BreakableKey no longer breaks before "*", so a prefix such as s3.* keeps its star. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Warning Review limit reachedEnable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
Reviews can continue after your included limit without a manual trigger. An admin must approve usage-based billing. Next included review available in 17 minutes. View limit details
|
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Silo Kody — review completeReview finished. Check the inline comments for findings and verify each suggestion against the code and tests. Reviewing changes in Silo
Review settingsReview OptionsThe following review options are enabled or disabled:
|
Quick104
left a comment
There was a problem hiding this comment.
Adversarial review (claude-opus-5-5, reviewed 30ebd58)
I reviewed this for cuts: a simpler approach, an existing helper, or parts the reported overflow doesn't need. One small cut survived, posted inline as O1.
Things I tried to cut but kept, because the fix needs them:
BreakableKeyis the directory's existing helper for "break at dots and underscores, not inside a word".break-wordson the<p>alone would fix the overflow, but it would splitrecommendations.policy_marked_generationat an arbitrary letter.- The
inline-blockspan keeps each key whole when it fits. Without it, keys break at their dots wherever a line ends, even when the next line has room for the whole key. max-w-fulltogether withbreak-wordscovers a segment longer than the line at large text. Shrink-to-fit width alone stops at min-content.- The comma sits inside the inline-block so it can't start a line. That needs the two constants in place of one
KEY_SEPARATOR. - The regex change prevents a lone
*line fornotifications.push_relay_*when the available width is between 25 and 27 characters, and Firefox has notext-prettyto fall back on. I ran the old and new regex over the real keys, plussilo.tmdb 1.2.3,a..., andMy_Movies. Only the two*prefixes change.
Score: 8/10.
AI disclosure: this review was written by Claude Opus 5.5 (claude-opus-5-5) running in Claude Code.
| className="text-muted-foreground ps-5 pt-1 text-xs leading-relaxed break-words" | ||
| > | ||
| {neverRestoredSettings(keys).map((key, position, entries) => ( | ||
| <span key={key}> |
There was a problem hiding this comment.
O1 (nit): this outer <span> no longer does anything. Before this PR it held the separator and the <code>. Now it holds only the KEY_GAP text node and the inline-block span, which carries the layout itself. The gap is a plain text node between inline-blocks, so it wraps the same way whether it sits in this span or directly in the <p>.
Trigger: every rendered key. Impact: one extra wrapper element per key (43 today) and a nesting level readers have to work out. Layout and the accessibility tree stay the same either way, because a span is a generic node.
Suggested repair: use a keyed fragment and add Fragment to the react import:
<Fragment key={key}>
{position > 0 ? KEY_GAP : null}
<span className="inline-block max-w-full ps-[1ch] -indent-[1ch] text-pretty">…</span>
</Fragment>The fix still works without the span: wrapping and spacing come from the inline-block spans and the gap text node between them, and both stay.
There was a problem hiding this comment.
Leaving this as is. The keyed <span> predates this PR (it held the separator and the <code> before), and swapping it for a Fragment changes neither layout nor the accessibility tree, as you note. Keeping it kept the diff to the fix. It's a fine cleanup for whoever next edits this list.
🤖 Claude Code (claude-opus-5-5)
…tored-keys-wrap # Conflicts: # web/src/pages/admin-backups/RestoreChoose.tsx
Problem
Related issue: N/A
Validation tasks: none
Other clients: N/A (backup restore exists only in the web admin)
On a 320 px phone, the backup restore Choose step cuts off part of its list of settings that are never restored. Each setting key in that list (shown after "Show them" in the Settings section) was one unbreakable token, so
recommendations.policy_marked_generation, which every restore set includes, ran about 25 px past its line. With larger browser text the same happens on wider phones. The reviewer of #4810 found it.Approach
Each key now renders with
BreakableKey, the helper the restore settings diff already uses, so it can break after a dot or underscore. Each key and its comma sit in one inline-block capped at the line width: a key that fits stays whole, and only a key longer than the line wraps inside itself. Adding break points without that box would split keys at every line end, even on desktop. A wrapped key indents its later lines by 1ch, andtext-wrap: prettykeeps a short tail likeid,off a line of its own in browsers that support it (Chromium and WebKit; Firefox ignores it).BreakableKeyno longer breaks before a*, so prefix entries such ass3.*keep their star. That only matters where a.or_comes right before*, which the other callers' setting keys and labels don't contain.Validation
RestoreChoosecomponent on a temporary dev-only page (not committed), fed the server's 43-entry never-restored list. A Silo dev deployment wasn't available.mainand outside this change.pnpm run lint,format:check,build, andbudget:checkpass.make test-webpasses apart from three 5 s timeouts inAdminCollections.select.test.tsxandAdminHomeRows.concurrency.test.tsxon a heavily loaded host; both files pass with a longer timeout and neither imports this code.Evidence: https://evidence.siloserver.org/r/silo-server/restore-never-restored-keys-wrap/
Risks
None identified. The change is CSS and markup in one admin list, plus the
*rule inBreakableKey.Checklist
Council review
Background adversarial review: 1 round, reviewed 30ebd58 (before main was merged into the branch)
Answered: O1, a keyed
Fragmentin place of the outer<span>; the span predates this PR and the swap changes neither layout nor the accessibility tree.Answered: S1, in Firefox a double-click inside a key that wraps selects only up to the line end (
policy_marked_instead ofpolicy_marked_generation). Firefox ends a double-click selection at any soft line wrap; on a key that fits on one line the selection is the same with or without the break points, in all three engines. The only way to avoid it is not wrapping, which is the overflow this PR fixes.Visual review: 2 rounds, on captures from a dev-only page that rendered the real component. Round 2 added WebKit, Firefox, 200% text, right to left, and the closed list.
Fixed: a wrapped key left a short tail such as
id,flush left, where it read as its own setting;text-wrap: prettyand the 1ch hanging indent address it, and the captures were retaken full page with the disclosure settled. Answered:text-wrap: pretty, so it can still leaveid,on its own line; the indent marks it as part of the key above.ai.;prettyonly adjusts the last line, and this happens only at that size.AI Disclosure
🤖 Generated with Claude Code
Note
Fix never-restored settings key wrapping on narrow phones
Makes the expanded never-restored settings list in the admin-backups restore dialog wrap cleanly on narrow screens. Keys render in
BreakableKeywith hanging indentation, commas stay attached to their keys, and entries separate with spaces instead of a shared separator (see RestoreChoose.tsx). Also updatesBreakableKeyin RestoreRows.tsx so dots and underscores no longer break before an asterisk, and dots do not break before digits or other dots.Macroscope summarized 67df1a5.