Skip to content

engine: gate wrld3_element_level_enumeration_is_uncapped behind cfg(not(debug_assertions)) #465

Closed

Description

@bpowers

Problem

src/simlin-engine/tests/wrld3_ltm_panic.rs::wrld3_element_level_enumeration_is_uncapped asserts that unbudgeted element-level circuit enumeration on WRLD3 produces exactly 1,863,803 elementary circuits. It runs unconditionally in debug builds, including the normal cargo test / cargo test -p simlin-engine flow used by the pre-commit hook.

Johnson's algorithm over 1.8M circuits is expensive in release mode; in debug mode (no optimization, bounds checks enabled, Vec growth not coalesced) the test can balloon in both wall time and peak memory. That's a problem for the default developer flow where cargo test is expected to complete in reasonable time without DoS-ing the developer's workstation -- especially when the pre-commit hook fans out.

Evidence

// src/simlin-engine/tests/wrld3_ltm_panic.rs:93-94
#[test]
fn wrld3_element_level_enumeration_is_uncapped() {

No cfg gate. find_indexed_circuits_with_limit(usize::MAX) then produces all 1,863,803 circuits from the WRLD3 element-level graph.

Proposed fix

Gate the test behind #[cfg(not(debug_assertions))] (release-only) or move it to a bench / --ignored test that's run on demand. The test's job is to verify the cap-lift semantics (usize::MAX must not trip TruncatedByBudget); that assertion has value as a regression check but doesn't need to run on every developer cargo test invocation in debug mode.

Alternative: reduce the fixture to a smaller dense graph that exercises the same code path without requiring 1.8M circuits. The existing comment calls out the "2026-04-18 adversarial cap-lift validation" specifically citing the WRLD3 count, so the full-count assertion has historical significance that would be lost with a smaller fixture.

Severity

Low. The test is correct; the concern is resource use on the default test flow.

Discovery context

Noted during adversarial review of PR #461 (branch ltm-perf-enable-always).

Files

  • src/simlin-engine/tests/wrld3_ltm_panic.rs:83-125

Activity

  1. bpowers commented on Apr 30, 2026

    @bpowers
    OwnerAuthor

    Fixed in commit fee04c6 ("engine: ignore wrld3_element_level_enumeration_is_uncapped by default").

    The test now carries #[ignore]:

    // src/simlin-engine/tests/wrld3_ltm_panic.rs:103-105
    #[test]
    #[ignore]
    fn wrld3_element_level_enumeration_is_uncapped() { ... }

    The accompanying docstring explains the gating ("Johnson's algorithm on WRLD3's 166-node SCC takes ~30s in debug -- over the per-test budget and a meaningful fraction of the 180s workspace cap") and documents the on-demand invocation:

    cargo test --release -p simlin-engine --test wrld3_ltm_panic -- --ignored wrld3_element_level_enumeration_is_uncapped
    

    The sibling wrld3_ltm_compilation_finishes_in_time (not ignored, 60s thread budget) continues to protect every-push compilation correctness, so the cap-lift regression-detection role is still covered on the default flow.

    Verified on main at HEAD 630fceb (2026-04-29).

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions