Skip to content

test: macro-failure diagnostic filter is copy-pasted in two tests #563

Open

Description

@bpowers

Two tests contain the same copy-pasted filter for deciding whether a diagnostic is a macro-handling failure.
A comment asks that the two copies be kept in step, but nothing enforces it.
There should be one copy.

Details

The filter counts a diagnostic when either holds:

  • it is a project-level CircularDependency or DuplicateMacroName (the macro registry failed to build), or
  • it is a BadModelName or DuplicateMacroName on a macro model or on the project (two macros or models share a name).

The copies are:

  • src/simlin-engine/tests/integration/metasd_macros.rs: narrower_macro_attributable_diagnostics, which drives the metasd corpus test and has its own test.
  • src/simlin-engine/src/macro_expansion_tests.rs, inline in the thyroid-shaped unit test (around line 1497).

They are identical today.
If one changes, the other test weakens and nothing fails.

Fix

Remove the copy from the unit test.
That test already asserts the specific failures it is about: no project-level CircularDependency, and MacroRegistry::build succeeds and resolves both macros.
The real thyroid model goes through the shared filter in metasd_macros.rs.

Alternative: export the filter from the crate behind the test-support feature and call it from both tests.
This keeps both checks, at the cost of a test-only public item.

Pointers

  • src/simlin-engine/src/macro_expansion_tests.rs
  • src/simlin-engine/tests/integration/metasd_macros.rs

Activity

  1. added a commit that references this issue on May 16, 2026
  2. added
    engine
    hygiene
    on Jun 8, 2026
  3. changed the title [-]engine: macro-attributable Diagnostic classifier is duplicated across a crate compilation boundary (lockstep enforced only by a comment)[/-] [+]test: macro-failure diagnostic filter is copy-pasted in two tests[/+] on Oct 12, 2026
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

    enginehygiene

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions