Skip to content

tests: remove implementation-asserting tests repo-wide - #1012

Merged
bpowers merged 2 commits into
mainfrom
test-suite-diet
Aug 9, 2026
Merged

tests: remove implementation-asserting tests repo-wide#1012
bpowers merged 2 commits into
mainfrom
test-suite-diet

Conversation

@bpowers

@bpowers bpowers commented Aug 9, 2026

Copy link
Copy Markdown
Owner

Why

A sweep of every test suite (simlin-engine, five other Rust crates, six TypeScript packages, pysimlin) for tests that assert implementation rather than behavior: re-assertions of source literals, tests of local copies of production logic, strict duplicates of stronger tests, and tests that cannot fail (zero assertions, swallowed exceptions, tautologies). Such tests must be edited whenever the source changes even when behavior is preserved, so they impose maintenance cost while constraining nothing.

Deleting them exposed a second layer: production code whose only callers were the deleted tests, and test-support surfaces compiled into release binaries. Net: 246 files, +2,421/−14,338 (about 660 tests deleted, 15 added or rewritten to be real).

Highlights by area

  • simlin-engine: 41 _monolithic/_vm twin pairs deleted -- both helpers compile through the same incremental path since the salsa unification, so each pair ran one path twice (the stale _incremental helper spellings are renamed too). The mdl literal-echo cluster, the stack_effect transcription family (38 of 100 opcodes -- a sample, not an enumeration), the circularly-self-verifying db/differential_tests.rs, nine duplicate corpus registrations in simulate.rs, and ~20 genuinely dead prod items including both 145-line strip_loc walks, get_incoming_links, and the ltm_post scalar pair whose rustdoc claimed an FFI consumer that does not exist.
  • diagram (TS): class-name assertions restated component source verbatim (the test build sets localIdentName: '[local]'); two whole files tested local copies of production logic -- one encoded a wrong copy of the drag-select predicate while passing green.
  • engine (TS): the layered backend suites (direct/worker/wasm) re-tested identical operations; zero-assertion try/catch tests; test-only worker-server getters removed after rewriting their tests to observe behavior.
  • simlin-serve: six dead prod functions (check_and_increment, refresh_meta, save_to_disk, diagnostics_set_changed, baseline_from_errors, datamodel_to_canonical_json) were kept compiling solely by their own tests; three helper duplications consolidated (forward-slash x3, extension dispatcher x2, sidecar rule x2); ~2.4s of pure test sleeps removed.
  • libsimlin/mcp: a test that greps patch.rs for a substring; tests that pass whether or not the patch applied; the test-only errors.rs re-export module deleted after migrating the uncovered format_diagnostic arms into a 7-row table in the engine.
  • pysimlin: constructor/frozen/repr echoes and exception-swallowing tests; dead LoopPolarity.from_runtime_scores + threshold constant (hand-duplicated Rust logic, zero callers), ErrorDetailDict, error_code_to_string.

Tests strengthened or added instead of deleted

  • The 20 unit_checking_test.rs tests whose only assertion was "it compiles" now chain assert_no_unit_diagnostics() -- mutation-tested: breaking model_time_units reds 6 of them and nothing else in the file.
  • The invariance oracle now asserts a non-empty invariant set per caller (a classifier hoisting nothing previously passed all seven corpus gates).
  • pysimlin's swallowing sim tests replaced with exact-value tests; polarity enums now asserted against the C header constants (a real FFI contract, mutation-checked); the untested explain() Module arm covered.
  • IconButton's documented href/disabled invariant (diagram CLAUDE.md) gained its first test, mutation-checked against the source line.
  • wasm backend: the deleted handle>0 pins were replaced by two behavioral tests (default-engine-is-VM, per-sim state isolation) that pin contracts previously covered nowhere.
  • EditOperation conversion is now a 5-arm table (the RemoveVariable arm had no test anywhere in the repo).
  • The MCP test double TestFileSystemAccess is now a type alias for production FileSystemAccess (it had silently diverged exactly where production is non-trivial), and the SD-AI relationships-regeneration path has its first test.
  • race.test.ts now asserts the patches it claims are ordered actually landed.

