Publish benchmark task data
Browse filesFiles changed (6)
- LICENSEAdded+21
- README.mdAdded+112
- croissant.jsonAdded+216
- data/PROVENANCE.mdAdded+13
- data/tasks.jsonlAdded
- scripts/gen-tasks.mjsAdded+581
123456789101112131415161718192021MIT License
Copyright (c) 2026 Pooria Arab
Permission is hereby granted, free of charge, to any person obtaining a copyof this software and associated documentation files (the "Software"), to dealin the Software without restriction, including without limitation the rightsto use, copy, modify, merge, publish, distribute, sublicense, and/or sellcopies of the Software, and to permit persons to whom the Software isfurnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in allcopies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS ORIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THEAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHERLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THESOFTWARE.123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112---license: "mit"language:- enpretty_name: "Accessibility Fix"tags:- benchmark- llm-evaluation- ai-benchmark- model-evaluation- evals- grading- accessibility- a11y- wcag- openrouter- openai- mcp- typescript- agent-benchmarktask_categories:- text-generationsize_categories:- n<1Kconfigs:- config_name: default data_files: - split: test path: data/tasks.jsonl---
# Accessibility Fix
Fix a broken page so keyboard, screen-reader and contrast checks pass.
## What it measures
Whether a fixed HTML page really repairs injected keyboard, screen-reader, and contrast defects without deleting or hiding content.
Category: `coding`. Status: `alpha`.
## How to run
```console$ npx benchmark-accessibility-fix list$ npx benchmark-accessibility-fix run --model <model-id> --provider openrouter$ npx benchmark-accessibility-fix score results.json```
`--provider mock` runs the whole benchmark offline with no keys. Real models runthrough OpenRouter (`OPENROUTER_API_KEY`) or any OpenAI-compatible base URL(`OPENAI_BASE_URL`, `OPENAI_API_KEY`).
## Data fields
`data/tasks.jsonl` holds 40 tasks, one JSON object per line(kinds: 40 single).
| field | type ||---|---|| `id` | string || `kind` | string || `prompt` | string || `expected` | string || `metadata` | object |
## Provenance
# Accessibility Fix provenance
This file is generated from the benchmark definition.
## Synthetic accessibility fixtures
- Kind: `synthetic`- URL: https://github.com/pooriaarab/benchmark-accessibility-fix/blob/main/scripts/gen-tasks.mjs- Licence: `MIT`- Retrieved: 2026-10-16T00:00:00.000Z- How to get it: Run `npm run generate:tasks` (or `node scripts/gen-tasks.mjs --seed 20261015` after `npm run build`) from the repository root. The generator grades every reference page with the built package and re-draws until it scores 1. A hidden split uses another seed: `node scripts/gen-tasks.mjs --seed <n> --split hidden --out <path>`; hidden files use a11yh- ids and stay out of git and npm.- Contamination notes: Public tasks use seed 20261015. Treat them as possibly in training data; use a separately seeded hidden split for final comparisons.- Refresh: Change the seed, run the generator, and review the JSONL diff.
## Grader
Deterministic static analysis of the fixed HTML: ten WCAG-cited checks score defects fixed, minus regressions, content loss, element removal, and hiding abuse. Model judging is off.
## Limitations
This dataset contains only the public task split (40 tasks).Hidden evaluation splits use a private seed and are deliberately not part ofthis dataset. Source kinds: synthetic. These are evaluation promptsfor the `benchmark-accessibility-fix` benchmark, not training data; scoring requires the package'sdeterministic grader. See PROVENANCE.md for contamination notes.
## Citation
```bibtex@misc{benchmark_accessibility_fix, author = {Pooria Arab}, title = {Accessibility Fix task data}, year = {2026}, url = {https://github.com/pooriaarab/benchmark-accessibility-fix}}```
## Links
- npm: https://www.npmjs.com/package/benchmark-accessibility-fix- GitHub: https://github.com/pooriaarab/benchmark-accessibility-fix- Leaderboard: https://aibenchmarkindex.com/benchmarks/benchmark-accessibility-fix- Dataset: https://huggingface.co/datasets/pooria/benchmark-accessibility-fix123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216{ "@context": { "@language": "en", "@vocab": "https://schema.org/", "citeAs": "cr:citeAs", "column": "cr:column", "conformsTo": "dct:conformsTo", "cr": "http://mlcommons.org/croissant/", "data": { "@id": "cr:data", "@type": "@json" }, "dataBiases": "cr:dataBiases", "dataCollection": "cr:dataCollection", "dataType": { "@id": "cr:dataType", "@type": "@vocab" }, "dct": "http://purl.org/dc/terms/", "equivalentProperty": "cr:equivalentProperty", "examples": { "@id": "cr:examples", "@type": "@json" }, "extract": "cr:extract", "field": "cr:field", "fileProperty": "cr:fileProperty", "fileObject": "cr:fileObject", "fileSet": "cr:fileSet", "format": "cr:format", "includes": "cr:includes", "isLiveDataset": "cr:isLiveDataset", "jsonPath": "cr:jsonPath", "key": "cr:key", "md5": "cr:md5", "parentField": "cr:parentField", "path": "cr:path", "personalSensitiveInformation": "cr:personalSensitiveInformation", "prov": "http://www.w3.org/ns/prov#", "rai": "http://mlcommons.org/croissant/RAI/", "recordSet": "cr:recordSet", "references": "cr:references", "regex": "cr:regex", "repeated": "cr:repeated", "replace": "cr:replace", "samplingRate": "cr:samplingRate", "sc": "https://schema.org/", "separator": "cr:separator", "source": "cr:source", "subField": "cr:subField", "transform": "cr:transform" }, "@type": "sc:Dataset", "conformsTo": [ "http://mlcommons.org/croissant/1.0", "http://mlcommons.org/croissant/RAI/1.0" ], "name": "Accessibility Fix", "description": "Fix a broken page so keyboard, screen-reader and contrast checks pass.", "url": "https://huggingface.co/datasets/pooria/benchmark-accessibility-fix", "sameAs": [ "https://github.com/pooriaarab/benchmark-accessibility-fix", "https://aibenchmarkindex.com/benchmarks/benchmark-accessibility-fix" ], "license": "https://choosealicense.com/licenses/mit/", "creator": { "@type": "Person", "name": "Pooria Arab", "url": "https://github.com/pooriaarab" }, "datePublished": "2026-10-16", "dateModified": "2026-10-16", "version": "0.1.0", "inLanguage": "en", "keywords": [ "benchmark-accessibility-fix", "llm-evaluation", "benchmark" ], "isAccessibleForFree": true, "citeAs": "@misc{benchmark-accessibility-fix, author={Pooria Arab}, title={Accessibility Fix}, year={2026}, url={https://github.com/pooriaarab/benchmark-accessibility-fix}}", "distribution": [ { "@type": "cr:FileObject", "@id": "data/PROVENANCE.md", "name": "data/PROVENANCE.md", "contentUrl": "https://huggingface.co/datasets/pooria/benchmark-accessibility-fix/resolve/main/data/PROVENANCE.md", "encodingFormat": "text/markdown", "sha256": "6f952aa73169afa78d3ac72269bcec7e2136b77b27d6f8b0caa5b42da13df958" }, { "@type": "cr:FileObject", "@id": "data/tasks.jsonl", "name": "data/tasks.jsonl", "contentUrl": "https://huggingface.co/datasets/pooria/benchmark-accessibility-fix/resolve/main/data/tasks.jsonl", "encodingFormat": "application/jsonlines", "sha256": "20d9f94a23dfa0d137e1235d84e3981b358ec54b0dd9d48ad4bba052cd207cc8" }, { "@type": "cr:FileObject", "@id": "scripts/gen-tasks.mjs", "name": "scripts/gen-tasks.mjs", "contentUrl": "https://huggingface.co/datasets/pooria/benchmark-accessibility-fix/resolve/main/scripts/gen-tasks.mjs", "encodingFormat": "text/javascript", "sha256": "fb61fec6a1ca75c7bc92e9a6908c0352d3b1617c728ecf762446302f0b10e45e" }, { "@type": "cr:FileObject", "@id": "LICENSE", "name": "LICENSE", "contentUrl": "https://huggingface.co/datasets/pooria/benchmark-accessibility-fix/resolve/main/LICENSE", "encodingFormat": "text/plain", "sha256": "db83f2db2a2b6a3b5587ce4750a3a6cff3dd1219650fa1ea3b3354ee04891d96" } ], "recordSet": [ { "@type": "cr:RecordSet", "name": "tasks", "description": "40 benchmark tasks, one JSON object per line.", "field": [ { "@type": "cr:Field", "name": "id", "dataType": "sc:Text", "source": { "fileObject": { "@id": "data/tasks.jsonl" }, "extract": { "jsonPath": "$.id" } } }, { "@type": "cr:Field", "name": "kind", "dataType": "sc:Text", "source": { "fileObject": { "@id": "data/tasks.jsonl" }, "extract": { "jsonPath": "$.kind" } } }, { "@type": "cr:Field", "name": "prompt", "dataType": "sc:Text", "source": { "fileObject": { "@id": "data/tasks.jsonl" }, "extract": { "jsonPath": "$.prompt" } } }, { "@type": "cr:Field", "name": "expected", "dataType": "sc:Text", "source": { "fileObject": { "@id": "data/tasks.jsonl" }, "extract": { "jsonPath": "$.expected" } } }, { "@type": "cr:Field", "name": "metadata", "dataType": "sc:Text", "source": { "fileObject": { "@id": "data/tasks.jsonl" }, "extract": { "jsonPath": "$.metadata" } } } ] } ], "rai:dataCollection": "Public task split cloned from the benchmark repository; tasks are produced by scripts/gen-tasks.mjs with a fixed public seed.", "rai:dataCollectionType": "Benchmark task prompts for LLM evaluation.", "rai:dataCollectionRawData": "https://github.com/pooriaarab/benchmark-accessibility-fix/tree/main/data", "rai:dataReleaseMaintenancePlan": "Refreshed when the benchmark's public seed changes; hidden splits are generated with a private seed and never published.", "rai:dataLimitations": "Public split only (40 tasks); hidden evaluation splits are held out. Evaluation prompts, not training data.", "rai:dataBiases": "Synthetic task families oversample the shapes the generator enumerates; coverage of real-world variation is limited by the generator templates.", "rai:personalSensitiveInformation": "None. Tasks contain no personal data; names, orders and scenarios are generated fixtures.", "rai:dataUseCases": [ "Testing and comparing LLM/agent behaviour on the measured construct", "Regression testing of model releases" ], "rai:dataSocialImpact": "Low risk: synthetic eval data. Improves transparency of model capability claims when used responsibly.", "rai:hasSyntheticData": true, "prov:wasDerivedFrom": [ "https://github.com/pooriaarab/benchmark-accessibility-fix/blob/main/scripts/gen-tasks.mjs" ], "prov:wasGeneratedBy": [ { "@type": "prov:Activity", "name": "Synthetic accessibility fixtures", "description": "synthetic source: https://github.com/pooriaarab/benchmark-accessibility-fix/blob/main/scripts/gen-tasks.mjs" } ], "alternateName": [ "pooria/benchmark-accessibility-fix" ]}12345678910111213# Accessibility Fix provenance
This file is generated from the benchmark definition.
## Synthetic accessibility fixtures
- Kind: `synthetic`- URL: https://github.com/pooriaarab/benchmark-accessibility-fix/blob/main/scripts/gen-tasks.mjs- Licence: `MIT`- Retrieved: 2026-10-16T00:00:00.000Z- How to get it: Run `npm run generate:tasks` (or `node scripts/gen-tasks.mjs --seed 20261015` after `npm run build`) from the repository root. The generator grades every reference page with the built package and re-draws until it scores 1. A hidden split uses another seed: `node scripts/gen-tasks.mjs --seed <n> --split hidden --out <path>`; hidden files use a11yh- ids and stay out of git and npm.- Contamination notes: Public tasks use seed 20261015. Treat them as possibly in training data; use a separately seeded hidden split for final comparisons.- Refresh: Change the seed, run the generator, and review the JSONL diff.123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581// Generates synthetic accessibility-fix fixtures (MIT).// Usage: node scripts/gen-tasks.mjs [--seed N] [--split public|hidden] [--out path] [--count N]// Public split defaults to data/tasks.jsonl with seed 20261015.// Hidden split defaults to artifacts/tasks.hidden.jsonl (gitignored, never published)// and uses its own a11yh- id prefix so hidden ids never collide with public ones.import { mkdir, writeFile } from "node:fs/promises";import { dirname } from "node:path";import { createHash } from "node:crypto";
const args = process.argv.slice(2);const get = (name, fallback) => { const index = args.indexOf(name); return index === -1 ? fallback : args[index + 1];};if (args.includes("--help")) { console.log("Usage: node scripts/gen-tasks.mjs [--seed N] [--split public|hidden] [--out path] [--count N]"); process.exit(0);}const seed = Number(get("--seed", "20261015"));const split = get("--split", "public");const count = Number(get("--count", "40"));const out = get("--out", split === "hidden" ? "artifacts/tasks.hidden.jsonl" : "data/tasks.jsonl");if (!Number.isInteger(seed) || !Number.isInteger(count) || count < 1) throw new Error("seed and count must be positive integers");if (split !== "public" && split !== "hidden") throw new Error("--split must be public or hidden");
function mulberry32(start) { let state = start >>> 0; return () => { state += 1831565813; let value = state; value = Math.imul(value ^ (value >>> 15), value | 1); value ^= value + Math.imul(value ^ (value >>> 7), value | 61); return ((value ^ (value >>> 14)) >>> 0) / 4294967296; };}
const pick = (rng, list) => list[Math.floor(rng() * list.length)];const pickN = (rng, list, n) => { const copy = [...list]; const out = []; while (out.length < Math.min(n, copy.length)) out.push(copy.splice(Math.floor(rng() * copy.length), 1)[0]); return out;};const shuffle = (rng, list) => { const a = [...list]; for (let i = a.length - 1; i > 0; i--) { const j = Math.floor(rng() * (i + 1)); [a[i], a[j]] = [a[j], a[i]]; } return a;};
// WCAG relative luminance for #rrggbb.function luminance(hex) { const h = hex.replace("#", ""); const [r, g, b] = [0, 2, 4].map((i) => { const c = parseInt(h.slice(i, i + 2), 16) / 255; return c <= 0.03928 ? c / 12.92 : ((c + 0.055) / 1.055) ** 2.4; }); return 0.2126 * r + 0.7152 * g + 0.0722 * b;}const ratio = (a, b) => { const [x, y] = [luminance(a), luminance(b)].sort((m, n) => n - m); return (x + 0.05) / (y + 0.05);};const hex = (rng, lo, hi) => "#" + [0, 1, 2].map(() => (lo + Math.floor(rng() * (hi - lo + 1))).toString(16).padStart(2, "0")).join("");
// A passing foreground/background pair at >= minRatio. The default// carries margin over the 4.5:1 rule so equivalent color spellings// (hsl() with rounded channels, 8-digit hex) cannot dip a reference// page under the threshold.function goodPair(rng, minRatio = 4.75) { for (let tries = 0; tries < 200; tries++) { const bg = hex(rng, 200, 255); const fg = hex(rng, 0, 120); if (ratio(fg, bg) >= minRatio) return { fg, bg }; } throw new Error("no good pair found");}// A failing pair against a fixed background (text lands in the 3.5-4.4 band// so the defect is visible but not blatant).function badFg(rng, bg) { for (let tries = 0; tries < 400; tries++) { const fg = hex(rng, 120, 190); const r = ratio(fg, bg); if (r < 4.5 && r > 2.5) return fg; } return "#8a8a8a";}// A passing foreground on a FIXED background: the inline span inherits// the body background, so it must be drawn against it, not against a// throwaway pair bg.function goodFg(rng, bg, minRatio = 4.75) { for (let tries = 0; tries < 400; tries++) { const fg = hex(rng, 0, 130); if (ratio(fg, bg) >= minRatio) return fg; } throw new Error("no good foreground found");}// A large-text pair in the passing 3:1-4.5 band (valid fix, tests the// large-text threshold). The 3.3 floor leaves room for color-format// rounding noise, same margin idea as goodPair.function largePair(rng) { for (let tries = 0; tries < 300; tries++) { const bg = hex(rng, 200, 255); const fg = hex(rng, 60, 160); const r = ratio(fg, bg); if (r >= 3.3 && r < 4.5) return { fg, bg }; } throw new Error("no large pair found");}
const CHECKS = [ ["missing-alt", "1.1.1"], ["unlabeled-input", "3.3.2"], ["low-contrast", "1.4.3"], ["heading-order", "1.3.1"], ["tabindex-positive", "2.4.3"], ["div-button", "4.1.2"], ["missing-lang", "3.1.1"], ["no-focus-style", "2.4.7"], ["empty-link", "2.4.4"], ["table-headers", "1.3.1"],];const WCAG = Object.fromEntries(CHECKS);
const ADJ = ["Harbor", "Kestrel", "Northern", "River", "Garden", "Amber", "Cedar", "Juniper", "Misty", "Copper", "Silver", "Quiet", "Bright", "Willow", "Frost", "Ember", "Sage", "Coral", "Atlas", "Meadow"];const NOUN = ["Lights", "Ridge", "Valley", "Crossing", "Mills", "Works", "Foundry", "Collective", "Cooperative", "Observatory", "Pantry", "Workshop", "Ledger", "Orchard", "Depot", "Exchange", "Studio", "Clinic", "Archive", "Guild"];const KIND = ["newsletter", "field guide", "status report", "release notes", "handbook", "bulletin", "weekly digest", "product sheet", "setup guide", "survey results", "booking page", "service page"];const TOPICS = [ ["ferry sailings", "harbor notes", "crossing times"], ["grind settings", "care notes", "brew ratios"], ["sleeper bookings", "reading list", "departure board"], ["volunteer shifts", "meeting point", "supply list"], ["api keys", "rate limits", "endpoint status"], ["survey findings", "next steps", "member quotes"], ["trail conditions", "permit windows", "ranger notes"], ["menu changes", "supplier list", "order cutoffs"], ["rehearsal dates", "set list", "venue notes"], ["seed inventory", "planting calendar", "pest watch"], ["loan rates", "branch hours", "member news"], ["build artifacts", "test matrix", "deploy log"],];const NOTES = [ "New routes post every Sunday evening.", "Burrs carry a five year warranty.", "Berths sell out around holidays.", "Gloves and bags are provided.", "Keys rotate every ninety days.", "Two hundred members answered.", "Permits open on the first Monday.", "Orders close at noon on Fridays.", "Rehearsals move indoors in winter.", "Seed counts refresh monthly.", "Rates lock for sixty days.", "Artifacts prune after thirty days.",];const SPANS = [ "Ferries run hourly on holidays.", "Free returns within thirty days.", "Bring a lock for the cabin door.", "All ages welcome with an adult.", "Sandbox data refreshes hourly.", "Evening hours were the top ask.", "Boots are required past the gate.", "Late orders ship the next day.", "Guests may watch the last set.", "Cover beds before a frost.", "Statements arrive by post.", "Flaky tests quarantine on retry.",];const ALTS = [ "Ferry crossing the harbor at dusk", "Steel burr coffee grinder on a counter", "Sleeper train under northern lights", "Volunteers clearing a riverbank", "Soil sensor beside tomato plants", "Reading room with tall shelves", "Trail marker above the treeline", "Stacked crates at the loading dock", "String section tuning on stage", "Seed packets on a potting bench", "Teller counter at the main branch", "Build monitor showing green jobs",];const CTA = ["Subscribe", "Add to basket", "Save article", "Join us", "Get a key", "Download PDF", "Book now", "Reserve a spot", "Notify me", "Start trial"];const NAV2 = ["About", "FAQ", "Pricing", "News", "Docs", "Team", "Contact", "Archive"];const FIELD_POOL = [ ["name", "Full name", "text"], ["email", "Email address", "email"], ["phone", "Phone number", "tel"], ["org", "Organization", "text"], ["city", "City", "text"], ["note", "Delivery note", "text"],];const CLASS_A = ["note", "hint", "aside", "fine", "meta", "muted"];const CLASS_B = ["cta", "btn-primary", "action", "primary-btn", "main-action", "go"];const CAPTIONS = ["Crossing times", "Grind guide", "Departure board", "Cleanup shifts", "Endpoint limits", "Survey results", "Permit windows", "Order ledger", "Rehearsal slots", "Seed counts", "Rate sheet", "Build history"];const COLHEADS = [["Option", "Detail", "Status"], ["Name", "Owner", "State"], ["Step", "Input", "Output"], ["Item", "Count", "Flag"]];const CELLS = [["Standard", "Weekly", "Open"], ["Plus", "Daily", "Open"], ["Rush", "Hourly", "Full"], ["Basic", "Monthly", "Closed"], ["Trial", "Once", "Open"], ["Custom", "On call", "Open"]];
// One randomized but fully accessible page. Returns the HTML plus a hooks// object with the exact strings defect breakers can target.function buildFixed(rng) { const title = `${pick(rng, ADJ)} ${pick(rng, NOUN)} ${pick(rng, KIND)}`; const topics = pick(rng, TOPICS); const [h2a, h2b, caption] = [topics[0], topics[1], pick(rng, CAPTIONS)]; const noteClass = pick(rng, CLASS_A); const ctaClass = pick(rng, CLASS_B); const noteText = pick(rng, NOTES); const spanText = pick(rng, SPANS); const heroAlt = pick(rng, ALTS); const img = `https://example.com/${title.toLowerCase().replace(/[^a-z]+/g, "-")}.jpg`; const ctaText = pick(rng, CTA); const nav2 = pick(rng, NAV2); const fields = pickN(rng, FIELD_POOL, 2 + Math.floor(rng() * 2)); const colheads = pick(rng, COLHEADS); const rows = pickN(rng, CELLS, 2 + Math.floor(rng() * 2)); // Colors: every pair is generated to pass. const body = goodPair(rng); const note = goodPair(rng); const spanFg = goodFg(rng, body.bg); const cta = goodPair(rng); const focusColor = goodPair(rng).fg; // A large-text heading pair in the legal 3:1-4.5 band keeps the // large-text path exercised without tripping the defect check. const large = rng() < 0.5 ? largePair(rng) : null; const largeRule = large ? `\n.big-head{color:${large.fg};background-color:${large.bg};font-size:26px;font-weight:700}` : ""; const bigHead = large ? `<h2 class="big-head">${h2a}</h2>` : `<h2>${h2a}</h2>`; const styleBlock = `<style>body{color:${body.fg};background-color:${body.bg};font-family:system-ui,sans-serif;line-height:1.5}.${noteClass}{color:${note.fg};background-color:${note.bg}}.${ctaClass}{color:${cta.fg};background-color:${cta.bg};padding:.6rem 1rem;border:0;border-radius:.4rem}a:focus-visible,.${ctaClass}:focus-visible{outline:3px solid ${focusColor};outline-offset:2px}${largeRule}</style>`;
const skip = `<a href="#main">Skip to content</a>`; const formFields = fields.map(([id, label, type]) => `<label for="${id}">${label}</label>\n<input id="${id}" name="${id}" type="${type}" autocomplete="${id}">`).join("\n"); const tableRows = rows.map((r) => `<tr>${r.map((c) => `<td>${c}</td>`).join("")}</tr>`).join("\n"); const table = `<table>\n<caption>${caption}</caption>\n<tr>${colheads.map((c) => `<th scope="col">${c}</th>`).join("")}</tr>\n${tableRows}\n</table>`; const sections = shuffle(rng, [ `<img src="${img}" alt="${heroAlt}">`, `<p class="${noteClass}">${noteText}</p>`, `<p><span style="color:${spanFg}">${spanText}</span></p>`, table, ]); const html = `<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><title>${title}</title>${styleBlock}</head><body><header><nav>${skip} <a href="/${nav2.toLowerCase()}">${nav2}</a></nav><h1>${title}</h1></header><main id="main">${bigHead}${sections[0]}${sections[1]}<h3>${h2b}</h3><form action="/signup" method="post">${formFields}<button type="submit">Sign up</button></form>${sections[2]}<p><button class="${ctaClass}" type="button">${ctaText}</button></p>${sections[3]}</main><footer><p><a href="/archive">Archive</a> <a href="/contact">Contact</a></p></footer></body></html>`; return { html, hooks: { heroAlt: ` alt="${heroAlt}"`, label: fields[1] ? `<label for="${fields[1][0]}">${fields[1][1]}</label>\n` : `<label for="${fields[0][0]}">${fields[0][1]}</label>\n`, noteRule: `.${noteClass}{color:${note.fg};`, noteBad: `.${noteClass}{color:${badFg(rng, note.bg)};`, spanRule: `<span style="color:${spanFg}">`, spanBad: `<span style="color:${badFg(rng, body.bg)}">`, ctaButton: `<button class="${ctaClass}" type="button">${ctaText}</button>`, ctaText, focusRule: `\na:focus-visible,.${ctaClass}:focus-visible{outline:3px solid ${focusColor};outline-offset:2px}`, skip, archive: `<a href="/archive">Archive</a>`, }, };}
const TABS = ["Overview", "History", "Members", "Billing", "Usage", "Alerts", "Archive", "Notes"];
// Hard tier: a different page skeleton, not the easy page with extra// defects. Grouped fields carry names through an aria-labelledby chain,// a tab widget holds role/tabindex/handler parts, and the table spans// headers across columns and rows - so a fixer tuned to the easy template// leaves real barriers behind.function buildHard(rng) { const title = `${pick(rng, ADJ)} ${pick(rng, NOUN)} ${pick(rng, KIND)}`; const topics = pick(rng, TOPICS); const [h2a, h2b, h3c] = topics; const caption = pick(rng, CAPTIONS); const noteClass = pick(rng, CLASS_A); const ctaClass = pick(rng, CLASS_B); const noteText = pick(rng, NOTES); const spanText = pick(rng, SPANS); const heroAlt = pick(rng, ALTS); const img = `https://example.com/${title.toLowerCase().replace(/[^a-z]+/g, "-")}.jpg`; const ctaText = pick(rng, CTA); const nav2 = pick(rng, NAV2); const cardText = pick(rng, CTA.filter((c) => c !== ctaText)); const tabs = pickN(rng, TABS, 2); const [f0, f1, f2] = pickN(rng, FIELD_POOL, 3); const colheads = pick(rng, COLHEADS); const cells = pickN(rng, CELLS, 4); const body = goodPair(rng); const note = goodPair(rng); const spanFg = goodFg(rng, body.bg); const cta = goodPair(rng); const tabPair = goodPair(rng); const focusColor = goodPair(rng).fg; const large = rng() < 0.5 ? largePair(rng) : null; const largeRule = large ? `\n.big-head{color:${large.fg};background-color:${large.bg};font-size:26px;font-weight:700}` : ""; const bigHead = large ? `<h2 class="big-head" id="deck">${h2a}</h2>` : `<h2 id="deck">${h2a}</h2>`; const styleBlock = `<style>body{color:${body.fg};background-color:${body.bg};font-family:system-ui,sans-serif;line-height:1.5}.${noteClass}{color:${note.fg};background-color:${note.bg}}.tab{color:${tabPair.fg};background-color:${tabPair.bg};padding:.4rem .8rem;display:inline-block}.${ctaClass}{color:${cta.fg};background-color:${cta.bg};padding:.6rem 1rem;border:0;border-radius:.4rem}a:focus-visible,.${ctaClass}:focus-visible,[role=tab]:focus-visible{outline:3px solid ${focusColor};outline-offset:2px}${largeRule}</style>`;
const skip = `<a href="#main">Skip to content</a>`; const labelParts = f0[1].split(" "); const labSpanA = `<span id="l-a">${labelParts[0]}</span>`; const labSpanB = `<span id="l-b">${labelParts.slice(1).join(" ") || pick(rng, topics)}</span>`; const tabA = `<div role="tab" tabindex="0" onkeydown="pickTab('a')" aria-selected="true">${tabs[0]}</div>`; const tabB = `<div role="tab" tabindex="0" onkeydown="pickTab('b')" aria-selected="false">${tabs[1]}</div>`; const tabsOpen = `<div class="tabs" role="tablist" aria-labelledby="tabs-title">`; const label = `<label for="hf2">${f1[1]}</label>`; const cardHref = `/${cardText.toLowerCase().replace(/[^a-z0-9]+/g, "-")}`; const cardLink = `<a href="${cardHref}">${cardText}</a>`; const table = `<table><caption>${caption}</caption><tr><th scope="col">${colheads[0]}</th><th colspan="2" scope="colgroup">${colheads[1]}</th></tr><tr><th scope="row">${cells[0][0]}</th><td>${cells[0][1]}</td><td>${cells[0][2]}</td></tr><tr><th scope="row">${cells[1][0]}</th><td>${cells[1][1]}</td><td>${cells[1][2]}</td></tr><tr><th scope="row">${cells[2][0]}</th><td>${cells[2][1]}</td><td>${cells[2][2]}</td></tr></table>`; const sections = shuffle(rng, [ `<img src="${img}" alt="${heroAlt}">`, `<p class="${noteClass}">${noteText}</p>`, `<p><span style="color:${spanFg}">${spanText}</span></p>`, table, ]); const html = `<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><title>${title}</title>${styleBlock}</head><body><header><nav>${skip} <a href="/${nav2.toLowerCase()}">${nav2}</a></nav><h1>${title}</h1></header><main id="main">${bigHead}<section aria-labelledby="deck">${sections[0]}${sections[1]}</section><h3 id="tabs-title">${h2b}</h3>${tabsOpen}${tabA}${tabB}</div><h4>${h3c}</h4><fieldset><legend>${h3c}</legend>${labSpanA} ${labSpanB}<input id="hf1" name="hf1" type="${f0[2]}" autocomplete="off" aria-labelledby="l-a l-b">${label}<input id="hf2" name="hf2" type="${f1[2]}" autocomplete="${f1[0]}"><input id="hf3" name="hf3" type="${f2[2]}" autocomplete="${f2[0]}" aria-label="${f2[1]}"></fieldset>${sections[2]}<p>${cardLink} <button class="${ctaClass}" type="button">${ctaText}</button></p>${sections[3]}</main><footer><p><a href="/archive">Archive</a> <a href="/contact">Contact</a></p></footer></body></html>`; return { html, hooks: { heroAlt: ` alt="${heroAlt}"`, label: `${label}\n`, labSpanA, labSpanB, labelledby: `aria-labelledby="l-a l-b"`, noteRule: `.${noteClass}{color:${note.fg};`, noteBad: `.${noteClass}{color:${badFg(rng, note.bg)};`, spanRule: `<span style="color:${spanFg}">`, spanBad: `<span style="color:${badFg(rng, body.bg)}">`, tabA, tabsOpen, ctaButton: `<button class="${ctaClass}" type="button">${ctaText}</button>`, ctaText, focusRule: `\na:focus-visible,.${ctaClass}:focus-visible,[role=tab]:focus-visible{outline:3px solid ${focusColor};outline-offset:2px}`, skip, archive: `<a href="/archive">Archive</a>`, cardLink, cardHref, cardText, heading3: `<h3 id="tabs-title">${h2b}</h3>`, }, };}
// Each breaker rewrites one hook in the fixed page. Variants make the same// defect appear in different disguises (role-button lookalikes, multi-step// tab order, empty-label silences) so a template-aware regex fixer misses.const BREAKERS = { "missing-alt": (h) => [(p) => p.replace(h.hooks.heroAlt, ""), "alt removed"], "unlabeled-input": (h, rng) => { const variant = rng(); if (variant < 0.5) return [(p) => p.replace(h.hooks.label, ""), "label removed"]; if (variant < 0.8) return [(p) => p.replace(/<label for="(\w+)">/, '<label for="missing-$1">'), "label for broken"]; return [(p) => p.replace(h.hooks.label.trimEnd(), h.hooks.label.trimEnd().replace(/>([^<]+)</, "><")), "label emptied"]; }, "low-contrast": (h) => [(p) => p.replace(h.hooks.noteRule, h.hooks.noteBad).replace(h.hooks.spanRule, h.hooks.spanBad), "colors dimmed"], "heading-order": (h, rng) => [(p) => (rng() < 0.5 ? p.replace("<h3>", "<h5>").replace("</h3>", "</h5>") : p.replace("<h1>", "<h2>").replace("</h1>", "</h2>")), "headings shuffled"], "tabindex-positive": (h, rng) => [(p) => { // Multi-step order: sprinkle 1-3 positive tabindices across the page. let out = p.replace('<a href="#main">', '<a tabindex="3" href="#main">'); if (rng() < 0.6) out = out.replace('<a href="/archive">', '<a tabindex="1" href="/archive">'); if (rng() < 0.4) out = out.replace('type="submit"', 'tabindex="7" type="submit"'); return out; }, "tabindex added"], "div-button": (h, rng) => { const v = rng(); const repl = v < 0.4 ? `<div class="cta-div" onclick="go()">${h.hooks.ctaText}</div>` : v < 0.7 ? `<div role="button">${h.hooks.ctaText}</div>` : `<span class="cta-div" onclick="go()">${h.hooks.ctaText}</span>`; return [(p) => p.replace(h.hooks.ctaButton, repl), "button divved"]; }, "missing-lang": () => [(p) => p.replace('<html lang="en">', "<html>"), "lang removed"], "no-focus-style": (h) => [(p) => p.replace(h.hooks.focusRule, ""), "focus rule removed"], "empty-link": (h, rng) => { const v = rng(); if (v < 0.5) return [(p) => p.replace(h.hooks.archive, '<a href="/archive"></a>'), "link emptied"]; if (v < 0.8) return [(p) => p.replace(h.hooks.archive, '<a href="/archive" aria-label=""></a>'), "link label emptied"]; return [(p) => p.replace(h.hooks.archive, '<a href="/archive"><span class="icon"></span></a>'), "link icon unlabeled"]; }, "table-headers": () => [(p) => p.replaceAll("<th scope=\"col\">", "<td>").replaceAll("</th>", "</td>"), "headers demoted"],};
// Hard-tier breakers hit the widget skeleton: dangling name chains, a Tab// trap, a control nested in a link, a widget hidden from AT, and spanning// headers demoted. Each leaves the page looking close to fixed, so a// template-aware repair still fails the check.const HARD_BREAKERS = { "missing-alt": (h) => [(p) => p.replace(h.hooks.heroAlt, ""), "alt removed"], "unlabeled-input": (h, rng) => { const v = rng(); if (v < 0.35) return [(p) => p.replace(h.hooks.labSpanB, h.hooks.labSpanB.replace('id="l-b"', 'id="l-gone"')), "labelledby link cut"]; if (v < 0.6) return [(p) => p.replace(h.hooks.labSpanA, h.hooks.labSpanA.replace(/>([^<]+)</, "><")).replace(h.hooks.labSpanB, h.hooks.labSpanB.replace(/>([^<]+)</, "><")), "labelledby emptied"]; if (v < 0.8) return [(p) => p.replace(h.hooks.labelledby, 'aria-labelledby="l-a l-missing"'), "labelledby dangled"]; return [(p) => p.replace(h.hooks.label, ""), "label removed"]; }, "low-contrast": (h) => [(p) => p.replace(h.hooks.noteRule, h.hooks.noteBad).replace(h.hooks.spanRule, h.hooks.spanBad), "colors dimmed"], "heading-order": (h, rng) => [(p) => (rng() < 0.5 ? p.replace("<h3", "<h5").replace("</h3>", "</h5>") : p.replace("<h1>", "<h2>").replace("</h1>", "</h2>")), "headings shuffled"], "tabindex-positive": (h, rng) => [(p) => { // Two disguises: a focus trap on the first tab (Tab swallowed), and // a bent multi-step order across nav and footer. let out = p; if (rng() < 0.6) out = out.replace('onkeydown="pickTab(\'a\')"', "onkeydown=\"if(event.key==='Tab')event.preventDefault()\""); out = out.replace('<a href="#main">', '<a tabindex="2" href="#main">'); if (rng() < 0.5) out = out.replace('<a href="/archive">', '<a tabindex="1" href="/archive">'); return out; }, "tab order bent"], "div-button": (h, rng) => { const v = rng(); if (v < 0.4) return [(p) => p.replace(`<p>${h.hooks.cardLink} ${h.hooks.ctaButton}</p>`, `<p><a href="${h.hooks.cardHref}">${h.hooks.cardText}<div class="cta-div" onclick="go()">${h.hooks.ctaText}</div></a></p>`), "control nested in link"]; if (v < 0.7) return [(p) => p.replace(h.hooks.tabA, h.hooks.tabA.replace(' tabindex="0" onkeydown="pickTab(\'a\')"', "")), "tab lost keyboard support"]; return [(p) => p.replace(h.hooks.tabsOpen, h.hooks.tabsOpen.replace(/>$/, ' aria-hidden="true">')), "widget hidden from AT"]; }, "missing-lang": () => [(p) => p.replace('<html lang="en">', "<html>"), "lang removed"], "no-focus-style": (h) => [(p) => p.replace(h.hooks.focusRule, ""), "focus rule removed"], "empty-link": (h, rng) => { const v = rng(); // The div-button breaker can consume the card link first; the footer // archive link is always there as a fallback target. return [(p) => { const target = p.includes(h.hooks.cardLink) ? h.hooks.cardLink : h.hooks.archive; if (v < 0.4 && target === h.hooks.cardLink) return p.replace(target, target.replace(">", ' aria-labelledby="ghost">')); if (v < 0.7) return p.replace(target, target.replace(/>([^<]+)</, "><")); return p.replace(target, target.replace(/>([^<]+)</, '><span class="icon"></span><')); }, "link name removed"]; }, "table-headers": () => [(p) => p.replaceAll("<th ", "<td ").replaceAll("</th>", "</td>"), "headers demoted"],};
function pickDefects(rng, taskIndex, tier) { const ids = CHECKS.map(([id]) => id); const defects = new Set([ids[taskIndex % ids.length]]); const target = tier === "hard" ? 4 + Math.floor(rng() * 2) : 2 + Math.floor(rng() * 2); while (defects.size < target) defects.add(ids[Math.floor(rng() * ids.length)]); return [...defects];}
const PROMPT_HEAD = `Fix the broken HTML page below so keyboard, screen-reader, and contrast checks pass.
Repair every defect you find: image text alternatives, input labels, text contrast (4.5:1 or better, or 3:1 for large text), heading order, tab order, native buttons, page language, visible focus styles, link names, and table headers. Keep all visible text and elements; do not delete or hide content to silence a check.
Return the complete fixed HTML document.`;
// Verification imports the real grader from the built package: an// expected page is only a valid reference when it scores exactly 1.const { benchmark } = await import(new URL("../dist/index.js", import.meta.url).href).catch(() => { throw new Error("dist/index.js not found - run `npm run build` before generating tasks");});
// Tokens that mean a template leak: a breaker or builder read a field// that does not exist and strung the result into the page.const JUNK = /\bundefined\b|\bNaN\b|\[object Object\]|\bnull\b/;const assertNoJunk = (where, text) => { if (JUNK.test(text)) throw new Error(`generated ${where} contains a template-leak token`);};
// Grade the fixed page as if every check were an injected defect: the// score is exactly 1 iff all ten checks pass with real targets. A page// that fails any check gets re-drawn; a reference that caps its own// task below 1 must never ship.const ALL_DEFECTS = CHECKS.map(([id]) => id);async function expectedScoresOne(html) { const probe = { id: "a11y-probe", kind: "single", prompt: `\`\`\`html\n${html}\n\`\`\``, expected: html, metadata: { defects: ALL_DEFECTS } }; const result = await benchmark.score(probe, { answer: html }); return result.score === 1;}
const rng = mulberry32(seed);const tasks = [];const fingerprints = new Set();for (let i = 0; i < count; i++) { const tier = i % 3 === 2 ? "hard" : "easy"; const build = tier === "hard" ? buildHard : buildFixed; const breakers = tier === "hard" ? HARD_BREAKERS : BREAKERS; let built; for (let attempt = 0; ; attempt += 1) { built = build(rng); assertNoJunk(`page ${i + 1}`, built.html); if (await expectedScoresOne(built.html)) break; if (attempt >= 199) throw new Error(`task ${i + 1}: no clean reference page after 200 draws`); } const defects = pickDefects(rng, i, tier).sort(); let broken = built.html; for (const id of defects) { const [breakPage] = breakers[id](built, rng); const next = breakPage(broken); if (next === broken) throw new Error(`breaker ${id} changed nothing on task ${i + 1}`); broken = next; } if (broken === built.html) throw new Error(`task ${i + 1} has no visible break`); assertNoJunk(`task ${i + 1}`, broken); fingerprints.add(createHash("sha1").update(built.html.replace(/>\s*</g, "><").replace(/[\w.-]+(?=\.jpg|"[a-z-]+")/g, "#")).digest("hex").slice(0, 12)); const idNum = String(i + 1).padStart(2, "0"); tasks.push({ id: `${split === "hidden" ? "a11yh" : "a11y"}-${idNum}`, kind: "single", prompt: `${PROMPT_HEAD}\n\n\`\`\`html\n${broken}\n\`\`\``, expected: built.html, metadata: { defects, wcag: defects.map((d) => WCAG[d]), tier, seed, split, taskSeed: seed + i, }, }); assertNoJunk(`task ${i + 1} prompt`, tasks[tasks.length - 1].prompt);}const coverage = new Map(CHECKS.map(([id]) => [id, 0]));for (const task of tasks) for (const id of task.metadata.defects) coverage.set(id, coverage.get(id) + 1);for (const [id, n] of coverage) { if (n < Math.floor(count / CHECKS.length)) throw new Error(`check ${id} appears in only ${n} tasks`);}// Distinct pages, not six fixed themes: the hidden split cannot reuse a// public reference page. Require well above the old six-theme ceiling.if (fingerprints.size < Math.min(30, count)) { throw new Error(`only ${fingerprints.size} distinct page fingerprints (need >= ${Math.min(30, count)})`);}await mkdir(dirname(out), { recursive: true });await writeFile(out, `${tasks.map((task) => JSON.stringify(task)).join("\n")}\n`);console.log(`generated ${tasks.length} ${split} tasks (seed ${seed}) -> ${out}`);console.log(`fingerprints: ${fingerprints.size} distinct pages`);console.log(`coverage: ${[...coverage].map(([id, n]) => `${id}=${n}`).join(" ")}`);LICENSEAdded+21
README.mdAdded+112
croissant.jsonAdded+216
data/PROVENANCE.mdAdded+13
data/tasks.jsonlAdded
scripts/gen-tasks.mjsAdded+581