Skip to content

engine: readers of a SMOOTH or DELAY output fail unit checking #457

Closed

Description

@bpowers

Variables that read the output of a SMOOTH or DELAY call fail unit checking because the checker cannot find units for the call's output.
The output's units are well defined (SMTH1, SMTH3, DELAY1 and DELAY3 return the units of their input), so readers should be checked against them.

Example

On World3 (test/metasd/WRLD3-03/wrld3-03.mdl), every SMOOTH and DELAY call site reported:

units error in model 'main' variable 'persistent_pollution_appearance_rate': does_not_exist -- can't find or no units for dependency '$⁚persistent_pollution_appearance_rate⁚0⁚delay3·output'
units error in model 'main' variable 'average_industrial_output_per_capita': does_not_exist -- can't find or no units for dependency '$⁚average_industrial_output_per_capita⁚0⁚smth1·output'

The name in quotes is the internal module the engine creates for each SMOOTH/DELAY call.

Why it matters

Smooths and delays are in nearly every real model, and an unresolved output also hides genuine mismatches downstream.
Seen on World3.

Fix

Unit inference already walks into each stdlib module and gives its output a unit variable, so readers should pick up the inferred units.
Two things defeated this on World3: inference threw away all its results when it hit any conflict, and the checker treated a dependency with unknown units as an error instead of skipping it.
Confirm on World3 that neither message appears and that a reader with the wrong declared units is still caught.

Pointers

Activity

  1. added
    engine
    on Jun 8, 2026
  2. changed the title [-]engine: stdlib module output units not propagated to consumers[/-] [+]engine: readers of a SMOOTH or DELAY output fail unit checking[/+] on Oct 12, 2026
  3. added
    bug
    on Oct 12, 2026
  4. bpowers commented on Oct 12, 2026

    @bpowers
    OwnerAuthor

    Closing: already fixed on main.

    A dependency with unknown units is skipped, not reported: every reader path drops DoesNotExist (src/simlin-engine/src/units_check.rs:648, 681, 745; #615), so the "can't find or no units for dependency" message can no longer reach a diagnostic. Inference keeps partial results (#618, 14fed2a) and resolves SMOOTH/DELAY outputs (units_infer.rs tests around line 1332 assert SMTH1/DELAY1 results infer the input's units); unknown_dependency_units_do_not_hard_error and test_smth1_in_complex_model pin the reader side.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugengine

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions