RachnaSutra AI GitHub

Validation and benchmarks

This page answers one question: how do we know the audit is right? Test fixtures written by the author only prove the code does what the author intended. So four independent kinds of evidence were gathered, including some that make the tool look worse than expected. All raw results are published and every number can be regenerated.

Important: these results describe version 0.2.0 on the inputs named here. They are not a guarantee of accuracy on other code. The labelling of real-world findings was done by the project author with AI assistance, not by an independent party.

Summary#

EvidenceWhat was doneHeadline result
Per-rule testsA failing and a passing input for every one of the 33 rules, plus false-positive guards152 automated tests pass; all examples published in Rule examples
W3C ACT test cases154 test cases from the ACT Rules Community Group, mapped to 10 rulesPrecision 71%, recall 65% after fixes (53% and 38% on the first run)
axe-core comparisonThe same 109 ACT cases run through axe-core 4.10.2 and RachnaSutraaxe-core is better: 92% precision and 83% recall, against 81% and 73%
Real-world audit12 public repositories, 1,360 files, 767 findings; 3 rounds of manual spot checksRound 1: 77% strict precision, 93% lenient; seven false-positive patterns found and fixed
Before and afterA real template site: audit, fix, re-audit, axe-core and browser check14 findings resolved, 0 introduced; axe-core link-name violations 12 to 0

1. Per-rule tests#

fixtures/rule-cases.mjs holds one failing and one passing input for each rule and a set of inputs that look wrong but are correct. test/rules.test.mjs asserts all of them, and npm run examples regenerates Rule examples from the same data, so the published examples cannot drift from the tested behaviour. A test also fails if a rule is added to the catalogue without a case.

2. W3C ACT Rules test cases#

Precision and recall for each mapped ACT rulePrecision and recall for each mapped ACT rule
Current precision and recall per ACT rule.
Tap or click to enlarge
Precision and recall before and after fixing defects the benchmark foundPrecision and recall before and after fixing defects the benchmark found
Not a blind result: the fixes were informed by the failing cases.
Tap or click to enlarge

The ACT Rules Community Group publishes machine-readable test cases (CC BY 4.0) with expected outcomes passed, failed and inapplicable. Ten ACT rules map to ten RachnaSutra checks. Each case page is audited in static mode. A failed case where our rule fires is a true positive; a passed or inapplicable case where it fires is a false positive.

First run, before any change#

ACT ruleCasesTPFNFPTNPrecisionRecall
23a2a8 Image has non-empty accessible name18326733%60%
b5c3f8 HTML page has lang attribute72203100%50%
2779a5 HTML page has non-empty title110506n/a0%
b4f0c3 Meta viewport allows for zoom113107100%75%
97a4e1 Button has non-empty accessible name174121067%80%
c487ae Link has non-empty accessible name2829017100%18%
e086e5 Form field has non-empty accessible name17252850%29%
80f0bf Audio or video avoids automatically playing audio8203340%100%
afw4f7 Text has minimum contrast282651529%25%
oj04fd Element in sequential focus order has visible focus90108n/a0%
All mapped1542032188453%38%

What the first run revealed#

The benchmark exposed real defects, not only expected limits of static analysis:

  • A document with no <head> element, or an empty lang="", was not reported.
  • Images named by title, hidden with aria-hidden, or marked presentational were wrongly reported.
  • Links and buttons whose only content is an empty-alt image or an icon were not reported, and hidden buttons were wrongly reported.
  • A contrast pair was judged even when a text-shadow, opacity or gradient changed the real contrast.

These were fixed and each has a permanent regression case in fixtures/rule-cases.mjs.

After the fixes#

