Skip to content

[Fable 5 Architecture Closeout] Phase 1 β€” shared contracts, boundary events, and history mutationΒ #208

Closed

Description

@suraj-ranganath

πŸ€– Part of #207. This phase establishes the shared behavior contracts that later phases should consume instead of reimplementing locally.

Summary

Replace divergent low-level contracts with one canonical implementation for user-facing booleans/numeric vectors, boundary-event detection, console history mutation, and small history/serialization helpers. These are behavior-sensitive because current copies disagree, so fix from first principles and use EEGLAB as the parity oracle where applicable.

Scope

Covers remaining findings from #197/#205 including:

  • is_on, is_empty_value, and numeric sequence parsing copies across popfunc, sigprocfunc/headplot.py, timefreqfunc/newtimef.py, newcrossf.py, timefreq.py, and tf_cycle_calc.py.
  • Boundary-event detection forks; route through the canonical EEGLAB-compatible eeg_findboundaries behavior where correct.
  • ConsoleEegh destructive and append paths mutating ALLCOM/LASTCOM without session notification.
  • Small canonical helper cleanups such as pop_topoplot history literal reuse, pop_saveset chanloc struct serialization, pop_topochansel label/index resolution, and dead duplicate CLI error helpers if still present.

Acceptance Criteria

  • One shared lower-level value helper module is used by pop/timefreq/sigproc callers without introducing upward imports from lower layers into popfunc.
  • Boundary checks match EEGLAB semantics: string boundary events and numeric boundary sentinels are handled consistently and tested across pop_resample, eeg_eegrej, pop_rmdat, pop_selectevent, and any other current fork.
  • eegh() append, clear, and removal paths update EEGPrepSession through session helpers and notify listeners without duplicating history entries.
  • History strings remain valid Python and GUI plus eegprep-console history stays synchronized.
  • Regression tests cover previous divergent cases, including MATLAB-style numeric strings, ndarray/list boolean values, numeric boundary events, and console workspace listeners.
  • Run focused tests plus ruff, ruff format --check, ty, and ./pre-commit.py --changed-from origin/develop.

References

  • AGENTS.md
  • .agents/skills/eegprep-feature-development/SKILL.md
  • .agents/skills/github-pr-review/SKILL.md
  • EEGLAB boundary behavior via eeg_findboundaries.m reference in the vendored EEGLAB tree.

/goal Prompt

/goal Complete Fable 5 architecture closeout Phase 1 from issue #<THIS_ISSUE>: consolidate shared boolean/numeric parsing, boundary-event detection, console history mutation, and small history/serialization helpers into canonical EEGPrep-owned code. Use #197/#205 as the audit source, inspect EEGLAB behavior before changing boundary/history semantics, preserve standalone runtime behavior, add regression tests for every changed contract, verify GUI plus eegprep-console synchronization where relevant, and run focused pytest plus ruff, format, ty, and pre-commit. Do not broaden into unrelated refactors; report any remaining incompatible finding explicitly.

Activity

  1. added
    phase
    on Jun 12, 2026
  2. suraj-ranganath commented on Jun 12, 2026

    @suraj-ranganath
    MemberAuthor

    πŸ€– # Research

    Boolean/numeric parsing currently lives in popfunc._pop_utils, while lower-level sigprocfunc and timefreqfunc import upward or keep local vector parsers; this makes shared contracts depend on caller layer and leaves colon/string behavior inconsistent. Boundary detection has three active predicates with conflicting sentinel behavior: EEGLAB eeg_findboundaries.m uses string strmatch('boundary', ...) or numeric -99 when option_boundary99 is on, while _event_utils treats -1 as boundary and eeg_eegrej/pop_resample keep their own copies. ConsoleEegh mutates ALLCOM through eegh() and clears LASTCOM directly, so append/clear/remove can skip EEGPrepSession.notify_changed() and leave console listeners stale.

    Relevant code

    Proposed Fix

    Move value parsing to a lower-level EEGPrep-owned helper used by popfunc, sigprocfunc, and timefreqfunc, with tests for MATLAB-style numeric strings and ndarray/list booleans. Make eeg_findboundaries the canonical boundary implementation, route pop/event/rejection helpers through it, and preserve EEGLAB string-prefix plus option_boundary99 == -99 behavior in numeric cases. Add a session-level history mutator for append/clear/remove, update ConsoleEegh to use it, and cover listener notification plus no duplicate history entries in console workspace tests.

  3. suraj-ranganath commented on Jun 12, 2026

    @suraj-ranganath
    MemberAuthor

    πŸ€– Phase 1 implementation is up in PR #214: #214

    Implemented shared value parsing, canonical boundary detection, session-level eegh history mutation, and the still-present pop_topoplot history-helper cleanup. Focused regression coverage is in place for numeric/string boundary paths, ndarray/list booleans, numeric vector parsing, and console listener notifications.

    Local checks: focused pytest suites passed; ruff check passed; ruff format --check passed; pre-commit changed-from feature/fable5-architecture-closeout passed. ty check is blocked locally by missing optional torch imports in existing ICLabel/tooling files. PR review CI passed.

  4. suraj-ranganath commented on Jun 12, 2026

    @suraj-ranganath
    MemberAuthor

    πŸ€– Completed by merged phase PR #214 into feature/fable5-architecture-closeout.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    phase

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions