feat: add --continueOnError flag to skip a hung/crashing document - #466
Open
sajeeshnaniyil wants to merge 1 commit into
Open
feat: add --continueOnError flag to skip a hung/crashing document#466sajeeshnaniyil wants to merge 1 commit into
sajeeshnaniyil wants to merge 1 commit into
Conversation
- Wrap checkSingle() inside pMap in a try/catch when continueOnError is set; log a warning and yield null for the failing doc instead of aborting. - Filter nulls from the results before consolidation. - Plumb the option through checker.js and ace.js in the same shape as doNotReportMedia (options.continueOnError || env ACE_CONTINUE_ON_ERROR). - Expose the CLI flag as -C / --continueOnError. Default behavior is unchanged: without the flag, pMap's fail-fast still aborts the whole audit on the first per-doc rejection. Closes daisy#465
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.
Adds a
--continueOnErrorflag (also-C, alsoACE_CONTINUE_ON_ERROR=1) that turns a per-document failure inside the HTML checker'spMapfrom fail-fast into log-and-skip. Default behavior is unchanged.Closes #465.
What changes
packages/ace-core/src/checker/checker-chromium.js— the pMap mapper now wrapscheckSingle()in a try/catch whencontinueOnErroris set. Failing docs get awinston.warn("Skipping document …")and yieldnull; nulls are filtered from the results beforeconsolidate()sees them.packages/ace-core/src/checker/checker.js— accepts and forwards the flag.packages/ace-core/src/core/ace.js— computescontinueOnErrorfromoptions.continueOnError || process.env.ACE_CONTINUE_ON_ERROR === '1', following the same shape asdoNotReportMedia.packages/ace-cli-shared/src/index.js— exposes-C, --continueOnErrorin the CLI help +meowflags.Why
Some real-world EPUBs occasionally have a single content document that either hangs the axe runner or times out. Today that single per-document rejection propagates through pMap's default fail-fast and aborts the entire audit — no report is produced even when 100+ other documents completed fine. Consumers who'd rather trade a small amount of coverage for a completed report have no escape hatch.
This flag is that escape hatch, opt-in only.
For the environment story of what was hanging on our end, and how we ended up not needing this in production once we reverted our own overzealous Electron flags — see #465 and its follow-up comment. The flag is still broadly useful independent of our specific pathology.
Compat
continueOnErroris optional at every layer.daisy/ace's current fail-fast semantics are preserved unless someone explicitly opts in.Tests
I skipped adding a unit test because there aren't any existing tests for
checker-chromium.js/checker.jsto build on, and simulating a per-document hang inside the pMap in isolation would need a fair bit of mock scaffolding for pMap + axeRunner. Happy to add one if you'd prefer — pointer to any preferred mocking pattern would speed that up.Commit
Angular-style per CONTRIBUTING.md: