Skip to content

engine: model_ltm_variables warnings duplicated across a module boundary in project error report #866

Description

@bpowers

Problem

Warnings accumulated inside the salsa query model_ltm_variables (src/simlin-engine/src/db/ltm/mod.rs) can be reported twice through simlin_project_get_errors when the emitting model is referenced as a MODULE by another model.

collect_all_diagnostics (src/simlin-engine/src/db/diagnostic.rs) drains model_all_diagnostics::accumulated once per model. But the dependency chain

model_all_diagnostics(parent)
  -> model_ltm_fragment_diagnostics(parent)
    -> model_ltm_variables(parent)
      -> module_composite_ports(child)
        -> model_ltm_variables(CHILD)

means the CHILD's accumulated warnings live in the PARENT's dependency tree. Salsa's accumulated is transitive over the query dependency graph, so those child warnings get drained under both the parent's and the child's model_all_diagnostics -- producing duplicate warnings in the project-level report.

Affected warnings

All are emitted inside model_ltm_variables and are therefore latently duplicable across a module edge:

These are conditional/rare, so the duplication is latent rather than always-visible, but it is a real correctness bug in diagnostic reporting: a user can see the same Warning twice in a single project.

Why it matters

User-visible duplicate warnings in the errors report. Does not affect simulatability or simulation results. Severity: low-to-medium.

Component

src/simlin-engine -- src/simlin-engine/src/db/ltm/mod.rs (emission site), src/simlin-engine/src/db/diagnostic.rs (collect_all_diagnostics drain).

The pattern was already hit once, and fixed narrowly

The conveyor spec 9.6 ConveyorLtmDegraded warning hit exactly this duplication. It was fixed specifically by emitting it in model_all_diagnostics -- which is drained once per model and is not called transitively across module edges -- rather than inside model_ltm_variables. That is the concrete precedent for option (b) below.

Possible fixes

  • (a) Dedup in the collector: dedup identical (model, variable, code, severity, message) diagnostics in collect_all_diagnostics.
  • (b) Move the emission site (the ConveyorLtmDegraded pattern): move each such warning's emission to a per-model diagnostic site that is not reachable transitively across module edges (e.g. model_all_diagnostics), so it is drained exactly once per model.

Discovery context

Identified during conveyor spec 9.6 work on branch conveyor-engine, as a pre-existing latent bug in the same code area where ConveyorLtmDegraded had to be routed around this exact transitive-accumulation behavior.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions