Skip to content

feat: add pythonlings doctor diagnostics - #61

Closed
Huoyanlifusu wants to merge 1 commit into
abhiksark:devfrom
Huoyanlifusu:feat/doctor-diagnostics
Closed

feat: add pythonlings doctor diagnostics#61
Huoyanlifusu wants to merge 1 commit into
abhiksark:devfrom
Huoyanlifusu:feat/doctor-diagnostics

Conversation

@Huoyanlifusu

Copy link
Copy Markdown
Contributor

Closes #46

Summary

Adds pythonlings [--root PATH] doctor, a read-only diagnostic command that reports:

  • Python runtime and installed package version
  • workspace structure and manifest validity
  • solution availability
  • progress-state readability
  • reset-snapshot coverage
  • bundled-docs coverage

Warnings never fail the command; required failures exit 1. The command never
creates, repairs, renames, or otherwise modifies workspace files — it uses its own
non-mutating inspection path (no reuse of the mutating state loader) and mirrors
core/reset.py's snapshot-path logic only.

Behavior

  • Discoverable in pythonlings --help and respects global --root (explicit
    --root wins over the current workspace).
  • Resolution failures (symlink loops, unknown ~user) are reported as a friendly
    [FAIL] Workspace: line with no traceback.
  • Malformed manifests (wrong field types, missing files, directories where files
    belong) are caught and reported as [FAIL] Manifest: with no traceback.
  • Corrupt or unreadable state is a warning and is never touched (no .bak, no repair).

Tests

  • python -m pytest tests/unit/test_doctor.py tests/integration/test_cli_doctor.py -q
    • 18 passed
  • python -m pytest -q
    • 169 passed
  • pythonlings --root tests/fixtures/passing_curriculum verify
    • passed
  • pythonlings --root tests/fixtures/passing_curriculum doctor
    • 8 checks, 3 warning(s), 0 failure(s) (fixture lacks solutions/snapshots/docs)
  • Read-only check on a freshly inited workspace (1172 files): SHA-256 hashes
    identical before and after doctor

Representative output (healthy workspace)

Pythonlings doctor
Workspace: <root>

[OK] Python runtime: Python 3.11.15
[OK] Pythonlings version: pythonlings 0.4.1
[OK] Workspace: <root>
[OK] Manifest: 292 exercises across 31 topics
[OK] Solutions: 292/292 available
[OK] Progress state: no progress file yet
[OK] Reset snapshots: 292/292 available
[OK] Bundled docs: 31/31 topics available

Summary: 8 checks, 0 warning(s), 0 failure(s)

Add a `pythonlings doctor` subcommand that inspects the runtime,
package version, workspace structure, manifest, solutions, state,
reset snapshots, and bundled docs without mutating any files.
Warnings do not fail the command; required failures exit 1.
@coderabbitai

coderabbitai Bot commented Aug 16, 2026

Copy link
Copy Markdown

Important

Review available on request

  • 🔍 Trigger review

Reviews should be triggered manually for repositories with fewer than 10 stars. Select Trigger review above or comment @coderabbitai review to review the latest changes. For a full review, comment @coderabbitai full review.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: c95687df-8501-4b0c-9fdb-6dbdb9c797ab


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 self-assigned this Aug 16, 2026
@abhiksark
abhiksark changed the base branch from main to dev August 16, 2026 18:58
@Huoyanlifusu
Huoyanlifusu deleted the feat/doctor-diagnostics branch August 17, 2026 00:57
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.

feat: add pythonlings doctor diagnostics

2 participants