Repository navigation
fix(doctor): probe the verify command's python and warn when pytest is missing (#13617) - #13799
Conversation
#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
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
|
Warning Review limit reachedEnable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
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. View limit details
|
…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
…hint (#13617) Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UNUoLT6mGYgTpTRWiCZcAU
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UNUoLT6mGYgTpTRWiCZcAU
EffortlessSteven
left a comment
There was a problem hiding this comment.
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: #13617and anAcceptance deltasentence. 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 PATHpython -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. Unknownis 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 exclusiveDirBuilder::create(nevercreate_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_dirchecks 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 ignoresPYTHONSAFEPATHstill 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 pytestprobe call is routed.
Findings
- Low, doctor.rs:1374: the hint interpolates
{venv}but hard-codessource .venv/bin/activate. For a project that usesvenv/(whichproject_venv_pythonaccepts), 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. - 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. - Low, platform (unchanged):
project_venv_pythonisNoneon Windows, so Windows never gets the venv hint, and the new venv tests arecfg(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
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
ripr static exposure checkCommit 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
left a comment
There was a problem hiding this comment.
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 ancestorpytest.ini/conftest.pyis read. The env setsPYTHONSAFEPATH=1and removesPYTHONPATH, 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 sharedshell_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.tomlto tests that exist under these names. - Local proof:
cargo test -p ripr --lib -- pytest_probe python_envpassed 8 of 8. Localcheck-traceabilitystopped 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
|
The Rust-only feature lane failure at Generated by Claude Code |
EffortlessSteven
left a comment
There was a problem hiding this comment.
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
|
The Rust-only feature lane failure at Generated by Claude Code |
EffortlessSteven
left a comment
There was a problem hiding this comment.
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
|
The Rust-only feature lane at Generated by Claude Code |
There was a problem hiding this comment.
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
left a comment
There was a problem hiding this comment.
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_isolatedruns PATHpython -c 'import sys, pytest; ...'from a fresh 0700 directory created with an exclusivecreate_dir(retrying on collision), withPYTHONSAFEPATH=1andPYTHONPATHremoved. It imports pytest rather than runningpython -m pytest, so no ancestorpytest.ini/conftest.pyis loaded; the harness's appended--versionis an ignoredsys.argv[1]. The directory is removed after the probe. The probe is advisory:runtime_probe_is_requiredonly 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_pythononly looks at.venv/bin/pythonandvenv/bin/pythonon non-Windows;project_venv_pytestreadspyvenv.cfgand the matchinglib/python3.X/site-packagesstatically, returnsUnknownforinclude-system-site-packages = trueor an ambiguous layout, and distinguishespytest-<digit>...dist-infofrompytest-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 forMissing/NoVenv. The new tests cover present/missing/unknown,.venvvsvenv, 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.
Requested by Steven Zimmerman · project thread
Summary
Advances #13617 (doctor half); the verify-command half is completed by #13801.
pythonimportingpytest(python -c 'import sys, pytest; ...', the interpreterpython -m pytestuses), run from a fresh unpredictable owner-only directory (exclusivecreate_dir, retry on collision) withPYTHONSAFEPATH=1, so a plantedpytest.py,conftest.pyorpytest.inicannot be picked up; importing instead of running-m pytest --versionalso keeps an ancestorpytest.ini/conftest.py(for example under/tmp) out of the probe. User-site installs stay visible. (-Pis not used: it is rejected before Python 3.11.).venv/venvis read statically (never executed) and only feeds the hint: when it has pytest but PATHpythondoes not, the warning says to activate the detected venv (source venv/bin/activateorsource .venv/bin/activate) before running the printed verify command. An unreadable venv layout (system site-packages, ambiguouslib/python3.X) is shown as "not verified".docs/CONFIGURATION.mddoctor note added.origin/main(picks up fix(output): classify missed-txt in is_json_request so main compiles #13848, which fixed the non-exhaustiveOutputFormat::MissedTxtmatch that broke compilation at the earlier base).Swarm / Source Boundary
ripr-swarmSource-of-truth Links
Proposal:
Spec:
ADR:
Plan item:
Governing issue or accepted claim: #13617
Acceptance delta (one sentence): Doctor probes whether PATH
python(thepython -m pytestinterpreter) 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
Production delta:
pythonpytest-import doctor probe with a venv activation hint naming the detectedvenv/or.venv/directory.Evidence/support delta:
venv/directory that must not be told.venv/bin/activate), NoVenv probe-seam test, probe command test pinning built args (-cimport script, no-m), env, cwd and exclusive private dir.Single acceptance criterion:
pythonthe verify command uses.Non-goals:
ripr checkverify command and confidence label (ux(python): verify-command interpreter and confidence at the producer (parity follow-up to #13617) #13801). Windows: venv detection is POSIX layout only; the PATH probe applies there.Support-tier Impact
Policy Impact
Proof
Result, failures, or skipped proof:
MissedTxtmatch, fixed on main by fix(output): classify missed-txt in is_json_request so main compiles #13848); it passes after merging main.PYTHONSAFEPATH=1from a private dir printedpytest 9.2.0and exited 0. The real probe was not run end to end against the repro repos; hosted CI covers the full suite for 5ef092f.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
python_envtests,pytest_probe_*doctor testscrates/ripr/src/output/python_env.rs,cli/commands/doctor.rs,output/doctor.rsStatic Language Check
killed,survived,untested,proven, andadequate.CI Economics
n/a
Engineering Check
panic,unwrap,expect,todo, orunimplementedin production code.panic,unwrap,expect,todo, orunimplementedin tests.🤖 Generated with Claude Code
https://claude.ai/code/session_01UNUoLT6mGYgTpTRWiCZcAU