Skip to content

fix(cli): wizard CSS_PATH broken after cli.py package split#1129

Open
scoobyluu wants to merge 2 commits into
massgen:mainfrom
scoobyluu:fix/cli-wizard-css-path
Open

fix(cli): wizard CSS_PATH broken after cli.py package split#1129
scoobyluu wants to merge 2 commits into
massgen:mainfrom
scoobyluu:fix/cli-wizard-css-path

Conversation

@scoobyluu

@scoobyluu scoobyluu commented Jun 26, 2026

Copy link
Copy Markdown

Summary

  • massgen --setup, --quickstart, and the first-run wizard crash on launch with StylesheetError: unable to read CSS file ... textual_themes/dark.tcss. After commit 68fcd74 moved massgen/cli.py into the massgen/cli/ package, Path(__file__).parent in entrypoint.py now resolves to massgen/cli/, so the wizard CSS_PATH definitions point at the nonexistent massgen/cli/frontend/displays/textual_themes/dark.tcss.
  • Fix: bump the three CSS_PATH declarations in massgen/cli/entrypoint.py (lines 2245, 2366, 2806) from .parent to .parent.parent so they resolve back to massgen/frontend/displays/textual_themes/dark.tcss.
  • Add massgen/tests/test_cli_wizard_css_paths.py: parses every CSS_PATH = Path(__file__).parent... / "*.tcss" literal in entrypoint.py and asserts each resolves to a real file, so a future module relocation surfaces the breakage in CI instead of via user crash.

Test plan

  • uv run pytest massgen/tests/test_cli_wizard_css_paths.py -v — 2 passed
  • Red/green verified: reverting only the fix (keeping the test) makes test_every_wizard_css_path_resolves_to_an_existing_file fail with the three missing massgen/cli/frontend/... paths
  • Manual: uv run massgen --setup should reach the wizard UI instead of raising StylesheetError

Summary by CodeRabbit

  • Bug Fixes

    • Updated how the CLI resolves and loads the Textual theme stylesheet for the quickstart, API key setup, and first-run wizard screens, improving reliability of theme discovery at runtime.
  • Tests

    • Added regression coverage that verifies the CLI declares exactly three wizard stylesheet paths and that each resolved .tcss file exists on disk, preventing future regressions from layout/path changes.

@coderabbitai

coderabbitai Bot commented Jun 26, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 746d6947-39d5-497c-95fd-015668f1e037

📥 Commits

Reviewing files that changed from the base of the PR and between b9101a8 and a0cc1f4.

📒 Files selected for processing (2)
  • massgen/cli/entrypoint.py
  • massgen/tests/test_cli_wizard_css_paths.py
🚧 Files skipped from review as they are similar to previous changes (1)
  • massgen/cli/entrypoint.py

📝 Walkthrough

Walkthrough

Updated three wizard CSS path declarations to resolve dark.tcss from the package frontend themes directory and added regression tests that validate the resolved files exist.

Changes

Wizard CSS path relocation

Layer / File(s) Summary
Wizard CSS_PATH updates
massgen/cli/entrypoint.py
The quickstart, API key setup, and first-run setup wizards now resolve dark.tcss from Path(__file__).parent.parent / "frontend" / "displays" / "textual_themes".
CSS path regression test
massgen/tests/test_cli_wizard_css_paths.py
A new test module extracts the wizard CSS_PATH expressions from massgen.cli.entrypoint, resolves them to filesystem paths, and asserts the targets exist.

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 7 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Title check ⚠️ Warning The title is relevant, but it does not match the required <type>: <brief description> format because it uses fix(cli): instead of fix:. Rewrite it as a template-compliant title like fix: restore wizard CSS_PATH resolution after cli package split.
✅ Passed checks (7 passed)
Check name Status Explanation
Description check ✅ Passed The description covers the bug, fix, and test plan with concrete verification steps, so it is sufficiently complete overall.
Docstring Coverage ✅ Passed Docstring coverage is 83.33% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Documentation Updated ✅ Passed No user docs were needed; the new helper and tests include Google-style docstrings, and the fix is an internal path change.
Capabilities Registry Check ✅ Passed PR only changes CLI CSS-path code and adds a CSS-path regression test; no backend/model files were changed, so the capabilities registry check doesn't apply.
Config Parameter Sync ✅ Passed PR only changes CLI CSS paths and adds a regression test; no YAML params were added, so the config-parameter sync check is not applicable.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
massgen/tests/test_cli_wizard_css_paths.py (1)

27-65: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add Google-style docstrings to the new functions.

