Repository navigation
feat(dfns): declare dynamic keywords explicitly - #396
Merged
Merged
Conversation
Mark sim-nam's models.mname as pk, and exchanges' exgmnamea/exgmnameb and solutiongroup's slnmnames as fk "models.mname". MF6 rejects duplicate model names and fails on an exchange or solution naming an unknown model. slnmnames is a string array, so allow fk on string arrays, each entry a key. An array's fk must now be a hierarchical path, as the spec already said. utl-hpc's partitions.mname is left unannotated for now: it leads its row, so a hierarchical fk would make it a dynamic keyword. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A leading untagged String with a hierarchical fk was taken for a dynamic keyword, making its list tagged. But fk only says what a value references, not its role in the input grammar: utl-hpc's partitions rows begin with a model name, a key into sim-nam's models, yet are an untagged table. Add String.dynamic to declare a dynamic keyword. It requires tagged=False and a hierarchical-path fk without fk_ref, and only a record's first field may have it. A dynamic key's fk is now checked like any String's, so its keywords may come from a list's pk as well as a string array. Mark the array-based packages' auxname dynamic, and annotate utl-hpc's partitions.mname with fk "sim-nam.models.mname" (MF6 rejects an undefined model name there; not a pk, since a repeat isn't rejected). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A dynamic keyword's keywords must be known before its line is read, so its fk can't use fk_ref, which resolves from a sibling later on that line. That is the real constraint; also requiring a hierarchical path was a leftover of inferring dynamic keys from the "." in fk. Drop it, so a bare block name without fk_ref is accepted like any static fk. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The validator already accepts one, looking up the block's pk in the same component, and dynamic keywords now rely on it. Say so in the spec instead of requiring fk_ref. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
wpbonelli
marked this pull request as ready for review
October 21, 2026 15:46
wpbonelli
added a commit
to modflowpy/pyphoenix-project
that referenced
this pull request
Oct 21, 2026
Followup to #499, instead of declaring component references by hand, derive them from the DFNs. Uses MODFLOW-ORG/modflow-devtools#396. Some stuff here will be cleaned up soon
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.
Declare dynamic keywords (strings whose value is dictated by another field's value) explicitly rather than inferring them from
fk. The primary/foreign key attributes indicate a relation between fields, not whether a dynamic value (i.e. a string field) acts as a keyword.Add a
dynamicattribute to the string field type:tagged = false,fk, and nofk_refThe only usage right now is
auxnamein the array-based packages:gwf-rcha,gwf-evta,gwf-chdg,gwf-drng,gwf-ghbg,gwf-rivg,gwf-welg.Also mark model-name pk/fk relations in SIM-NAM and UTL-HPC
sim-nam.models.mnamepk = truesim-nam.exchanges.exgmnamea,exgmnamebfk = "models.mname"sim-nam.solutiongroup.slnmnamesfk = "models.mname"utl-hpc.partitions.mnamefk = "sim-nam.models.mname"