Skip to content

feat(accessibility): choose a scan's WCAG version, best practices and needs review - #513

Merged
gaurav-singh-9227 merged 3 commits into
mainfrom
feat/a11y-scan-settings
Oct 23, 2026
Merged

gaurav-singh-9227 merged 3 commits into
mainfrom
feat/a11y-scan-settings

Conversation

@Aaryan430

@Aaryan430 Aaryan430 commented Oct 23, 2026 •

Copy link
Copy Markdown
Collaborator

Problem

Asked to "scan bstackdemo.com on WCAG 2.2 AAA with best practices on", the agent couldn't. startAccessibilityScan only exposed advancedRules, so every scan ran at the API's defaults: WCAG 2.1 AA, best practices off, needs review on.

Change

startAccessibilityScan takes three new optional arguments, passed to the Website Scanner create-scan API under scanSettings next to advancedRules:

Argument Values API default when left out
wcagVersion wcag2a … wcag22aaa, rgaa41 (the backend's WCAG_VERSION_LABEL_MAP) wcag21aa
bestPractices true / false false
needsReview true / false true
advancedRules (existing) true / false true
  • Settings sent: only the ones given; the rest take the API's own defaults.
  • The answer: it now has a line with the settings read back from the run, e.g. Scan settings, as the scan ran: WCAG 2.2 AAA, best practices on, needs review on, advanced rules off. The agent can then report the settings instead of guessing them. If the run's settings can't be read, the line names only what was asked for.
  • Not included, experimental rules: the public create-scan API has no field for them. They're a user/team-level Website Scanner setting (disableA11yEngineExperimentalRules) that only the dashboard can change. That needs a backend change first.

Verification

  • New tests/tools/accessibilityScanSettings.test.ts:
    • the scanner sends the settings it is given, and only those
    • the tool passes them through and states them
    • wcagVersion accepts only the API's values
  • Argument descriptions stay within the 120-character budget.
  • npm run build passes on Node 22: 1358 tests.
  • Live: startAccessibilityScan on bstackdemo.com with wcagVersion: "wcag22aaa" and bestPractices: true. The API's run summary shows wcagVersion: "wcag22aaa", bestPractices: true, needsReview: true, advanced: true. That's 91 issues, against 81 at the defaults.

Changes after review (Shreyas)

  • The settings line reads the run's settings back from its summary rather than labelling defaults from a table here. This also shows advanced rules that a plan turned off. Checked live on three runs.
  • A 422 passes on the API's own reason. "A scan with this name already exists" is used only for a 422 that gives none.
  • main merged in. npm run build passes: 1360 tests.

🤖 Generated with Claude Code

… needs review

"Scan bstackdemo.com on WCAG 2.2 AAA with best practices on" ran at the
API's defaults (WCAG 2.1 AA, best practices off), as startAccessibilityScan
could only set advanced rules. The create-scan API takes all four under
scanSettings, so the tool now does too: wcagVersion (the API's ten values,
wcag2a to wcag22aaa and rgaa41), bestPractices and needsReview, alongside
advancedRules. A setting left out still takes the API's default, and the
answer says what the scan ran with, marking the defaults.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Auto 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.

⚙️ Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Central YAML (base), Organization UI (inherited), Workspace UI (inherited); Enforced overrides: Organization
  • Review profile: ASSERTIVE
  • Plan: Enterprise
  • Run ID: c4315199-784b-4a4f-b771-7d3945871a83

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
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

@sarve-shreyas

Copy link
Copy Markdown
Collaborator

Review: #513

The schema change is additive, so existing callers are unaffected. CI shows only CodeQL and CodeRabbit (auto-review skipped), so the test counts in the description aren't CI-verified.

Medium

  • scanner.ts catch block: any HTTP 422 is reported as "A scan with this name already exists…". With the new settings, a wcagVersion the backend rejects (e.g. rgaa41 on a plan without it) would send the agent into a rename loop. Check err.response.data and otherwise surface the API message. (Whether the API returns 422 for bad settings is unverified.)

Low-Medium

  • scanSettingsNote / SCAN_DEFAULTS are hard-coded, so the "(default)" labels report what was requested, not what ran. Account- or team-level settings could differ. Read the settings from the create-scan/run-summary response, or reword to "API default (assumed)".

Low

  • Only wcag22aaa was exercised live. rgaa41, wcag2a etc. are unverified. ScanSettings.wcagVersion is typed string rather than keyof typeof WCAG_VERSIONS.
  • Missing tests: a 4xx/422 with settings, and bestPractices: false. The local-URL branch looks correct by reading but is untested.
  • The advancedRules description text was reworded, which changes the schema text clients see.

AI-assisted read-only review of the diff. Items marked (unverified) were not checked against the live APIs.

Aaryan430 and others added 2 commits October 23, 2026 17:02
…own reason

Review on #513:
- The success note read "(default)" for every setting not asked for, from a
  table in this code. It now reads the run's settings back from its summary
  ("as the scan ran"), which also shows advanced rules a plan turned off. When
  the summary cannot be read it names only what was asked for.
- A 422 was always reported as "a scan with this name already exists". The
  API's own reason is now passed on; the name message is kept for a 422 that
  gives none.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Aaryan430

Copy link
Copy Markdown
Collaborator Author

Thanks @sarve-shreyas. Both addressed in 79cc46d:

  • Medium (422): a 422 now passes on the API's own reason (Failed to start scan: <message>). The "a scan with this name already exists" text is used only for a 422 that has no reason. Both cases are tested.
  • Low-Medium ((default) labels): removed. After the scan finishes, the settings are read back from the run summary, and the note reports them as the scan ran: Scan settings, as the scan ran: WCAG 2.2 AAA, best practices on, needs review on, advanced rules off. This also shows advanced rules that a plan turned off. If the summary can't be read, the note names only what was asked for. I checked the read-back live against three recent runs, rgaa41 and wcag21aa, and confirmed that an unknown run returns nothing.

origin/main merged in. Build passes: lint, prettier, 1360 tests, tsc.

@Aaryan430

Copy link
Copy Markdown
Collaborator Author

This has been merged into #502 (c7e454d), which now ships it to main together with #509, #510 and #492. It conflicted with #509 in accessibility.ts, where both added new helpers, and both were kept. The scan-settings line is also given when a scan's export is still being generated. The combined build passes (1400 tests).

@gaurav-singh-9227
gaurav-singh-9227 merged commit c7e454d into main Oct 23, 2026
5 checks passed
Aaryan430 added a commit that referenced this pull request Oct 23, 2026
Brings in #502 (Automate links, share links, large exports, one-page view,
scan-run comparison, #510's device note, #513's scan settings, #492's Ask AI
pointer). Conflicts resolved by keeping both sides:
- fetchAccessibilityIssues resolves the source first, then compareWith goes to
  the scan-run comparison for a scan and to the app-build comparison for an
  app build; pageUrl and exportTaskId pass through for web reports, and the
  next-page hint keeps the pageUrl with the exact remaining count.
- Report links: a share link is unwrapped first, then app and manual-report
  links, then Automate links.
- The CSV parser pages through the shared pageOf/sortBySeverity; its local
  copy is dropped.
- The run-started message carries both the device note and the accessibility
  guidance.
- The ids handoff keeps main's Ask AI pointer within the 200-character budget;
  the app lists' searchCapability pointer moves to the buildId and appReportId
  argument descriptions.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants