Skip to content

docs(model-state): consolidate into one document, re-verified against icon4py main - #18

Closed
egparedes wants to merge 1 commit into
docs/knowledge-working-principlesfrom
synthesize-model-state
Closed

docs(model-state): consolidate into one document, re-verified against icon4py main#18
egparedes wants to merge 1 commit into
docs/knowledge-working-principlesfrom
synthesize-model-state

Conversation

@egparedes

Copy link
Copy Markdown
Contributor

Distils the five-document model-state proposal set into a single coherent main document, and folds the _specV2 review appendix into it (deleted).

Stacked on #17. The new document links to and is structured around knowledge/software-engineering/principles, which lands in #17, so this PR is based there to keep the diff clean. GitHub will retarget it to main when #17 merges.

What changed

  • model-state.md rewritten as one self-contained document. Requirements R1–R11 are split into four non-negotiable constraints (C1–C4) and seven ranked goals (G1–G7); the budgeted resource (reviewer attention) and the user model are named explicitly; the honest stopping point — declare and check, no registry — is argued on the page next to the full design; M13 (declared ordering constraints) is restored.
  • model-state_specV2.md deleted — it was a diff against the main document and stops making sense once applied.
  • model-state_evidence.md is now the single authoritative source for counts and file:line detail, re-verified throughout.
  • model-state_walkthrough.md annotated where it has drifted, with one claim superseded outright.

Verification

Every checkable claim was re-run against icon4py origin/main at 4c858a6a (2026-08-06 — four days newer than the previous pass), against origin/physics_driver_tmx for the TMX claims, and against icon4py's own venv for gt4py behaviour. Most claims held. These did not:

Claim Correction
Field | None disqualifies a gt4py named collection No — the subclasshook never inspects annotations. x: int | None with no default is conformant. What disqualifies TracerState are the = None defaults. Changes what M11 must check, and when the failure surfaces (class definition → call time)
New: a ClassVar also disqualifies a container (_field_type is _FIELD), and so does an empty dataclass. PrognosticState became conformant when PR 1404 removed its tracer field
E4: vn → u,v computed 3× with divergent domain bounds Two production sites, and bounds are identical. The defect is duplicated buffers + one path missing its halo exchange
E3: divergent hydrometeor inputs Understated — qv is zeroed too, so the published temperature is a dry-air temperature and virtual_temperature is identically equal to it
E6: 7 replication sites 13; 89 .get() calls at driver_utils:221-487
E10: seven TMX containers, ~14+5+16+30+7+7 fields 92 fields; TmxInputState re-declares all six fields of the common DiagnosticState, all six tracers, and rho/w
"msimberg's spec is already the setup-time design, no bucket anywhere" True of v2, false of v3 — v3's shared mutable Carry is exactly the run-time bucket the reachability test rejects. The agreement has inverted
tach check enforces nothing (previously unverified) Confirmed — it resolves zero first-party imports and reports every module's deps as unused
units="" for most geometry/interpolation/metrics entries Right for interpolation (23/23) and metrics (45/46), wrong for geometry (11/51)

One substantive disagreement with the thesis

"Every defect E1–E10 is decided once, before the time loop starts" is not quite right. E3 and E4 produce wrong values every step; only the wiring is fixed at setup. M5-lite is therefore a genuine run-time mechanism, and §4.5 now says so rather than folding it into the "no run-time object" claim.

Actionable independently of this design

E7's three wrong-key bugs are confirmed still live on origin/main and are filable today, with the intended mapping confirmed in three independent places:

  • test_benchmark_solve_nonhydro.py:163D2DEXDZ2_FAC1_MC assigned to d2dexdz2_fac2_mc
  • test_benchmark_solve_nonhydro.py:98, test_benchmark_diffusion.py:105EDGE_NORMAL_VERTEX_V assigned to dual_normal_vert_y, where the tangent was meant

Review notes

  • status goes back to draft per AGENTS.md — the rewrite is AI-assisted and has not had a human review. That is a deliberate downgrade from reviewed.
  • Claims that could not be verified here are labelled as such in the evidence appendix: the cupy setflags objection (cupy not installed — and v3 has relaxed the enforcement it targeted anyway), the PR review-load figures, and all prior-art line numbers outside ICON/LFRic/MAPL/gt4py.
  • Index keywords updated in the same change, per AGENTS.md.

… main

Distil the five-document model-state proposal set into a single coherent main
document, and fold the `_specV2` review appendix into it (deleted).

Structure now follows the working principles' vocabulary: requirements R1-R11
are split into four non-negotiable *constraints* (C1-C4) and seven *ranked
goals* (G1-G7), the budgeted resource and user model are named, the honest
stopping point (declare-and-check, no registry) is argued next to the full
design, and M13 is restored.

Every checkable claim was re-run against icon4py `origin/main` at 4c858a6a
(2026-08-06), against `origin/physics_driver_tmx` for the TMX claims, and
against icon4py's own venv for gt4py behaviour. Corrections:

- gt4py named collections: `| None` in an annotation disqualifies nothing --
  the subclasshook never inspects annotations. What disqualifies TracerState
  are the `= None` defaults. Newly found: a ClassVar also disqualifies a
  container (the `_field_type is _FIELD` clause), and PrognosticState became
  conformant when PR 1404 removed its `tracer` field. This changes what M11
  has to check and when the failure surfaces.
- E4: two production call sites, not three, and they do not differ in domain
  bounds; the defect is duplicated buffers plus one missing halo exchange.
- E3: `qv` is zeroed on the IO path too, so the published temperature is a
  dry-air temperature and virtual_temperature is identically equal to it.
- E6: 13 replication sites, not 7; 89 `.get()` calls at driver_utils:221-487.
- E10: TMX declares 92 fields across seven containers; TmxInputState
  re-declares all six fields of the common DiagnosticState.
