Skip to content

fix(doctor): probe the verify command's python and warn when pytest is missing (#13617) - #13799

Merged
EffortlessSteven merged 10 commits into
mainfrom
claude/project-thread-ebaya9-13617
Nov 13, 2026
Merged

EffortlessSteven merged 10 commits into
mainfrom
claude/project-thread-ebaya9-13617

Conversation

@EffortlessSteven

@EffortlessSteven EffortlessSteven commented Nov 8, 2026 •

Copy link
Copy Markdown
Member

Requested by Steven Zimmerman · project thread

Summary

Advances #13617 (doctor half); the verify-command half is completed by #13801.

  • Doctor's Python pytest probe checks the interpreter the verify route actually prints: PATH python importing pytest (python -c 'import sys, pytest; ...', the interpreter python -m pytest uses), run from a fresh unpredictable owner-only directory (exclusive create_dir, retry on collision) with PYTHONSAFEPATH=1, so a planted pytest.py, conftest.py or pytest.ini cannot be picked up; importing instead of running -m pytest --version also keeps an ancestor pytest.ini/conftest.py (for example under /tmp) out of the probe. User-site installs stay visible. (-P is not used: it is rejected before Python 3.11.)
  • A project .venv/venv is read statically (never executed) and only feeds the hint: when it has pytest but PATH python does not, the warning says to activate the detected venv (source venv/bin/activate or source .venv/bin/activate) before running the printed verify command. An unreadable venv layout (system site-packages, ambiguous lib/python3.X) is shown as "not verified".
  • The probe goes through the injected probe closure, so tests never spawn Python. A missing pytest is advisory (required=false, exit code unchanged).
  • Doctor probes pytest for Python roots without pytest config unless unittest-only.
  • Changelog fragment and docs/CONFIGURATION.md doctor note added.
  • Merged origin/main (picks up fix(output): classify missed-txt in is_json_request so main compiles #13848, which fixed the non-exhaustive OutputFormat::MissedTxt match that broke compilation at the earlier base).

Swarm / Source Boundary

  • ordinary feature, analyzer, editor, docs, spec, fixture, badge, dependency, or repo-ops development for ripr-swarm
  • repair or follow-up for a same-repo swarm PR
  • swarm-only CI, runner, routing, source-of-truth, or agent-operating surface
  • other swarm-scoped work:

Source-of-truth Links

Proposal:
Spec:
ADR:
Plan item:
Governing issue or accepted claim: #13617
Acceptance delta (one sentence): Doctor probes whether PATH python (the python -m pytest interpreter) imports pytest as the verify-route runtime and warns (with a venv activation hint) when pytest is not importable; the verify command's interpreter and confidence label are split to #13801.

Candidate Relationships

Candidate branch (GitHub PR head is authoritative after publication): claude/project-thread-ebaya9-13617
Stack parent or prerequisite PR (if any): none
Proposed replacement of PR (if any; not yet accepted): none
Acceptance retained from a replaced candidate (if any): n/a
Accepted winner and losing candidate disposition (when decided): n/a

Scope

  • output/python_env.rs (static venv detection), doctor pytest probe, docs, changelog.

Scope Classification

  • One production behavior

Production delta:

  • PATH python pytest-import doctor probe with a venv activation hint naming the detected venv/ or .venv/ directory.

Evidence/support delta:

  • python_env tests (pytest-cov control, Unknown cases), doctor hint tests with negative controls (including a venv/ directory that must not be told .venv/bin/activate), NoVenv probe-seam test, probe command test pinning built args (-c import script, no -m), env, cwd and exclusive private dir.

Single acceptance criterion:

  • Doctor warns when pytest is not importable by the PATH python the verify command uses.

Non-goals:

Support-tier Impact

  • none

Policy Impact

  • none

Proof

cargo test -p ripr --lib -- pytest_probe python_env   # exit 0, 8 passed (at 5ef092fd)
cargo test --locked -p ripr --test agent_command_journey   # exit 0, 16 passed
cargo xtask check-architecture            # exit 0
cargo xtask check-process-policy          # exit 0
cargo xtask precommit                     # exit 0 (earlier head)

Result, failures, or skipped proof:

Claim Boundary

Doctor reports pytest availability for the PATH python; static venv detection does not prove the venv works.

Rollback

Revert the commits; no schema or config changes.

Spec-Test-Code Traceability

  • Tests: python_env tests, pytest_probe_* doctor tests
  • Code: crates/ripr/src/output/python_env.rs, cli/commands/doctor.rs, output/doctor.rs
  • Golden outputs: unchanged

Static Language Check

  • Static output avoids killed, survived, untested, proven, and adequate.
  • Unknowns include stop reasons where applicable.

CI Economics

n/a

Engineering Check

  • No new panic, unwrap, expect, todo, or unimplemented in production code.
  • No new panic, unwrap, expect, todo, or unimplemented in tests.
  • Errors are reported with actionable context.

🤖 Generated with Claude Code

https://claude.ai/code/session_01UNUoLT6mGYgTpTRWiCZcAU

#13617)

Doctor probes python -m pytest (or the project .venv/venv read statically)
instead of a standalone pytest binary, warns when pytest is not importable,
and the printed verify command uses the venv interpreter and drops (high)
when the venv lacks pytest.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UNUoLT6mGYgTpTRWiCZcAU
@gemini-code-assist

Copy link
Copy Markdown

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@coderabbitai

coderabbitai Bot commented Nov 8, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

  • Ask an admin to enable usage-based reviews

Open in CodeRabbit

Reviews can continue after your included limit without a manual trigger. An admin must approve usage-based billing.

Next included review available in 19 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available. Your 152 included PR review attempts over the past 7 days set your current allowance at 1 review per hour.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Essentials
  • Run ID: a1d6f3bd-e67c-4e54-9ec6-e7ccae7d58e9
Commits

Reviewing files that changed from the base of the PR and between 7d73d7b and f492c48.

Files selected for processing: 8

  • .ripr/traceability.d/13617-doctor-python-pytest-probe.toml
  • changelog.d/13617-doctor-probes-path-python-m-pytest.md
  • crates/ripr/src/cli/commands/doctor.rs
  • crates/ripr/src/output/doctor.rs
  • crates/ripr/src/output/mod.rs
  • crates/ripr/src/output/python_env.rs
  • docs/CONFIGURATION.md
  • docs/specs/RIPR-SPEC-0007-repository-configuration.md
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

…tion (#13617)

Drop the human-only verify-command change (follow-up #13801).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UNUoLT6mGYgTpTRWiCZcAU
@EffortlessSteven EffortlessSteven changed the title fix(doctor): probe the verify command's python, prefer project venv (#13617) fix(doctor): probe the verify command's python and warn when pytest is missing (#13617) Nov 8, 2026

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Decision

  • Needs focused proof failure resolved before upstream.

Test proof

  • Focused HEAD proof failed (exit 101): cargo test --locked --package ripr --test agent_command_journey. This is a current failure, not a red/green witness.

@EffortlessSteven EffortlessSteven left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Exact-head review (head 3645577)

Scope read: this PR's delta against its merge-base ab93e28 (current origin/main, so #13848 is in): 6 files, +451/-3. That covers cli/commands/doctor.rs, output/doctor.rs, output/python_env.rs, output/mod.rs, docs/CONFIGURATION.md and the changelog fragment, read from a fetch of pull/13799/head. I also compared the rework commit da0d248 against the earlier head 2b718cd. Draft.

Verified

  • Body carries Governing issue or accepted claim: #13617 and an Acceptance delta sentence. Verify-command venv selection is deferred to #13801.
  • Doctor now probes what the printed verify command runs. python_pytest_runtime_probe (doctor.rs:1359) always probes PATH python -m pytest. It consults the venv only statically, and only to explain a PATH failure. So the earlier wording/behaviour mismatch (venv named as "the verify command's interpreter") is gone at this head.
  • Unknown is no longer a pass: it adds "not verified" to a PATH failure. A test pins the system-site-packages case.
  • The probe directory is private as claimed. create_private_probe_dir (output/doctor.rs:2123) uses an exclusive DirBuilder::create (never create_dir_all) with a RandomState-hashed name, mode 0700 on unix, and retries on collision. pytest_probe_command_is_python_dash_m_pytest_with_safe_path_in_private_dir checks that two directories differ, the directory starts empty, and a re-create is refused.
  • PYTHONSAFEPATH=1 (:2115) replaces -I, so user-site installs stay visible exactly as they are for the verify command. With cwd set to the empty private directory, a pre-3.11 Python that ignores PYTHONSAFEPATH still cannot import a planted module from the checkout.
  • Oracles discriminate. With pytest in the venv and a failing PATH probe, the activation hint appears; a venv without pytest gives no hint; a PATH pass says which command was probed; and exactly one python -m pytest probe call is routed.

Findings

  1. Low, doctor.rs:1374: the hint interpolates {venv} but hard-codes source .venv/bin/activate. For a project that uses venv/ (which project_venv_python accepts), the advice names the wrong path. Derive the activate path from the detected directory (venv/bin/activate). The test at :3850 only uses .venv, so it would not catch this.
  2. Low, output/python_env.rs:1-8: the module doc still says the venv interpreter is used by "both the printed command and doctor". After the rework it is neither: doctor uses it only as a hint, and the printed command is #13801. Update the doc so it does not claim more than the code does.
  3. Low, platform (unchanged): project_venv_python is None on Windows, so Windows never gets the venv hint, and the new venv tests are cfg(not(windows)).

Hosted checks at this head: 31 check runs were registered at 22:50Z and none had failed when read. Most were still running, so qualification is not established. The head moved at 22:44Z, so the author is actively writing.

Verdict: the rework closes the substantive issues of the previous head (interpreter mismatch, Unknown-as-pass, predictable probe directory). The two wording fixes above are small and can ride along before this leaves draft.

…rect python_env doc (#13617)

The probe now runs `python -c 'import sys, pytest; ...'` so an ancestor
pytest.ini/conftest (for example under /tmp) is never read. The activate
hint names the detected venv directory (`venv/` or `.venv/`), and the
python_env module doc states that doctor probes the PATH interpreter and
uses the venv only as a hint (#13801 owns choosing the interpreter).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UNUoLT6mGYgTpTRWiCZcAU
@EffortlessSteven
EffortlessSteven marked this pull request as ready for review November 8, 2026 23:14
@gemini-code-assist

Copy link
Copy Markdown

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Devin Review found 4 potential issues.

Devin Review

Comment thread crates/ripr/src/cli/commands/doctor.rs Resolved
Comment thread crates/ripr/src/cli/commands/doctor.rs Resolved
Comment thread docs/CONFIGURATION.md Resolved
Comment thread crates/ripr/src/output/doctor.rs Resolved
@github-actions

github-actions Bot commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

ripr static exposure check

Commit f492c48ae361 · run · advisory, static evidence only (not a mutation run).

ripr did not produce a report for this commit. Nothing here is a finding.

…robe, spec + traceability (#13617)

- The venv activate hint is joined to the selected root and shell-quoted,
  so it pastes from the caller's directory under --root.
- The pytest import probe unsets PYTHONPATH so a checkout listed there
  cannot supply a pytest.py that doctor would execute.
- docs/CONFIGURATION.md describes the import probe accurately.
- RIPR-SPEC-0007 gains the doctor pytest probe rule, mapped in
  .ripr/traceability.d/13617-doctor-python-pytest-probe.toml.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UNUoLT6mGYgTpTRWiCZcAU

@EffortlessSteven EffortlessSteven left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

SOURCE_REVIEW_READY

I reviewed the full diff at 38a69188, focusing on what changed since 3645577a:

  • Probe (output/doctor.rs): argv is -c "import sys, pytest; ...", so pytest itself never starts and no ancestor pytest.ini/conftest.py is read. The env sets PYTHONSAFEPATH=1 and removes PYTHONPATH, and the probe runs in a fresh owner-only directory. The test pins the args, both env entries, the cwd and that the directory is empty.
  • Hint (cli/commands/doctor.rs): the activate path is derived from the detected venv (venv/ or .venv/). Outside a . root it is joined to that root and quoted with the shared shell_arg. Tests cover both venv layouts with root-joined quoted paths, the bare hint at a . root, a venv without pytest (no advice) and an unreadable layout (not verified). On Windows, venv detection returns None, so no POSIX activate hint is produced there.
  • Docs, spec, traceability: CONFIGURATION.md describes the import probe and states that it does not detect a broken entry point. RIPR-SPEC-0007 has the new rule, mapped in .ripr/traceability.d/13617-doctor-python-pytest-probe.toml to tests that exist under these names.
  • Local proof: cargo test -p ripr --lib -- pytest_probe python_env passed 8 of 8. Local check-traceability stopped on a full disk, so hosted CI is the proof for it.
  • Review threads: Devin's 4 threads all have replies and are resolved. CodeRabbit and Gemini were rate-limited, so they gave no review.

Generated by Claude Code

Copy link
Copy Markdown
Member Author

The Rust-only feature lane failure at 38a69188 comes from main, not this PR. Since #13874 (669ccaa), the lib-test build fails with E0063 missing field owner_opt_outs at crates/ripr/src/output/human.rs:9236, a test literal this PR does not touch. Open fixes: #13920 and #13912. Once one of them lands, I'll merge main into this branch and re-request qualification.


Generated by Claude Code

@EffortlessSteven EffortlessSteven left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

SOURCE_REVIEW_READY

The only change since my review at 38a69188 is a merge of main at 50d8cbd9. It picks up #13912, which fixes main's lib-test owner_opt_outs build break, the cause of the earlier Rust gates and Rust-only failures. The merge auto-resolved in cli/commands/doctor.rs, docs/CONFIGURATION.md and RIPR-SPEC-0007 without conflicts. The PR's own source, tests and docs are unchanged from the reviewed head.


Generated by Claude Code

Copy link
Copy Markdown
Member Author

The Rust-only feature lane failure at 50d8cbd9 is also a main break, separate from the one #13912 fixed. lsp_lifecycle::real_seam_diagnostic_offers_the_repair_start_on_a_committed_change (#13800) expects attempt manifest: on stderr, which #13873 moved to stdout. The fix is #13933. Once it lands, I'll merge main here and re-request qualification.


Generated by Claude Code

@EffortlessSteven EffortlessSteven left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

SOURCE_REVIEW_READY

The only change since my review at 50d8cbd9 is a merge of main at f492c48a. It picks up #13933 (the LSP repair-start test fix behind the Rust-only lane failure). output/mod.rs auto-merged with no conflicts, and the PR's own source, tests, docs and spec are unchanged. The previous Rust gates failure at 50d8cbd9 was the PR-evidence ripr check hitting its 3600s timeout (job 128914012589). That stops the run before any check result, so I'm re-requesting qualification on this head. If it times out again, I'll bisect the diff for an analyzer hang.


Generated by Claude Code

Copy link
Copy Markdown
Member Author

The Rust-only feature lane at f492c48a failed on another main break, not on this PR. Main's crates/ripr/src/output/human.rs now initializes owner_opt_outs twice (lines 9260 and 9264, E0062), after two separate fixes for the earlier missing field both landed. Open fixes: #13951 and #13938. Once one of them lands, I'll merge main and re-request qualification.


Generated by Claude Code

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Decision

  • Needs verification checks before upstream.

Verification questions

  • Confirm the probe seam tests never execute Python, so they cannot validate that the constructed command imports pytest or avoids project-controlled code at runtime.
  • Confirm the static venv tests cover POSIX conventional layouts but do not exercise a venv whose pytest package is discoverable through a nonstandard layout.
  • Confirm adjacent Python verify/runtime routes outside the changed doctor route were not exhaustively enumerated, so broader sibling coverage remains a verification gap.

Evidence gaps

  • A completed focused cargo-test receipt is needed to validate the changed Rust behavior and test seams.
  • Model proof intent was rejected by deterministic validation.
  • The repository test result needed to demonstrate the checked-in tests pass is not yet evidenced in this packet.
  • The failed ripr sensor and absent cargo-test receipt prevent treating the packet as current red/green proof.
  • The scheduled cargo-test receipt is absent, so platform-specific compilation and behavior remain unverified in this review packet.

@EffortlessSteven EffortlessSteven left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

SOURCE_REVIEW_READY
VERDICT: APPROVE f492c48 — no blocking findings on this head.

Reviewed the whole diff at this head (+568/−3, eight files) for the doctor pytest probe.

  • Probe target and isolation (output/doctor.rs). doctor_python_pytest_check_isolated runs PATH python -c 'import sys, pytest; ...' from a fresh 0700 directory created with an exclusive create_dir (retrying on collision), with PYTHONSAFEPATH=1 and PYTHONPATH removed. It imports pytest rather than running python -m pytest, so no ancestor pytest.ini/conftest.py is loaded; the harness's appended --version is an ignored sys.argv[1]. The directory is removed after the probe. The probe is advisory: runtime_probe_is_required only requires a language's primary runtime, so a pytest failure never changes the exit code.
  • Venv hint (output/python_env.rs, cli/commands/doctor.rs). project_venv_python only looks at .venv/bin/python and venv/bin/python on non-Windows; project_venv_pytest reads pyvenv.cfg and the matching lib/python3.X/site-packages statically, returns Unknown for include-system-site-packages = true or an ambiguous layout, and distinguishes pytest-<digit>...dist-info from pytest-cov. The hint joins the activate script to the selected root and shell-quotes it, keeps the bare relative path for ./empty roots, and gives no advice for Missing/NoVenv. The new tests cover present/missing/unknown, .venv vs venv, the . root, and the pass path.
  • Probe selection (cli/commands/doctor.rs). The pytest probe is now added for a Python root that is not unittest-only (frameworks.contains("pytest") || !frameworks.contains("unittest")), matching the spec's "not unittest-only" clause. The traceability fragment lists the new tests and code files; the spec and CONFIGURATION text match the implementation.

Qualification: the hosted Ripr Rust Small on GitHub Hosted / Rust gates, Ripr Rust Small Result, and Rust-only feature lane checks are red at this head's 2026-11-09 merge group with error[E0062]: field 'owner_opt_outs' specified more than once in crates/ripr/src/app/repair_attempt/mod.rs:5856, a file this PR does not touch. The head's own copy of that file has no owner_opt_outs at all, so this is base-era drift, not this diff; the merge group must show those gates green. The Windows gate, cargo-deny, and the Python/doctor-relevant checks pass.

Not checked here: no local build or test run. Read-only: no push, label, enqueue, merge or branch change.

@EffortlessSteven
EffortlessSteven added this pull request to the merge queue Nov 13, 2026
Merged via the queue into main with commit c1fcadb Nov 13, 2026
86 of 90 checks passed
@EffortlessSteven
EffortlessSteven deleted the claude/project-thread-ebaya9-13617 branch November 13, 2026 21:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants