Go extension seams
Go's extension-tier names: documented, reachable, not portable.
Extension-tier names are part of this binding’s documented surface but are not harmonized across bindings, and may change in a minor release (API_SPEC.md §7 ).
277 names.
Analysis
type · canonical name analysis
type Analysis struct {
ID string `json:"id"`
Description *string `json:"description,omitempty"`
InitialState map[string]float64 `json:"initial_state,omitempty"`
Parameters map[string]float64 `json:"parameters,omitempty"`
TimeSpan TimeSpan `json:"time_span"`
ParameterSweep *ParameterSweep `json:"parameter_sweep,omitempty"`
Plots []Plot `json:"plots,omitempty"`
// ExpressionTemplateImports are raw §9.7.2 import entries injected into the
// ENCLOSING component's template scope for THIS analysis's run only (esm-spec
// §9.7.10 form C / §6.7). Authored per-run config (a peer of Parameters), so
// it DOES survive parse → emit; consumed only by an ephemeral per-run build,
// which this binding does not perform.
ExpressionTemplateImports []any `json:"expression_template_imports,omitempty"`
}
Analysis is an inline illustrative analysis of how to run a component.
Assertion
type · canonical name assertion
type Assertion struct {
Variable string `json:"variable"`
Time float64 `json:"time"`
Expected float64 `json:"expected"`
Tolerance *Tolerance `json:"tolerance,omitempty"`
// Coords pins a spatial-point evaluation: index-set/dimension name → numeric
// coordinate. Mutually exclusive with Reduce (esm-spec §6.6.5).
Coords map[string]float64 `json:"coords,omitempty"`
// Reduce collapses the spatial field to a scalar before comparison
// ("integral"/"mean"/"max"/"min"/"L2_error"/"Linf_error"; esm-spec §6.6.5).
Reduce string `json:"reduce,omitempty"`
// Reference is the analytic/precomputed solution required by error-norm
// reductions: an inline Expression or a from_file shape (esm-spec §6.6.5).
Reference any `json:"reference,omitempty"`
}
Assertion is a single scalar (variable, time, expected) check inside a Test. PDE-aware variants pin a spatial point via coords or reduce the field to a scalar via reduce (esm-spec §6.6.5); coords and reduce are mutually exclusive. Error-norm reductions require a reference solution. These extra fields round-trip verbatim; this binding does not evaluate them.
BuildReferenceGraphFromModel
function · canonical name build_reference_graph_from_model
func BuildReferenceGraphFromModel(model *Model, modelName string, indexSets map[string]IndexSet) (*ReferenceGraph, error)
BuildReferenceGraphFromModel is the typed convenience over BuildReferenceGraph: it renders model and the document’s index_sets registry to their raw views and resolves against those.
CadenceClassifier
type · canonical name cadence_classifier
type CadenceClassifier struct {
// contains filtered or unexported fields
}
func (c *CadenceClassifier) CheckExpectCadence() []error
func (c *CadenceClassifier) CheckNoContinuousRelational() []error
func (c *CadenceClassifier) Classify(expr Expression) (Cadence, error)
func (c *CadenceClassifier) LeafSeeds() (map[string]Cadence, error)
func (c *CadenceClassifier) SeedLeaf(leaf Expression) (Cadence, error)
CadenceClassifier derives cadence classes for one model. Build it with NewCadenceClassifier; it memoises observed-leaf resolution, so reuse one instance across a model’s equations rather than rebuilding it per node.
Methods
func (c *CadenceClassifier) CheckExpectCadence() []error
CheckExpectCadence walks every equation of the model and asserts that wherever a node carries an expect_cadence annotation the derived class agrees (CONFORMANCE_SPEC §5.7.6 guard 3). The annotation is a checked assertion, not a control input: it changes no semantics, and a disagreement is a defect.
func (c *CadenceClassifier) CheckNoContinuousRelational() []error
CheckNoContinuousRelational is §5.7.6 guard 2: a distinct/join/skolem/rank/argmin/argmax node (or a distinct aggregate) that classifies CONTINUOUS is rejected — state-dependent topology may not run per step in v1.
func (c *CadenceClassifier) Classify(expr Expression) (Cadence, error)
Classify derives an expression’s cadence class: for a leaf, its seed; for an operator node, the join over its children (§5.7.3). For a gather index(A, e…) the index expressions are classed independently of the array, which is simply what “join over children” already does — no special case is needed, and the stencil split falls out of it.
func (c *CadenceClassifier) LeafSeeds() (map[string]Cadence, error)
LeafSeeds returns the derived seed of every declared variable of the model, keyed by name — the observable form of the §5.7.2 table, useful for diagnostics and for a conformance adapter.
func (c *CadenceClassifier) SeedLeaf(leaf Expression) (Cadence, error)
SeedLeaf derives a leaf’s cadence from its ROLE, per the §5.7.2 seed table.
CadenceConst
constant · canonical name cadence_const
const CadenceConst Cadence = iota
CadenceConst never changes: evaluated once and folded into the artifact.
CadenceContinuous
constant · canonical name cadence_continuous
const CadenceContinuous
CadenceContinuous changes every step: evaluated on every RHS call.
CadenceDiscrete
constant · canonical name cadence_discrete
const CadenceDiscrete
CadenceDiscrete changes only at discrete events, and is piecewise-constant between them: evaluated at setup and on each refresh, memoized between.
CallbackCoupling
type · canonical name callback_coupling
type CallbackCoupling struct {
Type string `json:"type"` // "callback"
CallbackID string `json:"callback_id"`
Config map[string]any `json:"config,omitempty"`
Description *string `json:"description,omitempty"`
}
func (c CallbackCoupling) CouplingType() string
CallbackCoupling represents callback-based coupling
Methods
func (c CallbackCoupling) CouplingType() string
CodeAmbiguousOutputName
constant · canonical name code_ambiguous_output_name
const CodeAmbiguousOutputName = "ambiguous_output_name"
CodeAmbiguousOutputName: an output name that matches no variable exactly and whose last dotted segment is shared by more than one variable (CONFORMANCE_SPEC §5.17.4). This binding has no output derivation; the constant exists because the code vocabulary is uniform across bindings.
— Diagnostic codes: §9.6 expression templates — declaration, application and body expansion (raised via newETErr from lower_expression_templates.go, out_of_line_templates.go and template_compose.go). —
CodeAmbiguousSubsystemRef
constant · canonical name code_ambiguous_subsystem_ref
const CodeAmbiguousSubsystemRef = "ambiguous_subsystem_ref"
CodeAmbiguousSubsystemRef: a subsystem ref resolves to a file holding other than exactly one top-level system; §4.7 requires exactly one.
— Diagnostic codes: §4.7 subsystem refs. Shared with the structural validator, which reports the same two conditions for a document whose refs were never resolved (tests/invalid/subsystem_ref_not_found.esm, subsystem_ref_ambiguous.esm; the names are pinned by tests/invalid/expected_errors.json). —
CodeApplyExpressionTemplateBindingsMismatch
constant · canonical name code_apply_expression_template_bindings_mismatch
const CodeApplyExpressionTemplateBindingsMismatch = "apply_expression_template_bindings_mismatch"
CodeApplyExpressionTemplateBindingsMismatch: the supplied bindings do not match the template’s declared parameters — a missing parameter, or a binding naming a parameter the template does not declare.
— Diagnostic codes: §9.6 expression templates — declaration, application and body expansion (raised via newETErr from lower_expression_templates.go, out_of_line_templates.go and template_compose.go). —
CodeApplyExpressionTemplateInvalidDeclaration
constant · canonical name code_apply_expression_template_invalid_declaration
const CodeApplyExpressionTemplateInvalidDeclaration = "apply_expression_template_invalid_declaration"
CodeApplyExpressionTemplateInvalidDeclaration: an apply_expression_template node is structurally malformed — a missing or non-string template, a bindings payload that is not an object, or a binding entry whose key is not a non-empty string.
— Diagnostic codes: §9.6 expression templates — declaration, application and body expansion (raised via newETErr from lower_expression_templates.go, out_of_line_templates.go and template_compose.go). —
CodeApplyExpressionTemplateRecursiveBody
constant · canonical name code_apply_expression_template_recursive_body
const CodeApplyExpressionTemplateRecursiveBody = "apply_expression_template_recursive_body"
CodeApplyExpressionTemplateRecursiveBody: a template’s body applies the template itself, directly or through a cycle of applications.
— Diagnostic codes: §9.6 expression templates — declaration, application and body expansion (raised via newETErr from lower_expression_templates.go, out_of_line_templates.go and template_compose.go). —
CodeApplyExpressionTemplateUnknownTemplate
constant · canonical name code_apply_expression_template_unknown_template
const CodeApplyExpressionTemplateUnknownTemplate = "apply_expression_template_unknown_template"
CodeApplyExpressionTemplateUnknownTemplate: an apply_expression_template names a template neither declared locally nor exported by any import in scope.
— Diagnostic codes: §9.6 expression templates — declaration, application and body expansion (raised via newETErr from lower_expression_templates.go, out_of_line_templates.go and template_compose.go). —
CodeApplyExpressionTemplateVersionTooOld
constant · canonical name code_apply_expression_template_version_too_old
const CodeApplyExpressionTemplateVersionTooOld = "apply_expression_template_version_too_old"
CodeApplyExpressionTemplateVersionTooOld: a file declaring esm < 0.4.0 carries expression_templates or apply_expression_template.
— Diagnostic codes: §9.6 expression templates — declaration, application and body expansion (raised via newETErr from lower_expression_templates.go, out_of_line_templates.go and template_compose.go). —
CodeArrayShapeMismatch
constant · canonical name code_array_shape_mismatch
const CodeArrayShapeMismatch = "array_shape_mismatch"
CodeArrayShapeMismatch: an operand of a bare array-level expression carries a declared index set that the expression’s result is not shaped over, so there is no axis to align it to (esm-spec §4.3.4, §9.6.6; CONFORMANCE_SPEC §7.1).
CodeCadenceContinuousRelational
constant · canonical name code_cadence_continuous_relational
const CodeCadenceContinuousRelational = "cadence_continuous_relational"
Cadence-partition diagnostic codes.
CodeCadenceExpectMismatch
constant · canonical name code_cadence_expect_mismatch
const CodeCadenceExpectMismatch = "cadence_expect_mismatch"
Cadence-partition diagnostic codes.
CodeCadenceObservedCycle
constant · canonical name code_cadence_observed_cycle
const CodeCadenceObservedCycle = "cadence_observed_cycle"
CodeCadenceObservedCycle is the CADENCE-pass sighting of the same defect esm-spec §4.9.6 gives the structural validator: a dependency cycle among a model’s observed definitions, with the §4.3.1.1 recurrence self-edge exempted on candidacy. It is a *CadenceError raised while classifying, so Validate never sees it; the validator-track counterpart is validate_observed_cycle.go’s observed_cycle, which is what tests/invalid/expected_errors.json pins. Keep the two in step — in particular the self-edge gate, which both take from recurrenceCandidateVars.
Cadence-partition diagnostic codes.
CodeCallbackUnregistered
constant · canonical name code_callback_unregistered
const CodeCallbackUnregistered = "callback_unregistered"
CodeCallbackUnregistered: an equation reads a callback coupling variable and no callback supplies it at construction (esm-spec §9.6.6). Go does not simulate, so it never raises this.
— Diagnostic codes: expression EVALUATION (EvaluationError, raised from expression.go). unlowered_operator is a cross-binding wire code — Julia and TypeScript emit exactly this string — so it belongs in the registry rather than at the call site. —
CodeClosedFunctionArity
constant · canonical name code_closed_function_arity
const CodeClosedFunctionArity = "closed_function_arity"
CodeClosedFunctionArity: a closed function received the wrong number or kind of arguments, or an empty table.
— Diagnostic codes: §9.2 closed-function registry (raised via newClosedFunctionError from registered_functions.go). —
CodeClosedFunctionOverflow
constant · canonical name code_closed_function_overflow
const CodeClosedFunctionOverflow = "closed_function_overflow"
CodeClosedFunctionOverflow: an integer-valued result overflows Int32.
— Diagnostic codes: §9.2 closed-function registry (raised via newClosedFunctionError from registered_functions.go). —
CodeCompilerRefusedRule
constant · canonical name code_compiler_refused_rule
const CodeCompilerRefusedRule = "compiler_refused_rule"
CodeCompilerRefusedRule: the chosen compiler cannot run this document. Raised at build, naming the compiler, the rule (an equation or an observed, component-qualified) and the reason.
— Diagnostic codes: expression EVALUATION (EvaluationError, raised from expression.go). unlowered_operator is a cross-binding wire code — Julia and TypeScript emit exactly this string — so it belongs in the registry rather than at the call site. —
CodeCompilerUnavailable
constant · canonical name code_compiler_unavailable
const CodeCompilerUnavailable = "compiler_unavailable"
CodeCompilerUnavailable: the named compiler is in the vocabulary, but this binding, build or process cannot provide it; the message names what to load or build. Never answered by running a different compiler (esm-libraries-spec §2.5.10).
— Diagnostic codes: expression EVALUATION (EvaluationError, raised from expression.go). unlowered_operator is a cross-binding wire code — Julia and TypeScript emit exactly this string — so it belongs in the registry rather than at the call site. —
CodeCompilerUnknown
constant · canonical name code_compiler_unknown
const CodeCompilerUnknown = "compiler_unknown"
CodeCompilerUnknown: esm_problem’s compiler option named a value outside the closed vocabulary of API_SPEC §5.8 (interpreter, native, xla, mtk, sympy).
— Diagnostic codes: expression EVALUATION (EvaluationError, raised from expression.go). unlowered_operator is a cross-binding wire code — Julia and TypeScript emit exactly this string — so it belongs in the registry rather than at the call site. —
CodeConstUnitsVersionTooOld
constant · canonical name code_const_units_version_too_old
const CodeConstUnitsVersionTooOld = "const_units_version_too_old"
CodeConstUnitsVersionTooOld: a document declaring esm < 1.2.0 carries units on an expression node.
— Diagnostic codes: §4.8.5 declared units on a const node (raised via newETErr from units.go). —
CodeCoupleMultiplicativeNoTendency
constant · canonical name code_couple_multiplicative_no_tendency
const CodeCoupleMultiplicativeNoTendency = "couple_multiplicative_no_tendency"
CodeCoupleMultiplicativeNoTendency: a couple connector equation applies the multiplicative transform to a to target that has no D(to) equation in the flattened system — a parameter, an observed, an algebraic unknown, or an undefined name. Both esm-spec §10.3 and §4.7.2 define multiplicative against the target’s EXISTING ODE right-hand side, so there is nothing to multiply and the operation has no meaning. Silently dropping the connector equation — what this binding did before — is the one outcome a coupling mis-specification must not have: the document declares a coupling and the flattened system carries no trace of it.
additive deliberately has NO counterpart code: zero is the additive identity, so an additive term against an absent tendency simply becomes the tendency. There is no multiplicative identity that would do the same.
— Diagnostic codes: §10.3 / esm-libraries-spec §4.7.2 couple connector semantics (raised from flatten.go’s applyCouple). —
CodeCouplingEdgeUnknownRole
constant · canonical name code_coupling_edge_unknown_role
const CodeCouplingEdgeUnknownRole = "coupling_edge_unknown_role"
CodeCouplingEdgeUnknownRole: a coupling edge inside the library references a role name the library does not declare.
— Diagnostic codes: §10.9-§10.11 coupling libraries / coupling_import (raised via newETErr from coupling_imports.go). —
CodeCouplingImportBindNotAComponent
constant · canonical name code_coupling_import_bind_not_a_component
const CodeCouplingImportBindNotAComponent = "coupling_import_bind_not_a_component"
CodeCouplingImportBindNotAComponent: a role binding names something that is not a component of the importing document.
— Diagnostic codes: §10.9-§10.11 coupling libraries / coupling_import (raised via newETErr from coupling_imports.go). —
CodeCouplingImportNotLibrary
constant · canonical name code_coupling_import_not_library
const CodeCouplingImportNotLibrary = "coupling_import_not_library"
CodeCouplingImportNotLibrary: a coupling_import resolves to a file that is not a coupling library.
— Diagnostic codes: §10.9-§10.11 coupling libraries / coupling_import (raised via newETErr from coupling_imports.go). —
CodeCouplingImportRoleUnbound
constant · canonical name code_coupling_import_role_unbound
const CodeCouplingImportRoleUnbound = "coupling_import_role_unbound"
CodeCouplingImportRoleUnbound: a role the imported library declares is left unbound by the importing document.
— Diagnostic codes: §10.9-§10.11 coupling libraries / coupling_import (raised via newETErr from coupling_imports.go). —
CodeCouplingImportUnknownRole
constant · canonical name code_coupling_import_unknown_role
const CodeCouplingImportUnknownRole = "coupling_import_unknown_role"
CodeCouplingImportUnknownRole: a coupling_import binds a role the imported library does not declare.
— Diagnostic codes: §10.9-§10.11 coupling libraries / coupling_import (raised via newETErr from coupling_imports.go). —
CodeCouplingImportUnresolved
constant · canonical name code_coupling_import_unresolved
const CodeCouplingImportUnresolved = "coupling_import_unresolved"
CodeCouplingImportUnresolved: a coupling_import names a file that does not exist, is not readable, or was never resolved before use.
— Diagnostic codes: §10.9-§10.11 coupling libraries / coupling_import (raised via newETErr from coupling_imports.go). —
CodeCouplingLibraryIllegalPayload
constant · canonical name code_coupling_library_illegal_payload
const CodeCouplingLibraryIllegalPayload = "coupling_library_illegal_payload"
CodeCouplingLibraryIllegalPayload: a coupling library file carries a payload §10.11 forbids there (a component, a non-coupling_roles block, or a role entry of the wrong shape).
— Diagnostic codes: §10.9-§10.11 coupling libraries / coupling_import (raised via newETErr from coupling_imports.go). —
CodeCouplingLibraryNestedImport
constant · canonical name code_coupling_library_nested_import
const CodeCouplingLibraryNestedImport = "coupling_library_nested_import"
CodeCouplingLibraryNestedImport: a coupling library itself declares a coupling import; §10.11 admits no nesting.
— Diagnostic codes: §10.9-§10.11 coupling libraries / coupling_import (raised via newETErr from coupling_imports.go). —
CodeCouplingRoleUnused
constant · canonical name code_coupling_role_unused
const CodeCouplingRoleUnused = "coupling_role_unused"
CodeCouplingRoleUnused: a role the library declares is referenced by none of its coupling edges, so binding it could have no effect.
— Diagnostic codes: §10.9-§10.11 coupling libraries / coupling_import (raised via newETErr from coupling_imports.go). —
CodeDataSourceUnbound
constant · canonical name code_data_source_unbound
const CodeDataSourceUnbound = "data_source_unbound"
CodeDataSourceUnbound: a data-fed parameter (an update of kind: "data", esm-spec §5.4/§8.5) reached a build with nothing bound to it – no provider, no loaded array, no caller-supplied p value (esm-spec §9.6.6, CONFORMANCE_SPEC §5.46). The complement of ErrorDataSourceUndefined, which this binding DOES raise: that is the validator’s finding about a source name resolving to nothing, this is the build’s finding about a source that resolves and that nothing supplied data for. Go does not simulate, so nothing here raises it; the constant keeps the §9.6.6 vocabulary uniform.
— Diagnostic codes: expression EVALUATION (EvaluationError, raised from expression.go). unlowered_operator is a cross-binding wire code — Julia and TypeScript emit exactly this string — so it belongs in the registry rather than at the call site. —
CodeDerivedIndexSetUnmaterialized
constant · canonical name code_derived_index_set_unmaterialized
const CodeDerivedIndexSetUnmaterialized = "derived_index_set_unmaterialized"
CodeDerivedIndexSetUnmaterialized: an expression ranges over a kind: "derived" index set whose producer could not be materialized at build (esm-spec §9.6.6). Registered for the cross-binding vocabulary; this binding has no simulator, so nothing here raises it.
— Diagnostic codes: expression EVALUATION (EvaluationError, raised from expression.go). unlowered_operator is a cross-binding wire code — Julia and TypeScript emit exactly this string — so it belongs in the registry rather than at the call site. —
CodeDomainUnitMismatch
constant · canonical name code_domain_unit_mismatch
const CodeDomainUnitMismatch = "domain_unit_mismatch"
CodeDomainUnitMismatch: an identity-transform variable_map coupling whose from and to variables carry declared, non-empty, and DIFFERENT units (esm-spec §4.7.6). Mirrors the flatten-time DomainUnitMismatch the evaluating bindings raise (Julia _check_variable_map_units, Python _check_variable_map_units, Rust FlattenError::DomainUnitMismatch).
validate_static_checks.go holds static-validation checks for defects that are decidable from the SINGLE document (no evaluator, no solver, no other file). Their pinned (code, path) tuples live in tests/invalid/expected_errors.json, and these checks make Go’s Validate reject each with exactly that pin:
- join_key_invalid_type — an aggregate value-equality join whose key column draws from a categorical index set with a float or null member.
- domain_unit_mismatch — an identity variable_map coupling whose from/to variables carry declared, non-empty, DIFFERENT units.
- relational_node_in_continuous — a distinct/bool_and_or aggregate whose key/expr reads a STATE variable (value-invention in a continuous context).
- undefined_index_set — an aggregate
rangesentry{from: NAME}naming a set absent from the documentindex_setsregistry.
Every finding is emitted at the CONTAINING EXPRESSION FIELD (/models/M/equations/i/lhs or /rhs, or /coupling/i) — the same pointer convention the reference-integrity findings use.
CodeDuplicateReactionSpecies
constant · canonical name code_duplicate_reaction_species
const CodeDuplicateReactionSpecies = "duplicate_reaction_species"
CodeDuplicateReactionSpecies is a warning-level code: a species appears more than once in a reaction’s substrate/product list. Advisory only — it does not invalidate the document.
— Diagnostic codes: structural validation, peers of the Error* block above. —
CodeEditEntityNotFound
constant · canonical name code_edit_entity_not_found
const CodeEditEntityNotFound = "entity_not_found"
CodeEditEntityNotFound: an edit names a variable, equation, reaction, species, event, coupling entry, or component that does not exist.
CodeEditInvalidOperation
constant · canonical name code_edit_invalid_operation
const CodeEditInvalidOperation = "invalid_operation"
CodeEditInvalidOperation: an edit is refused for a reason other than the two above (e.g. it would empty a collection the schema requires to be non-empty).
CodeEditVariableInUse
constant · canonical name code_edit_variable_in_use
const CodeEditVariableInUse = "variable_in_use"
CodeEditVariableInUse: a removal would strand a live reference to the removed name.
CodeElementTypeUncarried
constant · canonical name code_element_type_uncarried
const CodeElementTypeUncarried = "element_type_uncarried"
CodeElementTypeUncarried: a declared working precision reaches a construct that cannot carry it (esm-spec §4.7 “Working precision crosses a mount”, §11.3.1) — a mounted leaf’s domain.element_type that must be written onto a reaction system, whose species and parameters have no per-variable element_type.
— Diagnostic codes: §4.7 subsystem refs. Shared with the structural validator, which reports the same two conditions for a document whose refs were never resolved (tests/invalid/subsystem_ref_not_found.esm, subsystem_ref_ambiguous.esm; the names are pinned by tests/invalid/expected_errors.json). —
CodeGeometryManifoldInvalid
constant · canonical name code_geometry_manifold_invalid
const CodeGeometryManifoldInvalid = "geometry_manifold_invalid"
CodeGeometryManifoldInvalid: a geometry kernel declares a manifold that is not one of the spec’s manifold kinds, or one inconsistent with the coordinates it is given.
— Diagnostic codes: §9.6 expression templates — declaration, application and body expansion (raised via newETErr from lower_expression_templates.go, out_of_line_templates.go and template_compose.go). —
CodeIndexedDefinitionUnsupportedForm
constant · canonical name code_indexed_definition_unsupported_form
const CodeIndexedDefinitionUnsupportedForm = "indexed_definition_unsupported_form"
CodeIndexedDefinitionUnsupportedForm: a bare-index observed definition index(V, k…) ~ rhs outside the runnable form (the RHS is not a faq whose output_idx names the subscripts in order), refused when a simulating binding builds the model. Go does not simulate, so it never raises this; the constant exists because the code table is cross-language uniform.
— Diagnostic codes: running an arrayed definition (esm-spec §6.3.1). —
CodeInterpAxisLengthMismatch
constant · canonical name code_interp_axis_length_mismatch
const CodeInterpAxisLengthMismatch = "interp_axis_length_mismatch"
CodeInterpAxisLengthMismatch: an interp axis length does not match the table’s.
— Diagnostic codes: §9.2 closed-function registry (raised via newClosedFunctionError from registered_functions.go). —
CodeInterpAxisTooShort
constant · canonical name code_interp_axis_too_short
const CodeInterpAxisTooShort = "interp_axis_too_short"
CodeInterpAxisTooShort: an interp axis has fewer than two points.
— Diagnostic codes: §9.2 closed-function registry (raised via newClosedFunctionError from registered_functions.go). —
CodeInterpNaNInAxis
constant · canonical name code_interp_na_n_in_axis
const CodeInterpNaNInAxis = "interp_nan_in_axis"
CodeInterpNaNInAxis: an interp axis contains a NaN.
— Diagnostic codes: §9.2 closed-function registry (raised via newClosedFunctionError from registered_functions.go). —
CodeInterpNonMonotonicAxis
constant · canonical name code_interp_non_monotonic_axis
const CodeInterpNonMonotonicAxis = "interp_non_monotonic_axis"
CodeInterpNonMonotonicAxis: an interp axis is not strictly increasing.
— Diagnostic codes: §9.2 closed-function registry (raised via newClosedFunctionError from registered_functions.go). —
CodeInvalidBroadcastFn
constant · canonical name code_invalid_broadcast_fn
const CodeInvalidBroadcastFn = "invalid_broadcast_fn"
CodeInvalidBroadcastFn: a broadcast node’s fn is absent, does not name a scalar operator, or is applied to an argument count that operator’s §4.2 arity does not admit (esm-spec §4.3.4, §9.6.6). The value analogue of unknown_closed_function: broadcast is the one op whose OPERATOR is carried as data, so no op-keyed check reaches it, and an unchecked fn was discarded silently rather than failing.
CodeInvalidEnumArg
constant · canonical name code_invalid_enum_arg
const CodeInvalidEnumArg = "invalid_enum_arg"
CodeInvalidEnumArg: an enum node argument is not a string.
— Diagnostic codes: §9.3 enum lowering (raised via newEnumLoweringError from lower_enums.go). —
CodeInvalidEnumArity
constant · canonical name code_invalid_enum_arity
const CodeInvalidEnumArity = "invalid_enum_arity"
CodeInvalidEnumArity: an enum node does not carry exactly two arguments.
— Diagnostic codes: §9.3 enum lowering (raised via newEnumLoweringError from lower_enums.go). —
CodeJoinKeyInvalidType
constant · canonical name code_join_key_invalid_type
const CodeJoinKeyInvalidType = "join_key_invalid_type"
CodeJoinKeyInvalidType: a value-equality join key column draws from a categorical index set whose members contain a float (not portably equality-comparable across bindings) or a null (unmatchable as a key). RFC semiring-faq-unified-ir §5.3 / §5.7 rule 1; CONFORMANCE_SPEC §5.5.1.
validate_static_checks.go holds static-validation checks for defects that are decidable from the SINGLE document (no evaluator, no solver, no other file). Their pinned (code, path) tuples live in tests/invalid/expected_errors.json, and these checks make Go’s Validate reject each with exactly that pin:
- join_key_invalid_type — an aggregate value-equality join whose key column draws from a categorical index set with a float or null member.
- domain_unit_mismatch — an identity variable_map coupling whose from/to variables carry declared, non-empty, DIFFERENT units.
- relational_node_in_continuous — a distinct/bool_and_or aggregate whose key/expr reads a STATE variable (value-invention in a continuous context).
- undefined_index_set — an aggregate
rangesentry{from: NAME}naming a set absent from the documentindex_setsregistry.
Every finding is emitted at the CONTAINING EXPRESSION FIELD (/models/M/equations/i/lhs or /rhs, or /coupling/i) — the same pointer convention the reference-integrity findings use.
CodeJoinSideAmbiguous
constant · canonical name code_join_side_ambiguous
const CodeJoinSideAmbiguous = "join_side_ambiguous"
CodeJoinSideAmbiguous: an on key for which the DOCUMENT does not determine a range symbol – its index set is drawn by more than one of the node’s ranges and the clause names no syms (CONFORMANCE_SPEC §5.5.8).
validate_static_checks.go holds static-validation checks for defects that are decidable from the SINGLE document (no evaluator, no solver, no other file). Their pinned (code, path) tuples live in tests/invalid/expected_errors.json, and these checks make Go’s Validate reject each with exactly that pin:
- join_key_invalid_type — an aggregate value-equality join whose key column draws from a categorical index set with a float or null member.
- domain_unit_mismatch — an identity variable_map coupling whose from/to variables carry declared, non-empty, DIFFERENT units.
- relational_node_in_continuous — a distinct/bool_and_or aggregate whose key/expr reads a STATE variable (value-invention in a continuous context).
- undefined_index_set — an aggregate
rangesentry{from: NAME}naming a set absent from the documentindex_setsregistry.
Every finding is emitted at the CONTAINING EXPRESSION FIELD (/models/M/equations/i/lhs or /rhs, or /coupling/i) — the same pointer convention the reference-integrity findings use.
CodeJoinSymsUnknownSymbol
constant · canonical name code_join_syms_unknown_symbol
const CodeJoinSymsUnknownSymbol = "join_syms_unknown_symbol"
CodeJoinSymsUnknownSymbol: a join.syms entry that is not a range symbol of the node (CONFORMANCE_SPEC §5.5.8).
validate_static_checks.go holds static-validation checks for defects that are decidable from the SINGLE document (no evaluator, no solver, no other file). Their pinned (code, path) tuples live in tests/invalid/expected_errors.json, and these checks make Go’s Validate reject each with exactly that pin:
- join_key_invalid_type — an aggregate value-equality join whose key column draws from a categorical index set with a float or null member.
- domain_unit_mismatch — an identity variable_map coupling whose from/to variables carry declared, non-empty, DIFFERENT units.
- relational_node_in_continuous — a distinct/bool_and_or aggregate whose key/expr reads a STATE variable (value-invention in a continuous context).
- undefined_index_set — an aggregate
rangesentry{from: NAME}naming a set absent from the documentindex_setsregistry.
Every finding is emitted at the CONTAINING EXPRESSION FIELD (/models/M/equations/i/lhs or /rhs, or /coupling/i) — the same pointer convention the reference-integrity findings use.
CodeMakearrayRegionInverted
constant · canonical name code_makearray_region_inverted
const CodeMakearrayRegionInverted = "makearray_region_inverted"
CodeMakearrayRegionInverted: a makearray region’s stop precedes its start, so the region denotes no cells (esm-spec §4.3.5).
— Diagnostic codes: §9.6 expression templates — declaration, application and body expansion (raised via newETErr from lower_expression_templates.go, out_of_line_templates.go and template_compose.go). —
CodeMetaparamNameConflict
constant · canonical name code_metaparam_name_conflict
const CodeMetaparamNameConflict = "metaparameter_name_conflict"
CodeMetaparamNameConflict: a metaparameter name collides with a name already bound in the scope the template expands into (esm-spec §9.6.6).
— Diagnostic codes: §9.7 template imports / §9.6.6 metaparameters (raised via newETErr from template_imports.go and subsystem_ref.go). —
CodeMetaparamTypeError
constant · canonical name code_metaparam_type_error
const CodeMetaparamTypeError = "metaparameter_type_error"
— Diagnostic codes: §9.7 template imports / §9.6.6 metaparameters (raised via newETErr from template_imports.go and subsystem_ref.go). —
CodeMetaparamUnbound
constant · canonical name code_metaparam_unbound
const CodeMetaparamUnbound = "metaparameter_unbound"
CodeMetaparamUnbound: a metaparameter reachable in an expanded template body has no binding — neither from the metaparameters block nor from an import’s rebind (esm-spec §9.6.6).
— Diagnostic codes: §9.7 template imports / §9.6.6 metaparameters (raised via newETErr from template_imports.go and subsystem_ref.go). —
CodeMissingDataSourceKind
constant · canonical name code_missing_data_source_kind
const CodeMissingDataSourceKind = "missing_data_source_kind"
A data source entry requires kind and source.url_template. A source declares no variables; the file variable and units are checked on the consuming PARAMETER instead – by the schema, since both are required there.
— Diagnostic codes: structural validation, peers of the Error* block above. —
CodeMissingDataSourceURLTemplate
constant · canonical name code_missing_data_source_url_template
const CodeMissingDataSourceURLTemplate = "missing_data_source_url_template"
— Diagnostic codes: structural validation, peers of the Error* block above. —
CodeMountFormUnsupported
constant · canonical name code_mount_form_unsupported
const CodeMountFormUnsupported = "mount_form_unsupported"
CodeMountFormUnsupported: a §4.7 {ref} mount at a form this binding does not implement — here, a top-level reaction_systems.<k> {ref} (esm-spec §4.7 “Two mount forms, one mechanism”). Refused at load, pointing at the entry, rather than decoded as an empty reaction system.
— Diagnostic codes: §4.7 subsystem refs. Shared with the structural validator, which reports the same two conditions for a document whose refs were never resolved (tests/invalid/subsystem_ref_not_found.esm, subsystem_ref_ambiguous.esm; the names are pinned by tests/invalid/expected_errors.json). —
CodeOperatorComposeAmbiguousBareName
constant · canonical name code_operator_compose_ambiguous_bare_name
const CodeOperatorComposeAmbiguousBareName = "operator_compose_ambiguous_bare_name"
CodeOperatorComposeAmbiguousBareName: the bare-name fallback (§4.7.1 step 3) would unify two STATE variables. Each carries its own INITIAL CONDITION and the merge keeps only one, so the choice decides what the flattened system integrates from — and the document, which bound them on a shared local name alone, has not expressed it. Deciding it silently is how flipping an entry’s systems order came to change the answer. A match where only ONE side is a state is not ambiguous: the state owns it.
— Diagnostic codes: §10.3 / esm-libraries-spec §4.7.2 couple connector semantics (raised from flatten.go’s applyCouple). —
CodeOperatorComposeNoMerge
constant · canonical name code_operator_compose_no_merge
const CodeOperatorComposeNoMerge = "operator_compose_no_merge"
CodeOperatorComposeNoMerge is an ERROR (esm-libraries-spec §4.7.1 step 5): an operator_compose entry merged NONE of the equations Systems
authored, which makes it indistinguishable from an entry that is not there — the operator integrates a private decoupled system from its own defaults, the other system receives no contribution, and the only evidence is a state count one too high. An operator that genuinely contributes only states of its own declares that with require_match: false and is then permitted.
— Diagnostic codes: §10.3 / esm-libraries-spec §4.7.2 couple connector semantics (raised from flatten.go’s applyCouple). —
CodeOperatorComposePartialMerge
constant · canonical name code_operator_compose_partial_merge
const CodeOperatorComposePartialMerge = "operator_compose_partial_merge"
CodeOperatorComposePartialMerge is WARNING-level: some but not all of Systems
\[1\]’s equations landed. Unlike a zero merge this is indistinguishable from an operator that legitimately contributes states of its own ALONGSIDE the ones it does merge, so the format cannot call it a defect; an author who knows better says so with require_match.
— Diagnostic codes: §10.3 / esm-libraries-spec §4.7.2 couple connector semantics (raised from flatten.go’s applyCouple). —
CodeOperatorComposeRequireMatchUnmatched
constant · canonical name code_operator_compose_require_match_unmatched
const CodeOperatorComposeRequireMatchUnmatched = "operator_compose_require_match_unmatched"
CodeOperatorComposeRequireMatchUnmatched: an operator_compose entry declared require_match: true and one of Systems
’s equations found no equation of Systems
\[0\]to land on (esm-libraries-spec §4.7.1 step 5). A PARTIAL match fails too: there is no “some is enough” reading an author could rely on — the seven-of-twelve-species case is exactly the defect the flag exists to catch. Refused at FLATTEN, not at validate: the document is schema-valid and structurally valid, and only the merge knows the answer.
— Diagnostic codes: §10.3 / esm-libraries-spec §4.7.2 couple connector semantics (raised from flatten.go’s applyCouple). —
CodeRaggedValuesNotGathered
constant · canonical name code_ragged_values_not_gathered
const CodeRaggedValuesNotGathered = "ragged_values_not_gathered"
CodeRaggedValuesNotGathered: a faq that is not a value-invention node ranges over a kind: "ragged" index set, but its body never reads that set’s values array. The range binds the POSITION k in 1..offsets
, not a member, so the body reads positions where the author meant members (esm-spec §4.3.1 “Ragged ranges”).
validate_static_checks.go holds static-validation checks for defects that are decidable from the SINGLE document (no evaluator, no solver, no other file). Their pinned (code, path) tuples live in tests/invalid/expected_errors.json, and these checks make Go’s Validate reject each with exactly that pin:
- join_key_invalid_type — an aggregate value-equality join whose key column draws from a categorical index set with a float or null member.
- domain_unit_mismatch — an identity variable_map coupling whose from/to variables carry declared, non-empty, DIFFERENT units.
- relational_node_in_continuous — a distinct/bool_and_or aggregate whose key/expr reads a STATE variable (value-invention in a continuous context).
- undefined_index_set — an aggregate
rangesentry{from: NAME}naming a set absent from the documentindex_setsregistry.
Every finding is emitted at the CONTAINING EXPRESSION FIELD (/models/M/equations/i/lhs or /rhs, or /coupling/i) — the same pointer convention the reference-integrity findings use.
CodeRangeBoxInvalid
constant · canonical name code_range_box_invalid
const CodeRangeBoxInvalid = "range_box_invalid"
CodeRangeBoxInvalid: a malformed decomposition, tile box or lane-set list.
— Diagnostic codes: expression EVALUATION (EvaluationError, raised from expression.go). unlowered_operator is a cross-binding wire code — Julia and TypeScript emit exactly this string — so it belongs in the registry rather than at the call site. —
CodeRangeGlobalLocality
constant · canonical name code_range_global_locality
const CodeRangeGlobalLocality = "range_global_locality"
CodeRangeGlobalLocality: a tile restriction or halo report meets a 0-d state write, or a contraction, scan or data-dependent gather along a decomposed axis.
— Diagnostic codes: expression EVALUATION (EvaluationError, raised from expression.go). unlowered_operator is a cross-binding wire code — Julia and TypeScript emit exactly this string — so it belongs in the registry rather than at the call site. —
CodeRangeHaloInsufficient
constant · canonical name code_range_halo_insufficient
const CodeRangeHaloInsufficient = "range_halo_insufficient"
CodeRangeHaloInsufficient: a tile reads an in-domain cell outside its storage box with no periodic image in it (API_SPEC §5.8, “Range-restricted right-hand sides”).
— Diagnostic codes: expression EVALUATION (EvaluationError, raised from expression.go). unlowered_operator is a cross-binding wire code — Julia and TypeScript emit exactly this string — so it belongs in the registry rather than at the call site. —
CodeRangeSelectionWritesIncomplete
constant · canonical name code_range_selection_writes_incomplete
const CodeRangeSelectionWritesIncomplete = "range_selection_writes_incomplete"
CodeRangeSelectionWritesIncomplete: an operator selection’s writes omits a variable one of its selected contributions writes.
— Diagnostic codes: expression EVALUATION (EvaluationError, raised from expression.go). unlowered_operator is a cross-binding wire code — Julia and TypeScript emit exactly this string — so it belongs in the registry rather than at the call site. —
CodeRefCycle
constant · canonical name code_ref_cycle
const CodeRefCycle = "E_REF_CYCLE"
CodeRefCycle: a directed cycle exists among the reference edges.
CodeRefDuplicateNodeID
constant · canonical name code_ref_duplicate_node_id
const CodeRefDuplicateNodeID = "E_REF_DUPLICATE_NODE_ID"
CodeRefDuplicateNodeID: two expression nodes in the same document share an explicit id.
CodeRefUndeclaredIndexSet
constant · canonical name code_ref_undeclared_index_set
const CodeRefUndeclaredIndexSet = "E_REF_UNDECLARED_INDEX_SET"
CodeRefUndeclaredIndexSet: an undeclared name in a ranges[*].from.
CodeRefUnknownFAQNode
constant · canonical name code_ref_unknown_faq_node
const CodeRefUnknownFAQNode = "E_REF_UNKNOWN_FAQ_NODE"
CodeRefUnknownFAQNode: a kind:"derived" index set’s from_faq names no node id in the document.
CodeRefUnresolvedJoinFactor
constant · canonical name code_ref_unresolved_join_factor
const CodeRefUnresolvedJoinFactor = "E_REF_UNRESOLVED_JOIN_FACTOR"
CodeRefUnresolvedJoinFactor: a join.on factor reference names nothing in the node’s scope.
CodeRelationalNodeInContinuous
constant · canonical name code_relational_node_in_continuous
const CodeRelationalNodeInContinuous = "relational_node_in_continuous"
CodeRelationalNodeInContinuous: a relational / value-invention aggregate (distinct: true under bool_and_or) whose key/expr reads a declared STATE variable, so the cadence partition classes the node CONTINUOUS and guard 2 (no relational engine on the hot path) forbids it. RFC §6.1, CONFORMANCE_SPEC §5.7.6 guard 2.
validate_static_checks.go holds static-validation checks for defects that are decidable from the SINGLE document (no evaluator, no solver, no other file). Their pinned (code, path) tuples live in tests/invalid/expected_errors.json, and these checks make Go’s Validate reject each with exactly that pin:
- join_key_invalid_type — an aggregate value-equality join whose key column draws from a categorical index set with a float or null member.
- domain_unit_mismatch — an identity variable_map coupling whose from/to variables carry declared, non-empty, DIFFERENT units.
- relational_node_in_continuous — a distinct/bool_and_or aggregate whose key/expr reads a STATE variable (value-invention in a continuous context).
- undefined_index_set — an aggregate
rangesentry{from: NAME}naming a set absent from the documentindex_setsregistry.
Every finding is emitted at the CONTAINING EXPRESSION FIELD (/models/M/equations/i/lhs or /rhs, or /coupling/i) — the same pointer convention the reference-integrity findings use.
CodeRewriteRuleNonterminating
constant · canonical name code_rewrite_rule_nonterminating
const CodeRewriteRuleNonterminating = "rewrite_rule_nonterminating"
CodeRewriteRuleNonterminating: the rewrite fixpoint did not converge within MAX_REWRITE_PASSES passes (esm-spec §9.6.3).
— Diagnostic codes: §9.6 expression templates — declaration, application and body expansion (raised via newETErr from lower_expression_templates.go, out_of_line_templates.go and template_compose.go). —
CodeSearchsortedNaNInTable
constant · canonical name code_searchsorted_na_n_in_table
const CodeSearchsortedNaNInTable = "searchsorted_nan_in_table"
CodeSearchsortedNaNInTable: a searchsorted table contains a NaN.
— Diagnostic codes: §9.2 closed-function registry (raised via newClosedFunctionError from registered_functions.go). —
CodeSearchsortedNonMonotonic
constant · canonical name code_searchsorted_non_monotonic
const CodeSearchsortedNonMonotonic = "searchsorted_non_monotonic"
CodeSearchsortedNonMonotonic: a searchsorted table is not non-decreasing.
— Diagnostic codes: §9.2 closed-function registry (raised via newClosedFunctionError from registered_functions.go). —
CodeSolverExternalUnresolved
constant · canonical name code_solver_external_unresolved
const CodeSolverExternalUnresolved = "solver_external_unresolved"
CodeSolverExternalUnresolved: solver.external carries ${ (esm-spec §2.2.6).
— Diagnostic codes: §9.6 expression templates — declaration, application and body expansion (raised via newETErr from lower_expression_templates.go, out_of_line_templates.go and template_compose.go). —
CodeSolverExternalVersionTooOld
constant · canonical name code_solver_external_version_too_old
const CodeSolverExternalVersionTooOld = "solver_external_version_too_old"
CodeSolverExternalVersionTooOld: solver.external in a file declaring esm < 1.3.0 (esm-spec §2.2.4).
— Diagnostic codes: §9.6 expression templates — declaration, application and body expansion (raised via newETErr from lower_expression_templates.go, out_of_line_templates.go and template_compose.go). —
CodeSolverTimeSpanInvalid
constant · canonical name code_solver_time_span_invalid
const CodeSolverTimeSpanInvalid = "solver_time_span_invalid"
CodeSolverTimeSpanInvalid: solver.time_span does not describe an interval – end not after start, a timestamp naming no calendar day, or an unreadable time origin (esm-spec §2.2.7).
— Diagnostic codes: §9.6 expression templates — declaration, application and body expansion (raised via newETErr from lower_expression_templates.go, out_of_line_templates.go and template_compose.go). —
CodeSolverTimeSpanVersionTooOld
constant · canonical name code_solver_time_span_version_too_old
const CodeSolverTimeSpanVersionTooOld = "solver_time_span_version_too_old"
CodeSolverTimeSpanVersionTooOld: solver.time_span in a file declaring esm < 1.3.0 (esm-spec §2.2.4).
— Diagnostic codes: §9.6 expression templates — declaration, application and body expansion (raised via newETErr from lower_expression_templates.go, out_of_line_templates.go and template_compose.go). —
CodeSolverVersionTooOld
constant · canonical name code_solver_version_too_old
const CodeSolverVersionTooOld = "solver_version_too_old"
CodeSolverVersionTooOld: a top-level solver block in a file declaring esm < 1.1.0 (esm-spec §2.2.4).
— Diagnostic codes: §9.6 expression templates — declaration, application and body expansion (raised via newETErr from lower_expression_templates.go, out_of_line_templates.go and template_compose.go). —
CodeSubsystemIndexSetConflict
constant · canonical name code_subsystem_index_set_conflict
const CodeSubsystemIndexSetConflict = "subsystem_index_set_conflict"
CodeSubsystemIndexSetConflict: a referenced subsystem declares an index set that conflicts with a same-named set already in the parent document.
— Diagnostic codes: §4.7 subsystem refs. Shared with the structural validator, which reports the same two conditions for a document whose refs were never resolved (tests/invalid/subsystem_ref_not_found.esm, subsystem_ref_ambiguous.esm; the names are pinned by tests/invalid/expected_errors.json). —
CodeSubsystemIndexSetRenameUnknownName
constant · canonical name code_subsystem_index_set_rename_unknown_name
const CodeSubsystemIndexSetRenameUnknownName = "subsystem_index_set_rename_unknown_name"
CodeSubsystemIndexSetRenameUnknownName: a mount edge’s index_set_rename names an index set the RESOLVED mounted document does not declare (esm-spec §4.7 “Mount-edge index-set renaming”) — the mount-edge mirror of template_import_rename_unknown_name.
— Diagnostic codes: §4.7 subsystem refs. Shared with the structural validator, which reports the same two conditions for a document whose refs were never resolved (tests/invalid/subsystem_ref_not_found.esm, subsystem_ref_ambiguous.esm; the names are pinned by tests/invalid/expected_errors.json). —
CodeSubsystemIndexSetRenameUnsupportedMountForm
constant · canonical name code_subsystem_index_set_rename_unsupported_mount_form
const CodeSubsystemIndexSetRenameUnsupportedMountForm = "subsystem_index_set_rename_unsupported_mount_form"
CodeSubsystemIndexSetRenameUnsupportedMountForm: index_set_rename on a mount form that does not implement it (esm-spec §4.7 “Mount-edge index-set renaming”, “Where it applies”). The field is a legal SubsystemRef property at either mount form, but a binding whose top-level models.<k> {ref} inliner cannot apply it MUST say so rather than merge the leaf under its pre-rename axis names. Go does not inline a top-level {ref} at all, so it never raises this; the constant exists because the code table is cross-language uniform.
— Diagnostic codes: §4.7 subsystem refs. Shared with the structural validator, which reports the same two conditions for a document whose refs were never resolved (tests/invalid/subsystem_ref_not_found.esm, subsystem_ref_ambiguous.esm; the names are pinned by tests/invalid/expected_errors.json). —
CodeSubsystemRefIsCouplingLibrary
constant · canonical name code_subsystem_ref_is_coupling_library
const CodeSubsystemRefIsCouplingLibrary = "subsystem_ref_is_coupling_library"
CodeSubsystemRefIsCouplingLibrary: a subsystem ref resolves to a COUPLING library (§10.9) rather than to a document declaring a system.
— Diagnostic codes: §4.7 subsystem refs. Shared with the structural validator, which reports the same two conditions for a document whose refs were never resolved (tests/invalid/subsystem_ref_not_found.esm, subsystem_ref_ambiguous.esm; the names are pinned by tests/invalid/expected_errors.json). —
CodeSubsystemRefIsTemplateLibrary
constant · canonical name code_subsystem_ref_is_template_library
const CodeSubsystemRefIsTemplateLibrary = "subsystem_ref_is_template_library"
CodeSubsystemRefIsTemplateLibrary: a subsystem ref resolves to a TEMPLATE library (§9.7) rather than to a document declaring a system.
— Diagnostic codes: §4.7 subsystem refs. Shared with the structural validator, which reports the same two conditions for a document whose refs were never resolved (tests/invalid/subsystem_ref_not_found.esm, subsystem_ref_ambiguous.esm; the names are pinned by tests/invalid/expected_errors.json). —
CodeTableAxisNaN
constant · canonical name code_table_axis_na_n
const CodeTableAxisNaN = "table_axis_nan"
CodeTableAxisNaN: an axis’s values carries a non-finite entry; §9.5.1 requires strictly-increasing FINITE floats.
— Diagnostic codes: §9.5 sampled function tables — the §9.5.3 table_lookup lowering (raised via newTableLookupError from lower_table_lookup.go).
A CROSS-BINDING vocabulary: every binding raises these same strings from its own §9.5.3 lowering, so they belong in the shared registry rather than beside the pass. Only the codes THIS binding actually emits are declared — the remaining §9.5.5 codes (table_axis_non_monotonic, table_data_nan, table_outputs_length_mismatch, table_axis_duplicate_name, table_outputs_duplicate_name) are load-time table-well-formedness checks this binding does not perform, and a constant for a code nothing raises would advertise a diagnostic it cannot report. —
CodeTableDataShapeMismatch
constant · canonical name code_table_data_shape_mismatch
const CodeTableDataShapeMismatch = "table_data_shape_mismatch"
CodeTableDataShapeMismatch: data’s nesting does not match the shape axes (and outputs, when present) imply, so the selected output names no sub-array.
— Diagnostic codes: §9.5 sampled function tables — the §9.5.3 table_lookup lowering (raised via newTableLookupError from lower_table_lookup.go).
A CROSS-BINDING vocabulary: every binding raises these same strings from its own §9.5.3 lowering, so they belong in the shared registry rather than beside the pass. Only the codes THIS binding actually emits are declared — the remaining §9.5.5 codes (table_axis_non_monotonic, table_data_nan, table_outputs_length_mismatch, table_axis_duplicate_name, table_outputs_duplicate_name) are load-time table-well-formedness checks this binding does not perform, and a constant for a code nothing raises would advertise a diagnostic it cannot report. —
CodeTableInterpolationAxesMismatch
constant · canonical name code_table_interpolation_axes_mismatch
const CodeTableInterpolationAxesMismatch = "table_interpolation_axes_mismatch"
CodeTableInterpolationAxesMismatch: interpolation and the axis count disagree — linear and nearest require 1 axis, bilinear 2.
— Diagnostic codes: §9.5 sampled function tables — the §9.5.3 table_lookup lowering (raised via newTableLookupError from lower_table_lookup.go).
A CROSS-BINDING vocabulary: every binding raises these same strings from its own §9.5.3 lowering, so they belong in the shared registry rather than beside the pass. Only the codes THIS binding actually emits are declared — the remaining §9.5.5 codes (table_axis_non_monotonic, table_data_nan, table_outputs_length_mismatch, table_axis_duplicate_name, table_outputs_duplicate_name) are load-time table-well-formedness checks this binding does not perform, and a constant for a code nothing raises would advertise a diagnostic it cannot report. —
CodeTableLookupAxisNameMismatch
constant · canonical name code_table_lookup_axis_name_mismatch
const CodeTableLookupAxisNameMismatch = "table_lookup_axis_name_mismatch"
CodeTableLookupAxisNameMismatch: the key set of table_lookup.axes does not match the axis names the referenced table declares — or the node carries positional args, which §9.5.2 requires to be empty.
— Diagnostic codes: §9.5 sampled function tables — the §9.5.3 table_lookup lowering (raised via newTableLookupError from lower_table_lookup.go).
A CROSS-BINDING vocabulary: every binding raises these same strings from its own §9.5.3 lowering, so they belong in the shared registry rather than beside the pass. Only the codes THIS binding actually emits are declared — the remaining §9.5.5 codes (table_axis_non_monotonic, table_data_nan, table_outputs_length_mismatch, table_axis_duplicate_name, table_outputs_duplicate_name) are load-time table-well-formedness checks this binding does not perform, and a constant for a code nothing raises would advertise a diagnostic it cannot report. —
CodeTableLookupOutputOutOfRange
constant · canonical name code_table_lookup_output_out_of_range
const CodeTableLookupOutputOutOfRange = "table_lookup_output_out_of_range"
CodeTableLookupOutputOutOfRange: table_lookup.output selects no output of the referenced table — an index past len(outputs) (or past 0 for a single-output table), a name absent from outputs, or a non-integer / non-string selector.
— Diagnostic codes: §9.5 sampled function tables — the §9.5.3 table_lookup lowering (raised via newTableLookupError from lower_table_lookup.go).
A CROSS-BINDING vocabulary: every binding raises these same strings from its own §9.5.3 lowering, so they belong in the shared registry rather than beside the pass. Only the codes THIS binding actually emits are declared — the remaining §9.5.5 codes (table_axis_non_monotonic, table_data_nan, table_outputs_length_mismatch, table_axis_duplicate_name, table_outputs_duplicate_name) are load-time table-well-formedness checks this binding does not perform, and a constant for a code nothing raises would advertise a diagnostic it cannot report. —
CodeTableLookupUnknownTable
constant · canonical name code_table_lookup_unknown_table
const CodeTableLookupUnknownTable = "table_lookup_unknown_table"
CodeTableLookupUnknownTable: a table_lookup names no table, or one the document’s function_tables block does not declare.
— Diagnostic codes: §9.5 sampled function tables — the §9.5.3 table_lookup lowering (raised via newTableLookupError from lower_table_lookup.go).
A CROSS-BINDING vocabulary: every binding raises these same strings from its own §9.5.3 lowering, so they belong in the shared registry rather than beside the pass. Only the codes THIS binding actually emits are declared — the remaining §9.5.5 codes (table_axis_non_monotonic, table_data_nan, table_outputs_length_mismatch, table_axis_duplicate_name, table_outputs_duplicate_name) are load-time table-well-formedness checks this binding does not perform, and a constant for a code nothing raises would advertise a diagnostic it cannot report. —
CodeTableOutOfBoundsUnsupported
constant · canonical name code_table_out_of_bounds_unsupported
const CodeTableOutOfBoundsUnsupported = "table_out_of_bounds_unsupported"
CodeTableOutOfBoundsUnsupported: the referenced table declares out_of_bounds: "error", which this binding does not implement. Per esm-spec §9.5.3a the lookup is REFUSED at the point it would otherwise lower — answering it under the "clamp" mode the binding does have would return a number the author did not ask for with nothing in the result to say so. The document still LOADS and still round-trips; it simply does not evaluate.
— Diagnostic codes: §9.5 sampled function tables — the §9.5.3 table_lookup lowering (raised via newTableLookupError from lower_table_lookup.go).
A CROSS-BINDING vocabulary: every binding raises these same strings from its own §9.5.3 lowering, so they belong in the shared registry rather than beside the pass. Only the codes THIS binding actually emits are declared — the remaining §9.5.5 codes (table_axis_non_monotonic, table_data_nan, table_outputs_length_mismatch, table_axis_duplicate_name, table_outputs_duplicate_name) are load-time table-well-formedness checks this binding does not perform, and a constant for a code nothing raises would advertise a diagnostic it cannot report. —
CodeTemplateBodyExpansionTooDeep
constant · canonical name code_template_body_expansion_too_deep
const CodeTemplateBodyExpansionTooDeep = "template_body_expansion_too_deep"
CodeTemplateBodyExpansionTooDeep: nested template application exceeded the expansion depth budget — the non-cyclic guard against unbounded growth.
— Diagnostic codes: §9.6 expression templates — declaration, application and body expansion (raised via newETErr from lower_expression_templates.go, out_of_line_templates.go and template_compose.go). —
CodeTemplateBodyReferencesCouplingRewrittenVariable
constant · canonical name code_template_body_references_coupling_rewritten_variable
const CodeTemplateBodyReferencesCouplingRewrittenVariable = "template_body_references_coupling_rewritten_variable"
CodeTemplateBodyReferencesCouplingRewrittenVariable: a SURVIVING registry body names a variable a coupling rule rewrote out of the flattened equations — a variable_map’s substituted target, or a spelling an operator_compose renaming match deleted (esm-spec §9.6.4, CONFORMANCE_SPEC §5.35). The body is authored source no equation walk reaches, and it expands at the BUILD boundary, so it is REFUSED rather than resolved: rewriting it would silently diverge from the expand-at-load image of the same document.
— Diagnostic codes: §9.6 expression templates — declaration, application and body expansion (raised via newETErr from lower_expression_templates.go, out_of_line_templates.go and template_compose.go). —
CodeTemplateConstraintUnknownIndexSet
constant · canonical name code_template_constraint_unknown_index_set
const CodeTemplateConstraintUnknownIndexSet = "template_constraint_unknown_index_set"
CodeTemplateConstraintUnknownIndexSet: a template’s constraints entry names an index set absent from the document index_sets registry.
— Diagnostic codes: §9.6 expression templates — declaration, application and body expansion (raised via newETErr from lower_expression_templates.go, out_of_line_templates.go and template_compose.go). —
CodeTemplateImportCycle
constant · canonical name code_template_import_cycle
const CodeTemplateImportCycle = "template_import_cycle"
— Diagnostic codes: §9.7 template imports / §9.6.6 metaparameters (raised via newETErr from template_imports.go and subsystem_ref.go). —
CodeTemplateImportIndexSetConflict
constant · canonical name code_template_import_index_set_conflict
const CodeTemplateImportIndexSetConflict = "template_import_index_set_conflict"
CodeTemplateImportIndexSetConflict: a merged index_sets name collides with a non-deep-equal definition (esm-spec §9.7.5). This binding does not raise it yet; the constant exists because the §9.6.6 table is cross-language uniform.
— Diagnostic codes: §9.7 template imports / §9.6.6 metaparameters (raised via newETErr from template_imports.go and subsystem_ref.go). —
CodeTemplateImportIsCouplingLibrary
constant · canonical name code_template_import_is_coupling_library
const CodeTemplateImportIsCouplingLibrary = "template_import_is_coupling_library"
CodeTemplateImportIsCouplingLibrary: a template import resolves to a COUPLING library (§10.9). The two library kinds are imported through different blocks and are not interchangeable.
— Diagnostic codes: §9.7 template imports / §9.6.6 metaparameters (raised via newETErr from template_imports.go and subsystem_ref.go). —
CodeTemplateImportNameConflict
constant · canonical name code_template_import_name_conflict
const CodeTemplateImportNameConflict = "template_import_name_conflict"
— Diagnostic codes: §9.7 template imports / §9.6.6 metaparameters (raised via newETErr from template_imports.go and subsystem_ref.go). —
CodeTemplateImportNotLibrary
constant · canonical name code_template_import_not_library
const CodeTemplateImportNotLibrary = "template_import_not_library"
CodeTemplateImportNotLibrary: an import resolves to a file that is not a template library (it declares components, or declares no expression_templates / coupling_roles block at all).
— Diagnostic codes: §9.7 template imports / §9.6.6 metaparameters (raised via newETErr from template_imports.go and subsystem_ref.go). —
CodeTemplateImportRebindUnknownName
constant · canonical name code_template_import_rebind_unknown_name
const CodeTemplateImportRebindUnknownName = "template_import_rebind_unknown_name"
CodeTemplateImportRebindUnknownName: a rebind key names no metaparameter the imported library declares.
— Diagnostic codes: §9.7 template imports / §9.6.6 metaparameters (raised via newETErr from template_imports.go and subsystem_ref.go). —
CodeTemplateImportRenameCollision
constant · canonical name code_template_import_rename_collision
const CodeTemplateImportRenameCollision = "template_import_rename_collision"
CodeTemplateImportRenameCollision: a rename target collides with a name already in scope (another import’s export, or a local declaration).
— Diagnostic codes: §9.7 template imports / §9.6.6 metaparameters (raised via newETErr from template_imports.go and subsystem_ref.go). —
CodeTemplateImportRenameInvalid
constant · canonical name code_template_import_rename_invalid
const CodeTemplateImportRenameInvalid = "template_import_rename_invalid"
CodeTemplateImportRenameInvalid: an import’s rename / rebind entry is malformed — not an object, or an entry whose key or value is not a non-empty string.
— Diagnostic codes: §9.7 template imports / §9.6.6 metaparameters (raised via newETErr from template_imports.go and subsystem_ref.go). —
CodeTemplateImportRenameUnknownName
constant · canonical name code_template_import_rename_unknown_name
const CodeTemplateImportRenameUnknownName = "template_import_rename_unknown_name"
CodeTemplateImportRenameUnknownName: a rename key names nothing the imported library exports.
— Diagnostic codes: §9.7 template imports / §9.6.6 metaparameters (raised via newETErr from template_imports.go and subsystem_ref.go). —
CodeTemplateImportUnknownName
constant · canonical name code_template_import_unknown_name
const CodeTemplateImportUnknownName = "template_import_unknown_name"
— Diagnostic codes: §9.7 template imports / §9.6.6 metaparameters (raised via newETErr from template_imports.go and subsystem_ref.go). —
CodeTemplateImportUnresolved
constant · canonical name code_template_import_unresolved
const CodeTemplateImportUnresolved = "template_import_unresolved"
— Diagnostic codes: §9.7 template imports / §9.6.6 metaparameters (raised via newETErr from template_imports.go and subsystem_ref.go). —
CodeTemplateImportVersionTooOld
constant · canonical name code_template_import_version_too_old
const CodeTemplateImportVersionTooOld = "template_import_version_too_old"
CodeTemplateImportVersionTooOld: a file declaring esm < 0.8.0 carries expression_template_imports, top-level expression_templates, or metaparameters (esm-spec §9.6.5).
— Diagnostic codes: §9.7 template imports / §9.6.6 metaparameters (raised via newETErr from template_imports.go and subsystem_ref.go). —
CodeTemplateInjectTargetNotComponent
constant · canonical name code_template_inject_target_not_component
const CodeTemplateInjectTargetNotComponent = "template_inject_target_not_component"
CodeTemplateInjectTargetNotComponent: an injection target resolves to something that is not an injectable component.
— Diagnostic codes: §9.7 template imports / §9.6.6 metaparameters (raised via newETErr from template_imports.go and subsystem_ref.go). —
CodeTemplateInjectTargetUnknown
constant · canonical name code_template_inject_target_unknown
const CodeTemplateInjectTargetUnknown = "template_inject_target_unknown"
CodeTemplateInjectTargetUnknown: an injection target names a component the document does not declare.
— Diagnostic codes: §9.7 template imports / §9.6.6 metaparameters (raised via newETErr from template_imports.go and subsystem_ref.go). —
CodeTemplateLibraryIllegalPayload
constant · canonical name code_template_library_illegal_payload
const CodeTemplateLibraryIllegalPayload = "template_library_illegal_payload"
CodeTemplateLibraryIllegalPayload: a document carries top-level expression_templates beside models / reaction_systems / data_sources / coupling / domain, which a template-library file never declares (esm-spec §9.7.1).
— Diagnostic codes: §9.7 template imports / §9.6.6 metaparameters (raised via newETErr from template_imports.go and subsystem_ref.go). —
CodeUndefinedIndexSet
constant · canonical name code_undefined_index_set
const CodeUndefinedIndexSet = "undefined_index_set"
CodeUndefinedIndexSet: an aggregate ranges entry {from: NAME} names an index set that is not a key of the document index_sets registry. No implicit interval is inferred for an undeclared name (RFC §5.2).
validate_static_checks.go holds static-validation checks for defects that are decidable from the SINGLE document (no evaluator, no solver, no other file). Their pinned (code, path) tuples live in tests/invalid/expected_errors.json, and these checks make Go’s Validate reject each with exactly that pin:
- join_key_invalid_type — an aggregate value-equality join whose key column draws from a categorical index set with a float or null member.
- domain_unit_mismatch — an identity variable_map coupling whose from/to variables carry declared, non-empty, DIFFERENT units.
- relational_node_in_continuous — a distinct/bool_and_or aggregate whose key/expr reads a STATE variable (value-invention in a continuous context).
- undefined_index_set — an aggregate
rangesentry{from: NAME}naming a set absent from the documentindex_setsregistry.
Every finding is emitted at the CONTAINING EXPRESSION FIELD (/models/M/equations/i/lhs or /rhs, or /coupling/i) — the same pointer convention the reference-integrity findings use.
CodeUnevaluableOperator
constant · canonical name code_unevaluable_operator
const CodeUnevaluableOperator = "unevaluable_operator"
CodeUnevaluableOperator: evaluation reached an op that IS in the esm-spec §4.2 evaluable core but that this evaluator has no rule for (esm-spec §9.6.6): an array/query or value-invention op, or an enum that should have been lowered at load. The complement of CodeUnloweredOperator.
— Diagnostic codes: expression EVALUATION (EvaluationError, raised from expression.go). unlowered_operator is a cross-binding wire code — Julia and TypeScript emit exactly this string — so it belongs in the registry rather than at the call site. —
CodeUnknownClosedFunction
constant · canonical name code_unknown_closed_function
const CodeUnknownClosedFunction = "unknown_closed_function"
CodeUnknownClosedFunction: an fn node names a function outside the closed registry.
— Diagnostic codes: §9.2 closed-function registry (raised via newClosedFunctionError from registered_functions.go). —
CodeUnknownEnum
constant · canonical name code_unknown_enum
const CodeUnknownEnum = "unknown_enum"
CodeUnknownEnum: an enum node names an enum the file does not declare.
— Diagnostic codes: §9.3 enum lowering (raised via newEnumLoweringError from lower_enums.go). —
CodeUnknownEnumSymbol
constant · canonical name code_unknown_enum_symbol
const CodeUnknownEnumSymbol = "unknown_enum_symbol"
CodeUnknownEnumSymbol: an enum node names a symbol its enum does not declare.
— Diagnostic codes: §9.3 enum lowering (raised via newEnumLoweringError from lower_enums.go). —
CodeUnknownExpressionType
constant · canonical name code_unknown_expression_type
const CodeUnknownExpressionType = "unknown_expression_type"
— Diagnostic codes: structural validation, peers of the Error* block above. —
CodeUnloweredOperator
constant · canonical name code_unlowered_operator
const CodeUnloweredOperator = "unlowered_operator"
CodeUnloweredOperator: evaluation reached a rewrite-target op — one OUTSIDE the esm-spec §4.2 evaluable core (a spatial or right-hand-side D, grad, a user op) — that no rewrite rule eliminated.
— Diagnostic codes: expression EVALUATION (EvaluationError, raised from expression.go). unlowered_operator is a cross-binding wire code — Julia and TypeScript emit exactly this string — so it belongs in the registry rather than at the call site. —
CodeUnresolvedSubsystemRef
constant · canonical name code_unresolved_subsystem_ref
const CodeUnresolvedSubsystemRef = "unresolved_subsystem_ref"
CodeUnresolvedSubsystemRef: a subsystem ref names a file that does not exist / is not readable, or that was never resolved before validation.
— Diagnostic codes: §4.7 subsystem refs. Shared with the structural validator, which reports the same two conditions for a document whose refs were never resolved (tests/invalid/subsystem_ref_not_found.esm, subsystem_ref_ambiguous.esm; the names are pinned by tests/invalid/expected_errors.json). —
CodeUnsupportedConstruct
constant · canonical name code_unsupported_construct
const CodeUnsupportedConstruct = "unsupported_construct"
CodeUnsupportedConstruct: a continuous or discrete event, or an implicit equation, reached an evaluator that cannot run it (esm-spec §9.6.6). Go does not simulate, so it never raises this; the constant keeps the §9.6.6 vocabulary uniform.
— Diagnostic codes: expression EVALUATION (EvaluationError, raised from expression.go). unlowered_operator is a cross-binding wire code — Julia and TypeScript emit exactly this string — so it belongs in the registry rather than at the call site. —
CodeValidationFailed
constant · canonical name code_validation_failed
const CodeValidationFailed = "validation_failed"
— Diagnostic codes: structural validation, peers of the Error* block above. —
ComponentAdjacency
type · canonical name component_adjacency
type ComponentAdjacency struct {
Neighbor ComponentNode
Edge CouplingEdge
}
ComponentAdjacency is one entry returned by ComponentGraph.Adjacency: a neighbouring component node and the coupling edge that reaches it.
ComponentCounts
type · canonical name component_counts
type ComponentCounts struct {
VarCount int `json:"var_count"`
EqCount int `json:"eq_count"`
SpeciesCount int `json:"species_count"`
}
ComponentCounts is a component node’s summary metadata (esm-libraries-spec §4.8.1). Exactly three counts are defined, and they mean different things for the two component types:
- a MODEL carries VarCount = len(variables), EqCount = len(equations) and SpeciesCount = 0;
- a REACTION SYSTEM carries VarCount = len(parameters), EqCount = len(reactions) — the reaction count IS the equation count, there is no fourth field — and SpeciesCount = len(species). The schema forbids a
variablesfield on a reaction system and SpeciesCount already carries the species, soparametersis the only thing left for §4.8.1’s “variable count” to mean — and it is the exact analogue of a model’svariables, which likewise counts unknowns and parameters together.
ComponentGraphFromFile
function · canonical name component_graph_from_file
func ComponentGraphFromFile(file *ESMFile) *ComponentGraph
ComponentGraphFromFile creates a component graph from an ESM file.
Models and reaction systems are visited in sorted key order: ranging over the maps directly made the node and edge lists differ run to run, which is not a conformance failure (order is not pinned) but does make every rendered or diffed export nondeterministic.
Connector
type · canonical name connector
type Connector struct {
Equations []ConnectorEquation `json:"equations"`
}
Connector represents the connector system for couple coupling
ConnectorEquation
type · canonical name connector_equation
type ConnectorEquation struct {
From string `json:"from"`
To string `json:"to"`
Transform string `json:"transform"` // "additive", "multiplicative", "replacement"
// Expression is OPTIONAL: esm-schema.json `$defs/ConnectorEquation` requires
// only from/to/transform. Without `omitempty` the nil interface emitted
// `"expression": null` into every connector equation authored without one —
// an ADDED key, so a load → save did not just lose content, it invented it.
Expression Expression `json:"expression,omitempty"`
}
ConnectorEquation represents a single equation in a connector
CouplingKind
type · canonical name coupling_kind
type CouplingKind string
CouplingKind identifies the kind of coupling a component-graph edge represents.
CouplingKindCouple
constant · canonical name coupling_kind_couple
const CouplingKindCouple CouplingKind = "couple"
CouplingKindCouple marks an edge built from a couple coupling entry (esm-spec §10.1, §10.3): the two systems are joined through explicit connector equations.
CouplingKindOperatorCompose
constant · canonical name coupling_kind_operator_compose
const CouplingKindOperatorCompose CouplingKind = "operator_compose"
CouplingKindOperatorCompose marks an edge built from an operator_compose coupling entry (esm-spec §10.1): matching time derivatives are identified and their right-hand sides added together.
CouplingKindVariableMap
constant · canonical name coupling_kind_variable_map
const CouplingKindVariableMap CouplingKind = "variable_map"
CouplingKindVariableMap marks an edge built from a variable_map coupling entry (esm-spec §10.1, §10.4): a parameter in one system is replaced by a variable from another, or by an expression computed from it.
DataSourceExtent
type · canonical name data_source_extent
type DataSourceExtent struct {
Metaparameter string `json:"metaparameter"`
}
DataSourceExtent binds a source’s delivered record count to a metaparameter (esm-spec 8.9.4).
DataSourceRecordFilter
type · canonical name data_source_record_filter
type DataSourceRecordFilter struct {
RequireFinite []string `json:"require_finite,omitempty"`
}
DataSourceRecordFilter names the file variables whose value must be finite for a record of a points source to be delivered (esm-spec 8.9.3).
DefaultIndepVar
constant · canonical name default_indep_var
const DefaultIndepVar = "t"
— Spec default: the independent variable when Domain.IndependentVariable is unset (esm-spec §11; dae.go defaults to this). —
DetailedValidationResult
type · canonical name detailed_validation_result
type DetailedValidationResult struct {
Valid bool `json:"valid"`
Messages []ValidationMessage `json:"messages,omitempty"`
}
DetailedValidationResult holds the legacy (message-oriented) validation results returned by ValidateStructural. New callers should prefer Validate (or ValidateText for unparsed JSON), which returns the code-bearing ValidationResult.
DiagnosticError
error · canonical name diagnostic_error
type DiagnosticError interface {
error
DiagnosticCode() string
}
DiagnosticError is implemented by the package’s code-bearing error types (EvaluationError, ExpressionTemplateError, RuleEngineError, EnumLoweringError, ClosedFunctionError, CoupleMultiplicativeNoTendencyError, tableLookupError, OperatorComposeNoMergeError, OperatorComposeAmbiguousBareNameError, OperatorComposeRequireMatchError). It lets a caller recover the stable diagnostic code from any of them uniformly — errors.As(err, &de) then de.DiagnosticCode() — without switching over the concrete types. All ten render Error() in the shared “
\[code\]message” form.
Dimensionless
constant · canonical name dimensionless
var Dimensionless = Dimension{}
Dimensionless is the zero vector.
DistributionLognormal
constant · canonical name distribution_lognormal
const DistributionLognormal = "lognormal"
Distribution kind literals (esm-spec 6.3).
DistributionNormal
constant · canonical name distribution_normal
const DistributionNormal = "normal"
Distribution kind literals (esm-spec 6.3).
DistributionUniform
constant · canonical name distribution_uniform
const DistributionUniform = "uniform"
Distribution kind literals (esm-spec 6.3).
EdgeKindFromFAQ
constant · canonical name edge_kind_from_faq
const EdgeKindFromFAQ EdgeKind = "from_faq"
EdgeKindFromFAQ: kind:"derived" index set → the node that materializes it (from_faq).
EdgeKindJoinFactor
constant · canonical name edge_kind_join_factor
const EdgeKindJoinFactor EdgeKind = "join_factor"
EdgeKindJoinFactor: aggregate node → a factor named by join.on.
EdgeKindRangeFrom
constant · canonical name edge_kind_range_from
const EdgeKindRangeFrom EdgeKind = "range_from"
EdgeKindRangeFrom: aggregate node → the index set it iterates (ranges[*].from).
EmitReferencePreserving
function · canonical name emit_reference_preserving
func EmitReferencePreserving(jsonStr, basePath string, metaparameters map[string]int64) (string, error)
EmitReferencePreserving loads jsonStr under Option B and emits the canonical, self-contained reference-preserving document (esm-spec §9.6.4 rule 5, §9.6.7): surviving call sites verbatim, materialized template registries, imports consumed, esm: 0.9.0 version stamp. The byte-identity cross-binding surface — output is byte-identical to the Julia-generated emitted.esm goldens.
EquationBalance
type · canonical name equation_balance
type EquationBalance struct {
// Unknowns are the model's declared unknowns, sorted. (Declaration order is
// what the shared corpus's `details` happens to show, but Go's variable map
// does not preserve it, so this list is sorted for determinism. The pin
// contract compares (code, path) pairs, not details.)
Unknowns []string
// Equations is the number of entries in the model's `equations` block.
Equations int
// MissingEquationsFor names the unknowns that no equation LHS credits — the
// diagnostic detail that preserves the discriminating power of the removed
// `missing_observed_expr`, since it names exactly the unknowns that code used
// to name.
MissingEquationsFor []string
// ExtraEquationsFor names non-unknown targets an equation LHS credits.
ExtraEquationsFor []string
}
EquationBalance is the outcome of the esm-spec §4.9.4 balance check.
ErrCanonicalDivByZero
error · canonical name err_canonical_div_by_zero
var ErrCanonicalDivByZero = errors.New("E_CANONICAL_DIVBY_ZERO")
Error codes per discretization RFC §5.4.6 / §5.4.7.
ErrCanonicalNonFinite
error · canonical name err_canonical_non_finite
var ErrCanonicalNonFinite = errors.New("E_CANONICAL_NONFINITE")
Error codes per discretization RFC §5.4.6 / §5.4.7.
ErrCanonicalUnsupportedField
error · canonical name err_canonical_unsupported_field
var ErrCanonicalUnsupportedField = errors.New("E_CANONICAL_UNSUPPORTED_FIELD")
ErrCanonicalUnsupportedField is returned by CanonicalJSON when a node carries a set field outside the closed emissible set {op,args,wrt,dim,fn,name,value} (arg/bindings tolerated) — the node has no faithful canonical JSON in the pinned encoding. Matches the Julia reference’s E_CANONICAL_UNSUPPORTED_FIELD (see canonicalize.jl).
Error codes per discretization RFC §5.4.6 / §5.4.7.
ErrorArrayDefaultWithoutShape
constant · canonical name error_array_default_without_shape
const ErrorArrayDefaultWithoutShape = "array_default_without_shape"
ErrorArrayDefaultWithoutShape is inline array data as the default of a variable that declares no shape (esm-spec §6.3). Inline array data is a SHAPED variable’s value, so with no shape there is nothing for the array to fill (tests/invalid/array_default_without_shape.esm).
— Diagnostic codes: structural validation, per ESM Libraries Spec Section 3.4. The names and values are pinned by tests/invalid/expected_errors.json. —
ErrorAssertionRankMismatch
constant · canonical name error_assertion_rank_mismatch
const ErrorAssertionRankMismatch = "assertion_rank_mismatch"
ErrorAssertionRankMismatch is an assertion whose form does not match the declared rank of the variable it names (esm-spec §6.6.5): pointwise on a shaped variable, or coords / reduce on a scalar one (tests/invalid/assertion_rank_mismatch_*.esm).
— Diagnostic codes: structural validation, per ESM Libraries Spec Section 3.4. The names and values are pinned by tests/invalid/expected_errors.json. —
ErrorCircularDependency
constant · canonical name error_circular_dependency
const ErrorCircularDependency = "circular_dependency"
ErrorCircularDependency is a cycle in the cross-model reference graph: ModelA’s equations reference ModelB’s variables and vice versa (tests/invalid/circular_coupling.esm).
— Diagnostic codes: structural validation, per ESM Libraries Spec Section 3.4. The names and values are pinned by tests/invalid/expected_errors.json. —
ErrorDataSourceUndefined
constant · canonical name error_data_source_undefined
const ErrorDataSourceUndefined = "data_source_undefined"
ErrorDataSourceUndefined is raised when a parameter’s update.source names no declared data_sources entry (esm-spec §8.5).
— Diagnostic codes: structural validation, per ESM Libraries Spec Section 3.4. The names and values are pinned by tests/invalid/expected_errors.json. —
ErrorEquationCountMismatch
constant · canonical name error_equation_count_mismatch
const ErrorEquationCountMismatch = "equation_count_mismatch"
— Diagnostic codes: structural validation, per ESM Libraries Spec Section 3.4. The names and values are pinned by tests/invalid/expected_errors.json. —
ErrorEquationDefinesParameter
constant · canonical name error_equation_defines_parameter
const ErrorEquationDefinesParameter = "equation_defines_parameter"
ErrorEquationDefinesParameter is raised when an equation’s left-hand side names a PARAMETER — bare, indexed, inside a faq, or through a scoped reference into a subsystem (esm-spec §6.3.1). An equation defines unknowns only.
— Diagnostic codes: structural validation, per ESM Libraries Spec Section 3.4. The names and values are pinned by tests/invalid/expected_errors.json. —
ErrorEventAffectsParameter
constant · canonical name error_event_affects_parameter
const ErrorEventAffectsParameter = "event_affects_parameter"
ErrorEventAffectsParameter is raised when an event affects LHS names a PARAMETER. From esm 1.0.0 events affect unknowns only: a parameter that changes during a run carries its own update block (esm-spec §5.4), so there is no discrete_parameters list to be missing from and the write is wrong outright rather than wrong-unless-declared.
— Diagnostic codes: structural validation, per ESM Libraries Spec Section 3.4. The names and values are pinned by tests/invalid/expected_errors.json. —
ErrorEventVarUndeclared
constant · canonical name error_event_var_undeclared
const ErrorEventVarUndeclared = "event_var_undeclared"
— Diagnostic codes: structural validation, per ESM Libraries Spec Section 3.4. The names and values are pinned by tests/invalid/expected_errors.json. —
ErrorICInReactionSystem
constant · canonical name error_ic_in_reaction_system
const ErrorICInReactionSystem = "ic_in_reaction_system"
— Diagnostic codes: structural validation, per ESM Libraries Spec Section 3.4. The names and values are pinned by tests/invalid/expected_errors.json. —
ErrorNullReaction
constant · canonical name error_null_reaction
const ErrorNullReaction = "null_reaction"
— Diagnostic codes: structural validation, per ESM Libraries Spec Section 3.4. The names and values are pinned by tests/invalid/expected_errors.json. —
ErrorReservedVariableName
constant · canonical name error_reserved_variable_name
const ErrorReservedVariableName = "reserved_variable_name"
ErrorReservedVariableName is a DECLARATION — a variables key, a species, or a reaction parameter — spelled with a globally-scoped name: the document’s independent variable (domain.independent_variable, default “t”) or the §6.4 _var placeholder (esm-spec §4.9.1.1). Both are in scope in every component and are resolved BY NAME ahead of the declaration maps — creditIndependentVariable below is exactly that precedence — so the declaration is unreachable and every reader silently receives the implicit symbol instead of the declared quantity. Hard error: the document that reported this (issue #200) validated clean and then read the simulation clock in place of a fuel time-lag constant. (tests/invalid/reserved_variable_name_*.esm).
— Diagnostic codes: structural validation, per ESM Libraries Spec Section 3.4. The names and values are pinned by tests/invalid/expected_errors.json. —
ErrorSystemKindMismatch
constant · canonical name error_system_kind_mismatch
const ErrorSystemKindMismatch = "system_kind_mismatch"
ErrorSystemKindMismatch is raised when a model’s declared system_kind contradicts the esm-spec §6.3.1 derivation.
— Diagnostic codes: structural validation, per ESM Libraries Spec Section 3.4. The names and values are pinned by tests/invalid/expected_errors.json. —
ErrorUnboundIndexSymbol
constant · canonical name error_unbound_index_symbol
const ErrorUnboundIndexSymbol = "unbound_index_symbol"
ErrorUnboundIndexSymbol is raised when a string subscript of an index on an equation’s left-hand side names no declared variable or metaparameter and no faq binds it (esm-spec §6.3.1).
— Diagnostic codes: structural validation, per ESM Libraries Spec Section 3.4. The names and values are pinned by tests/invalid/expected_errors.json. —
ErrorUndefinedOperator
constant · canonical name error_undefined_operator
const ErrorUndefinedOperator = "undefined_operator"
— Diagnostic codes: structural validation, per ESM Libraries Spec Section 3.4. The names and values are pinned by tests/invalid/expected_errors.json. —
ErrorUndefinedParameter
constant · canonical name error_undefined_parameter
const ErrorUndefinedParameter = "undefined_parameter"
ErrorUndefinedParameter is reserved for a future undeclared-parameter diagnostic; no check emits it yet (kept for cross-binding code parity).
— Diagnostic codes: structural validation, per ESM Libraries Spec Section 3.4. The names and values are pinned by tests/invalid/expected_errors.json. —
ErrorUndefinedSpecies
constant · canonical name error_undefined_species
const ErrorUndefinedSpecies = "undefined_species"
— Diagnostic codes: structural validation, per ESM Libraries Spec Section 3.4. The names and values are pinned by tests/invalid/expected_errors.json. —
ErrorUndefinedSystem
constant · canonical name error_undefined_system
const ErrorUndefinedSystem = "undefined_system"
— Diagnostic codes: structural validation, per ESM Libraries Spec Section 3.4. The names and values are pinned by tests/invalid/expected_errors.json. —
ErrorUndefinedVariable
constant · canonical name error_undefined_variable
const ErrorUndefinedVariable = "undefined_variable"
— Diagnostic codes: structural validation, per ESM Libraries Spec Section 3.4. The names and values are pinned by tests/invalid/expected_errors.json. —
ErrorUnitInconsistency
constant · canonical name error_unit_inconsistency
const ErrorUnitInconsistency = "unit_inconsistency"
— Diagnostic codes: structural validation, per ESM Libraries Spec Section 3.4. The names and values are pinned by tests/invalid/expected_errors.json. —
ErrorUnitParseError
constant · canonical name error_unit_parse_error
const ErrorUnitParseError = "unit_parse_error"
ErrorUnitParseError is a declared unit string that denotes no real unit (“not_a_unit”). It is a defect in the FILE — a hard error, distinct from unit_inconsistency (a provable dimensional mismatch between two resolvable units) — and is the code the shared corpus pins for tests/invalid/unparseable_unit.esm.
— Diagnostic codes: structural validation, per ESM Libraries Spec Section 3.4. The names and values are pinned by tests/invalid/expected_errors.json. —
ErrorUnknownOverrideKey
constant · canonical name error_unknown_override_key
const ErrorUnknownOverrideKey = "unknown_override_key"
ErrorUnknownOverrideKey is an inline test’s initial_conditions or parameter_overrides key that matches no declared name under the esm-spec §6.6.2 override-key rules (tests/invalid/unknown_override_key_*.esm).
— Diagnostic codes: structural validation, per ESM Libraries Spec Section 3.4. The names and values are pinned by tests/invalid/expected_errors.json. —
ErrorUnresolvedScopedRef
constant · canonical name error_unresolved_scoped_ref
const ErrorUnresolvedScopedRef = "unresolved_scoped_ref"
— Diagnostic codes: structural validation, per ESM Libraries Spec Section 3.4. The names and values are pinned by tests/invalid/expected_errors.json. —
EvaluationError
error · canonical name evaluation_error
type EvaluationError struct {
Code string
Message string
}
func (e *EvaluationError) DiagnosticCode() string
func (e *EvaluationError) Error() string
EvaluationError is raised by the scalar evaluator when an expression cannot be evaluated. The Code field carries a stable diagnostic code — in particular unlowered_operator when a rewrite-target op (a spatial/RHS D, or grad/div/laplacian/integral sugar) reaches evaluation without having been lowered to a stencil by a rewrite rule (esm-spec §4.2 / §9.6.8). The gate fires before evaluation, not at load: loading such a file stays permissive.
Methods
func (e *EvaluationError) DiagnosticCode() string
DiagnosticCode returns the stable diagnostic code (DiagnosticError).
func (e *EvaluationError) Error() string
EventCoupling
type · canonical name event_coupling
type EventCoupling struct {
Type string `json:"type"` // "event"
EventType string `json:"event_type"` // "continuous" or "discrete"
Name string `json:"name"`
Conditions []Expression `json:"conditions,omitempty"` // for continuous events
Trigger *DiscreteEventTrigger `json:"trigger,omitempty"` // for discrete events
Affects []AffectEquation `json:"affects,omitempty"`
AffectNeg []AffectEquation `json:"affect_neg,omitempty"`
RootFind *string `json:"root_find,omitempty"`
Reinitialize *bool `json:"reinitialize,omitempty"`
Description *string `json:"description,omitempty"`
}
func (e EventCoupling) CouplingType() string
func (ec *EventCoupling) UnmarshalJSON(data []byte) error
EventCoupling represents event-based coupling. Like a model-local event it may affect UNKNOWNS ONLY (event_affects_parameter otherwise, esm-spec 5.4).
Methods
func (e EventCoupling) CouplingType() string
func (ec *EventCoupling) UnmarshalJSON(data []byte) error
Custom JSON unmarshaling for EventCoupling
Expression
type · canonical name expression
type Expression any
Expression represents the union type: number | string | ExprNode In Go, this is handled by using interface{} and custom unmarshaling
ExpressionGraphFromEquation
function · canonical name expression_graph_from_equation
func ExpressionGraphFromEquation(equation Equation) *ExpressionGraph
ExpressionGraphFromEquation creates an expression graph for a single equation (esm-libraries-spec §4.8.2). The equation is numbered 0 and its variables are unscoped.
ExpressionGraphFromExpression
function · canonical name expression_graph_from_expression
func ExpressionGraphFromExpression(expr Expression) *ExpressionGraph
ExpressionGraphFromExpression creates an expression graph for a bare expression (esm-libraries-spec §4.8.2). A synthetic expr_result observed node stands in for the expression’s value, and every free variable feeds it.
ExpressionGraphFromFile
function · canonical name expression_graph_from_file
func ExpressionGraphFromFile(file *ESMFile) *ExpressionGraph
ExpressionGraphFromFile creates an expression graph from an ESM file.
ExpressionGraphFromFileWithOptions
function · canonical name expression_graph_from_file_with_options
func ExpressionGraphFromFileWithOptions(file *ESMFile, opts ExpressionGraphOptions) *ExpressionGraph
ExpressionGraphFromFileWithOptions creates an expression graph from an ESM file, honouring opts.
Every inline model and reaction system is walked, INCLUDING its inline subsystems (recursively): a subsystem’s variables are part of the document’s dependency structure, and omitting them silently truncated the graph. Scoped names compose with a dot; {ref} include stubs are skipped as opaque leaves.
Components are visited in sorted key order so the node and edge lists do not vary run to run.
ExpressionGraphFromModel
function · canonical name expression_graph_from_model
func ExpressionGraphFromModel(model Model, systemName string) *ExpressionGraph
ExpressionGraphFromModel creates an expression graph for a single model, including its inline subsystems. Pass “default” as systemName for a bare target whose nodes should carry unscoped names.
ExpressionGraphFromReaction
function · canonical name expression_graph_from_reaction
func ExpressionGraphFromReaction(reaction Reaction) *ExpressionGraph
ExpressionGraphFromReaction creates an expression graph for a single reaction (esm-libraries-spec §4.8.2). The reaction is numbered 0 and its species are unscoped.
ExpressionGraphFromReactionSystem
function · canonical name expression_graph_from_reaction_system
func ExpressionGraphFromReactionSystem(system ReactionSystem, systemName string) *ExpressionGraph
ExpressionGraphFromReactionSystem creates an expression graph for a single reaction system, including its inline subsystems.
FieldIC
type · canonical name field_ic
type FieldIC struct {
State string
Expr Expression
}
FieldIC is one deferred ic equation (esm-spec §11.4.1) as a (state, expression) pair. An initial condition is a DATUM, not an equation of motion, so these are classified OUT of FlattenedSystem.Equations and reported only here (esm-libraries-spec §4.7.5 step 4).
FlattenedFunctionTable
type · canonical name flattened_function_table
type FlattenedFunctionTable struct {
Name string
Table FunctionTable
}
FlattenedFunctionTable is one entry of the flattened system’s merged function-table registry (esm-spec §9.5), in document order.
FlattenedIndexSet
type · canonical name flattened_index_set
type FlattenedIndexSet struct {
Name string
Set IndexSet
}
FlattenedIndexSet is one entry of the flattened system’s document-scoped index-set registry, in document order.
FlattenedTemplate
type · canonical name flattened_template
type FlattenedTemplate struct {
Name string
Declaration any
}
FlattenedTemplate is one entry of the MERGED expression-template registry (esm-spec §9.6.4 rule 7, §10.7). Declaration is the raw template declaration (params + body, and any sidecar the document carried).
FmtASCII
constant · canonical name fmt_ascii
const FmtASCII = "ascii"
— Render format discriminator (display.go; compared ~50× as a bare string). —
FmtLatex
constant · canonical name fmt_latex
const FmtLatex = "latex"
— Render format discriminator (display.go; compared ~50× as a bare string). —
FmtUnicode
constant · canonical name fmt_unicode
const FmtUnicode = "unicode"
— Render format discriminator (display.go; compared ~50× as a bare string). —
FmtUnicodeSpaced
constant · canonical name fmt_unicode_spaced
const FmtUnicodeSpaced = "unicode_spaced"
FmtUnicodeSpaced is FmtUnicode with the multiplication operator rendered as " · " (spaced) instead of “·”. The spacing is applied where the operator is emitted, so it never touches a “·” occurring inside a variable name or chemical formula.
— Render format discriminator (display.go; compared ~50× as a bare string). —
FromJSON
function · canonical name from_json
func FromJSON(data []byte) (*ESMFile, error)
FromJSON creates an ESM file from JSON data
IndexSet
type · canonical name index_set
type IndexSet struct {
Kind string `json:"kind"`
Size *int `json:"size,omitempty"`
Members []any `json:"members,omitempty"`
FromFAQ *string `json:"from_faq,omitempty"`
Of []string `json:"of,omitempty"`
Offsets *string `json:"offsets,omitempty"`
Values *string `json:"values,omitempty"`
// SizeExpr carries an interval `size` that is still a metaparameter
// EXPRESSION — a bare name like `"N_REC"` or a `{op, args}` tree — rather
// than an integer. Exactly one of Size / SizeExpr is ever set.
//
// It exists because this registry is TYPED where every other binding's is a
// plain dict, and esm-spec §4.7 "Index-set merge" hands it an UNFOLDED size:
// a leaf mounted at a §4.7 edge whose axis is sized by a name only the
// ASSEMBLER declares resolves with that size still symbolic, and the size
// travels up into the mounting document's registry to be closed there
// (§9.7.6 site 5). Decoding that into `Size *int` fails, and it failed as a
// bare `json: cannot unmarshal string` — an anonymous unmarshal error where
// the spec calls for either a resolved axis or a diagnostic. The custom
// codec below routes a non-integer `size` here and writes it back out
// verbatim, so the declaration survives parse -> emit unchanged.
//
// It is deliberately NOT a JSON field of its own: `size` is one wire key
// with two inhabitants, and MarshalJSON re-emits it under that one key.
SizeExpr any `json:"-"`
}
func (s IndexSet) MarshalJSON() ([]byte, error)
func (s *IndexSet) UnmarshalJSON(data []byte) error
IndexSet is one entry in the document-scoped index_sets registry (RFC semiring-faq-unified-ir §5.2): the declaration shape for an iteration domain referenced from a faq range via { “from”: <name> } and from arrayed-variable shape lists. Exactly one of four kinds — each populating its own subset of fields:
- “interval”: a dense \[1..Size\] grid axis (Size required).
- “categorical”: an explicit enumeration (Members required).
- “derived”: materialized from an index-set-producing node named by its id (FromFAQ required).
- “ragged”: a per-parent inner set backed by CSR factors (Of, Offsets, Values required).
The Go binding is schema-only: it stores and round-trips these declarations but does not resolve {from} references or evaluate the sets.
Methods
func (s IndexSet) MarshalJSON() ([]byte, error)
MarshalJSON re-emits an unfolded size under the same size key it was read from, so a symbolic axis round-trips to itself.
func (s *IndexSet) UnmarshalJSON(data []byte) error
UnmarshalJSON decodes an index-set declaration, routing a size that is not an integer literal into SizeExpr (see the field comment). Numbers still land in Size.
IsClosedFunction
function · canonical name is_closed_function
func IsClosedFunction(name string) bool
IsClosedFunction reports whether name is in the v0.3.0 closed registry.
LevelError
constant · canonical name level_error
const LevelError = "error"
LevelError is a document-INVALIDATING finding. It is also the value of an UNSET Level: a StructuralError built without one is an error, which is why isWarning tests for the warning rather than against the error.
— Diagnostic SEVERITY levels: the values StructuralError.Level and ValidationMessage.Level carry on the wire.
These are the last diagnostic vocabulary validate.go still spelled as bare literals after the Error* / Code* blocks moved here, and they are the same kind of thing: a value a consumer compares against, so the string is a contract and belongs beside the codes it qualifies. The values are unchanged.
Only two are emitted. “info” appears in ValidationMessage.Level’s field comment as an admissible value but is produced nowhere, so it gets no constant — a constant for a level nothing raises would advertise a severity this binding cannot report. —
LevelWarning
constant · canonical name level_warning
const LevelWarning = "warning"
LevelWarning is an ADVISORY finding that does not invalidate the document (e.g. duplicate_reaction_species).
— Diagnostic SEVERITY levels: the values StructuralError.Level and ValidationMessage.Level carry on the wire.
These are the last diagnostic vocabulary validate.go still spelled as bare literals after the Error* / Code* blocks moved here, and they are the same kind of thing: a value a consumer compares against, so the string is a contract and belongs beside the codes it qualifies. The values are unchanged.
Only two are emitted. “info” appears in ValidationMessage.Level’s field comment as an admissible value but is produced nowhere, so it gets no constant — a constant for a level nothing raises would advertise a severity this binding cannot report. —
LiftedShape
type · canonical name lifted_shape
type LiftedShape struct {
Name string
Shape []int
}
LiftedShape is the concrete integer grid shape the pointwise spatial lift (esm-spec §10.5) assigned to one lifted state variable.
LoadOption
type · canonical name load_option
type LoadOption func(*loadOptions)
LoadOption configures a LoadPath / LoadString / LoadDocument call.
MaxRewritePasses
constant · canonical name max_rewrite_passes
const MaxRewritePasses = 64
MaxRewritePasses is the maximum number of productive rewrite passes before a file is rejected as non-converging (esm-spec §9.6.3, diagnostic rewrite_rule_nonterminating). Pinned identically across all bindings so the accept/reject decision — and the resulting fixpoint — is byte-identical everywhere.
ModelSummary
function · canonical name model_summary
func ModelSummary(esm *ESMFile) string
ModelSummary returns a structured model summary display showing all models, reaction systems, data loaders, coupling, domain, and solver as specified in Section 6.3
NewCadenceClassifier
function · canonical name new_cadence_classifier
func NewCadenceClassifier(file *ESMFile, model *Model) *CadenceClassifier
NewCadenceClassifier builds the classifier for one model of a document. Pass the whole file so the data update’s source refinement (§5.7.2) can resolve; a nil file is accepted and simply loses that refinement.
NodeKindAlgebraic
constant · canonical name node_kind_algebraic
const NodeKindAlgebraic = "algebraic"
Graph node kinds (esm-libraries-spec §4.8.2).
This is the GRAPH vocabulary, which is COARSER than the §6.3.1 classifier partition the package computes internally: a sampled parameter and a constant parameter are both plain “parameter” here. The classifier names themselves (see RoleSampled / RoleConstant below) are unchanged; only the graph’s node label uses these.
NodeKindBrownian
constant · canonical name node_kind_brownian
const NodeKindBrownian = "brownian"
Graph node kinds (esm-libraries-spec §4.8.2).
This is the GRAPH vocabulary, which is COARSER than the §6.3.1 classifier partition the package computes internally: a sampled parameter and a constant parameter are both plain “parameter” here. The classifier names themselves (see RoleSampled / RoleConstant below) are unchanged; only the graph’s node label uses these.
NodeKindDiscrete
constant · canonical name node_kind_discrete
const NodeKindDiscrete = "discrete"
Graph node kinds (esm-libraries-spec §4.8.2).
This is the GRAPH vocabulary, which is COARSER than the §6.3.1 classifier partition the package computes internally: a sampled parameter and a constant parameter are both plain “parameter” here. The classifier names themselves (see RoleSampled / RoleConstant below) are unchanged; only the graph’s node label uses these.
NodeKindObserved
constant · canonical name node_kind_observed
const NodeKindObserved = "observed"
Graph node kinds (esm-libraries-spec §4.8.2).
This is the GRAPH vocabulary, which is COARSER than the §6.3.1 classifier partition the package computes internally: a sampled parameter and a constant parameter are both plain “parameter” here. The classifier names themselves (see RoleSampled / RoleConstant below) are unchanged; only the graph’s node label uses these.
NodeKindParameter
constant · canonical name node_kind_parameter
const NodeKindParameter = "parameter"
Graph node kinds (esm-libraries-spec §4.8.2).
This is the GRAPH vocabulary, which is COARSER than the §6.3.1 classifier partition the package computes internally: a sampled parameter and a constant parameter are both plain “parameter” here. The classifier names themselves (see RoleSampled / RoleConstant below) are unchanged; only the graph’s node label uses these.
NodeKindSpecies
constant · canonical name node_kind_species
const NodeKindSpecies = "species"
Graph node kinds (esm-libraries-spec §4.8.2).
This is the GRAPH vocabulary, which is COARSER than the §6.3.1 classifier partition the package computes internally: a sampled parameter and a constant parameter are both plain “parameter” here. The classifier names themselves (see RoleSampled / RoleConstant below) are unchanged; only the graph’s node label uses these.
NodeKindState
constant · canonical name node_kind_state
const NodeKindState = "state"
Graph node kinds (esm-libraries-spec §4.8.2).
This is the GRAPH vocabulary, which is COARSER than the §6.3.1 classifier partition the package computes internally: a sampled parameter and a constant parameter are both plain “parameter” here. The classifier names themselves (see RoleSampled / RoleConstant below) are unchanged; only the graph’s node label uses these.
NonEquationIndex
constant · canonical name non_equation_index
const NonEquationIndex = -1
NonEquationIndex is the EquationIndex sentinel for a dependency that does not originate from a positionally-numbered equation or reaction: a coupling variable map folded in by ExpressionGraphOptions.MergeCoupled, and the synthetic expr_result edges of a bare-expression target.
OpConst
constant · canonical name op_const
const OpConst = "const"
inline literal payload node
— Spec enum literal: AST op names used across more than one file (esm-spec §4.2 / §9). applyExpressionTemplateOp already lives in lower_expression_templates.go and is intentionally not redeclared here. —
OpDerivative
constant · canonical name op_derivative
const OpDerivative = "D"
derivative op (structural time derivative, or a spatial rewrite target)
— Spec enum literal: AST op names used across more than one file (esm-spec §4.2 / §9). applyExpressionTemplateOp already lives in lower_expression_templates.go and is intentionally not redeclared here. —
OpEnum
constant · canonical name op_enum
const OpEnum = "enum"
enum symbol (lowered to const at load)
— Spec enum literal: AST op names used across more than one file (esm-spec §4.2 / §9). applyExpressionTemplateOp already lives in lower_expression_templates.go and is intentionally not redeclared here. —
OperatorApplyCoupling
type · canonical name operator_apply_coupling
type OperatorApplyCoupling struct {
Type string `json:"type"` // "operator_apply"
Operator string `json:"operator"`
Description *string `json:"description,omitempty"`
}
func (o OperatorApplyCoupling) CouplingType() string
OperatorApplyCoupling represents operator application
Methods
func (o OperatorApplyCoupling) CouplingType() string
OperatorComposeCoupling
type · canonical name operator_compose_coupling
type OperatorComposeCoupling struct {
Type string `json:"type"` // "operator_compose"
Systems [2]string `json:"systems"`
Translate map[string]any `json:"translate,omitempty"`
Lifting *string `json:"lifting,omitempty"`
// RequireMatch is the entry's MERGE INTENT (esm-libraries-spec §4.7.1
// step 5). TRI-STATE, which is why it is a pointer: nil is NOT false.
//
// nil the author has not said. A zero-merge is then
// CodeOperatorComposeNoMerge, an ERROR (such an entry is
// indistinguishable from one that is absent); a partial merge is a
// warning.
// true the Systems[1] equations are CONTRIBUTIONS and every one must
// land; any shortfall, partial included, is a hard refusal.
// false a standalone-contributing operator, DECLARED. Unmatched equations
// are expected and nothing is reported.
//
// `omitempty` on a pointer drops only nil, so an explicit false survives the
// round trip -- dropping it would silently re-arm the zero-merge refusal on
// every document that opted out.
RequireMatch *bool `json:"require_match,omitempty"`
Description *string `json:"description,omitempty"`
}
func (o OperatorComposeCoupling) CouplingType() string
OperatorComposeCoupling represents operator composition
Methods
func (o OperatorComposeCoupling) CouplingType() string
OpFn
constant · canonical name op_fn
const OpFn = "fn"
closed-registry function call
— Spec enum literal: AST op names used across more than one file (esm-spec §4.2 / §9). applyExpressionTemplateOp already lives in lower_expression_templates.go and is intentionally not redeclared here. —
OpIC
constant · canonical name op_ic
const OpIC = "ic"
initial-condition wrapper
— Spec enum literal: AST op names used across more than one file (esm-spec §4.2 / §9). applyExpressionTemplateOp already lives in lower_expression_templates.go and is intentionally not redeclared here. —
OpMakearray
constant · canonical name op_makearray
const OpMakearray = "makearray"
hyper-rectangular array constructor
— Spec enum literal: AST op names used across more than one file (esm-spec §4.2 / §9). applyExpressionTemplateOp already lives in lower_expression_templates.go and is intentionally not redeclared here. —
OpTableLookup
constant · canonical name op_table_lookup
const OpTableLookup = "table_lookup"
sampled function-table query
— Spec enum literal: AST op names used across more than one file (esm-spec §4.2 / §9). applyExpressionTemplateOp already lives in lower_expression_templates.go and is intentionally not redeclared here. —
ParseCadence
function · canonical name parse_cadence
func ParseCadence(s string) (Cadence, bool)
ParseCadence maps an expect_cadence annotation to its class.
PartialSubstitute
function · canonical name partial_substitute
func PartialSubstitute(expr Expression, bindings map[string]Expression, keepSymbolic []string) (Expression, error)
PartialSubstitute performs substitution but preserves the original structure when possible. This is useful when you want to substitute some variables but keep others as symbolic references.
PropagateDimension
function · canonical name propagate_dimension
func PropagateDimension(expr Expression, env map[string]Unit) (*Unit, error)
PropagateDimension walks an Expression AST and returns the resulting Unit. It mirrors the Julia reference implementation (get_expression_dimensions):
- numeric literals → indeterminate (nil, nil), except where their meaning is determined: neutral in “+”/"-", and read by value as an exponent
- variable names → looked up in env; unknown variables return nil, nil (dimensional analysis is best-effort when unit annotations are missing)
- “+”, “-” require all operands to share a dimension
- “*” multiplies dimensions, “/” divides
- “^” requires a dimensionless constant exponent (which may be RATIONAL)
- CIRCULAR functions (sin/cos/tan) take an ANGLE or a dimensionless number and return dimensionless; INVERSE circular functions (asin/acos/atan, atan2) take dimensionless arguments and RETURN AN ANGLE (rad)
- the remaining transcendentals (exp/log/ln/log10, the hyperbolics) require a dimensionless argument and return dimensionless; sqrt halves the operand’s dimension
- “D” (derivative) divides by the wrt variable’s unit (default “t”)
A non-nil error signals a dimensional inconsistency discovered during propagation. The caller decides whether to turn that into a UnitWarning.
Rat
type · canonical name rat
type Rat struct {
Num int32 `json:"num"`
Den int32 `json:"den"`
}
func (r Rat) Add(o Rat) Rat
func (r Rat) AddChecked(o Rat) (Rat, bool)
func (r Rat) Equal(o Rat) bool
func (r Rat) Float() float64
func (r Rat) IsZero() bool
func (r Rat) Mul(o Rat) Rat
func (r Rat) MulChecked(o Rat) (Rat, bool)
func (r Rat) Neg() Rat
func (r Rat) String() string
func (r Rat) Sub(o Rat) Rat
func (r Rat) SubChecked(o Rat) (Rat, bool)
Rat is an exact RATIONAL unit exponent (num/den).
Dimension exponents are rational, not integer: 1/s^0.5 is the noise intensity of an SDE (tests/fixtures/sde/*.esm), m^(1/2) and s^(-1/2) appear wherever a square root of a dimensional quantity does, and sqrt(x) halves whatever exponents x carries. An int8 exponent vector cannot represent any of them, so — now that an unparseable unit is a HARD ERROR — an integer representation falsely rejects those files.
The ZERO VALUE is the exponent 0: every operation normalizes a zero (or missing) denominator to 1 via fix(), so Rat{} and a composite literal such as Rat{Num: 2} are both well-formed. Nothing compares two Rats (or two Dimensions) with == — Equal cross-multiplies, so a non-reduced value never silently compares unequal to its reduced form.
Methods
func (r Rat) Add(o Rat) Rat
Add returns r + o.
func (r Rat) AddChecked(o Rat) (Rat, bool)
AddChecked returns r + o and whether it fits the Rat representation.
func (r Rat) Equal(o Rat) bool
Equal reports whether two exponents denote the same rational number, regardless of whether either is in lowest terms.
func (r Rat) Float() float64
Float returns the exponent as a float64 (used for scale arithmetic).
func (r Rat) IsZero() bool
IsZero reports whether the exponent is 0.
func (r Rat) Mul(o Rat) Rat
Mul returns r × o.
func (r Rat) MulChecked(o Rat) (Rat, bool)
MulChecked returns r × o and whether it fits the Rat representation.
func (r Rat) Neg() Rat
Neg returns −r.
func (r Rat) String() string
String renders the exponent: “2”, “-1”, “1/2”, “-3/2”.
func (r Rat) Sub(o Rat) Rat
Sub returns r − o.
func (r Rat) SubChecked(o Rat) (Rat, bool)
SubChecked returns r − o and whether it fits the Rat representation.
RemoveEquationAt
function · canonical name remove_equation_at
func RemoveEquationAt(model Model, index int) (Model, error)
RemoveEquationAt returns a copy of model without the equation at index. Indices are 0-based (Julia’s are 1-based; Go and TypeScript agree on 0).
Returns *EntityNotFoundError when the index is out of range.
RemoveEquationByLHS
function · canonical name remove_equation_by_lhs
func RemoveEquationByLHS(model Model, lhs Expression) (Model, error)
RemoveEquationByLHS returns a copy of model without the FIRST equation whose left-hand side structurally equals lhs.
Matching uses field-aware structural equality (exprEqual), so e.g. two const nodes with different values, or two derivatives differing only in wrt, are not treated as the same equation.
Returns *EntityNotFoundError when no equation matches. TypeScript and Julia spell this as an overload of their single remove-equation entry point; Go has no overloading, so the index and pattern forms are separate functions.
RenameVariableInFile
function · canonical name rename_variable_in_file
func RenameVariableInFile(file ESMFile, modelName, oldName, newName string) (ESMFile, error)
RenameVariableInFile renames a variable of the model modelName throughout file, and is the scope-aware counterpart of RenameVariable.
Beyond what RenameVariable does, it:
- resolves SCOPED references while rewriting, so a self-qualified read of the variable (“EarthSystem.global_forcing” inside model EarthSystem) is rewritten rather than left dangling; and
- rewrites the coupling endpoints that name the variable — a
variable_map’sfrom/toand aneventcoupling’s affect targets — which are plain strings in the file, not expressions inside the model, and so are out of reach of any model-scoped rewrite.
Returns *EntityNotFoundError when the model or the variable does not exist.
This entry point has no counterpart in the other bindings: TypeScript, Julia, Rust and Python all stop at the model-scoped rename. It is additive — the model-scoped RenameVariable keeps its cross-binding behaviour unchanged.
ResolveAndLower
function · canonical name resolve_and_lower
func ResolveAndLower(jsonStr, basePath string, metaparameters map[string]int64) (string, error)
ResolveAndLower is the exported raw §9.7 pipeline — resolveAndLowerJSON verbatim: load-time template-import/metaparameter resolution against basePath, then the §9.6.3 rewrite fixpoint AND Expand-at-build, returning the post-lowering Option-A image as JSON (numeric tokens preserved via json.Number). This is the entry point that reproduces the committed expanded.esm goldens (CONFORMANCE_SPEC.md §5.9) without going through the typed Load round-trip, whose serializer normalizes fields.
It is NOT the right entry point for a conformance runner that must be compared against the other four bindings: they all stop at the Option-B image, and expansion multiplies out a reference-dense document. Use ResolveAndLowerReferencePreserving, of which this is Expand ∘ that.
ResolveAndLowerReferencePreserving
function · canonical name resolve_and_lower_reference_preserving
func ResolveAndLowerReferencePreserving(jsonStr, basePath string, metaparameters map[string]int64) (string, error)
ResolveAndLowerReferencePreserving is the raw §9.7 pipeline WITHOUT the Expand-at-build step: load-time template-import/metaparameter resolution against basePath, §9.7.10 form-B coupling injection, then the §9.6.3 rewrite fixpoint — stopping at the Option-B image. Surviving apply_expression_template references stay as leaves (§9.6.4 rule 4) and each component keeps its expression_templates registry (rule 5). Returns the post-lowering document as JSON, numeric tokens preserved via json.Number.
This is what a conformance runner should drive to produce an artifact COMPARABLE WITH THE OTHER FOUR BINDINGS. The Julia reference, Python (resolve_template_machinery → lower_expression_templates), TypeScript (resolveTemplateMachinery → lowerExpressionTemplates) and Rust all stop here; only Go’s fused ResolveAndLower went on to Expand, so Go alone emitted the Option-A image and could not be compared to the other four structurally.
It is also the only pipeline that TERMINATES on a reference-dense document. Expansion is what Option B exists to avoid: it substitutes each reference’s body at every call site, so a document whose templates reference templates multiplies out. EarthSciDiscretizations’ duo_* cases were OOM-killed past 9 GB going through ResolveAndLower, which is why the Go runner had no output to compare at all on that family.
ResolveAndLower remains the Option-A surface: it is this function followed by Expand, and reproduces the committed expanded.esm goldens. Prefer this one unless you specifically need the expanded image.
ResolveReferencesInFile
function · canonical name resolve_references_in_file
func ResolveReferencesInFile(file *ESMFile) (map[string]*ReferenceGraph, error)
ResolveReferencesInFile is the typed convenience over ResolveReferences: it renders file to its raw view and resolves every model in it.
RoleAlgebraic
constant · canonical name role_algebraic
const RoleAlgebraic = "algebraic"
Derived variable-role labels (esm-spec §6.3.1), the FINER partition the classification API computes. The expression graph maps them onto the coarser §4.8.2 NodeKind* vocabulary through graphKindForRole.
RoleBrownian
constant · canonical name role_brownian
const RoleBrownian = "brownian"
Derived variable-role labels (esm-spec §6.3.1), the FINER partition the classification API computes. The expression graph maps them onto the coarser §4.8.2 NodeKind* vocabulary through graphKindForRole.
RoleConstant
constant · canonical name role_constant
const RoleConstant = "constant"
Derived variable-role labels (esm-spec §6.3.1), the FINER partition the classification API computes. The expression graph maps them onto the coarser §4.8.2 NodeKind* vocabulary through graphKindForRole.
RoleDiscrete
constant · canonical name role_discrete
const RoleDiscrete = "discrete"
Derived variable-role labels (esm-spec §6.3.1), the FINER partition the classification API computes. The expression graph maps them onto the coarser §4.8.2 NodeKind* vocabulary through graphKindForRole.
RoleObserved
constant · canonical name role_observed
const RoleObserved = "observed"
Derived variable-role labels (esm-spec §6.3.1), the FINER partition the classification API computes. The expression graph maps them onto the coarser §4.8.2 NodeKind* vocabulary through graphKindForRole.
RoleODEState
constant · canonical name role_ode_state
const RoleODEState = "ode_state"
Derived variable-role labels (esm-spec §6.3.1), the FINER partition the classification API computes. The expression graph maps them onto the coarser §4.8.2 NodeKind* vocabulary through graphKindForRole.
RoleSampled
constant · canonical name role_sampled
const RoleSampled = "sampled"
Derived variable-role labels (esm-spec §6.3.1), the FINER partition the classification API computes. The expression graph maps them onto the coarser §4.8.2 NodeKind* vocabulary through graphKindForRole.
RuleEngineError
error · canonical name rule_engine_error
type RuleEngineError struct {
Code string
Message string
}
func (e *RuleEngineError) DiagnosticCode() string
func (e *RuleEngineError) Error() string
RuleEngineError is a stable-coded error raised by the DAE contract. Code is one of the RFC §12 codes (e.g. E_NONTRIVIAL_DAE).
Methods
func (e *RuleEngineError) DiagnosticCode() string
DiagnosticCode returns the stable diagnostic code (DiagnosticError).
func (e *RuleEngineError) Error() string
SerializeExpression
function · canonical name serialize_expression
func SerializeExpression(expr Expression) (string, error)
SerializeExpression serializes just an expression to JSON
SerializeExpressionCompact
function · canonical name serialize_expression_compact
func SerializeExpressionCompact(expr Expression) (string, error)
SerializeExpressionCompact serializes just an expression to compact JSON
SerializeModel
function · canonical name serialize_model
func SerializeModel(model *Model) (string, error)
SerializeModel serializes just a model to JSON
SerializeReactionSystem
function · canonical name serialize_reaction_system
func SerializeReactionSystem(system *ReactionSystem) (string, error)
SerializeReactionSystem serializes just a reaction system to JSON
StructuralValidationResult
type · canonical name structural_validation_result
type StructuralValidationResult struct {
Valid bool `json:"valid"`
StructuralErrors []StructuralError `json:"structural_errors"`
UnitWarnings []UnitWarning `json:"unit_warnings"`
}
StructuralValidationResult holds the code-bearing structural validation output. It is the return type of ValidateStructuralWithCodes, and the source of the structural and unit findings Validate reports.
SubstituteInAffectEquation
function · canonical name substitute_in_affect_equation
func SubstituteInAffectEquation(affect AffectEquation, bindings map[string]Expression) (AffectEquation, error)
SubstituteInAffectEquation substitutes variables in an affect equation. Note: LHS is a variable name (string) so it’s not substituted, only RHS.
SubstituteInEquation
function · canonical name substitute_in_equation
func SubstituteInEquation(eq Equation, bindings map[string]Expression) (Equation, error)
SubstituteInEquation substitutes variables in both LHS and RHS of an equation. The equation’s _comment annotation rides along: substitution rewrites the expressions, it does not make the author’s note about this equation stale.
SubstituteInFile
function · canonical name substitute_in_file
func SubstituteInFile(file ESMFile, bindings map[string]Expression) (ESMFile, error)
SubstituteInFile performs substitution across an entire ESM file.
SubstituteInFileWithContext
function · canonical name substitute_in_file_with_context
func SubstituteInFileWithContext(file ESMFile, bindings map[string]Expression) (ESMFile, error)
SubstituteInFileWithContext performs substitution across an entire ESM file with scoped reference support.
SubstrateProduct
type · canonical name substrate_product
type SubstrateProduct struct {
Species string `json:"species"`
Stoichiometry float64 `json:"stoichiometry"`
}
SubstrateProduct represents a substrate or product in a reaction.
Stoichiometry MUST be a positive finite number; fractional coefficients (e.g. 0.87 CH2O) are allowed. Integer-valued coefficients round-trip as integers via encoding/json because float64(1) marshals to “1” in Go’s standard encoder.
SystemKindDAE
constant · canonical name system_kind_dae
const SystemKindDAE = "dae"
— Spec enum literal: Model.SystemKind and the ode/dae DAE classification (esm-spec §6 / dae.go). —
SystemKindNonlinear
constant · canonical name system_kind_nonlinear
const SystemKindNonlinear = "nonlinear"
— Spec enum literal: Model.SystemKind and the ode/dae DAE classification (esm-spec §6 / dae.go). —
SystemKindODE
constant · canonical name system_kind_ode
const SystemKindODE = "ode"
— Spec enum literal: Model.SystemKind and the ode/dae DAE classification (esm-spec §6 / dae.go). —
SystemKindPDE
constant · canonical name system_kind_pde
const SystemKindPDE = "pde"
— Spec enum literal: Model.SystemKind and the ode/dae DAE classification (esm-spec §6 / dae.go). —
SystemKindSDE
constant · canonical name system_kind_sde
const SystemKindSDE = "sde"
— Spec enum literal: Model.SystemKind and the ode/dae DAE classification (esm-spec §6 / dae.go). —
Test
type · canonical name test
type Test struct {
ID string `json:"id"`
Description *string `json:"description,omitempty"`
// InitialConditions and ParameterOverrides each map a LOCAL variable name to
// its value for this run. A value is a number, or — for a SHAPED variable —
// INLINE ARRAY DATA: a row-major nested JSON array matching the declared
// shape after metaparameter folding (esm-spec §6.6.2, §6.3). Hence `any`
// rather than float64: this binding is a rewrite-only port with no
// simulator, so it carries the authored value through parse → emit
// verbatim rather than interpreting it.
InitialConditions map[string]any `json:"initial_conditions,omitempty"`
ParameterOverrides map[string]any `json:"parameter_overrides,omitempty"`
TimeSpan TimeSpan `json:"time_span"`
Tolerance *Tolerance `json:"tolerance,omitempty"`
// ExpressionTemplateImports are raw §9.7.2 import entries injected into the
// ENCLOSING component's template scope for THIS test's run only (esm-spec
// §9.7.10 form C / §6.6.6): the discretization a discretization-agnostic PDE
// leaf is lowered under in a per-test ephemeral build. Authored per-run
// config (a peer of ParameterOverrides), so — unlike a component's own
// imports — this DOES survive parse → emit. Consumed only by an ephemeral
// per-run build, which this binding does not perform (no numeric solver).
ExpressionTemplateImports []any `json:"expression_template_imports,omitempty"`
Assertions []Assertion `json:"assertions"`
}
Test is an inline validation test for a Model or ReactionSystem.
ToUnicodeSpaced
function · canonical name to_unicode_spaced
func ToUnicodeSpaced(target Expression) string
ToUnicodeSpaced converts an expression to a Unicode string identical to ToUnicode except that the multiplication operator renders as " · " (spaced) for readability in model-summary displays. The spacing is produced at the operator during formatting (FmtUnicodeSpaced), not by a post-hoc string replace, so a “·” inside a rendered leaf (e.g. a hydrate chemical formula) is never disturbed.
UnmarshalCouplingArray
function · canonical name unmarshal_coupling_array
func UnmarshalCouplingArray(data []byte) ([]CouplingEntry, error)
UnmarshalCouplingArray handles the deserialization of the coupling array
UnmarshalCouplingEntry
function · canonical name unmarshal_coupling_entry
func UnmarshalCouplingEntry(data []byte) (CouplingEntry, error)
UnmarshalCouplingEntry handles the deserialization of a single coupling entry
UnmarshalExpression
function · canonical name unmarshal_expression
func UnmarshalExpression(data []byte) (Expression, error)
UnmarshalExpression handles the custom unmarshaling for Expression union type. Numeric literals preserve the RFC §5.4.6 round-trip parse rule: a JSON-number token with ‘.’, ’e’, or ‘E’ parses to float64; otherwise to int64 (falling back to float64 if out of int64 range).
EVERY expression-bearing field is normalized, not just args. The decoded node is routed through the shared field-preserving walker (mapExprChildren), so an operator node nested in a sidecar field — an aggregate’s expr / filter / key / join, an integral’s lower / upper, a table_lookup’s axes / output, a makearray’s values / regions, an apply_expression_template’s bindings — arrives as a real ExprNode with its own children normalized in turn, exactly like a child of args. Before this, only args was normalized and every other field stayed a raw map
interface{}, which made those subtrees invisible to Substitute, FreeVariables, Canonicalize and the enum-lowering pass (audit G3, and the G15 enum-lowering half of it).
UpdateKindCondition
constant · canonical name update_kind_condition
const UpdateKindCondition = "condition"
Update kind literals (esm-spec 5.4, “When: the six kinds”).
UpdateKindCrossing
constant · canonical name update_kind_crossing
const UpdateKindCrossing = "crossing"
Update kind literals (esm-spec 5.4, “When: the six kinds”).
UpdateKindData
constant · canonical name update_kind_data
const UpdateKindData = "data"
Update kind literals (esm-spec 5.4, “When: the six kinds”).
UpdateKindRemesh
constant · canonical name update_kind_remesh
const UpdateKindRemesh = "remesh"
Update kind literals (esm-spec 5.4, “When: the six kinds”).
UpdateKindSchedule
constant · canonical name update_kind_schedule
const UpdateKindSchedule = "schedule"
Update kind literals (esm-spec 5.4, “When: the six kinds”).
UpdateKindWiener
constant · canonical name update_kind_wiener
const UpdateKindWiener = "wiener"
Update kind literals (esm-spec 5.4, “When: the six kinds”).
ValidateStructuralWithCodes
function · canonical name validate_structural_with_codes
func ValidateStructuralWithCodes(file *ESMFile) *StructuralValidationResult
ValidateStructuralWithCodes performs structural validation and returns structured errors directly
ValidationMessage
type · canonical name validation_message
type ValidationMessage struct {
Level string `json:"level"` // "error", "warning", "info"
Message string `json:"message"` // Human-readable description
Path string `json:"path"` // JSON path to the problematic element
}
ValidationMessage represents a single validation issue in the legacy DetailedValidationResult surface returned by ValidateStructural.
VariableAdjacency
type · canonical name variable_adjacency
type VariableAdjacency struct {
Neighbor VariableNode
Edge DependencyEdge
}
VariableAdjacency is one entry returned by ExpressionGraph.AdjacencyVariable: a neighbouring variable node and the dependency edge that reaches it.
VariableExprSite
type · canonical name variable_expr_site
type VariableExprSite struct {
// Path is the JSON-pointer suffix from the variable, e.g.
// "/update/expression" or "/update/1/from/unit_conversion".
Path string
// Expr is the Expression currently at the position.
Expr Expression
// Set writes a replacement back into the variable.
Set func(Expression)
}
VariableExprSite is one Expression-bearing position inside a ModelVariable, with the JSON-pointer suffix that addresses it and a setter that writes a rewritten tree back.
esm 1.0.0 moved an observed unknown’s defining expression OUT of the variable (into the model’s equations), and moved parameter mutation IN (as update). The positions a pass must visit on a variable are therefore no longer “the expression field” but the update block’s when / expression and its data binding’s unit_conversion — exactly the three variable-scoped rows of the esm-spec §4.9.5 table. Enumerating them ONCE here is what stops the five passes that walk variables (enum lowering, parse normalization, substitution, reference integrity, unit propagation) from each growing a different hole.
VariableExprSites
function · canonical name variable_expr_sites
func VariableExprSites(mv *ModelVariable) []VariableExprSite
VariableExprSites returns every Expression-bearing position of mv, in a stable order. mv must be addressable; the returned setters mutate it in place.
VariableMapCoupling
type · canonical name variable_map_coupling
type VariableMapCoupling struct {
Type string `json:"type"` // "variable_map"
From string `json:"from"`
To string `json:"to"`
Transform Expression `json:"transform"` // string kind | ExprNode
Factor *float64 `json:"factor,omitempty"`
Lifting *string `json:"lifting,omitempty"`
Description *string `json:"description,omitempty"`
}
func (v VariableMapCoupling) CouplingType() string
func (v VariableMapCoupling) TransformIsExpression() bool
func (v VariableMapCoupling) TransformKind() string
func (v *VariableMapCoupling) UnmarshalJSON(data []byte) error
VariableMapCoupling represents variable mapping. Transform is a union (mirrors DataSourceBinding.UnitConversion): either one of the named string kinds (“param_to_var”, “identity”, “additive”, “multiplicative”, “conversion_factor”) held as a string, or a widened Expression transform held as an ExprNode (esm-spec §8.6/§10.4/§10.5 — the regridding form). Expression transforms are always operator-node OBJECTS on the wire; bare string/number Expression spellings are not admissible (the string space is reserved for the named kinds).
Methods
func (v VariableMapCoupling) CouplingType() string
func (v VariableMapCoupling) TransformIsExpression() bool
TransformIsExpression reports whether the transform is the widened Expression form (an operator node) rather than a named string kind.
func (v VariableMapCoupling) TransformKind() string
TransformKind returns the named string transform kind, or "" when the transform is an Expression AST (or absent).
func (v *VariableMapCoupling) UnmarshalJSON(data []byte) error
Custom JSON unmarshaling for VariableMapCoupling (handles the transform union: named string kind | ExpressionNode object). A string transform is stored as a string; an object transform is decoded via UnmarshalExpression into an ExprNode. Any other JSON shape (number, array, boolean) is rejected: an Expression transform is always an operator-node OBJECT (the degenerate bare-reference / literal spellings are reserved for the string kinds).
VarTypeParameter
constant · canonical name var_type_parameter
const VarTypeParameter = "parameter"
VarTypeParameter is a quantity supplied to the solver, valued by default or a distribution and optionally refreshed by an update.
— Spec enum literal: ModelVariable.Type (esm-spec §6.3). esm 1.0.0 declares exactly TWO. Whether an unknown is a state, an observed, or an algebraic unknown, and whether a parameter is Brownian or discrete, is DERIVED: call the classification functions in classify.go (esm-spec §6.3.1). —
VarTypeUnknown
constant · canonical name var_type_unknown
const VarTypeUnknown = "unknown"
VarTypeUnknown is a quantity the solver solves for; its behaviour is stated by the model’s equations and nowhere else.
— Spec enum literal: ModelVariable.Type (esm-spec §6.3). esm 1.0.0 declares exactly TWO. Whether an unknown is a state, an observed, or an algebraic unknown, and whether a parameter is Brownian or discrete, is DERIVED: call the classification functions in classify.go (esm-spec §6.3.1). —
VertexKindFactor
constant · canonical name vertex_kind_factor
const VertexKindFactor VertexKind = "factor"
VertexKindFactor is a factor named by a join.on reference.
VertexKindIndexSet
constant · canonical name vertex_kind_index_set
const VertexKindIndexSet VertexKind = "index_set"
VertexKindIndexSet is a declared index_sets entry.
VertexKindNode
constant · canonical name vertex_kind_node
const VertexKindNode VertexKind = "node"
VertexKindNode is an expression node (aggregate, or id-bearing).
WithBasePath
function · canonical name with_base_path
func WithBasePath(dir string) LoadOption
WithBasePath anchors relative expression_template_imports refs (esm-spec §9.7.2) for LoadString / LoadDocument input. LoadPath derives it from the file’s directory automatically; an explicit WithBasePath overrides that.
WithMetaparameters
function · canonical name with_metaparameters
func WithMetaparameters(m map[string]int64) LoadOption
WithMetaparameters binds the ROOT document’s open metaparameters at the loader API (esm-spec §9.7.6 binding site 4): already-closed edge bindings win, API bindings beat defaults. Binding a name the document does not declare fails with template_import_unknown_name.
WritePathCompact
function · canonical name write_path_compact
func WritePathCompact(file *ESMFile, path string) error
WritePathCompact writes an ESM file to path in the compact canonical form.