Skip to content

[Study] Add packaged help and menu docs - #87

Merged
suraj-ranganath merged 4 commits into
feature/study-standalone-completionfrom
phase/6a-admin-help-docs
May 30, 2026
Merged

suraj-ranganath merged 4 commits into
feature/study-standalone-completionfrom
phase/6a-admin-help-docs

Conversation

@suraj-ranganath

Copy link
Copy Markdown
Member

Add EEGPrep-owned packaged help resources for implemented admin, Help-menu, File-menu, BIDS, and current STUDY workflows. Help lookup now resolves through package resources and fails clearly when a resource is missing, with docs and tests covering menu inventory, GUI help, console, and STUDY surfaces.

Closes #66

Part of #78

@claude

claude Bot commented May 30, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @suraj-ranganath's task in 4m 43s —— View job


PR Review: Add packaged help and menu docs

  • Read PR diff against base branch
  • Review help resource loader changes (pophelp.py)
  • Review menu_actions.py refactor
  • Review test updates
  • Spot-check Markdown help files for parity / accuracy
  • Verify docs additions
  • Post summary review

Summary

Clean, well-scoped refactor that delivers on the issue: GUI Help buttons and Help-menu topics now resolve only through packaged eegprep.resources.help/<name>.md, missing resources fail loudly, and the docs/test surface has been extended to lock in those guarantees. The new Sphinx pages (gui_help_menus.rst, study_workflows.rst) and the cross-references from interactive_console.rst, api/index.rst, and user_guide/index.rst line up with the runtime contract spelled out in development.rst and AGENTS.md. Help files themselves are concise and follow the EEGLAB FUNCTION - description heading convention with "See also" cross-links.

I'd merge after the small nit below; nothing blocking.

Notable strengths

  • src/eegprep/functions/guifunc/pophelp.py rightly swaps Path(__file__).parents[2] / "resources/help" for importlib.resources.files("eegprep.resources.help"). That's the modern, install-layout-independent way to locate package data — and pyproject.toml:191-199 already declares resources/help/*.md under [tool.setuptools.package-data], so wheels and editable installs both work.
  • _find_source no longer has a silent "missing → docs URL" branch (menu_actions.py:1204-1205), and pophelp.py:77-81 raises a clear FileNotFoundError("Missing packaged EEGPrep help resource …"). The new test test_show_help_missing_resource_raises_clear_error_not_coming_soon and test_pophelp_requires_packaged_resource both pin that behavior. Good fail-fast story.
  • test_implemented_menu_help_actions_have_packaged_resources in tests/test_guifunc_pophelp_chansel.py:64-82 walks every help: and implemented pop_*/eeg_* action and verifies a packaged .md exists and matches the function name. That's exactly the inventory check needed to prevent help-resource drift as new actions land.
  • pop_adjustevents_dialog_spec (pop_adjustevents.py:238) gets help_text="pophelp('pop_adjustevents')", bringing it in line with the rest of the dialog specs (cross-checked across pop_reref, pop_interp, pop_runica, etc.). Without this, the spec relied on the implicit function-name fallback in qt.py:887 — same effective lookup, but the explicit pophelp(...) string matches sibling specs and is what test_dialog_help_targets_have_packaged_resources consumes.

Findings

1. Stale "eeglab" fallback in _dispatch (src/eegprep/functions/guifunc/menu_actions.py:219-220) — minor nit

if base == "help":
    self._show_help(variant or "eeglab", parent)

With this PR, _show_help is just pophelp(function_name, parent=parent), so a bare help action (no :variant) would call pophelp("eeglab", …), hit _find_source("eeglab"), and raise FileNotFoundError: Missing packaged EEGPrep help resource for 'eeglab'. The renamed "about" topic is eegprep.md now (see eegprep.resources.help/eegprep.md and the menu test test_help_menu_pophelp_actions_have_packaged_topics which already lists "eegprep" not "eeglab").

In practice this is dead — every menu item that dispatches help: ships a variant (help:eegprep, help:eeg_helpadmin, …), so the or branch is unreachable from the current menu spec. But the literal still leaks the pre-rebrand topic name and would be a sharp edge if anyone wires a bare help action later. Suggest:

if base == "help":
    self._show_help(variant or "eegprep", parent)

Fix this →

2. Any typing for Traversable in pophelp.py — informational, not blocking