ACT ruleCasesTPFNFPTNPrecisionRecall
23a2a8 Image has non-empty accessible name182321150%40%
b5c3f8 HTML page has lang attribute74003100%100%
2779a5 HTML page has non-empty title11501583%100%
b4f0c3 Meta viewport allows for zoom113107100%75%
97a4e1 Button has non-empty accessible name174111180%80%
c487ae Link has non-empty accessible name289211690%82%
e086e5 Form field has non-empty accessible name17342860%43%
80f0bf Audio or video avoids automatically playing audio8203340%100%
afw4f7 Text has minimum contrast282641633%25%
oj04fd Element in sequential focus order has visible focus90108n/a0%
All mapped1543418148871%65%
Important: the fixes were made after reading the failing test cases, so the second table is not a blind result. It shows the defects were real and are fixed; it does not predict accuracy on unseen pages.

Known and accepted gaps#

  • Contrast (25% recall) and visible focus (0%) need a rendered page; static analysis cannot compute them across the cascade. These rules only judge literal colour pairs and are labelled accordingly.
  • Placeholder-only form fields: ACT rule e086e5 accepts a placeholder as an accessible name. RachnaSutra reports it as review-required because WCAG practice (3.3.2) treats a placeholder as a weak label. This is a deliberate policy difference and appears as false alarms in the table.
  • Autoplay: whether a video has an audio track cannot be known statically, so the rule is medium confidence.
  • Elements built from role attributes (for example role="img" on a div) are not yet recognised.

Full lists of missed and false-alarm cases: act.md.

3. Comparison with axe-core#

RachnaSutra and axe-core precision and recall on seven ACT rulesRachnaSutra and axe-core precision and recall on seven ACT rules
axe-core is more accurate; RachnaSutra works on source files, offline.
Tap or click to enlarge

axe-core 4.10.2 (run in jsdom) and RachnaSutra were run on the same inputs for the seven rules both can express.

ACT ruleCasesRachnaSutra P / Raxe-core P / R
23a2a8 Image has non-empty accessible name1850% / 40%100% / 80%
b5c3f8 HTML page has lang attribute7100% / 100%67% / 100%
2779a5 HTML page has non-empty title1183% / 100%83% / 100%
b4f0c3 Meta viewport allows for zoom11100% / 75%100% / 100%
97a4e1 Button has non-empty accessible name1780% / 80%100% / 80%
c487ae Link has non-empty accessible name2890% / 82%100% / 91%
e086e5 Form field has non-empty accessible name1760% / 43%100% / 43%
All seven10981% / 73%92% / 83%

Reading: axe-core, which analyses a real DOM, is more accurate than RachnaSutra's source-text rules, as expected. RachnaSutra's value is different: it runs on source files without a browser, in CI, offline, on JSX and template files axe-core cannot load, and it adds the agent workflow. It is a complement, not a replacement. Runtime axe-core integration is on the roadmap.

On 509 real HTML files the two tools agreed on most findings; the differences are published in act-vs-axe.md. Many "axe-only" language and title results come from partial template files, where jsdom invents an <html> element that the source does not contain, so they should not be read as RachnaSutra misses. The 29 "RachnaSutra-only" form-label results are mostly placeholder-only inputs (the policy difference above).

4. Real-world audit of public repositories#

Findings per audited public repositoryFindings per audited public repository
A big count is not a verdict on a project.
Tap or click to enlarge

Twelve public repositories were cloned at depth 1 and audited statically; no code from them was executed.

RepositoryFiles scannedFindings
ColorlibHQ/AdminLTE168103
jgthms/bulma536450
twbs/bootstrap28498
mozilla/pdf.js7490
reactjs/react.dev11510
shadcn-ui/taxonomy972
vercel/commerce462
startbootstrap/startbootstrap-clean-blog154
startbootstrap/startbootstrap-agency132
h5bp/html5-boilerplate24
gatsbyjs/gatsby-starter-blog31
alphagov/accessible-autocomplete71
Total1,360767

Commits and per-rule counts are in real-world.md. A large count is not a verdict on a project: several are documentation sites, test pages and design-system demos with deliberately minimal markup.

Manual precision check#

