You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
feat(scripts): map changed files and feature surfaces to CI browser checks - #4841
Add scripts/browser-checks.ts so contributors and agents can map changed files (or named feature surfaces such as composer, pending, files, diff, sidebar, terminal, prompts, relay, account) directly to the canonical CI browser scripts in scripts/ci-browser.sh without maintaining a hand-edited per-script table that conflicts across PRs.
Ranks canonical CI browser scripts using direct imports, 1-hop src/ caller/CSS propagation, inverse-document-frequency DOM/API-route/protocol-code coupling tokens, and named feature surfaces (--surfaces, --surface <id>, --base <rev>, --limit <n>, --json).
Excludes demo-only browser checks when changes touch server/ alone.
Supports --run to execute the matched browser checks through the isolated runner (scripts/ci-browser-parallel.ts for demo-only sets, or scripts/check.ts run --build when any script needs an isolated herdr session).
Documents bun scripts/browser-checks.ts in CONTRIBUTING.md.
Validation
Ran bun test ./scripts/browser-checks.test.ts (6 pass, 0 fail)
Ran bun run check fast (actionlint, generate:types --check, generate:themes --check, typecheck, build, and test:unit: 28,839 pass, 0 fail across 1,356 files)
Skipped bun run check full locally (covered by CI Integration and browser and Native Windows install; this change touches scripts/ tooling and CONTRIBUTING.md only)
Auto incremental reviews are disabled on this repository.
Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.
You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.
Use the checkbox below for a quick retry:
Trigger review
No actionable comments were generated in the recent review.
Summary
Summary by CodeRabbit
New Features
Added a command-line tool that identifies browser checks relevant to changed files or selected feature areas. You can review suggested checks, list available areas, output results as JSON, or run the checks directly.
Check selection accounts for staged, unstaged, and untracked changes, and avoids suggesting demo-only checks for server-only edits.
Documentation
Added contribution guidance for finding and running relevant browser checks.
The change adds a browser-check tool that maps changed files or named surfaces to CI browser scripts. It can show match details and suggested commands, or run selected scripts.
Changes: Browser Check Tool
Layer / File(s)
Summary
Surface model and repository index scripts/browser-checks.ts
Defines browser surfaces and result types. Scans repository files, imports, and source tokens to build script and surface summaries.
Target discovery and check selection scripts/browser-checks.ts, scripts/browser-checks.test.ts
Discovers changed files, validates targets, and ranks matching scripts. Tests cover surface and path matching, server-only targets, coupling tokens, and invalid inputs.
CLI, execution, and usage scripts/browser-checks.ts, CONTRIBUTING.md
Adds CLI options for listing surfaces, outputting JSON, and running matches. The runner builds the shell when needed and configures the child process. CONTRIBUTING.md documents the command.
This adds a developer tool that maps changed files to CI browser checks, plus documentation. No concrete defect remains in the reviewed head, and the change is limited to scripts and contributor docs, so merge risk is minimal.
Pre-merge checks: 4
Check name
Status
Explanation
Title check
The title names the main change: a new script that maps changed files and feature surfaces to CI browser checks. It is specific and matches the summary and objectives. It is 74 characters, which is ac…
Description check
The description follows the template's two sections, Change and Validation. The Change section explains the new script, its options, the --run behavior, and the CONTRIBUTING.md update. The Validation …
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Full details: Title check
Explanation
The title names the main change: a new script that maps changed files and feature surfaces to CI browser checks. It is specific and matches the summary and objectives. It is 74 characters, which is acceptable.
Full details: Description check
Explanation
The description follows the template's two sections, Change and Validation. The Change section explains the new script, its options, the --run behavior, and the CONTRIBUTING.md update. The Validation section lists the tests and checks run, with results, and states which check was skipped and why. It does not link an issue, and the template asks for one for features. The description also does not state that the change is a feature the maintainer agreed to, and the template's HTTP/WS contract-test note does not apply to this change.
Resolution
Optional: link the issue where a maintainer agreed to this feature, since the template asks for it on feature changes. The description is otherwise complete.
Finishing Touches
Generate unit tests (beta)
Commit to this branch
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Reviewing files that changed from the base of the PR and between b378257 and eedb55a.
Files selected for processing: 3
CONTRIBUTING.md
scripts/browser-checks.test.ts
scripts/browser-checks.ts
Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 0 remain after this review.
Map 29 CI browser scripts that matched no surface (machine dialog, account PC list, per-agent chat and image QA, header, PWA update and others), weigh a matched surface at 20 instead of 8, and take a 1-hop importer's tokens at 0.25 instead of 0.6 so a large caller such as App.tsx no longer floods the ranking. On 21 older merged PRs not used for tuning, a script the PR edited ranks in the top 12 for 11 instead of 10.
…d renames and Windows paths
- --run drops BROWSER_SHARD, BROWSER_EXCLUDE, BROWSER_LIVE_ONLY and CHECK_DIR from the child's environment, so CI filters cannot empty the picked set into a false pass and a reused check directory's herdr sessions are not stopped.
- An edit to a shared script helper (scripts/demo-server.ts and the like) lists the checks that import it instead of none.
- The printed command builds dist-shell/ first when a picked script needs it.
- --base must name a revision; changed files list both sides of a rename; Windows-style paths match.
- A file that is both an input and an input's importer is credited once.
- The diff and themes surfaces include useRepoDiffViewer and the theme bootstrap entry.
Review pass (omo gate reviewer + Codex gpt-6.2-sol-fast xhigh at 35cf8e7) and one fix round, pushed as 35cf8e7 and 72013b3.
Accuracy study. For each merged PR, its changed source files were fed to the matcher and the CI browser scripts the PR itself edited (or that it broke) were looked up in the ranking. "Hit" = at least one of them in the default top 12.
21 older PRs (#4472 ... #4732, not used for tuning)
10/21 hit, recall 0.48
11/21 hit, recall 0.52
Examples after the fix: #4502 chat-fallback-browser-qa #1, #4768 core-kept-grid #1, #4821 settings-rows #3, #4820 device-security #2, #4811 machine-dialog #19 -> #5. Still weak: large terminal changes (#4759, #4775, #4778, #4781), where generic scripts (ui-ime, ui-terminal) outrank the specific ones. #4785's secret-input-regression and #4828's terminal-copy-off-regression are not in scripts/ci-browser.sh, so they are out of this tool's scope. One CLI run (full repo index) takes about 1.9 s.
Fixed
35cf8e7: 29 CI scripts that matched no surface now do (4 left: ideal-state-idle, herdr-prefix-keys, portal, plugin-actions); a matched surface weighs 20 instead of 8; a 1-hop importer's tokens weigh 0.25 instead of 0.6. These values were picked on the 15-PR set; only the 21-PR set measures the gain (+1).
72013b3: --run drops BROWSER_SHARD, BROWSER_EXCLUDE, BROWSER_LIVE_ONLY and CHECK_DIR (a false pass with BROWSER_LIVE_ONLY=true was reproduced by both reviewers; a reused CHECK_DIR's sessions would be stopped by check.ts); edits to shared helpers such as scripts/demo-server.ts list their importers; the printed command adds bun run build:shell && when needed; --base must name a revision; renames list both paths; Windows-style paths match; no double credit for a file that is both an input and an importer; diff/themes surfaces include useRepoDiffViewer and theme-bootstrap.
Left as follow-ups (not fixed here)
MEDIUM: the import scan misses generated browser-entry imports and new URL(path, import.meta.url) loads (e.g. src/lib/useWebPanel.ts, src/fonts/*.woff2 match nothing).
MEDIUM: under --run, build:shell writes dist-shell/ before check.ts takes the checkout lock (launch order only; no collision reproduced).
MEDIUM: on Windows, demoOnlyScripts in ci-browser-parallel.ts compares backslash paths with src/ and labels demo scripts as herdr (emulated on Linux, not run on Windows; existing code, safe direction).
LOW: the CSS ranking test still passes with CSS-to-TSX matching disabled.
Validation: bun test ./scripts/browser-checks.test.ts (6 pass, includes a new MachineDialog -> machine-dialog-regression case that fails on eedb55a). Skipped bun run check fast locally (this PC was over 85% CPU); CI runs it. scripts/conventions.test.ts fails the same 2 fixed-sleep ratchet tests on eedb55a and on 72013b3 here, so they are unrelated.
The hold label stays: it was set on the maintainer's instruction.
Merged through pr-merge at head 6531696ad. Seen before the merge was asked for: required checks green, no unresolved thread, no conflict, no hold, main not red, no release in progress. CodeRabbit said it did not review (a limit or a skip) since this head.
main had moved since the checks of 72013b37e: pr-merge --update merged it in (ebe59d046), and every required check was green at this head.
Maintainer's tooling PR; he asked Dori to review and merge (Dori session 2026-11-27); reviews: omo gate + Codex; accuracy check in PR comment
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
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.
Change
Add
scripts/browser-checks.tsso contributors and agents can map changed files (or named feature surfaces such ascomposer,pending,files,diff,sidebar,terminal,prompts,relay,account) directly to the canonical CI browser scripts inscripts/ci-browser.shwithout maintaining a hand-edited per-script table that conflicts across PRs.src/caller/CSS propagation, inverse-document-frequency DOM/API-route/protocol-code coupling tokens, and named feature surfaces (--surfaces,--surface <id>,--base <rev>,--limit <n>,--json).server/alone.--runto execute the matched browser checks through the isolated runner (scripts/ci-browser-parallel.tsfor demo-only sets, orscripts/check.ts run --buildwhen any script needs an isolated herdr session).bun scripts/browser-checks.tsinCONTRIBUTING.md.Validation
bun test ./scripts/browser-checks.test.ts(6 pass, 0 fail)bun run check fast(actionlint,generate:types --check,generate:themes --check,typecheck,build, andtest:unit: 28,839 pass, 0 fail across 1,356 files)bun run check fulllocally (covered by CIIntegration and browserandNative Windows install; this change touchesscripts/tooling andCONTRIBUTING.mdonly)