Model the documented PALS root node properties - #82
Merged
Conversation
Extend PALSroot with the root keys documented in the standard's Fundamental Structure chapter: authors (with the one-key `author:` entry form), notes, reminders, phase_space_coordinates, extension_labels (both the registered names/prefixes/suffixes form and the flat label -> description form used by the standard's loading examples), and the load file list. facility becomes optional, since joiner and settings-only files carry none, and version also accepts bare numbers as written by the standard's root_keys example. Load resolution (combining files named in `load`) is not part of this change; the entries are modeled so the documents read and round-trip. 21 files leave the standard-examples known-failures list. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
ax3l
force-pushed
the
topic-palsroot-properties
branch
from
July 30, 2026 22:23
ef8290c to
dfd5c67
Compare
ax3l
commented
Jul 30, 2026
EZoni
approved these changes
Jul 30, 2026
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
First PR of the series working down
tests/standard_examples_known_failures.txt:PALSrootnow models the root keys documented in the standard's Fundamental Structure chapter.authors: list ofAuthor(namerequired;orcid,affiliation,emailoptional). The standard's one-key- author:entry form is unwrapped on load and restored on dump.notesandreminders: lists of strings.phase_space_coordinates: accepted as a string. The standard documents four values (ANGLE_AND_ENERGY,ANGLE_AND_MOMENTUM,KINETIC_AND_ENERGY,KINETIC_AND_MOMENTUM), but its ownroot_keysexample writesstandard, so the value is not restricted for now.extension_labels: either the registeredExtensionLabelsform (names/prefixes/suffixessections,extra="forbid"so it cannot swallow the other form) or the flat label → description dict used by the standard's loading examples.load: list of file names (with the literalSELF). Entries are modeled so the documents read and round-trip; resolving them into a combined document is left for a follow-up PR.facilityis now optional, since joiner and settings-only files carry none.versionalso accepts bare numbers (version: 1), as written by the standard'sroot_keysexample.The facility item unpacking moved into a reusable
unpack_element_items()helper soPALSrootno longer routes through the one-key-name unwrapping that only applies to named containers;BeamLine/UnionEle/Latticebehavior is unchanged.PALSroot.model_dump()keepsversionvisible even when unset (as before) and drops unset optional keys.21 files leave the known-failures list; the remaining entries are facility-level
includeresolution and the sequencevariables/ compactsetsforms.Known limitations (follow-up material)
PlaceholderNamein the element union (pre-existing). Combined withQuadrupole's stricter-than-standard "at least one multipole group" check, the standard'sroot_keysq1loads as a name reference rather than aQuadrupole. Worth a dedicated PR.loadandincludeentries are parsed, not resolved.Testing
pytest tests/— 49 passed.tests/validate_standard_examples.pyagainst the pinned standard commit (5c39fde): 65 files checked, 0 unexpected results.tests/test_root.pycovers the root keys, version forms, facility-less files, bothextension_labelsforms, YAML/JSON round-trips, and the serialized document shape.🤖 Generated with Claude Code