Skip to content

[tests] Remove low-signal agent-written unit tests - #429

Merged
suraj-ranganath merged 15 commits into
developfrom
work/prune-low-signal-tests
Oct 7, 2026
Merged

suraj-ranganath merged 15 commits into
developfrom
work/prune-low-signal-tests

Conversation

@suraj-ranganath

@suraj-ranganath suraj-ranganath commented Oct 6, 2026 •

Copy link
Copy Markdown
Member

Delete agent-written unit tests that would not catch a real bug the EEGLAB-ported tests or the remaining workflow tests miss, cutting non-provenance tests from 3566 to 1440 and the default suite from 253s to 58s. All 642 provenance-tagged ported tests are unchanged. AGENTS.md now forbids writing unit tests after the code.

@suraj-ranganath

Copy link
Copy Markdown
Member Author

🤖 Specification

Problem. The suite had 3566 agent-written tests next to 642 EEGLAB-ported (@eeglab_test) tests. Many asserted types, shapes, keys, constants, mock plumbing, widget labels, or duplicated ported/workflow coverage, and the default lane took 253s. Agents kept adding more because the feature-development skill asked for >90% coverage and tests written after implementation.

Approach. Every non-provenance test was kept only if it would catch a concrete bug that neither the ported tests (treated as E2E; a CI lane for them comes in a later PR) nor the sample-data/workflow tests would catch. Typical keeps: MATLAB/known-value numerical oracles, fixed regressions, 1-based latency and boundary-event edges, GUI-to-history and GUI/console EEGPrepSession sync, CLI/BIDS/extension/eegprep-lean contracts, and harness guards against reference-lane false passes. The work was split across 12 areas (clean_rawdata, ICA, GUI, session, I/O, pop processing, events, plots, stats, STUDY, CLI/extensions, harness), one commit each.

Also: stale tests/conftest.py marker entries and orphaned tests/fixtures.py helpers removed; 91 parity-matrix test_notes updated to cite only surviving tests; AGENTS.md gains "Never write unit tests after you write code" plus a rule that new tests must catch a bug ported/workflow tests miss; the feature-development skill and contributor guide follow suit.

Before After
Non-provenance tests 3566 1440
Provenance tests 642 642 (unchanged)
Default lane (pytest tests) 3153 passed, 253s 1217 passed, 58s
test_cli_main.py ~77s ~1.4s
eegprep-lean (not network) ~37s ~1s

Tests.

  • Collection check: all 642 provenance node ids still collect with identical upstream references.
  • pytest tests: 1217 passed, 94 skipped, 0 failed. eegprep-lean: 74 passed, 2 skipped (zarr extra absent).
  • Python reference lane (--eeglab-backend python, -m "parity and not slow and not gui", 527 provenance tests) run on Restore faithful EEGLAB test workflows for hybrid validation #424's head and this branch: identical outcomes test by test (165 pass, 362 fail on both) and identical failure messages apart from one random index in test_reference_shuffle.
  • ruff check, ruff format --check, ty check, ./pre-commit.py --changed-from origin/work/matlab-tests-phase2: pass.

Notes for the CI-lane follow-up. Most ported tests do not pass under --eeglab-backend python today (MATLAB-typed inputs and shapes, plus missing top-level exports such as eegprep.statcond, eegprep.fdr, eegprep.eeg_ms2f, eegprep.numdim). Many ported STUDY/LIMO/dipfit/event tests are smoke-only. Where that left a behavior unprotected, auditors kept the Python known-value test. Pre-existing, unchanged here: TestPopReref/TestPopEpochParity and test_pop_loadset_h5.py skip whole classes/modules without MATLAB, so some pure-Python tests inside them only run in the MATLAB lane.

Found while auditing (not fixed here). runamica._write_data_file writes (chans, frames) data in C order (channel-contiguous); MATLAB fwrite and AMICA expect frame-contiguous. Tracked separately. A non-strict xfail documenting #193 (eeg_picard ignores random_state) was removed because it could never fail.

@claude

claude Bot commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

Claude encountered an error after 0s —— View job


I'll analyze this and get back to you.

@suraj-ranganath
suraj-ranganath changed the base branch from work/matlab-tests-phase2 to develop October 7, 2026 03:13
@claude

claude Bot commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

Claude encountered an error after 0s —— View job


I'll analyze this and get back to you.

@suraj-ranganath
suraj-ranganath marked this pull request as ready for review October 7, 2026 03:22

@claude claude Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Code review skipped — your organization has no extra usage available to pay for this review.

If your organization's extra usage balance is empty, an organization admin can add extra usage credits at claude.ai/admin-settings/usage. If its monthly spend limit was reached, an admin can raise it on the same page. If neither applies, contact Anthropic support.

Once extra usage is available, someone with write access to this repository can comment @claude review on this pull request to trigger a review.

@claude

claude Bot commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

Claude encountered an error after 0s —— View job


I'll analyze this and get back to you.

@suraj-ranganath

Copy link
Copy Markdown
Member Author

🤖 Follow-ups split out from this PR: #430 (run the ported tests in CI via the Python lane), #431 (eeg_picard ignores random_state), #432 (Python-only tests hidden behind MATLAB skips), #433 (review rewritten parity-matrix notes), #434 (strengthen two weak kept tests).

Keep EEGLAB-ported tests and tests that catch bugs the ported and workflow tests miss.
Keep EEGLAB-ported tests and tests that catch bugs the ported and workflow tests miss.
Keep EEGLAB-ported tests and tests that catch bugs the ported and workflow tests miss.
Keep EEGLAB-ported tests and tests that catch bugs the ported and workflow tests miss.
Keep EEGLAB-ported tests and tests that catch bugs the ported and workflow tests miss.
Keep EEGLAB-ported tests and tests that catch bugs the ported and workflow tests miss.
Keep EEGLAB-ported tests and tests that catch bugs the ported and workflow tests miss.
Keep EEGLAB-ported tests and tests that catch bugs the ported and workflow tests miss.
Keep EEGLAB-ported tests and tests that catch bugs the ported and workflow tests miss.
Keep EEGLAB-ported tests and tests that catch bugs the ported and workflow tests miss.
Keep EEGLAB-ported tests and tests that catch bugs the ported and workflow tests miss.
Keep EEGLAB-ported tests and tests that catch bugs the ported and workflow tests miss.
Add the AGENTS.md rule to never write unit tests after writing code, and align the feature-development skill and contributor guide with it.
@suraj-ranganath
suraj-ranganath force-pushed the work/prune-low-signal-tests branch from ae70f6f to 3850a89 Compare October 7, 2026 04:09
@suraj-ranganath
suraj-ranganath merged commit f466b85 into develop Oct 7, 2026
9 checks passed
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