pretext-cli
pretext-cli copied to clipboard
Report failures
@siwelwerd and I are really appreciating the GitHub Actions workflows developed by @siefkenj so far - we have a team of four contributors working on a collaborative PreTeXt document, so having automated test builds and workflows allows us to focus mostly on content and assume all the tech stuff is building correcty and will deploy automatically once we merge into main.
However, there are a lot of failures that don't trigger the red X (e.g. dupe xml:ids). It would be great if the CLI actually errored out so the Action would report the error.
To add a little more precision from my perspective: I don't think PreText should ever throw a PTX:ERROR in the output and then report at the end "Success!". And while maybe not a desirable default behavior, I'd love to be able to add a flag so that it fails on PTX:WARNING as well. Our authors may not really care about the WARNINGs, but as a maintainer I want to fix those to prevent potential problems down the road.
I assume these are errors reported as PTX:ERROR, which comes from Core, not from the CLI proper. Sometimes those errors trigger core to fail, in which case the CLI will also fail. I'm hesitant to override what core things should be a breaking error vs what it is just logging as an error. If there are errors in core, it should be up to core to report them as such.
That said, perhaps the CLI could have an option to fail on all core errors, where we parse the output from core and if we ever see a PTX:ERROR we log it as an error. Then the test script could fail because it gets something to stderr.
See #731 - I just realized that that won't close this, since we currently pipe everything to stderr. What we might want (or need @siefkenj to implement in his action) is to force the action to fail if anything is piped to stderr, once #731 only sends errors/criticals there.
See #731 - I just realized that that won't close this, since we currently pipe everything to stderr. What we might want (or need @siefkenj to implement in his action) is to force the action to fail if anything is piped to stderr, once #731 only sends errors/criticals there.
I don't think that will be a robust solution. stderr is not just used for errors. It is used by many programs for "not stdout" and so they put a bunch of logging information there. What we need for pretext core to stream errors to the cli so they can be filtered and reported properly...
https://github.com/PreTeXtBook/pretext/blob/master/pretext/pretext.py does use the logging library - how do we react to when log.error is used there (or in the CLI)?
The other concern is when XSLT logs an error...
I think https://github.com/PreTeXtBook/pretext/blob/master/pretext/pretext.py#L3510C66-L3510C83 means all XSLT output is logged to log.info - perhaps we can have log_std=log.info and log_err=log.error arguments and do some logic to route things to one or the other...
See https://github.com/PreTeXtBook/pretext/pull/2169/
Closed by https://github.com/PreTeXtBook/pretext-cli/pull/748