The helper uses a free-form docstring, and both new tests have none. Please convert these to Google-style so this module follows the repo standard. As per coding guidelines, **/*.py: For new or changed functions, include Google-style docstrings.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@massgen/tests/test_cli_wizard_css_paths.py` around lines 27 - 65, The new
helper and tests in test_cli_wizard_css_paths.py use non-standard or missing
docstrings; update _resolve_css_path,
test_entrypoint_declares_at_least_one_css_path, and
test_every_wizard_css_path_resolves_to_an_existing_file to use Google-style
docstrings consistent with the repo’s Python style. Keep the docstrings concise,
use the standard summary plus Args/Returns as applicable, and replace the
free-form helper docstring with the Google-style format.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@massgen/tests/test_cli_wizard_css_paths.py`:
- Around line 42-65: The CSS path tests only verify that at least one wizard
CSS_PATH exists, so a missing or rewritten wizard can slip through. Update the
tests in test_cli_wizard_css_paths.py to explicitly assert all three expected
wizard CSS_PATH declarations are present, using the existing _CSS_PATH_PATTERN
and _ENTRYPOINT_PATH checks, before validating that each resolved path exists.
If helpful, key the assertion off the specific wizard classes or the expected
match count so coverage stays aligned with the three wizard flows.

---

Nitpick comments:
In `@massgen/tests/test_cli_wizard_css_paths.py`:
- Around line 27-65: The new helper and tests in test_cli_wizard_css_paths.py
use non-standard or missing docstrings; update _resolve_css_path,
test_entrypoint_declares_at_least_one_css_path, and
test_every_wizard_css_path_resolves_to_an_existing_file to use Google-style
docstrings consistent with the repo’s Python style. Keep the docstrings concise,
use the standard summary plus Args/Returns as applicable, and replace the
free-form helper docstring with the Google-style format.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 6e25944a-07c5-4b18-9401-12a7c247befa

📥 Commits

Reviewing files that changed from the base of the PR and between 007bd85 and 716c92d.

📒 Files selected for processing (2)
  • massgen/cli/entrypoint.py
  • massgen/tests/test_cli_wizard_css_paths.py

Comment thread massgen/tests/test_cli_wizard_css_paths.py Outdated
scoobyluu pushed a commit to scoobyluu/MassGen that referenced this pull request Jun 26, 2026
Address CodeRabbit feedback on PR massgen#1129:

- Tighten the regression test to assert exactly the three expected wizard
  CSS_PATH declarations (setup, quickstart, first-run). The prior "at least
  one" assertion would have silently masked an accidental wizard removal.
- Add Google-style docstrings to _resolve_css_path and both test functions
  so this module satisfies the repo's docstring coverage standard.
…e split

The setup, quickstart, and first-run wizards in massgen/cli/entrypoint.py
declared CSS_PATH as `Path(__file__).parent / "frontend" / ...`. That worked
when the code lived in massgen/cli.py, but after commit 68fcd74 split it into
the massgen/cli/ package, __file__.parent resolves to massgen/cli/, so the path
pointed at the nonexistent massgen/cli/frontend/.... `massgen --setup` (and the
quickstart/first-run flows) crashed on launch with
`StylesheetError: unable to read CSS file ... textual_themes/dark.tcss`.

Use `.parent.parent` so the path resolves to massgen/frontend/displays/
textual_themes/dark.tcss, matching the actual theme location.

Added a regression test (test_cli_wizard_css_paths.py) that parses every
CSS_PATH literal in entrypoint.py and asserts the resolved path exists, so a
future module relocation surfaces the breakage before users do.
Address CodeRabbit feedback on PR massgen#1129:

- Tighten the regression test to assert exactly the three expected wizard
  CSS_PATH declarations (setup, quickstart, first-run). The prior "at least
  one" assertion would have silently masked an accidental wizard removal.
- Add Google-style docstrings to _resolve_css_path and both test functions
  so this module satisfies the repo's docstring coverage standard.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
massgen/tests/test_cli_wizard_css_paths.py (1)

63-68: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Scope this assertion to the three wizard classes.

Lines 63-68 currently count every matching CSS_PATH literal in entrypoint.py, not just _QuickstartWizardApp, SetupWizardApp, and _FirstRunSetupApp. A future non-wizard app with the same literal shape would fail this regression even though the wizard contract is still intact. Parsing those three class assignments explicitly would keep the test aligned with what this PR is actually protecting.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@massgen/tests/test_cli_wizard_css_paths.py` around lines 63 - 68, The test in
test_cli_wizard_css_paths.py is counting every CSS_PATH literal in entrypoint.py
instead of only the three wizard classes. Update the assertion logic to
explicitly scope the search to _QuickstartWizardApp, SetupWizardApp, and
_FirstRunSetupApp, using those class assignments as the source of truth. Keep
the existing _ENTRYPOINT_PATH and _CSS_PATH_PATTERN usage, but narrow the
parsing so unrelated future apps do not affect the wizard CSS_PATH count.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@massgen/tests/test_cli_wizard_css_paths.py`:
- Around line 63-68: The test in test_cli_wizard_css_paths.py is counting every
CSS_PATH literal in entrypoint.py instead of only the three wizard classes.
Update the assertion logic to explicitly scope the search to
_QuickstartWizardApp, SetupWizardApp, and _FirstRunSetupApp, using those class
assignments as the source of truth. Keep the existing _ENTRYPOINT_PATH and
_CSS_PATH_PATTERN usage, but narrow the parsing so unrelated future apps do not
affect the wizard CSS_PATH count.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: b06a88b5-281a-4b5c-9cae-c25cf472a6b5

📥 Commits

Reviewing files that changed from the base of the PR and between 716c92d and b9101a8.

📒 Files selected for processing (1)
  • massgen/tests/test_cli_wizard_css_paths.py

@scoobyluu scoobyluu force-pushed the fix/cli-wizard-css-path branch from b9101a8 to a0cc1f4 Compare June 26, 2026 03:50
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