_find_source and _read_help_source declare Any | None (pophelp.py:71, pophelp.py:84) where the prior code had Path | None. The actual returned object is a importlib.resources.abc.Traversable. Using Traversable (or MultiplexedPath/PosixPath union) would document the contract better; Any only avoids the import churn. Fine as-is, just calling it out in case you want to tighten it.

3. _resource_source_name always returns a POSIX-style logical path — fine, just noting it

pophelp.py:90-91 now writes "eegprep/resources/help/<name>" into the help-dialog header instead of the real on-disk path. The test (test_pophelp_reads_packaged_markdown_and_appends_called_function) explicitly switched its assertion to match (tests/test_guifunc_pophelp_chansel.py:23-24). This is intentional and matches the "treat help as packaged data, not files" stance — just lose a small bit of debuggability (you can no longer copy-paste the path into an editor). Acceptable trade.

Tests / docs coverage

  • Test suite was not executed in this review; the diff additions, marker assertions, and resource-inventory test give high confidence the behavior is exercised. Worth running EEGPREP_SKIP_MATLAB=1 uv run pytest tests/test_guifunc_pophelp_chansel.py tests/test_gui_main_window.py locally before merge to confirm the missing-resource and inventory-parity tests pass.
  • docs/source/development.rst:182-186 and docs/source/user_guide/gui_help_menus.rst:34-44 now codify the "no fallback to vendored EEGLAB / docstrings" rule, matching AGENTS.md. Good.
    · branch phase/6a-admin-help-docs

@suraj-ranganath

Copy link
Copy Markdown
Member Author

Addressed Claude review follow-up in commit 6523f84:

  • changed the bare help-action fallback from eeglab to eegprep
  • tightened packaged help resource helper typing to Traversable, using the portable importlib.abc import and avoiding .stem on generic traversables

Verification rerun:

  • uv run --no-sync ruff check .
  • uv run --no-sync ruff format --check .
  • uv run --no-sync ty check
  • uv run --no-sync pytest tests/test_guifunc_pophelp_chansel.py tests/test_gui_main_window.py -> 66 passed

@suraj-ranganath

Copy link
Copy Markdown
Member Author

Re-audited PR #87 against Phase 6a issue #66, not just Claude's review. Found and fixed one additional in-scope inventory gap in commit 69f058c:

  • removed the stale eeglab_update Phase 6 placeholder now that the Help menu uses implemented updates
  • added tests that bare help dispatch defaults to the packaged eegprep topic
  • added tests that Help/admin link actions do not mutate EEGPrepSession selection/history
  • added a package-data declaration test for resources/help/*.md

Verification rerun:

  • uv run --no-sync ruff check .
  • uv run --no-sync ruff format --check .
  • uv run --no-sync ty check
  • uv run --no-sync pytest tests/test_guifunc_pophelp_chansel.py tests/test_gui_main_window.py tests/test_menu_placeholder_inventory.py -> 75 passed

I do not see another incomplete Phase 6a item after this pass; the remaining Phase 6 work is 6b/6c scope.

…ion' into phase/6a-admin-help-docs

# Conflicts:
#	src/eegprep/resources/help/pop_loadstudy.md
#	src/eegprep/resources/help/pop_savestudy.md
#	src/eegprep/resources/help/pop_study.md
#	src/eegprep/resources/help/pop_studyerp.md
#	src/eegprep/resources/help/pop_studywizard.md
#	tests/test_menu_placeholder_inventory.py
@suraj-ranganath

Copy link
Copy Markdown
Member Author

Merged latest origin/feature/study-standalone-completion into Phase 6a and resolved conflicts in commit d78153b.

Conflict resolutions:

  • STUDY help resources now reflect the real Phase 5a STUDY implementations from the epic branch while keeping Phase 6a's packaged-help convention and uppercase EEGLAB-style headings.
  • Placeholder inventory now treats pop_studydesign and select_study_set as implemented from Phase 5a while keeping updates implemented and removing the stale eeglab_update Phase 6 placeholder.

Verification rerun after conflict resolution:

  • uv run --no-sync ruff check .
  • uv run --no-sync ruff format --check .
  • uv run --no-sync ty check
  • uv run --no-sync pytest tests/test_guifunc_pophelp_chansel.py tests/test_gui_main_window.py tests/test_menu_placeholder_inventory.py tests/test_gui_pop_study.py tests/test_study_metadata.py -> 97 passed

PR merge state is clean.

@suraj-ranganath
suraj-ranganath merged commit 5d6c749 into feature/study-standalone-completion May 30, 2026
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