Repository navigation
refactor: remove code smells and comments, simplify tools and core modules - #321
Conversation
Extract named helpers (PageActivity, fillField, waitForFirstTextCondition, readStableRegularFile, find snippet rendering, in-page annotation helpers) so the code documents itself, drop the dead pre-1.61 Playwright locator fallback, move browser_find argument validation to the schema only, and fix timeout tool descriptions to state the enforced 30000-1200000ms range. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Ry3T5sGF3JufzTgSc9VU6Y
Extract variant apply/scan/compare/restore helpers, keyboard issue detection, skip-link activation, focus-trap detection, an in-page focus reader composed of small named functions, and shared report path/resource helpers used by every report-writing tool. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Ry3T5sGF3JufzTgSc9VU6Y
Named band counting with a DisjointSets helper, groupBy for sibling grouping, aria-hidden inheritance helper, summary rendering helpers, and named measurement steps (ref resolution, owner frames, per-frame batches). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Ry3T5sGF3JufzTgSc9VU6Y
…session detector Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Ry3T5sGF3JufzTgSc9VU6Y
Move the recorder subsystem out of context.ts, replace hand-rolled timer races with settleWithin/rejectAfterTimeout, dedupe release-once closures, bounded error formatting, late navigation failure reporting and download file naming, and name timeout/limit constants. Server instructions now advertise scan_page and describe scan_page_matrix's variants accurately. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Ry3T5sGF3JufzTgSc9VU6Y
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Ry3T5sGF3JufzTgSc9VU6Y
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Ry3T5sGF3JufzTgSc9VU6Y
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Ry3T5sGF3JufzTgSc9VU6Y
…heartbeat Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Ry3T5sGF3JufzTgSc9VU6Y
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Ry3T5sGF3JufzTgSc9VU6Y
The harness asserted which page dropped the session cookie, but with the default concurrency of 4 the loss is attributed to whichever page checks first and the culprit appears under concurrentUrls. The tool documents concurrency 1 for pinning a loss to exactly one page. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Ry3T5sGF3JufzTgSc9VU6Y
…vior Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Ry3T5sGF3JufzTgSc9VU6Y
Codex Review SummaryThis 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. |
|
Caution Review failedThe pull request is closed. Walkthrough
Merge Risk:
|
Summary
Readability refactor across
src/. Comments are removed and the code is restructured so it explains itself through names. Tool behavior is preserved. A few user-facing tool descriptions that were wrong are fixed.Structure
src/. License headers,@publictags and lint/TS directives remain. Where a comment carried meaning, the code was renamed or extracted so the name says it.audit_site: the ~500-line handler is split intoCrawlScope,CrawlFrontier,OrderedLinkCommits,SessionLossDetector,scanCrawledPage, and report/summary builders.audit_keyboard: issue detection, skip-link activation and focus-trap detection are separate functions. The in-page focus reader is composed of small named helpers.audit_screen_readerand measurement: band counting uses an axis helper and aDisjointSetsclass, with agroupByhelper and named measurement steps (ref resolution, owner frames, per-frame batches).scan_page_matrix: split into apply / scan / compare / restore / render steps.scan_pageandbrowser_find: report rendering, matcher and snippet windows are extracted. The in-page annotation drawer uses named nested helpers.waitForCompletion: uses a smallPageActivitytracker.InputRecordersubsystem moved out ofcontext.tsintosrc/inputRecorder.ts.validateResolvedConfigis split into named validators.program.tsbuilds the browser backend factory in one place instead of two.Duplication removed
src/utils/timeout.ts(settleWithin,rejectAfterTimeout,rejectOnAbort).reserveReportPath,fileResource)._resolveSelectorfallback is removed (Playwright is pinned to 1.63).User-facing fixes
scan_page, the primary single-page scan, which was missing. They also describescan_page_matrixcorrectly as viewport, color-scheme, reduced-motion and zoom variants (it previously said "viewports and WCAG tag sets").browser_navigation_timeoutandbrowser_default_timeoutadvertised0-300000ms, but the schema enforces 30000–1200000. The descriptions and README now state the enforced range.browser_navigation_timeoutscope: the description said it only affects the current tab, but it applies to all existing tabs.browser_findvalidation: argument validation (missing or conflictingtext/regex) now lives only in the input schema. Every call goes through schema parsing before the handler runs.Test harness
audit_sitesession-loss checks, while running at the default concurrency of 4. At concurrency 4 the loss is attributed to whichever page checks first, and the culprit appears underconcurrentUrls. Those checks now passconcurrency: 1, which is how the tool documents pinning a loss to one page. This check failed before this branch as well.Verification
Run on Node 24.22.2, the version the project's
enginesfield requires. On the preinstalled Node 22, tests fail before any change becauseRegExp.escapeis missing.npm run lint(oxlint +tsc --noEmit)npm run buildnpm test(vitest)mcp-http.test.ts > keeps wildcard listener :: restricted to loopback hosts) also fails onmainin this environment, which has no IPv6 wildcard listener.npm run kniptests/transportFixture.tsunused, whichmainreports toonode .codex/run-mcp-direct-harness.mjs, every tool against a real headless Chromium)browser_installis skipped by default. Before this branch: 32 passed, 1 failed (audit_site, see above)..codex/mcp-tool-prompts.tsv, run throughclaude -p --model haikuwith only this server's MCP tools available)browser_install. Every run was served byclaude-haiku-5-5.The Haiku loop reuses the prompts and fixture server from
.codex/run-mcp-tool-loop.mjs, but drives Claude Code instead of Codex. Each prompt runs in its own isolated server, and Haiku must report concrete tool output as evidence plus a final PASS/FAIL line. That run surfaced thebrowser_navigation_timeoutdescription mismatch fixed above.🤖 Generated with Claude Code
https://claude.ai/code/session_01Ry3T5sGF3JufzTgSc9VU6Y


Confidence Score: 5/5
The PR appears safe to merge; no actionable regressions were found.Summary
Extracts named helpers across browser tools, audits, recording, and timeout code while removing explanatory comments.
No actionable issues were found. Tests were not run.
Reviews (1) · Last reviewed commit: "fix: browser_navigation_timeout descript..." · Reviewed by Greptile
Summary by CodeRabbit