fix(a11y-critical): log unknown ids in options.rules, do not throw - #293
Draft
Aaryan430 wants to merge 2 commits into
Draft
fix(a11y-critical): log unknown ids in options.rules, do not throw#293Aaryan430 wants to merge 2 commits into
Aaryan430 wants to merge 2 commits into
Conversation
options.rules is an enable/disable map and its consumers look ids up by key, so an id the current instance does not know is a no-op. Throwing on one turns a harmless extra key into a rejected axe.run, and in a multi-frame run a single frame's rejection discards the whole result set. Log and continue instead, matching the existing behaviour for an unmatched tag in options.runOnly. options.runOnly still throws on an unknown rule id. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…it is replaced configure() reports success by not throwing and returns nothing, and _load() replaces axe._audit outright — so a caller cannot tell a completed registration from one that was later discarded. The built axe.js calls _load on evaluation, which makes a second evaluation in one context reset the registry to stock with no error raised. Record the before/after rule counts on audit.lastConfigure, carry a generation counter across _load, and log when _load replaces an existing audit. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
options.rulesis an enable/disable map. An id in it that the current axeinstance does not know is a no-op — both consumers of the map
(
get-check-option.js,rule-should-run.js) look ids up by key and neverenumerate it, so an extra key cannot change how any rule runs.
Validation nevertheless threw on such an id, which turns a harmless extra key
into a rejected
axe.run. In a multi-frame run that is fatal: a frame whoserule registry differs from the caller's rejects, and
collect-results-from-framespropagates one frame's error as a rejection ofthe whole run, so the entire result set is lost.
This makes an unknown id in
options.ruleslog and continue, matching whatnormalizeRunOptionsalready does ten lines above for an unmatched tag inoptions.runOnly.options.runOnlyis unchanged and still throws — it means "run only these",so an unknown id there means the caller gets nothing they asked for and
silence would be wrong.
Tests: replaces the throw assertion with three specs — the unknown id is
logged, no error is raised, and known ids in the same map are still applied.