Real defects found and fixed by the sweep

  • VDF byte readers (read_u32/u16/f32) violated their documented totality: offset..offset+4 could panic on overflow in debug builds (load-bearing under libsimlin's panic=abort). Now checked_add.
  • docs/sdai-model.schema.json was 139 lines stale -- caught the moment the schema test became a drift guard instead of a test that mutates the checked-in file on every cargo test run.
  • format_diagnostic leaked the "<unknown>" placeholder into the structured variable_name field on the Unit arm (the Equation arm correctly passed None through).
  • The pysimlin version-tag guard was vacuously skipped in every CI run (shallow clones fetch no tags); CI now uses fetch-tags: true and the guard is verified to pass against the real tags.
  • Engine test_common, serve/mcp-core test_support, and the 1.3k-line layout/eval_stats no longer compile into release binaries (feature-gated; verified with nm on the built artifacts).
  • Cross-crate: an unrelated single edit invalidating things aside, the simlin-serve/simlin-mcp-core test-support features must land together (serve's dev-dependency names mcp-core's feature).

Known judgment calls / surfaced-not-fixed

🤖 Generated with Claude Code

https://claude.ai/code/session_01S3vQ72pUeYXdMgCv7sSjaB

A sweep of every suite (simlin-engine, five other Rust crates, six
TypeScript packages, pysimlin) for tests that assert implementation
rather than behavior: re-assertions of source literals, tests of local
copies of production logic, strict duplicates, and tests that cannot
fail. About 660 tests are deleted; the ones whose names promised real
coverage were rewritten to earn it (unit_checking's twenty
assert_no_unit_diagnostics swaps, exact-value pysimlin sim tests, the
invariance oracle's non-empty floor, wasm default-engine and per-sim
isolation), and a few documented-but-untested contracts gained their
first tests (IconButton href mode, EditOperation's RemoveVariable arm,
SD-AI relationship regeneration).

Removing the tests exposed prod code with no other callers, now
deleted: six dead simlin-serve functions, the engine's monolithic
compile remnants and roughly twenty dead items, libsimlin's test-only
errors.rs re-export, pysimlin's from_runtime_scores classifier.
Test-support modules no longer compile into release binaries
(feature-gated, verified with nm against built artifacts). The sweep
also surfaced real defects, addressed here: VDF byte readers could
panic on arbitrary input despite documented totality, the checked-in
SD-AI schema was 139 lines stale behind a test that mutated it instead
of checking it, format_diagnostic leaked its "<unknown>" placeholder
into the structured variable_name field, and CI's shallow clones made
the pysimlin version-tag guard skip vacuously on every run.
@codecov

codecov Bot commented Aug 9, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 98.08795% with 10 lines in your changes missing coverage. Please review.
✅ Project coverage is 92.17%. Comparing base (0140175) to head (5c13fd3).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
src/simlin-engine/src/json_proptest.rs 60.00% 4 Missing ⚠️
src/simlin-engine/src/json_sdai_proptest.rs 63.63% 4 Missing ⚠️
src/simlin-mcp-core/src/open.rs 97.67% 1 Missing ⚠️
src/simlin-mcp-core/src/tools/edit_model.rs 98.24% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1012      +/-   ##
==========================================
+ Coverage   92.04%   92.17%   +0.13%     
==========================================
  Files         249      247       -2     
  Lines      161135   158229    -2906     
==========================================
- Hits       148318   145855    -2463     
+ Misses      12817    12374     -443     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Comment thread docs/design/ltm--loops-that-matter.md Outdated
survives only as a standalone scalar-array convenience utility.)
separate Python slot-0 reclassification path. (Python's own
`LoopPolarity.from_runtime_scores` -- a standalone scalar-array port of the
Rust classifier that no production path called -- has been removed, so the

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good documentation is NEVER a changelog. it is evergreen writing about the current state of the source code. people can dig through git history to find the changelog.

Documentation describes the current state of the source; it never
narrates the edit that produced it ("X was removed", "used to Y",
"behaviour is unchanged") -- git history is the changelog. This
rewrites the changelog-style passages the test-suite-diet branch
introduced across the ltm design doc, tech-debt.md, three CLAUDE.md
files, and five rustdoc comments, converting the lessons worth keeping
into standing constraints (e.g. why TestFileSystemAccess must remain
an alias for the production impl rather than a second implementation).

Codifies the rule in the root CLAUDE.md's Comment and Rustdoc
Standards so future work lands evergreen by default. GH-anchored
regression rationale (e.g. belt_tests' "the reject GH #924 removed")
is deliberately kept: an issue number is a pointer, not a narrative.
@claude

claude Bot commented Aug 9, 2026

Copy link
Copy Markdown

Review Findings

Reviewed the full diff (246 files, +2,421/-14,338), with particular attention to production-code changes, removed public APIs, and newly-added/rewritten tests. The sweep is careful — feature-gating for test_common/test_support/layout_eval is correct, the removed public items (save_to_disk, check_and_increment, refresh_meta, abbreviation, detect_loops, to_dimension_name/to_element_name, IdentRef, with_subscript, get_incoming_links, resolve_non_private_dependencies, ensure_variable_uids visibility narrowing, error_code_to_string, ErrorDetailDict, LoopPolarity.from_runtime_scores and POLARITY_CONFIDENCE_THRESHOLD, libsimlin::errors module) genuinely have no remaining callers in-tree, and the real defects called out in the description (VDF checked_add, format_diagnostic <unknown> leak, sdai-model.schema.json drift, panic = abort totality, CI fetch-tags) are fixed correctly. format_unit_error/format_equation_error are file-private, so the formatted.variable_name = diag.variable.clone() override in format_diagnostic{,_with_datamodel} is safe (their callers are only those two). The added exhaustive-arm tests (every_builtin_variant_names_itself_and_is_recognized, format_diagnostic_maps_every_arm, convert_operation_maps_every_edit_operation) correctly derive from the enum variant list rather than sampling it.

One real, small finding below.


[P3] Stale comment claims CI is a shallow clone that skips this guard, but this same PR made CI fetch tags

src/simlin-mcp/src/main.rs:132-158 — The rustdoc on pysimlin_version_matches_latest_tag says CI "checks out with actions/checkout@v4 and no fetch-depth, i.e. a shallow clone with no tags, so this guard runs only on a developer's full clone and is a no-op in CI," and the SKIPPING message repeats that ("a shallow clone, as CI produces, fetches no tags"). But .github/workflows/ci.yaml in this PR now sets fetch-tags: true, and the PR description explicitly says "CI now uses fetch-tags: true and the guard is verified to pass against the real tags." The comment and the skip message contradict the new CI behavior — a future reader will trust the comment and assume the guard is CI-inert, when it now actually runs. Also worth simplifying: the guard no longer needs the "skip on CI" framing at all if CI is expected to have tags; a missing-tag path is now a developer-workstation edge case, not a documented CI behavior.


Overall correctness verdict: correct. No blocking issues; the one finding above is a documentation nit that ships stale but does not affect behavior.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0b4d750af6

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +138 to +140
// present locally. CI checks out with `actions/checkout@v4` and no
// `fetch-depth`, i.e. a shallow clone with no tags, so this guard runs
// only on a developer's full clone and is a no-op in CI. That is a

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Correct the version guard's CI comment

The same change sets fetch-tags: true in .github/workflows/ci.yaml, so this guard is now expected to execute in CI; this newly added comment and the skip message below claim the opposite. If tags are unexpectedly unavailable, the logs will incorrectly describe the skip as normal CI behavior and recommend an unnecessary unshallow fetch. Update both descriptions to match the workflow's tag-fetching behavior.

AGENTS.md reference: AGENTS.md:L115-L118

Useful? React with 👍 / 👎.

@@ -196,20 +192,6 @@ impl Drop for LtmCircuitBudgetGuard {
}
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Remove the deleted loop helper from the development map

Deleting ltm::detect_loops leaves the scoped development map claiming that ltm/mod.rs still defines this top-level helper. Future work following that documented module surface will try to import an API that no longer exists, so update the map as part of this removal or retain the helper.

AGENTS.md reference: src/simlin-engine/AGENTS.md:L178-L178

Useful? React with 👍 / 👎.

Comment on lines +79 to +83
Classification of a runtime score series -- including the confidence
cutoff separating Rux/Bux from U -- happens engine-side in
`LoopPolarity::from_runtime_scores` / `POLARITY_CONFIDENCE_THRESHOLD`
(`src/simlin-engine/src/ltm/types.rs`); Python only carries the label
and the confidence the engine computed, so there is no second

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Update the runtime-loop rustdoc after removing the classifier

This new documentation correctly says Python no longer has a separate classifier, but db::analysis::reclassify_loops_from_results still states at lines 2843–2846 that Run.loops uses LoopPolarity.from_runtime_scores on slot 0 and exposes the engine path separately as Run.loops_runtime. That method is removed in this change and Run.loops now uses the engine result, so update the rustdoc to avoid documenting the opposite A2A semantics.

AGENTS.md reference: AGENTS.md:L115-L118

Useful? React with 👍 / 👎.

@bpowers
bpowers merged commit c7ba043 into main Aug 9, 2026
19 checks passed
@bpowers
bpowers deleted the test-suite-diet branch August 9, 2026 04:40
@claude

claude Bot commented Aug 9, 2026

Copy link
Copy Markdown

Review Findings

[P3] Stale doc comment on pysimlin_version_matches_latest_tag contradicts the CI change

File: src/simlin-mcp/src/main.rs:132-143 (and eprintln at lines 154-157)

The PR adds fetch-tags: true to .github/workflows/ci.yaml so this guard runs in CI (as the PR description confirms: "CI now uses fetch-tags: true and the guard is verified to pass against the real tags"), but the multi-line doc comment above the test was not updated to match. It still asserts:

CI checks out with `actions/checkout@v4` and no `fetch-depth`, i.e. a shallow clone with no tags, so this guard runs only on a developer's full clone and is a no-op in CI. That is a deliberate limitation, not an oversight: making it fail on an empty tag list would break every CI run.

Every claim in that block is now false: CI does fetch tags, the guard is no longer no-op in CI, and it would in fact fail on an empty tag list (which is the point). The eprintln skip message at line 155-157 ("a shallow clone, as CI produces, fetches no tags") is stale in the same way. This will mislead future maintainers who rely on the comment when deciding whether the skip branch is load-bearing or removable.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

let agg_series = series_at(&results, offset_of(&results, agg_name));

P2 Badge Remove the dangling focused-test reference

The focused scalar_target_agg_value_matches_inlined_reducer test is deleted in this change and its assertions are folded into this test, but the rustdoc at line 701 still says that the missing test pins the behavior in detail; a repo-wide search finds no remaining definition. Update the rustdoc to point to the inline assertions instead of a nonexistent regression test.

AGENTS.md reference: AGENTS.md:L115-L118

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

p.x >= r.left && p.x <= r.right && p.y >= r.top && p.y <= r.bottom
}

/// Clipped parameter interval `[t0, t1]` of segment `p0 + t*(p1-p0)` (t in

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Update the diagram map after deleting the helper

Deleting rect_contains_point leaves the scoped development map claiming that diagram/common.rs still provides this shared geometry helper. Future layout work following that documented surface will try to use an API that no longer exists, so remove it from the map or retain the helper.

AGENTS.md reference: src/simlin-engine/AGENTS.md:L192-L192

Useful? React with 👍 / 👎.

Comment on lines +686 to +687
for v in &all {
match v {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Tie builtin cases to the enum enumeration

When a new BuiltinFn variant is introduced, this loop still ranges only over the manually constructed all vector. The exhaustive match merely forces adding a pattern; adding that pattern while forgetting the constructor leaves the test green, so it does not enforce its claimed every-variant coverage. Derive the cases from a canonical variant list or otherwise make omissions fail.

AGENTS.md reference: AGENTS.md:L97-L97

Useful? React with 👍 / 👎.

fn convert_operation_maps_every_edit_operation() {
use simlin_engine::ModelOperation;

let ops = vec![

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Derive edit-operation cases from the enum

When another EditOperation variant is added, the production match will require an implementation but this hand-written vector remains unchanged and the test stays green, leaving the new arm's field mapping unverified despite the test claiming complete dispatch coverage. Generate these rows from the variant enumeration or explicitly document which arms are covered elsewhere.

AGENTS.md reference: AGENTS.md:L97-L97

Useful? React with 👍 / 👎.

Comment thread src/libsimlin/src/lib.rs
@@ -51,7 +51,6 @@ use simlin_engine::serde as engine_serde;
use std::ffi::CStr;

// ── internal modules ───────────────────────────────────────────────────

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Update the engine map after removing the re-export

After deleting libsimlin::errors, the engine development map in src/simlin-engine/AGENTS.md line 92 still says that libsimlin re-exports the engine's error-formatting surface. Repo-wide search confirms that no simlin::errors module remains, so update that cross-component description to avoid directing callers to a removed import path.

AGENTS.md reference: AGENTS.md:L115-L118

Useful? React with 👍 / 👎.

Comment on lines +15 to +19
//! It lives here rather than in the binary so the tests and the binary run
//! the SAME impl. `simlin-mcp-core`'s integration suites previously used a
//! hand-maintained near-copy (`test_support::TestFileSystemAccess`), which
//! had drifted at exactly the two points where this file is non-trivial: it
//! did not reject `.mdl` writes, and it did not regenerate the SD-AI

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Rewrite the filesystem rustdoc as current-state guidance

This newly added module rustdoc narrates where the implementation previously lived and how the former test double drifted, even though repository documentation is required to describe the current state rather than serve as a changelog. Rewrite this as the standing invariant—tests and the binary share this implementation so write semantics cannot diverge—without the historical sequence.

AGENTS.md reference: AGENTS.md:L120-L120

Useful? React with 👍 / 👎.

Comment on lines -21 to -25
it('the toolbar spacer height comes from --toolbar-dense-height', () => {
const css = readCss('Home.module.css');
const m = /\.toolbarSpacer\s*\{([^}]*)\}/.exec(css);
expect(m).not.toBeNull();
expect(m![1]).toContain('height: var(--toolbar-dense-height)');

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Keep the app-shell token coupling covered

Deleting this file removes the only assertion that Home.module.css derives its toolbar spacer from the same --toolbar-dense-height token as the actual Toolbar; the surviving theme-tokens.test.ts checks only the Toolbar side. If the Home spacer is later replaced with a literal and the shared token changes, the header and content offset can diverge with the suite still green, so retain a coupling guard rather than dropping this coverage.

AGENTS.md reference: AGENTS.md:L189-L199

Useful? React with 👍 / 👎.

bpowers added a commit that referenced this pull request Aug 9, 2026
…ode (#1013)

Follow-up to #1012, addressing the three codex review findings that
arrived as it merged. All three are the stale-claim class: documentation
describing a state of the world the code no longer has.

- **`simlin-mcp` version guard**: the comment and skip message described
CI as a tagless shallow clone where the guard "is a no-op" — the
opposite of what `ci.yaml`'s `fetch-tags: true` checkout (added in
#1012) does. An unexpected skip in CI would have been misread as
documented-normal behavior. Both now state that CI fetches tags
specifically so the guard runs, and that a skip is expected only on a
local clone without them. (Verified live: with the fresh
`pysimlin-v0.8.0` tag fetched, the guard passes against the 0.8.0
release.)
- **Engine module map**: `src/ltm/` still advertised the deleted
top-level `detect_loops` helper; anyone following the documented surface
would import a nonexistent API.
- **`reclassify_loops_from_results` rustdoc**: claimed pysimlin
`Run.loops` "still reclassifies via its own Python
`LoopPolarity.from_runtime_scores` mirror (slot-0 only)" and "exposes
the all-slots engine path separately as `Run.loops_runtime`" — both
false: `Run.loops` rides this helper via `Sim.get_loops_runtime`, there
is no separate property, and the Python classifier no longer exists. The
A2A-semantics note is now correctly a two-site comparison (this helper's
all-slots concatenation vs discovery's strongest-path scalar) instead of
three.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

https://claude.ai/code/session_01S3vQ72pUeYXdMgCv7sSjaB
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant