Skip to content

Add --with-jing option and exercise both validators in CI#328

Merged
jordikroon merged 2 commits into
masterfrom
check-ci-without-jing
Jul 25, 2026
Merged

Add --with-jing option and exercise both validators in CI#328
jordikroon merged 2 commits into
masterfrom
check-ci-without-jing

Conversation

@jordikroon

Copy link
Copy Markdown
Member

Server build process doesn't use jing for XML validation. Which is related to why doc-it #327 is unable to build.

This is a first step towards fixing it by making sure we have a correct CI pipeline that build with and without jing.

CI is expected to fail for doc-it with the message below:

Failed XIncludes, manual parts will be missing. Unresolved xpointers:
- bcmath-number.round..parameters.mode
Dumped file: temp/manual.err. Inspect residual xi:include tags in this file.

Validating temp/manual.xml (libxml)... failed.

[error manual.xml 31350:0] IDREF attribute linkend references an unknown ID "language.types.void.casting"
[error manual.xml 31460:0] IDREF attribute linkend references an unknown ID "language.types.void.casting"
[error manual.xml 1319249:0] IDREF attribute linkend references an unknown ID "ini.fatal-error-backtraces"

Eyh man. No worries. Happ shittens. Try again after fixing the errors above.

@jordikroon
jordikroon force-pushed the check-ci-without-jing branch from 872b604 to b7fd137 Compare July 24, 2026 13:41
Comment thread configure.php Outdated
break;

case 'jing':
if (!in_array($v, ['auto', 'yes', 'no'])) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (!in_array($v, ['auto', 'yes', 'no'])) {
if (!in_array($v, ['auto', 'yes', 'no'], true)) {

Comment thread configure.php Outdated
Comment on lines +1007 to +1008
$out = null;
$ret = null;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What are these for?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left over from the old code. Likely there because the line after this uses it by reference. Which PHP already does for you. Removed ;-)

Comment thread configure.php Outdated
$out = [];

if ( $ret == 0 )
if ( !$ret )

@kamil-tekiela kamil-tekiela Jul 24, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

=== is better

was there ever a chance for the NULL value to survive?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should be an int if we set $ret. So strict is fine here.

Comment thread configure.php Outdated
@jordikroon
jordikroon force-pushed the check-ci-without-jing branch from 7a0c87c to 59c1486 Compare July 24, 2026 14:11
@alfsb

alfsb commented Jul 24, 2026

Copy link
Copy Markdown
Member

I think this is wrong, as calling configure.php --with-jing=yes on a machine where there is no Java, the code will blindly call xml_validate_jing(), that in turn exec( "java -D ..."), that fails (silently?).

IDREF errors are downgraded to warnings in translations, at validation step, but only in Java/Jing branches. See: f572f00 .

The root problem can be more easily resolved by replicating the same downgrade on libxml branches, but only in translations. On doc-en, IDREFs should still be a hard failure. No --with-jing is necessary.

@alfsb

alfsb commented Jul 24, 2026

Copy link
Copy Markdown
Member

That is, to change xml_validate_libxml() as to clean libxml errors before the $dom->relaxNGValidate( RNG_SCHEMA_FILE ), and to inspect if the generated errors on failure.

if in_translation if error_count == ifref_count { echo done, return }

@jordikroon

Copy link
Copy Markdown
Member Author

I think this is wrong, as calling configure.php --with-jing=yes on a machine where there is no Java, the code will blindly call xml_validate_jing(), that in turn exec( "java -D ..."), that fails (silently?).

I have added improved error handling for when Java is absent. So that should not fail silently anymore. Also Jing errors are handled better now with 2>&1 added to it.

IDREF errors are downgraded to warnings in translations, at validation step, but only in Java/Jing branches. See: f572f00 .

The root problem can be more easily resolved by replicating the same downgrade on libxml branches, but only in translations. On doc-en, IDREFs should still be a hard failure. No --with-jing is necessary.

This PR was not meant to be a fix for #327, but rather a fix for the inconsistency between the production build, and the local or CI build. Given we allow both Jing and libxml validation, we should test both here. Otherwise it is bound to happen again one way or another.

So in other words, we need a follow up PR in order to fix doc-it and apparently doc-uk as well.

@alfsb

alfsb commented Jul 24, 2026

Copy link
Copy Markdown
Member

I have added improved error handling for when Java is absent. So that should not fail silently anymore. Also Jing errors are handled better now with 2>&1 added to it.

I think it is now ok.

So in other words, we need a follow up PR in order to fix doc-it and apparently doc-uk as well.

There are a few changes on text-entities, configure fixups, en revcheck arg passing. I will try to make those in one go, next week.

Also, any changes in doc-base will help the study of actions/checkout being stuck in the past.

@jordikroon
jordikroon merged commit ba82257 into master Jul 25, 2026
10 of 12 checks passed
@alfsb

alfsb commented Jul 25, 2026

Copy link
Copy Markdown
Member

On second thought, this option can be named something --debug-ci or --all-validators, and code changed to something like this

 if ( $hasJava || $debugCI )
    validateJing()
 if ( ! $hasJava || $debugCI )
    validateLibxml()

The reason is twofold. First, the configure is run really once in CI, instead of double run, almost doubling performance. Second, I do not see this option being used outside Github CI.

As its raison d'être is catching failure validation differences, both functions call exit, so either one failing will fail the entire (and unique) run.

@alfsb

alfsb commented Jul 25, 2026

Copy link
Copy Markdown
Member

In fact, something like, to also include the requirement that CI has to have Java:

 if ( $debugCI && ! $hasJava )
    // No Java error on CI machine
 if ( $hasJava || $debugCI )
    validateJing()
 if ( ! $hasJava || $debugCI )
    validateLibxml()

@alfsb

alfsb commented Jul 25, 2026

Copy link
Copy Markdown
Member

In fact, as I'm slowly making changes and documentating the GH CI behavirour, I may need to include the --debug-ci option anyways, as to expose verbosity of configure.php in this enviroment. So the merged option would something like:

  --debug-ci         Changes validation and verbosity for CI enviroments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants