Repository navigation
Add a seeded EasyBuild parity audit script - #74
Merged
Merged
Conversation
The new script lives under scripts/. The recipe command gains a hidden parity-audit subcommand that exports JSON for it. An integration test suite writes its own fixtures, and the integration CI job runs it. The script prints the seed it samples with, so a run can be repeated. The sample always takes in the easyblocks that change module naming. The script compares module metadata and the nearest dependencies against EasyBuild at runtime, with no copied corpus.
Raise the default sample size in scripts/parity_audit.py to 2000, and keep printing the random seed to stdout. The easyblock scan now parses each file instead of matching substrings. It finds classes that hook module naming, version templates or toolchains, and maps EB_ class names back to software names, so easyconfigs that pick their easyblock implicitly are found too.
The comparator skipped every EasyBuild dependency without a toolchain name, and never looked for dependencies that only eb-stack resolved. A recipe whose dependency lost its toolchain, or for which eb-stack invented an extra dependency, therefore passed. A dependency without a toolchain name is now reported as <kind>_dep:<name>:missing_toolchain, and every eb-stack dependency with no EasyBuild counterpart as extra_<kind>_dep:<name>. The unused assignment regex goes. parity_audit_resolves_with_easybuild_framework installs EasyBuild into a virtual environment of its own and audits the fixtures under fixtures/parity_audit_framework/: an App recipe with a GCCcore zlib dependency, which must match, and MissTc, whose dependency has an empty toolchain and must be reported. The integration CI job sets up Python 3.14 for it.
The framework test installed whatever easybuild-framework and easybuild-easyblocks PyPI served that day, so its outcome could change without a commit here. scripts/easybuild-requirements.txt pins both at 5.4.2, and the test installs that file into its own virtual environment.
The truth side was dropping external-module dependencies before the two-way check, so eb-stack reported those dependencies as extra. The comparator now leaves an external module out on both sides.
The comparator matched dependencies on name alone, so eb-stack choosing a different version or toolchain of the right package passed. A dependency now matches on name and version, and on toolchain when both sides record one; a candidate sharing only a name shows as extra. recipe parity-audit records the toolchain of each resolved dependency for this, or the tuple's own toolchain when nothing resolved.
extract_easybuild_truth swallowed every exception from set_up_configuration and carried on, so a broken EasyBuild configuration file produced truth computed from default robot, module and environment settings. The audit now exits with the configuration error instead.
Exact version pins still let pip pick any artifact for those versions, and the EasyBuild sdists build with an unpinned setuptools in an isolated environment. scripts/easybuild-build-requirements.txt locks setuptools as the build backend, and both lock files carry sha256 hashes. The framework test installs the build lock with `--only-binary :all:`, then EasyBuild with `--no-build-isolation`, both with `--require-hashes`, and checks that every locked package carries a hash.
The comparator recognised an external module on the eb-stack side by its identity, so an external module that eb-stack resolved to an ordinary in-tree build of the same name and version matched. Every recipe parity-audit dependency record now carries an external_module marker; eb-stack refuses recipes that list an external module, so it is always false. The comparator requires the marker, reports a record without it, and pairs an EasyBuild external module only with a dependency marked external, reporting external_resolved_in_tree or external_missing otherwise.
The first four ToolA comparator tests each spelled out the full truth and stack documents and the parity_audit.py command line, which later tests get from tool_a_truth, tool_a_stack and run_comparator. They now build on those helpers and override only the fields they exercise. run_comparator and the new run_comparator_against_eb_stack share run_parity_audit, so the test that runs the real eb-stack binary uses the same runner. That test now asserts the exact mismatch fields instead of their count.
The oracle read module names and dependencies from the easyconfig alone, so an easyblock that changes them while writing its module passed unexamined, even though the sample targets exactly those easyblocks. For every targeted recipe extract_easybuild_truth now instantiates the easyblock and writes its module with make_module_step(fake=True). From that file it compares the module name, the module loads and the EBVERSION value with what eb-stack resolved. EasyBuild runs with a modules tool that loads nothing, Tcl module syntax and a throwaway prefix, so the host's modules and configuration do not leak in. `--include-easyblocks` adds site easyblocks to discovery and to EasyBuild. Easyblocks run helpers that call a bare python; PythonPackage asks it for the library directory while writing the module. For the duration of the run a bin directory in the work directory, with only a python symlink to the audit's interpreter, comes first on PATH. PATH, tempfile.tempdir and the work directory are restored or removed in a finally block, whatever the run raises. fixtures/parity_audit_hooks/ contains two easyblocks whose hooks eb-stack cannot see, one adding a module load and one changing the version, and the audit must report both. fixtures/parity_audit_python/ contains a PythonPackage recipe that the audit runs with a failing python first on PATH, and it must still write the module and match.
easyblock_module_truth called make_module_step on a bare easyblock. eb runs post_init first, which sets the build parallelism, and refreshes the run-step templates such as %(installdir)s before each step. Without them, recipes whose module names a path through %(installdir)s (Geant4-data, VSCode, HIP, imkl and the Dataset models) failed with unresolved templates. EB_GROMACS also refuses to write a module for a missing installation unless `--module-only` and `--force` are set, which `eb --module-only --force` does. The oracle now calls post_init and update_config_template_run_step before make_module_step and configures EasyBuild with `--module-only` and `--force`. fixtures/parity_audit_prepare/ contains an easyblock for each case, and the audit must evaluate all three without error.
_decode_eb_class_name undid only some of EasyBuild's class name encoding, so EB_FFTW_period_MPI and EB_Term_colon__colon_ReadLine_colon__colon_Gnu mapped to names no easyconfig uses and their recipes were never targeted. Discovery now uses easybuild.tools.filetools.decode_class_name, which EasyBuild itself uses to find an easyblock for a software name. fixtures/parity_audit_class_names/ contains a FFTW.MPI recipe with an EB_FFTW_period_MPI easyblock, which the audit must target.
A recipe that gives its dependencies as a set gets them written to its module in hash order, so comparing loads in recipe order reported mismatches that differ only in order. Both sides are now sorted before the comparison.
A full corpus run has mismatches that are expected, such as recipes EasyBuild cannot evaluate without installed software, so a plain non-zero exit cannot fail CI. `--baseline` compares a run with a recorded set of mismatches, by recipe and field, and fails on a new one, on one that no longer occurs, and on a baseline taken with another seed or sample size. `--write-baseline` records a run, with the easyconfigs commit from `--easyconfigs-commit`.
scripts/parity-audit-corpus.sh fetches the easybuild-easyconfigs commit a baseline records (the v5.4.2 release) into a cache directory, reusing a clean checkout at that commit, and runs the audit with the baseline's seed and sample size. A new parity-corpus CI job caches the checkout and runs the script against a debug eb-stack build. The job installs the locked EasyBuild into a virtual environment under the runner's temporary directory and passes its interpreter as PYTHON, so eb stays off PATH for the rest of the job. scripts/parity-audit-corpus-baseline.json lists 111 recipes. EasyBuild 5.4.2 cannot write a module for them without installed software, loaded build modules or existing target modules. They are buildenv, the EasyBuild meta recipes, ModuleRC wrappers around CUDAcompat, dotNET-Core, Java and STAR-CCM+, Clang, LLVM, ROCm-LLVM, impi and VEP.
extract_easybuild_truth caught Exception around each recipe and around its easyblock hooks. SystemExit is not an Exception, so an easyblock that called sys.exit(0) while writing its module ended the whole audit with status 0, before any report was written. Both handlers now catch SystemExit as well and record it as SystemExit(code), so the recipe becomes an easybuild_error mismatch, the report is written and the audit exits non-zero. fixtures/parity_audit_exit/ contains an easyblock whose make_module_step raises SystemExit(0), and the audit must fail on it.
HaoZeke
force-pushed
the
stack/parity-ready
branch
from
November 21, 2026 08:36
5b43d7b to
e7bc9dd
Compare
HaoZeke
force-pushed
the
stack/parity-audit-harness
branch
from
November 21, 2026 09:29
56935ed to
83d7b2e
Compare
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
scripts/parity_audit.py, a seeded audit that compares resolved module names and nearest-level dependencies fromeb-stackagainst EasyBuild at runtime. The seed is printed, and the same seed gives the same sample. No corpus is vendored.The second commit raises the default sample to 2000 and finds hook easyblocks with an AST scan covering module-naming, version-template and toolchain hooks.
tests/parity_audit_script.rsbuilds its fixtures in a temporary directory and runs the script withpython3as a subprocess. It checks the exit status and the JSON report, and that two seeded runs match. CI runs the test target.The script is the only Python involved. It compiles on Python 3.14.10 without warnings. The Rust test needs a cargo run on 3.14.