Repository navigation
Follow a SPINE tag end to end: follow_spine.py, classify.py and the CI step - #6
Merged
Merged
Conversation
…I step tools/release/follow_spine.py TAG runs the whole chain for one SPINE tag and ends in one outcome, written to status.json in an artifacts folder: - s0 checks the tag form (vX.Y.Z; a pre-release or a tag below v1.2.1 is not followed), --apply's conditions and the environment, before any network access. - s1 resolves the tag (the model's own tag must still point at the schema's spine_sha, or the outcome is tag_moved) and checks it out. - s2 dumps it with dump_schema.py --spine-sha; the tag must equal "v" + spine.__version__. - s3 decides identical or changed: generate.generate() on both schemas, with the version normalised, plus type_check and writer_format. - s4 writes and checks the tag's current set with make_fixtures.py. - s5 classifies the change; a replay (another --baseline, or an older tag) stops here. - s6 builds and tests a git archive of HEAD with the new set (and, if changed, the new schema and regenerated model), runs the regenerated spine-dump on HEAD's previous files, and classifies again. - s8, with --apply after "changed", writes the schema, model, golden_members.inc, current set and manifest into the clean working tree. Nothing is committed. Exit codes: 0 identical, 10 changed (contracts_failed when only spine_reader_contracts failed), 20 not followed, 30 a failure naming its stage, 2 a usage error (no status.json). tools/release/classify.py describes the change between two schemas kind by kind (fields, enums, scheme tables, type_check, writer_format, decoded columns, warnings) and proposes the bump of the highest kind from one table: none < patch < minor < person, with person for any kind the table lacks. needs_attention is set for an added class, a new warning or a substitution. Tests (ctest spine_reader_release_tools, Python 3.10 or newer; no SPINE, no network): test_classify.py mutates a frozen copy of the 1.4.0 schema for every change kind and checks the real pair 1.2.2 -> 1.2.3 (dumps in tools/release/tests/data); test_outcomes.py checks outcome_for(), check_usage() and compare_schemas(). CI: ci/github-ci.sh --follow-spine DIR runs follow_spine.py on the model's own tag after ctest and requires identical; the 1.14 job uses it and uploads the artifacts when it fails (actions/upload-artifact, pinned). check_names.py now scans only the .hpp and .cpp files of src/model: it read src/model/EGM.md, whose "I/O" matched the macro I, and failed. Docs: tools/release/README.md (new), tools/release/EGM.md, tools/EGM.md, tools/gen/README.md and EGM.md, ci/EGM.md, the root EGM.md and README.
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.
Last step of following SPINE releases (stage 0 and stage 1). One command takes a SPINE tag through the whole chain and ends in one outcome:
CI now runs it on the model's own tag on every push, and requires
identical.What changes
tools/release/follow_spine.py(new, mode 100755, Python 3.10+). It runs these stages, writesstatus.jsonand one log per stage in an artifacts folder, and prints the command that reproduces the run:s0_checksvX.Y.Z; a pre-release or a tag below v1.2.1 is not followed),--apply's conditions, environment (numpy, h5py, yaml, scipy, git, CMake 3.21+, a compiler); no networks1_taggit ls-remoteand a checkout per commit. The model's own tag must still point at the schema'sspine_shas2_dumpdump_schema.py --spine-sha; the tag must equalv+spine.__version__s3_comparegenerate.generate()gives the same files for both schemas once the version is normalised, andtype_checkandwriter_formatare unchangeds4_fixturesmake_fixtures.py --tag: the tag's current set, written and read back by the tag itself, every cross-checks5_classifyclassify.py. A replay (a--baselineother than the committed schema, or an older tag) stops heres6_build,s6_testgit archive HEADexport with the new set (and, if changed, the new schema, regenerated model,check_names.py,golden_members.inc), CMake, ctest with--output-junit; then the regeneratedspine-dumpon HEAD's previouscurrent_v1/current_v2, and a second classifications8_apply--apply, afterchangedonly: the schema, model,golden_members.inc, current set and manifest go into the clean working tree; nothing is committedThe outcomes and exit codes:
identicalchanged, withcontracts_failedwhenspine_reader_contractsis the only failed entrynot_followedenvironment_error,tag_moved,dump_failed,version_mismatch,generate_failed,fixture_tooling_failed,fixture_check_failed,build_failed,test_failed,internal_errorstatus.jsontools/release/classify.py(new) describes the change between two schemas, kind by kind:type_checkandwriter_format;(kind, name)with the schema's and the committed manifest's (--baseline-warnings, an addition to the design so that fixture warnings are not new on every run), and substitutions;It proposes the bump of the highest kind found, from one table: none < patch < minor < person, and "person" for any kind the table lacks.
classification.mdends with the checklist oftools/gen/README.md.Tests, run by ctest's new
spine_reader_release_toolsentry for Python 3.10 or newer. They need neither SPINE nor the network:test_classify.pymutates a frozen copy of the 1.4.0 schema (tools/release/tests/data/, notschema/) for every change kind;test_outcomes.pychecksoutcome_for(),check_usage()(including--applyon a dirty tree in a scratch git repository) andcompare_schemas()(type_checkalone,writer_formatalone, a non-ASCII doc).CI.
ci/github-ci.sh --follow-spine DIRrunsfollow_spine.py v<schema version>after ctest and requires exit 0. The 1.14 job uses it.actions/upload-artifact, pinned by SHA (v7.0.2).Fix:
tools/gen/check_names.pyfailed onmain. It scanned every file ofsrc/model/, includingEGM.md, whose "no I/O" matched the macroIof<complex.h>. It now scans only the.hppand.cppfiles. No ctest runs it, so nobody noticed;follow_spine.pyruns it ins6_build.Docs:
tools/release/README.md(new): the environment, the stages, what to do for each outcome, replays,--apply, the bump table, and the scanner;tools/release/EGM.md,tools/EGM.md, the rootEGM.mdand README: the new entry, the CI step, and--apply's side effects;tools/gen/README.md: it points tofollow_spine.py, and step 4 says to readclassification.mdfirst;ci/EGM.md: the--follow-spineoption and the dry-run command.Checked
Outcomes, from runs of
follow_spine.py. The local tags are in a scratch clone of SPINE (--spine-repo <clone>):identical(0)RecoParticle.test_scorechanged(10), patch; the follow-up says the fixtures hold it only at its defaultcsda_kedefaultchanged,contracts_failed, personcsda_kechanged,contracts_failed, minor; the build passescsda_keunitchanged,contracts_failed, personNuInteractionScheme.MARLEYwith its tableschanged, patch, needs attention: "labels no fixture row stores: MARLEY"ParticleShape.SHOWERandTRACKtest_failed(30) ats6_testcrt_scores(no CAFMaker reads it)changed, minoridentical, needs attention (unlisted_class)HDF5Readerraisesfixture_check_failedFieldMetadata.pdgdump_failed, reasonAttributeErrorversion.pyleft at 1.4.0version_mismatchformat_versionfixture_tooling_failedfixture_check_failedtag_movednot_followed(20)status.json--spine-repoenvironment_error--baseline tools/release/tests/data/spine-1.2.2.jsonchanged, replay, patch (enum additions)changed, replay; the three scheme substitutions listed--applyon v1.4.99, in a clean clone of this branch.git statusshows only the schema, the model,golden_members.inc, thecurrent_*files and the manifest.v2root(v0.16.3) andv0.11.1_v1(v0.11.1).git checkout . && git clean -fdundoes it.--applywith the model's own tag is a usage error.The identical run on v1.4.0 leaves
git statusclean.CI dry run in CERN's SFT images:
--follow-spine: 7 entries, 6 run and pass.follow_spine.py v1.4.0cloned SPINE from GitHub and gaveidenticalin about 2.5 minutes.Under LCG_110 on EL9: 7 ctest entries, 6 run and pass.
check_names.pyreports 0 clashes.flake8 --max-line-length=100reports nothing ontools/release/.