Skip to content

Consolidate CLI and extension architecture - #218

Merged
suraj-ranganath merged 2 commits into
feature/fable5-architecture-closeoutfrom
phase/211-cli-extension-architecture
Jun 12, 2026
Merged

suraj-ranganath merged 2 commits into
feature/fable5-architecture-closeoutfrom
phase/211-cli-extension-architecture

Conversation

@suraj-ranganath

Copy link
Copy Markdown
Member

Consolidates the agent CLI transform and pipeline execution paths, routes module harnesses through the canonical dispatcher, and splits runtime extension catalog loading from curation validation. Centralizes extension status and entry-point metadata helpers so the registry, validator, and plugin menu share the same ownership. Fixes #211. Part of #207.

@claude

claude Bot commented Jun 12, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @suraj-ranganath's task in 5m 9s —— View job


Code review

  • Overall assessment: Solid consolidation; needs one behavior confirmation. The CLI dispatcher unification, the extension_catalog → extension_catalog_validation split, and the renamed-public extension helpers are clean and well-tested.
  • Highest-risk area: Pipeline clean step now inherits the transform CLI's "off" criterion defaults (behavior change for existing pipeline YAML).
  • Merge recommendation: Safe to merge after confirming the clean-default change is intended and pinning it with a test/doc.

Important

1. Pipeline clean step silently changes default cleaning aggressiveness
src/eegprep/cli/commands/pipeline.py:467-472 now routes clean through transforms.apply_transform → transform_args("clean", …) → _clean_options (transforms.py:436-442), where unspecified flatline_criterion, channel_criterion, line_noise_criterion, and window_criterion resolve to "off".

The old _apply_clean only forwarded criteria that were present in the config, letting pop_clean_rawdata apply its own (non-off) defaults. So a pre-existing pipeline that ran {name: clean} with no extra keys previously performed flatline/channel/line-noise/window cleaning; after this PR it performs ASR burst cleaning only. This is consistent with the direct eegprep clean CLI (which is the consolidation goal), but it does change results for existing pipeline configs.

Why it matters: a researcher's saved pipeline produces different cleaned data with no error or warning. Suggested fix: confirm this is intended, note it in the pipeline docs/migration notes (docs/source/...), and add a pipeline clean test asserting the pop_clean_rawdata kwargs (e.g. unspecified → "off") so the consolidated defaults are locked.

2. Scalar highpass in a pipeline clean step raises TypeError
_clean_options (asr branch) does list(args.highpass) if args.highpass else "off" (transforms.py:439). Via the transform subcommand --highpass is nargs=2, so it is always a list or None. The pipeline path now feeds transform_args("clean", …) with highpass=params.get("highpass") verbatim, and validate/_validate_step does not check clean.highpass (pipeline.py:384-390). A config with highpass: 0.5 (a scalar, which the old _apply_clean passed straight through) now hits list(0.5) → TypeError, surfacing as a generic failure. Suggested fix: coerce a scalar to a 1-/2-element list (or validate clean.highpass shape) before dispatch.

Nits

  • Lost error metadata: pipeline._channel_indices now delegates to transforms._channel_tokens (pipeline.py:570-572), reaching into another module's underscore-private helper and dropping the previous path="steps[].channels" from the emitted CONFIG_SCHEMA_ERROR. Agent callers lose the path hint. Consider a public helper or threading path through.
  • Dead assignment: args.json_requested = requested_json in main.py:74 is never read — EEGPrepArgumentParser.error consults the instance attribute set at construction, and _json_requested reads requested_json/args.json. Harmless but removable.

Test gaps

  • No test pins the pipeline clean default-criteria behavior (Important refactor for packaging and test distribution #1). The updated test_pipeline_filter_history_uses_modern_eegfiltnew nicely pins the filter kwargs; an equivalent clean assertion would lock the consolidated defaults.

EEGLAB parity notes

  • bundled_plugins() now derives menu from record.spec.menus[0] via _menu_text (plugin_menu.py:77) instead of the removed _BUNDLED_PLUGIN_MENUS dict. This aligns it with the manager projection (which already used _menu_text), but it changes the inventory string for some bundled plugins — e.g. firfilt becomes tools > filter > <first filter item> rather than Tools > Filter the data, and path segments render lowercase (tools vs Tools). The new test_bundled_plugins_use_registry_menu_projection only checks internal consistency, so a divergence from the EEGLAB-facing label would pass silently. Worth confirming the lowercase/deep-path text is the intended menu label and that no docs/consumers expect the old strings.

Checked: CLI dispatcher routing (main.py, all commands/*.main), --json propagation for REMAINDER/nested parsers (covered by the new test_nested_qc_parse_errors_return_stable_json_error), transform/pipeline argument-default parity, the extension_catalog/extension_catalog_validation split and __init__ lazy-export retargeting, renamed extension helpers, and plugin_menu status centralization.
· phase/211-cli-extension-architecture

@suraj-ranganath

Copy link
Copy Markdown
Member Author

🤖 Addressed the review findings in e106b68: pipeline clean now validates highpass shape before dispatch, direct transform calls return structured config errors for malformed highpass, pipeline clean defaults are pinned to the direct CLI behavior with docs/tests, channel parsing uses a public helper with path metadata, the dead json_requested assignment is removed, and bundled plugin inventory labels are restored to EEGLAB-facing summaries.

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