Fix TOML annotation drift and enforce the convention via pre-commit (#274) - #357
Open
priyanshlunia wants to merge 2 commits into
Open
Fix TOML annotation drift and enforce the convention via pre-commit (#274)#357priyanshlunia wants to merge 2 commits into
priyanshlunia wants to merge 2 commits into
Conversation
…nts, deprecated keys) Restore the shared annotation convention across the config-style TOMLs that drifted since the standardization sweep: add missing 2-10 line purpose headers (gal-resistive examples, nuzero fixture, four regression cases), complete the missing inline descriptions (SLAYER section, canonical DIIID ideal example, Solovev kinetic examples), strip decorative dividers from the SLAYER regression case, correct the inaccurate psiedge truncation comment, and remove deprecated keys (mat_flag, ode_flag, power_bp/b/r, truncate_at_dW_peak, force_wv_symmetry) that the loader warns about and discards. Parsed values are unchanged except the removed no-op keys. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…conventions Four declarative pygrep hooks (no external scripts) lint the covered TOMLs on commit: header block present, no decorative dividers, inline description on every variable line in examples/ and test/test_data/, and no deprecated config keys (pattern mirrors _DEPRECATED_FFS_KEYS/_DEPRECATED_EQUIL_KEYS). Document the enforcement in toml-conventions.md, codify the regression-case exemption for the repetitive quantity schema keys, and list the new checks in the developer setup guide. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
Summary
Closes #274.
The standardization sweep in #285 established one shared annotation convention for the
config-style TOMLs, but the issue stayed open — and in the weeks since that merge, 9 new
TOMLs were added and most existing ones modified, reintroducing drift. This PR fixes all
current violations and adds pre-commit enforcement so the convention holds going forward.
1. Fix the drift (11 files,
887bd8f):DIIID-like_gal_resistive_example,DIIID-like_gal_resistive_pe_example, theregression_solovev_kinetic_nuzerofixture,and the
diiid_slayer_n1,gal_resistive_diiid,gal_resistive_pe,solovev_kinetic_nuzeroregression cases.[SLAYER]section and scan grid inthe SLAYER example,
rtol_xlmda/write_outputs_to_HDF5/verbosein the canonicalDIIID-like_ideal_example, and the same trailing keys in the Solovev kinetic decks.mat_flag,ode_flag,power_bp,power_b,power_r,truncate_at_dW_peak(SLAYERexample) and
force_wv_symmetry(Solovev NTV example).# ---dividers stripped fromdiiid_slayer_n1.toml; thepsiedgecomment claiming "integration truncated at peak" corrected in 3 files (theedge-dW scan is diagnostic-only with
truncate_at_dW_peak = false).2. Enforce the convention (
af540d5): four declarativepygrephooks in.pre-commit-config.yaml— no external scripts, config-only like the existing hooks:toml-header-block— covered files must open with a#header blocktoml-no-decorative-dividers— rejects# -----style dividerstoml-inline-annotations— everykey = valueline needs a trailing# description(
examples/andtest/test_data/only)toml-no-deprecated-keys— rejects keys mirrored from_DEPRECATED_FFS_KEYS/_DEPRECATED_EQUIL_KEYS3. Docs:
docs/development/toml-conventions.mdgains an Enforcement section andcodifies the regression-case exemption (the repetitive
[quantities.*]schema keys aredeveloper metadata and don't need inline comments — cases need the header plus informative
per-quantity block comments). The setup guide's pre-commit list mentions the new checks.
Scope
.pre-commit-config.yaml, 2 dev-docs files.src/, no test-code changes.Verification
TOML.parsefilecomparison of every touched file vsdevelop—parsed values byte-identical except the 7 intentionally removed deprecated keys, which
the loader warns about and discards before the control structs are built.
the full audited violation set (missing headers, 8 dividers, 19 unannotated lines,
5 deprecated keys) when run against
develop's versions of the files.(
regress --cases solovev_n1,diiid_n1,diiid_slayer_n1,solovev_kinetic_ntv --refs develop,local);expected all-zero deltas given the value-neutrality check above.
🤖 Generated with Claude Code