Skip to content

fix: prefer current workspace for update - #57

Merged
abhiksark merged 3 commits into
abhiksark:devfrom
Huoyanlifusu:fix/update-current-workspace
Aug 16, 2026
Merged

fix: prefer current workspace for update#57
abhiksark merged 3 commits into
abhiksark:devfrom
Huoyanlifusu:fix/update-current-workspace

Conversation

@Huoyanlifusu

@Huoyanlifusu Huoyanlifusu commented Aug 15, 2026

Copy link
Copy Markdown
Contributor

Fixes #42

Summary

  • preserve whether update --path was explicitly provided
  • honor target precedence: --path, global --root, current workspace, then the default home workspace
  • reject missing, invalid, or source-checkout targets before any migration or copy operation
  • reuse the existing workspace resolver without creating a missing workspace

Previously, bare pythonlings update always received the default home path from argparse, so it could update ~/.pythonlings even when run from another valid workspace.

Tests

Integration coverage verifies every precedence branch and the failure boundaries:

  • explicit update --path wins over global --root and the current workspace
  • global --root wins over the current workspace
  • bare update selects the current workspace
  • bare update falls back to the default home workspace outside a workspace
  • missing targets fail without being created
  • existing non-workspace targets fail without being modified
  • legacy state, directory-valued manifests, and the source checkout are rejected before mutation

Validation after rebasing onto current dev:

  • python -m pytest tests/integration/test_cli_workspace.py tests/unit/test_workspace.py -q
    • 23 passed
  • python -m pytest -q
    • 185 passed
  • pythonlings --root tests/fixtures/passing_curriculum verify
    • passed
  • python -m ruff check pythonlings/cli.py pythonlings/core/curriculum.py tests/integration/test_cli_workspace.py
    • passed
  • PIP_CONFIG_FILE=/dev/null PIP_INDEX_URL=https://pypi.org/simple python -m build
    • built pythonlings-0.4.1.tar.gz and pythonlings-0.4.1-py3-none-any.whl
  • installed the wheel in a clean virtual environment and exercised pythonlings update
    • the current workspace was updated while the home workspace remained unchanged
    • an explicit missing target failed and remained absent
    • pythonlings --version reported 0.4.1

Screenshots

Not applicable. This changes CLI workspace resolution only.

Checklist

  • Documentation not required because the command syntax is unchanged
  • Added or updated tests
  • Verified the full suite and passing curriculum
  • Built and installed the wheel

@coderabbitai

coderabbitai Bot commented Aug 15, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 92c4a45d-c8dd-4562-89fb-57917638a6c7

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

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.

@abhiksark abhiksark left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Welcome to Pythonlings, @Huoyanlifusu, and thank you for your first contribution! The precedence implementation is focused and behaves correctly in my review: explicit update --path, global --root, current workspace, and default home workspace resolve in the required order, while a missing target fails without being created. The full suite also passes (python -m pytest -q: 147 passed), as does pythonlings --root tests/fixtures/passing_curriculum verify. Before merge, please add the integration tests promised in issue #42 for every precedence branch, including the missing/non-workspace no-creation case. The PR currently changes only pythonlings/cli.py, and its checklist correctly shows test coverage and the required full-suite command as incomplete. Please update those checks and record the exact results in the description after adding the regressions.

@Huoyanlifusu

Huoyanlifusu commented Aug 16, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for the review! I added the requested integration coverage — 6 new tests in
tests/integration/test_cli_workspace.py.

The new tests cover every precedence branch:

  • explicit update --path
  • global --root
  • the current workspace
  • the default home workspace
  • missing targets failing without being created
  • existing non-workspace directories failing without being modified

Verification:

  • python -m pytest tests/integration/test_cli_workspace.py -q
    • 12 passed
  • python -m pytest -q
    • 157 passed
  • python -m pythonlings --root tests/fixtures/passing_curriculum verify
    • passed

Rebased onto the latest main to resolve the merge conflict with #53 — the full-suite
count moved from 153 to 157 as a result.

@Huoyanlifusu
Huoyanlifusu force-pushed the fix/update-current-workspace branch from e963463 to 9e42d72 Compare August 16, 2026 04:34
@abhiksark
abhiksark changed the base branch from main to dev August 16, 2026 18:58
@abhiksark
abhiksark force-pushed the fix/update-current-workspace branch from 9e42d72 to 0aa40d7 Compare August 16, 2026 19:41

@abhiksark abhiksark left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

The requested precedence regressions are present, invalid targets are rejected before mutation, and the current head passes the full Python 3.11 through 3.13 CI matrix, including package build, wheel reinstall, and installed CLI flows. Approved for squash merge into dev.

@abhiksark
abhiksark merged commit 4c3c01d into abhiksark:dev Aug 16, 2026
4 checks passed
@Huoyanlifusu
Huoyanlifusu deleted the fix/update-current-workspace branch August 17, 2026 01:34
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.

fix: make pythonlings update prefer the current workspace

2 participants