Manual precision check per round: true positives, context-dependent and false positivesManual precision check per round: true positives, context-dependent and false positives
Labels by the author with AI assistance; not independent.
Tap or click to enlarge

Findings were sampled at random (seeded, up to 6 per rule) and each was read in its source context. Labels: TP (real pattern, plausible concern), CD (context-dependent: template, runtime text, intentional demo, or a policy difference) and FP (wrong claim or mis-parse).

RoundWhat was sampledLabelledTPCDFPStrict precisionLenient precision
1All rules, before any fix957315777%93%
27 rules changed after round 1331713352%91%
33 rules changed after round 21376054%100%

Strict precision counts only TP; lenient counts TP and CD. Round 2 and 3 cover only the rules that were changed, which are the hardest ones, so their percentages are lower than round 1 and are not comparable with it.

False positives found, and fixed, with a regression case each: input nested in a labelled button; <html> inside a documentation code sample; :active selectors reported as focus problems; pseudo-elements and icons reported as small targets; a button named by <label for>; SCSS interpolation breaking selector parsing; spacer elements reported as targets; names supplied by templates or runtime localisation.

Honest limits of this check#

  • The labeller is the project author with AI assistance, not an independent reviewer. Samples and labels are published so anyone can disagree (benchmarks/results/real-world-sample-round*.json, real-world-labels-round*.json).
  • Samples are small. Treat percentages as indicative.
  • Because the fixes were informed by this corpus, it is no longer blind for the rules that changed. A new set of repositories would be needed for a blind re-test.
  • Recall on real code was not measured, because there is no ground truth list of every issue in these repositories.

5. Before-and-after case study#

A built page set from the MIT-licensed Clean Blog template (startbootstrap/startbootstrap-clean-blog) was audited, fixed by hand, and re-audited. Details and the diff: case-studies/clean-blog.

StepResult
Baseline static audit31 findings, including 12 social-media links with no accessible name and 2 pages with no main landmark
Fixesaria-label on the 12 links, icons hidden from assistive technology, <main> added on the 2 pages (a 172-line diff)
rachnasutra verify --reportbaseline 31, now 17: 14 resolved, 17 remaining, 0 introduced
axe-core on the same pageslink-name violations 12 before, 0 after
Real browser (Chromium pane)3 links per page had empty names before and are named after; 1 <main> after
Not doneNo screen reader test, no keyboard-only walkthrough, no visual review

The 17 remaining findings were reviewed and deliberately not changed: ten focus-outline rules and five contrast rules sit in unused framework classes of the compiled Bootstrap CSS, and the other two are placeholder text on the About page and a missing image width and height on the post page.

6. What is still missing#

GapWhy it mattersStatus
A blind re-test on new repositoriesCurrent numbers were used to improve the rulesPlanned
Independent labellingRemoves author biasOpen; contributions welcome
Runtime evidence (browser, axe-core, screenshots)audit --mode browser renders index.html, saves a screenshot, and runs axe-coreImplemented when Playwright is installed. Screen-reader and keyboard paths stay manual. This does not change the static axe comparison above
Live host smoke testsSkills are only structurally verifiedSee Host smoke tests
Usage and community track recordCannot be created in advanceTime

Reproduce#

npm install && npm test                      # 152 tests
npm run examples                             # regenerate rule examples
node benchmarks/act.mjs                      # ACT benchmark (needs network)
# axe-core comparison (installs axe-core and jsdom in a throwaway folder):
mkdir /tmp/rs-bench && cd /tmp/rs-bench && npm init -y && npm install axe-core@4.10.2 jsdom@25.0.1 && cd -
BENCH_MODULES=/tmp/rs-bench node benchmarks/axe-compare.mjs
# real-world audit: clone repositories into a folder (one subfolder each), then
node benchmarks/real-world.mjs <corpusDir> <seed> && node benchmarks/adjudicate.mjs

The list of repositories and commits used is in real-world.md.