-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
metanorma site generate ignore errors collected on compile #301
Comments
Examples of errors that do not affect exit codes: |
I'm afraid metanorma-cli falls in between areas of responsibility: I didn't author it, and I haven't particularly been maintaining it. I agree that fatals should be propagated up; wouldn't the simplest thing to do be to raise an error if a fatal error is returned? (I suppress errors in metanorma gems so that the file can be processed to completion, with a complete list of errors, and a complete *.xml.abort file generated for debugging. But nothing prevents an error being re-raised by whatever is consuming the list of errors.) I am vague as to whether the (OTOH, if fatalerror is triggered in metanorma-standoc, then no Semantic XML file will be generated, and that alone should be enough to abort execution, because the isodoc conversion has nothing to proceed from.) I'm afraid I do not and will not have the free time to fix this myself, but that at least gives you some pointers. If errors can be trapped in isodoc and standoc, and then propagated back up through well-managed channels to metanorma gem and metanorma-cli, that is a good thing, but as you can see, that propagation until now has been piecemeal and haphazard. |
I think we already have a strict node for this But the original problem is that metanorma returns zero exit code in that case which is definitely wrong To be on the same page I don't propose any massive refactoring/changes, just two simple things:
|
FWIW, I'm still in agreement with this; should I assign you the task, @CAMOBAP ? |
@CAMOBAP how's the progress of this task? Thanks. |
@CAMOBAP is working on this. Thanks! |
@CAMOBAP Be aware, if you aren't already, that I have rationalised logging during the Asciidoctor parsing component of compilation, so that the Ideally any processing of errors should be integrated into that log, but I don't know how straightforward that would be. |
The #320 PR is based on errors from https://github.com/metanorma/metanorma/blob/main/lib/metanorma/compile.rb#L197-L199 can I rely on this logic?
got it maybe you can suggest modules/files to look at? |
#301 return non-zero exit code on fatal errors
For now. The problem is that ALL logs need to output to the same spot, and at the moment, only standoc (and children) are doing so. I am about to have relaton pass its log errors back to standoc, so standoc can add them to its log. But it seems to me now that the standoc log, in turn, should not be output by standoc, but by metanorma gem.
yes: The logging class is https://github.com/metanorma/metanorma-utils/blob/main/lib/utils/log.rb
https://github.com/metanorma/metanorma-standoc/blob/a16d7b909329842bf3ad32793349908c80ed4e56/lib/metanorma/standoc/base.rb#L43 is where
See how
So instead of this set up, we would pass the https://github.com/metanorma/metanorma/blob/main/lib/metanorma/processor.rb#L20
https://github.com/metanorma/metanorma/blob/main/lib/metanorma/input/asciidoc.rb
Asciidoctor is really not designed for passing variables into it. But if you call the above with out_opts[:log] = "LOG", it shows up in
as It also makes sense to pass the file location to the log on initialising it, not on writing it, as the filename may not be available by the time metanorma closes the file. I can make that change. ... Do you want me to start the scaffolding for this in metanorma-utils and metanorma-standoc? |
@CAMOBAP I will: metanorma/metanorma#350 . I will update you with the refactoring, but the idea will be for the log to be initialised in metanorma gem, not standoc. Of course, you don't want a log out of this, you want:
But the log will enable printing errors to stdout consistently (and saving them to disk, which has become critical), and because all messages are stored with their severities, we can track the occurrences of fatal errors. |
OK:
You now only (only :-) need to modify metanorma and isodoc, but you will do the following:
|
From metanorma/isodoc#314: A request to implement --strict and --loose validation in metanorma-cli:
To realise this, we will need to agree on the levels of severity that trigger this behaviour. |
Agree with @opoudjis on loose vs strict. |
@CAMOBAP update on this please? |
no update yet |
I've merged the relevant PR in standoc into main, because it addressed a separate issue. |
I've now merged the PRs for metanorma and metanorma-utils as well: logs are now initialised and written to disk in metanorma, not metanorma-standoc. |
Intro
During investigation of
mn2pdf
fatal error I have noted that metanorma finishes successfully in case ofFatal: ...
errorsProblem
Compiler::compile_file
returns an array of fatal errors which is ignored:metanorma-cli/lib/metanorma/cli/site_generator.rb
Line 31 in 7663824
Proposed solution
@opoudjis @ronaldtse I would like to get your feedback on proposed solution
The text was updated successfully, but these errors were encountered: