Add syrupy snapshot verification with manually triggered CI job#189
Open
ndaelman-hu wants to merge 48 commits into
Open
Add syrupy snapshot verification with manually triggered CI job#189ndaelman-hu wants to merge 48 commits into
ndaelman-hu wants to merge 48 commits into
Conversation
…nto nomad-simulations mappings for results population
remove spurious `return` Co-authored-by: Esma B. Boydas <80156958+EBB2675@users.noreply.github.com>
- Extract both eigenvalues and occupations with schema-conformant field names (`value`, `occupation`, `n_levels`) - Handle non-spin-polarized arrays by adding an explicit spin dimension; set `spin_channel` only for spin-polarized calculations - Guard against missing eigenvalue or occupation arrays
- `get_systems` accepts dict, list, or None sources and always includes the initial system, so `model_system` is populated for static runs without minimization data - Read geometry optimization steps defensively: a missing or unreadable `geom/go.*.xyz` file logs a warning instead of aborting the parse - Inject `_initial_system` into the text parser data in `write_to_archive` so the mapping can resolve it - Add `get_initial_system_for_mapping` fallback accessor
…alues` - Replace mappings to the non-existent `threshold_change_unit` field with `unit='eV'` on the `threshold_change` annotations, fixing an AttributeError while keeping the EDIFF convergence threshold - Revert eigenvalue output from `electronic_band_structures` to `electronic_eigenvalues`; drop the corresponding `get_band_structures` mappings - Use schema-conformant eigenvalue payload keys in both OUTCAR and XML parsers (`value`, `occupation`, `n_levels`; drop `npoints`) - Update VASP tests to assert on `electronic_eigenvalues` including `occupation`
- Add `get_configuration_forces` helper to `PWSCFMainfileTextParser`, index-aligned with `get_configurations`, collecting per-SCF-step forces for multi-step runs (geometry optimization, molecular dynamics) - Populate `Outputs.total_forces` via writer-side fallback in `parse_program`: the step-resolved forces were lost when `get_configurations` started returning only the final SCF step, and mapping-driven payload injection does not reach `archive.data` (same limitation as the electronic-properties fallback, see TODO(mapping-migration) markers) - Hoist the configuration methods dict to `_configuration_methods` so both helpers iterate identically
- `test_migration_snapshots.py`: one snapshot test per parser (15 tests, 14 parsers), serializing `archive.data` via `m_to_dict(with_meta=False)` - `baseline_1c7acd6_snapshots.ambr`: parser output captured at pre-migration commit 1c7acd6; regeneration in a worktree at that commit reproduces it byte-identically - `test_migration_snapshots.ambr`: current expected output; migration is additive w.r.t. the baseline (zero removals under structural comparison, list reordering tolerated) - Add `syrupy` dev dependency - Include verification report
The snapshot suite is a development-time verification harness; CI does not install the `dev` dependency group (syrupy), so the `snapshot` fixture is unavailable there.
- New `workflow_dispatch` workflow runs `tests/parsers/test_migration_snapshots.py` on demand - Move `syrupy` into the `dev` extra so the standard `uv pip install -e '.[dev,md]'` install provides the `snapshot` fixture; drop the `[dependency-groups]` block that CI never installed - The default test run keeps ignoring the snapshot suite
ndaelman-hu
added a commit
that referenced
this pull request
Jul 6, 2026
Fix parser data loss found by migration snapshot verification (#189) - GPAW: extract occupations alongside eigenvalues, schema-conformant field names - Octopus: populate `model_system` for static calculations - VASP: fix `SelfConsistency.threshold_change` mapping; revert to `electronic_eigenvalues` - QE: restore per-step `total_forces` for multi-step runs
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.
Purpose
Add the snapshot-testing setup used to verify the PR #170 parser migration as a permanent, on-demand regression harness. Snapshot comparison against a tracked baseline caught several regressions the regular test suite missed (GPAW occupations, Octopus
model_system, VASPSelfConsistencythreshold, QE per-steptotal_forces).Scope
Included
tests/parsers/test_migration_snapshots.py: one syrupy snapshot test per parser (15 tests, 14 parsers) serializingarchive.data.ambrsnapshots: current expected output plus the pre-migration baseline (commit 1c7acd6), ~48 MB undertests/(not shipped in wheels;src/-only packaging)workflow_dispatchCI job (.github/workflows/snapshot-tests.yml) running the snapshot suite on demand; the default test run keeps ignoring itsyrupyadded to thedevextraOut of scope
Context & Links
fix/pr170-parser-corrections); retarget totest-data-normalizationafter Parser data-loss corrections from PR 170 migration verification #188 mergesReviewer Notes
Snapshots regenerate with
pytest tests/parsers/test_migration_snapshots.py --snapshot-update. The baseline.ambrregenerates byte-identically from a worktree at 1c7acd6.Status
Breaking Changes
Dependencies / Blockers
Testing / Validation