Repository navigation
cli: reject init --force at the curriculum source #71
Description
Activity
- addedbugSomething isn't workingSomething isn't workinggood first issueGood for newcomersGood for newcomersdev sprintPythonlings Community Dev Sprint August 2026Pythonlings Community Dev Sprint August 2026area: cliCommand-line interface behaviorCommand-line interface behaviorsize: SSmall, focused contributionSmall, focused contribution
on Aug 18, 2026 coderabbitai commented
on Aug 18, 2026 coderabbitaiboton Aug 18, 2026 – with coderabbitaiMore actions🔗 Related PRs
#53 - fix: preserve workspace gitignore entries [merged]
#54 - fix: wrap malformed info.toml failures in ManifestError [merged]
#66 - release: promote v0.4.2 to main [merged]
📝 Issue Planner
Check the box below or use the
@coderabbitai plancommand to generate an implementation plan and prompts that you can use with your favorite coding assistant.- Create Plan
🧪 Issue enrichment is currently in open beta.
You can configure auto-planning by selecting labels in the issue_enrichment configuration.
To disable automatic issue enrichment, add the following to your
.coderabbit.yaml:issue_enrichment: auto_enrich: enabled: false
💬 Have feedback or questions? Drop into our discord!
I've submitted a fix for this in #147.
The change adds a same-path guard in
init_workspace()before any copy, mirroring the existing guard inupdate_workspace(). It also adds unit and integration regression tests for the resolved same-path case.All acceptance criteria are met, and I verified:
- Exit code 1, no traceback
- Source checkout unchanged (tree hash comparison)
- 25 targeted tests pass
- Full suite passes
Closes #71
Motivation
Running forced initialization from a source checkout can crash after Pythonlings resolves the destination to the same directory as its bundled curriculum. A contributor-facing command should reject that target before attempting any copy.
Current evidence
Deep QA on
devate1d4dae37234b75124bd6a53f06734296ebbbdeereproduced this twice in disposable copies:The command exits 1 with a traceback.
init_workspace()starts copying before checking whetherpathequalssource_root().update_workspace()already rejects the equivalent source target.Exact scope
Reject forced initialization when the resolved destination is the curriculum source, before any file is copied or removed. Return a concise
pythonlings:error through the existing CLI error path.Acceptance checklist
init --path <curriculum-source> --forceexits non-zero without a traceback.Explicit exclusions
Do not change update target precedence, overwrite semantics for a normal learner workspace, curriculum copy layout, or automatic workspace discovery.
Likely files
pythonlings/core/curriculum.pypythonlings/cli.pytests/unit/test_curriculum.pytests/integration/test_cli_workspace.pyVerification
Repeat the same-path command against a disposable source copy and confirm its tree hash is unchanged.
Sprint coordination
See Discussion #37 and tracker #52. This issue is intentionally unassigned. A coordination comment is welcome, but it does not reserve the issue. The first pull request that satisfies every acceptance criterion and verification requirement is considered for merge.