Repository navigation
Closed
Labels
phaseEpic implementation phase
Description
🤖
Phase 1: Parity Matrix, Staleness Triage, And Porting Contracts
Summary
Build the audit foundation for the remaining EEGLAB core parity epic. This phase does not port features. It creates the machine-readable map that tells later phases what to port, what to consolidate, and what to intentionally skip.
This phase must merge before Phases 2-7 begin.
Scope
Create a committed parity matrix from vendored EEGLAB source to EEGPrep for the first seven items in .notes/eeglab-migration-gap-audit.md:
- Long-tail helper coverage
- Missing or legacy
pop_*entry points - Unsupported options in implemented functions
- STUDY depth
- Statistics package
- Time-frequency internals
- File format and channel-location long tail
The matrix should be audit-driven, not a same-name port checklist.
Required Status Values
Each row must use one of these statuses:
implemented: EEGPrep already covers the behavior.partial: EEGPrep has an implementation but important EEGLAB behavior or options remain.port: should be ported in this epic.consolidated: behavior exists under a different EEGPrep module/function.stale_skip: stale, obsolete, not user-facing, not workflow-required, and not worth porting.matlab_runtime_skip: MATLAB-specific runtime/helper behavior that should not exist in standalone EEGPrep.external_dependency_skip: depends on external toolboxes/plugins outside this epic.
Staleness Policy
Define stale functions concretely. A function can be stale_skip only when all are true:
- not main-menu reachable;
- not documented as a user API in current EEGLAB docs/help;
- not called by in-scope EEGPrep workflows;
- not required by MATLAB parity tests;
- not needed as a helper for phases 2-7;
- not a compatibility alias users are likely to type.
When in doubt, mark partial or port and leave notes for the responsible phase.
Acceptance Criteria
- Add a committed parity matrix under docs or tooling.
- Add a small validation test/tool that fails when an EEGLAB public/semi-public function in scope has no classification.
- Document the standalone runtime rule: package code must not depend on
src/eegprep/eeglab. - Document how later phase agents should update the matrix when implementing or intentionally skipping rows.
- Record decisions in
.notes/implementation-notes.htmlwhile working.
Verification
Run:
uv run --no-sync pytest <new parity matrix tests>uv run --no-sync ruff check .uv run --no-sync ruff format --check .uv run --no-sync ty check./pre-commit.py --changed-from origin/develop
/goal Prompt
/goal Build the audit and contract foundation for the remaining EEGLAB core parity epic. Create a machine-readable parity matrix for gaps 1-7, classify functions as port/consolidate/skip with explicit reasons, document stale-function policy, add validation tests, and keep EEGPrep standalone with no runtime dependency on the vendored EEGLAB tree. Do not port feature behavior in this phase; make the result reliable enough for Phases 2-7 to run from it.
Metadata
Metadata
Assignees
Labels
phaseEpic implementation phase
Activity
claude commentedon Jun 5, 2026
🤖 Plan:
Research
Phase 1 is infrastructure, not a bug fix. It must produce a committed machine-readable parity matrix covering audit categories 1–7, a validator that fails on unclassified in-scope EEGLAB functions, a documented standalone-runtime rule, and guidance for later phases on updating rows. Audit input data already exists in `.notes/eeglab-migration-gap-audit.md`; enumeration source-of-truth is the vendored `src/eegprep/eeglab/` tree (currently empty in CI clone — Phase 1 tooling must handle that). The existing `menu_placeholders` pattern is the closest precedent for a typed, machine-readable, test-validated inventory.
Relevant code
Proposed Approach (design, not a fix)
Scope clearly exceeds the 100-LOC self-contained-bug threshold (hundreds of classifications, new tooling, new tests, new docs), so this is an analysis comment for human review before implementation, per fix-issue policy.
1. Matrix storage. Commit one JSON file per audit area under `tools/parity_matrix/` (`adminfunc.json`, `guifunc.json`, `miscfunc.json`, `popfunc.json`, `sigprocfunc.json`, `statistics.json`, `studyfunc.json`, `timefreqfunc.json`, plus `unsupported_options.json` for category 3 and `file_formats.json` for category 7 where rows are option-level rather than function-level). JSON not YAML: stdlib-only, diff-friendly, validator-trivial. Row schema:
```json
{
"eeglab_path": "functions/popfunc/pop_averef.m",
"name": "pop_averef",
"status": "consolidated",
"eegprep_path": "src/eegprep/functions/popfunc/pop_reref.py",
"surface": "menu|console|api|internal|none",
"phase": "2|3|4|5|6|7|null",
"reason": "<≤140 char rationale, required for *_skip statuses>",
"unsupported_options": ["option_name", ...],
"notes": ""
}
```
Statuses are the seven from the issue. `reason` is mandatory for all `*_skip` rows so staleness decisions are auditable.
2. Python loader + validator. Add `tools/parity_matrix/init.py` exposing `load_matrix()` (returns dict keyed by area) and `enumerate_eeglab_functions(area)` (filesystem walk of `src/eegprep/eeglab/functions//*.m`, gracefully empty when the vendored tree is absent). Validator function `unclassified_functions(area)` returns the set of `.m` filenames present in the vendored tree but absent from the matrix. Pure stdlib; stays under `tools/` so it is not part of the installed `eegprep` package per AGENTS.md.
3. Tests. New `tests/test_parity_matrix.py` with: (a) schema validation per row, (b) status enum check, (c) reason required for `*_skip`, (d) when vendored EEGLAB present, `unclassified_functions(area) == set()` for each in-scope area, (e) when vendored tree empty, the enumeration test is `pytest.skip`-ed (mirrors `EEGPREP_SKIP_MATLAB` skip pattern). No marker needed; pure-Python.
4. Initial population. Use the missing-by-name lists already enumerated at the bottom of `.notes/eeglab-migration-gap-audit.md` as the starting row set. Each row gets an initial classification:
5. Docs. Add `docs/source/development/parity_matrix.md` (or extend an existing dev doc) covering: schema, status semantics, the six-condition staleness rule verbatim from the issue, how phase agents update rows on implementation, and the AGENTS-aligned standalone-runtime restatement ("package runtime code must not read from `src/eegprep/eeglab/`; the matrix and validator live under `tools/` and run only in development/CI"). Add a pointer from `AGENTS.md`'s Repo Map to `tools/parity_matrix/`.
6. Implementation notes. Append decisions to `.notes/implementation-notes.html` per acceptance criteria (will create if absent).
Branching. Per epic #131, target `feature/eeglab-core-parity-completion` (epic branch), not `develop`. Branch name per fix-issue skill: `agent/20260605-fix-132`.
Estimated scope. ~10 JSON files (~600+ rows total once filled), ~150 LOC loader/validator, ~80 LOC tests, ~80 LOC docs. Function-row count is the variable cost; the framework itself is small.
Open questions for human reviewer before I proceed: