Skip to content

feat(dfns): scoped keys and bound keys for advanced packages - #406

Merged
wpbonelli merged 3 commits into
MODFLOW-ORG:developfrom
wpbonelli:advanced-keys
Nov 2, 2026
Merged

wpbonelli merged 3 commits into
MODFLOW-ORG:developfrom
wpbonelli:advanced-keys

Conversation

@wpbonelli

@wpbonelli wpbonelli commented Nov 2, 2026 •

Copy link
Copy Markdown
Member
  • LAK connectiondata.iconn, MAW connectiondata.icon and SFR diversions.idv are unique per feature: pk = {scope = "ifno"}
  • SFR's period idv, MAW's angledata.icon and LAK/MAW obs connection numbers reference them
  • a scope may name a field of an enclosing record, so SFR's union arm idv can be scoped by ifno
  • SFR/UZF declare bound = "packagedata.ifno", LAK <=nlakeconn, MAW <=ngwfnodes
  • MAW's connectiondata gets shape = ["ngwfnodes"], sum(packagedata.ngwfnodes)
  • an fk may have a rule and a scope; new rule mover_enabled on MVR's packages.pname
  • a key set may list several paths, unique across them; SSM declares source = ["sources.pname", "fileinput.pname"]
  • ssm_package skips flow packages with a paired advanced transport package

* LAK `connectiondata.iconn`, MAW `connectiondata.icon` and SFR
  `diversions.idv` are unique within their feature: `pk = {scope = "ifno"}`
* SFR's period diversion `idv`, MAW's `angledata.icon` (newer than 6.7) and
  the LAK/MAW observations' connection numbers reference them, scoped by
  `ifno`
* a key's scope may name a column of an enclosing record in the same list
  item, so SFR's union arm `idv` can be scoped by the item's `ifno`
* SFR and UZF declare `bound = "packagedata.ifno"`, LAK `<=nlakeconn`, MAW
  `<=ngwfnodes`, so SPC's `bndno` resolves against them
* MAW's `connectiondata` gets `shape = ["ngwfnodes"]`, derived as
  `sum(packagedata.ngwfnodes)`, as LAK's is
* dfnspec.md: a "Consumer checks" table for constraints with no spec form
  (MOVER on; an SSM package named across `sources` and `fileinput`)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@wpbonelli wpbonelli added this to the 1.10.0 milestone Nov 2, 2026
@wpbonelli wpbonelli added the enhancement New feature or request label Nov 2, 2026
wpbonelli and others added 2 commits November 2, 2026 13:14
…o rules

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Drop the "Consumer checks" section; each constraint now has a spec form:

- An fk may give a rule with a scope: the scope picks the instance and
  the rule narrows its values. New rule mover_enabled on MVR's
  packages.pname, for MF6's check_packages (gwf-mvr.f90:942-971).
- A key set may list several block.field paths of one type. As a
  supertype table, its key spans them. SSM declares
  source = ["sources.pname", "fileinput.pname"], for MF6's shared
  isrctype (tsp-ssm.f90:814-821, 912-919).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@wpbonelli
wpbonelli merged commit 1686878 into MODFLOW-ORG:develop Nov 2, 2026
18 checks passed
@wpbonelli
wpbonelli deleted the advanced-keys branch November 2, 2026 21:38
wpbonelli added a commit that referenced this pull request Nov 2, 2026
Follow-up to #406, #395. Allow a key set to specify when a component may assume a role.

# gwf-wel
[keys]
mover_provider = { path = "<=maxbound", when = "mover" }
bound = "<=maxbound"

* mover roles (mover_provider, mover_receiver) get when = "mover"
* validator checks that when names a keyword option, as it does for fields

Also, the spec previously gave rules two jobs: without a scope a rule picked the instance, with a scope it narrowed the target's values. Consolidate these into one meaning: a subset of the fk's target that the value must fall in (a view, in relational terms). A rule may stand in for a scope or may narrow a scoped target.
wpbonelli added a commit to modflowpy/pyphoenix-project that referenced this pull request Nov 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant