postprocess: Add --on-error flag for non-fatal transform failures#1851
Conversation
c25423c to
8d5b23a
Compare
thedataking
left a comment
There was a problem hiding this comment.
Right now, the postprocessor only transfers comments but we have PRs to process assertions, and other useful cleanup. I don't think we should have a comment-specific flag.
Please consider a more generic design where we accept a flag (or flag pair --fail-fast/--no-fail-fast with the former being the default) that any Transform that derives from AbstractTransform can use to decide whether to keep going or not.
9797c41 to
a70460a
Compare
|
The flag ended up being --continue-on-error, which is now passed to AbstractTransform for future transforms. |
|
|
from offline discussion: Tri-state
We can use exceptions to simplify error handling: Then the policy logic goes here:
For PR #1849 specifically (not blocking for this PR) : |
cd1862c to
efb8cba
Compare
--on-error flag for non-fatal transform failures
efb8cba to
51ac43a
Compare
51ac43a to
05f1224
Compare
thedataking
left a comment
There was a problem hiding this comment.
PR body is stale. Cache.update was moved to after the comment-verbatim check. Worth doing but you should document the change when you update the PR body.
continue_on_error appears to be a vestige from previous iteration; remove it?
20a26d7 to
ee47bc7
Compare
|
I was unaware the top-most comment should be edited to reflect the current state of the PR, I'll do that from now on. Instances of the old This should be g2g? |
thedataking
left a comment
There was a problem hiding this comment.
LGTM with one nitpick:
Please undo formatting changes in transforms/init.py and comments.py.
transforms/__init__.pychanges can just be removed from this commit entirely- comments.py: just need to revert
CommentsTransform.__init__
(logging.exception works well here, nice find. note that it prints the error at the end of the traceback as well as in the f-string you pass as an argument - should be harmless.)
ee47bc7 to
11f9c7f
Compare
Add an --on-error option for per-function transform failures. The default keep-going mode continues after TransformError failures and exits nonzero if any function failed. abort stops at the first TransformError. warn continues after TransformError failures, reports them as warnings, and exits successfully. Only TransformError is treated as a recoverable per-function failure; other exceptions still surface as normal program errors.
11f9c7f to
516ffa0
Compare
Adds configurable transform error handling via
--on-error.Comment transform failures now raise
TransformErrorinstead of relying on a hard assert. The CLI can either abort on the first failure, keep going while returning exit 1, or warn and return exit 0.As part of this,
cache.update(...)now happens only after the comment parity check succeeds.