Skip to content

[Epic] Fable 5 Findings — Whole-Codebase Code-Quality Review #193

Closed

Description

@suraj-ranganath

Epic: Fable 5 Findings — Whole-Codebase Code-Quality Review

🤖 This epic tracks remediation of a thermo-nuclear (strict maintainability) code-quality review of the entire EEGPrep codebase, run at commit 8ba958e (tip of PR #190 fix/async-ica-progress).

What was reviewed

All of src/eegprep (~83k lines across 432 modules, excluding the vendored src/eegprep/eeglab/ reference), the tests/ suite (~49k lines), tools/, the Sphinx docs, and packaging. The review judged the code against EEGPrep's three goals: it must work standalone in Python (no runtime dependency on the vendored MATLAB reference), stay familiar to EEGLAB users (pop_* semantics, 1-based user-facing indices, history commands), and be a delight for EEG researchers.

Method

19 scoped reviewer agents covered every subsystem plus cross-cutting sweeps (vendored-EEGLAB runtime leaks, 1-based/0-based index boundaries, duplicate helpers, GUI/console/session atomicity, test quality, packaging/UX). Every finding was then put through an independent adversarial verification pass (a separate agent prompted to refute it against the working tree); findings that could not be defended, were parity-justified, or had already been fixed were dropped. Raw findings → 6 refuted → 12 merged duplicates → 123 confirmed findings.

Findings by category

Category Count
1 — Structural regression / bug risk 48
2 — Missed major simplification 7
3 — Wrong ownership / duplicated helper 38
4 — Session/history atomicity 3
5 — File sprawl 3
6 — Legibility with real cost 24
Total 123

Phases

Findings are grouped into 5 phase issues, ordered so each phase makes the next one safe. Recommended execution order is 1 → 5: the test suite is made honest first (so numeric fixes are guarded), then data-integrity and correctness bugs, then structural refactors, then packaging/polish.

The five highest-impact items (start here)

  1. pop_saveset corrupts the live EEG dict — saving rewrites urchan/urevent to 1-based on the caller's own objects; a second save double-increments. (Phase 2)
  2. pop_loadset / pop_fileio silent fallbacks — a malformed .set is silently reinterpreted (HDF5 retry, then anonymous data matrix) and surfaces as a cryptic unrelated error. (Phase 3)
  3. eeg_from_data guesses channel-vs-sample orientation from shape[0] > shape[1] — a tall high-density import silently transposes channels and time. (Phase 2)
  4. ~152 core-numeric tests can never fail — assertions are wrapped in try/except -> skipTest, so regressions report as skips and CI stays green. (Phase 1)
  5. The CLI implements the transform pipeline twice with divergent validation — a notch the subcommand rejects passes through the pipeline path as a negative cutoff. (Phases 3 + 4)

Scope & limitations

  • Reviewers were read-only and did not execute the test suite; numerical findings are reasoned from code and the EEGLAB oracle, not reproduced at runtime. Verify each finding from first principles before fixing.
  • The vendored src/eegprep/eeglab/ tree was treated as reference only and not reviewed (but runtime code depending on it was flagged).
  • The full per-finding report (with verifier notes and complete evidence snippets) is in THERMO_NUCLEAR_REVIEW.md on the review branch thermo-nuclear-full-codebase-review.

Generated by an automated multi-agent review at the maintainer's request. Each phase issue lists its findings as a checklist.

Delivery status (PRs)

Each phase is implemented in an isolated worktree branched from fix/fresh-uv-console and opened as its own PR. PRs were verified green (relevant pytest + ruff + pre-commit) and adversarially reviewed; every fix carries a reproducing/regression test, and an integration branch (fable5/integration) confirms the phases compose.

Recommended merge order: 1 → 2 → 3 → 5, then rebase #204 onto the result and merge, then tackle #205. The only cross-phase merge conflict observed was a single ASR test file (resolved); a Phase 2 picard test was hardened (in #202) so it composes with Phase 1's shared fixture.

Merge staging (epic branch model)

Epic branch: fable5/epic (off fix/fresh-uv-console). Epic PR to develop: #206 (advisor human review; do not auto-merge — supersedes #199).

Flow: the five phase PRs merge into fable5/epic first, then #206 carries the epic to develop.

Activity

  1. added
    epic
    on Jun 12, 2026
  2. claude commented on Jun 12, 2026

    @claude
    Contributor

    🤖 Plan:

    Analysis

    #193 is the tracking epic for the Fable 5 review, not a single fix candidate. The 123 findings are already decomposed into five child issues (#194–#198), each of which is the right unit for a branch + PR. Opening a PR against #193 itself would either duplicate that decomposition or silently re-scope it; per AGENTS.md "make the smallest change that solves the request", the right move is to land work against the phase issues and let this epic close when all five are checked off.

    Preflight (open PRs touching phases 1–5): none. gh pr list --state open returns only PR #191 (unrelated torch lockfile bump). No parallel implementation is in flight, so a maintainer can assign phases independently without merge conflicts on the epic itself.

    Recommended execution order (already stated in the epic body): #194 → #195 → #196 → #197 → #198. Phase 1 first because ~152 tests currently skipTest on assertion failure (`tests/conftest.py` and individual test files wrap asserts in try/except), so CI cannot fail until that's fixed — landing later numeric fixes before Phase 1 means regressions show as skips, not failures.

    Top 5 (from the epic body, ranked by blast radius):

    Recommendation: leave #193 open as the tracking checklist; do not open a PR against it. Direct fix-issue agents at #194 first, then walk forward. If you want a single agent to drive the whole epic, that's a meta-orchestration request and should be scoped explicitly — it's well past the >100-line / multi-module threshold for autonomous PR work.

  3. suraj-ranganath commented on Jun 12, 2026

    @suraj-ranganath
    MemberAuthor

    🤖 Phase integration is complete on fable5/epic. PRs #200, #202, #203, #201, and #204 are merged into the epic branch; #206 now contains the composed remediation plus integration fixes from the final review pass. Local verification passed: ruff check, ruff format --check, ty check, ./pre-commit.py --changed-from origin/develop, and EEGPREP_SKIP_MATLAB=1 uv run --no-sync pytest -m "not slow" (2023 passed, 249 skipped, 16 deselected, 1 expected xfail). Phase 4b remains tracked separately in #205 and is not a blocker for #206.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

epic

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions