Repository navigation
feat(web): classify every config option for the page and publish three it ignored - #1339
Open
benvinegar wants to merge 1 commit into
Open
benvinegar wants to merge 1 commit into
benvinegar wants to merge 1 commit into
Conversation
…e it ignored Nothing made a config option's author decide what the browser review page does with it, so `tab_width`, `auto_split_min_width`, and `sidebar` reached the terminal and were silently ignored by the page. `core/run/webConfigSupport.ts` classifies every key of the config reference table in one record (`published`, `host-side`, `terminal-only`, `deferred`), as `webCommandTable.ts` does for commands. The table's keys are now a literal union, so an option without an entry fails to typecheck. A `published` option names the presentation field it lands in; the host's `view` block must carry exactly those fields (a `satisfies` check plus a test in both directions). The three options are published in `ReviewViewDefaults` and applied by the page under its existing precedence: this browser's stored choice, then the session default, then the page's own. The page sets Pierre's `--diffs-tab-size` (it drew tabs 2 wide before; the terminal's default is 4), uses the configured column threshold for `auto` layout, and opens or closes the files sidebar at launch. A pager session publishes a closed sidebar, as the terminal opens it. The daemon parses the shared state with the same strict parser the page uses, and the new fields are required, so `HUNK_SESSION_DAEMON_VERSION` moves to 23. The wire fixture's contents are unchanged; it is renamed. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Contributor
[Medium impact] This PR appears safe to merge. SummaryThe browser review page now follows the session’s tab width, automatic split threshold, and sidebar setting, with a typed record covering every config option.
No actionable issues found. benvinegar explicitly leaves header hiding, moved-line colors, generated support documentation, and updates to the older design docs for follow-up. The hand-written support list remains a known drift risk. Reviews (1) · Last reviewed commit: "feat(web): classify every config option ..." · Reviewed by Greptile |
This branch has not been deployed
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.
Problem
Nothing made the author of a config option decide what the browser review page does with it. Each option is wired to the terminal by hand, and the page gets only what someone remembered to publish. Three options the terminal honors were silently ignored by the page:
tab_widthauto_split_min_widthsidebartrue,false, or"auto"Approach
1. A typed classification of every config option (
core/run/webConfigSupport.ts), modelled on whatweb/commands/webCommandTable.tsdoes for commands. One record keyed by every key ofCONFIG_REFERENCE_OPTIONS, each entry one of:published— the host sends the resolved value to the page as a session default, and the entry names the presentation field it lands in.applied: falsemarks a value the page receives and cannot act on yet, with a reason.host-side— it changes the review's input or seeds shared state, so both surfaces see the result.terminal-only— a terminal mechanism the page has no counterpart for.deferred— the page should honor it and cannot yet.Enforcement:
ConfigOptionKeyand the record issatisfies Record<ConfigOptionKey, WebConfigSupport>. An option with no entry fails to typecheck. The table's contents and its consumers (runtime parsing, the docs generator) are unchanged.viewblock issatisfies ReviewViewDefaults & Record<WebPublishedViewField, unknown>, so a published field the host does not send, or an extra one, fails to typecheck.sharedState.test.tschecks the same thing at runtime in both directions and that each published value follows the option it is classified from.mode,theme,wrap_lines,line_numbers,tab_width,auto_split_min_width,sidebar;hunk_headersis sent but not applied (hiding header rows needs the renderer)vcs,watch,exclude_untracked,agent_notescursor_line,scroll_off,file_gap,hunk_gap,wheel_scroll_lines,menu_bar,copy_decorations,prompt_save_view_preferences,transparent_background,animationscolor_moved2. The three options are published and applied.
ReviewViewDefaultsgainstabWidth,autoSplitMinWidth, andsidebar. The page keeps its precedence: this browser's stored choice, then the session default, then the page's own default. It sets Pierre's--diffs-tab-size, uses the configured column threshold forautolayout, and opens or closes the files sidebar at launch ("auto"leaves it to the viewport).Decisions worth a look
HUNK_SESSION_DAEMON_VERSIONmoves from 22 to 23. The daemon parses the shared-state snapshot with the same strict, exact-key parser the page uses (session/broker/state.ts), and it serves the page bundle. Without a bump, an older daemon at the same revision would reject a newer window's state. The new fields are therefore required rather than optional. The wire fixture's contents are unchanged (shared state is not in the wire corpus); it is renamed v22 → v23, as feat(review): per-surface selection, direct note intents, and viewed files #1289 did for the same kind of change.HUNK_REVIEW_PROTOCOL_VERSIONstays 1, per its own comment: the daemon and window are held to one build by the daemon revision.tab_width.sidebarsays, matching how the terminal opens one (useExtensionPaneController.ts).animationsis classified terminal-only: the page follows the browser'sprefers-reduced-motion. Say so if the page should honor the option instead.hunk_headersispublishedwithapplied: falserather thandeferred, because the host already sends it and the "every sent field is accounted for" rule needs an entry for it.Non-goals
/filter key and Ctrl/Cmd+Enter note save found in the same audit are separate.Why core
The classification describes host config and gates what the host publishes;
core/may not importweb/. The page-side changes are presentation only.Tests
core/run/webConfigSupport.test.ts: the record covers exactly the config reference's options; every option the page does not apply has a one-sentence reason; each published option lands in its own field.app/review/sharedState.test.ts: the three options project as the launch resolved them, fall back to the terminal's built-in defaults when unset, a pager session's sidebar starts closed, and the built defaults match the record in both directions.session/reviewSharedState.test.ts: the parser requires every published view field with a well-formed value.web/view/viewPreferences.test.ts: override, then session, then page default for each; the sidebar mapping;autosplitting at the configured threshold.test/web/review-config.e2e.ts(new, real Chromium): computedtab-sizeon Pierre's code column is 8 withtab_width = 8and 4 without config;autolayout switches to split at a 1000px viewport only because ofauto_split_min_width = 100;sidebar = falsecloses the sidebar at 1440px andsidebar = trueopens it at 1000px; the state route carries the new fields.Commands run (macOS, Darwin 25.6.0; Bun 1.4.4):
bun run typecheckbun run lintbun run format:checkbun run deps:checkbun test ./test/review-conformancebun testovercore/run,app/review,web,ui/lib,scripts/quality,scripts/generate, and the shared-state, protocol-schema, and wire-snapshot testsbun run build:web && bun run test:webEnforcement was checked by breaking it: deleting one option's entry from the record, and deleting one published field from the host's
viewblock, each failbun run typecheck; both were restored.Not run: the full
bun run test. On this machine it fails 55 tests on the base branch for unrelated reasons (44 pick up a globally installed extension under~/.config/hunk/extensions, 8 are macOS/varvs/private/var, 3 are file-watch and daemon-launcher timing); the affected directories were run directly instead, as listed. Also not run:test:integrationandtest:tty-smoke(no terminal rendering or interaction change). Linux and Windows not tested locally.Not verified: a browser tab left open across a daemon upgrade. By the exact-match hello an old tab only exists for an old-revision session, which the new daemon refuses, but that is inferred from code, not tested.
Known limitations / follow-up
docs/web-review-plan.mdanddocs/browser-review-seam-audit.mdstill list the old four view defaults.This PR description was generated by Claude Code using Claude Fable 5.2