- msimberg's spec v3 supersedes v2 and its shared mutable `Carry` is the
  run-time bucket the reachability test rejects -- the previously claimed
  agreement has inverted.
- `tach check` enforces nothing (was listed as unverified): it resolves zero
  first-party imports and reports every module's deps as unused.
- Metadata dict sizes and empty-units counts corrected; `units=""` for most
  geometry entries was wrong (11/51).

The evidence appendix is now the single authoritative source for counts and
file:line detail, re-verified throughout; the walkthrough is annotated where
it has drifted. E7's three wrong-key bugs are confirmed still live and filable.

status goes back to draft: the rewrite has not been reviewed by a human.
egparedes added a commit that referenced this pull request Aug 10, 2026
…on PR #18

Incorporate the useful material from the alternative consolidation
(synthesize-model-state, PR #18) after independent re-verification against
icon4py origin/main at de151fad8, so that PR can be closed:

- E3 sharpened: the IO path is fully dry (qv zero too), so published
  virtual_temperature == temperature and the published temperature is
  dry-air (re-verified at driver_io.py:146-147).
- E4 corrected: two production sites, identical domain bounds; the defect
  is duplicated buffers + one missing halo exchange. Also fixes this
  document's own stale line numbers (driver_states.py:290/:302 on main).
- E6 corrected upward: ~12 replication sites (union definition), not 7;
  counts propagated to the walkthrough sketch and cost analysis.
- E7: intended mapping independently confirmed at three sites; filable now.
- E8 upgraded: the triplication is tested into place (driver_io reads +
  test docstring 'stated independently').
- E9 scoped: units='' holds for metrics/interpolation, not geometry.
- E10 detailed: 92 fields across seven dataclasses, verified on the tmx
  branch 2026-08-05.
- E1/E2: the fix's fallback branch restates the half-level extent -- E2's
  knowledge represented a third time, created by the fix.
- C2 strengthened (no record descriptor; golden-file bindings test);
  C4 noted as satisfied by construction; G6 grounded in
  cached_dummy_field_factory.
- gt4py ClassVar consequence: metadata as ClassVar is safe on Component,
  not on InputT; wiring-object-vs-program-argument must be declared and
  checked at seal().
- M3: muphys already declares both properties -- a first consumer waiting.
- M6: icon4py has zero invalidation machinery (grep + no evict API).
- A-vs-B table: E3/E4 need M5-lite either way -- the one admitted run-time
  mechanism; adoption order: file E7 bugs now, reuse the existing kind key,
  M13 lands with the winning composition layer.
- msimberg v3: synthesized the two parallel readings -- composes on the
  declaration side, but D1/D2's shared mutable Carry + sampler cache is a
  run-time name-addressed store; bind-once at setup dissolves the conflict.
- tach check enforces nothing today (namespace-package regression).
- Open questions: restored the tracer-validation sign-off question;
  mass_flx_ic answered as science but still inexpressible as declaration.

Not adopted from #18: its claim that PR 1301 is still open (it merged
2026-08-03, before #18's verification date); its three-appendix structure
(this document stays single-file); its stale E6/PR-1360 figures.
@egparedes

Copy link
Copy Markdown
Contributor Author

Closed in favor or #19

@egparedes egparedes closed this Aug 10, 2026
egparedes added a commit that referenced this pull request Aug 10, 2026
…on PR #18

Incorporate the useful material from the alternative consolidation
(synthesize-model-state, PR #18) after independent re-verification against
icon4py origin/main at de151fad8, so that PR can be closed:

- E3 sharpened: the IO path is fully dry (qv zero too), so published
  virtual_temperature == temperature and the published temperature is
  dry-air (re-verified at driver_io.py:146-147).
- E4 corrected: two production sites, identical domain bounds; the defect
  is duplicated buffers + one missing halo exchange. Also fixes this
  document's own stale line numbers (driver_states.py:290/:302 on main).
- E6 corrected upward: ~12 replication sites (union definition), not 7;
  counts propagated to the walkthrough sketch and cost analysis.
- E7: intended mapping independently confirmed at three sites; filable now.
- E8 upgraded: the triplication is tested into place (driver_io reads +
  test docstring 'stated independently').
- E9 scoped: units='' holds for metrics/interpolation, not geometry.
- E10 detailed: 92 fields across seven dataclasses, verified on the tmx
  branch 2026-08-05.
- E1/E2: the fix's fallback branch restates the half-level extent -- E2's
  knowledge represented a third time, created by the fix.
- C2 strengthened (no record descriptor; golden-file bindings test);
  C4 noted as satisfied by construction; G6 grounded in
  cached_dummy_field_factory.
- gt4py ClassVar consequence: metadata as ClassVar is safe on Component,
  not on InputT; wiring-object-vs-program-argument must be declared and
  checked at seal().
- M3: muphys already declares both properties -- a first consumer waiting.
- M6: icon4py has zero invalidation machinery (grep + no evict API).
- A-vs-B table: E3/E4 need M5-lite either way -- the one admitted run-time
  mechanism; adoption order: file E7 bugs now, reuse the existing kind key,
  M13 lands with the winning composition layer.
- msimberg v3: synthesized the two parallel readings -- composes on the
  declaration side, but D1/D2's shared mutable Carry + sampler cache is a
  run-time name-addressed store; bind-once at setup dissolves the conflict.
- tach check enforces nothing today (namespace-package regression).
- Open questions: restored the tracer-validation sign-off question;
  mass_flx_ic answered as science but still inexpressible as declaration.

Not adopted from #18: its claim that PR 1301 is still open (it merged
2026-08-03, before #18's verification date); its three-appendix structure
(this document stays single-file); its stale E6/PR-1360 figures.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant