Thanks to visit codestin.com
Credit goes to GitHub.com

Skip to content

Conversation

@moreal
Copy link
Contributor

@moreal moreal commented Jan 21, 2026

This pull request introduces /upgrade-pylib-next command to find a module to update by running scripts/update_lib todo (#6823). It just finds a module to update and delegates other to /upgrade-pylib. (cc #6580)

This pull request also has changes about /upgrade-pylib. It became to use auto-mark subcommand to test newly introduced tests also.

Summary by CodeRabbit

  • Chores
    • Added structured guidance document for investigating test failures with step-by-step analysis and issue reporting workflow.
    • Added workflow document for selecting and upgrading Python library modules based on dependency status.
    • Updated Python library upgrade process with streamlined steps, enhanced test-management guidance, and improved examples.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 21, 2026

📝 Walkthrough

Walkthrough

Three new Claude command documents added to guide test failure investigation and Python library upgrades. The first provides structured debugging procedures for failing tests. The second automates selection of next upgrade candidates. The third substantially restructures the upgrade workflow with expanded guidance for test management and git workflows.

Changes

Cohort / File(s) Summary
New Test Failure Investigation
.claude/commands/investigate-test-failure.md
New guidance document establishing structured tool-assisted process for diagnosing failing tests, including mandatory analysis steps, fix categorization (simple vs. complex), pre-commit workflow commands, and issue template generation.
New Upgrade Workflow Automation
.claude/commands/upgrade-pylib-next.md
New workflow document that codifies module selection criteria for Python library upgrades, including status checks via task listing, open PR filtering, dependency-aware prioritization, and recommended invocation command.
Restructured Upgrade Process
.claude/commands/upgrade-pylib.md
Substantial reorganization of upgrade documentation replacing four-stage flow with expanded seven-step sequence, introducing tool-assisted test failure investigation, explicit git-commit creation, subagent-guided workflows, auto-marking of failures, panic handling, and enriched examples for both module-name and library-path invocations.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

  • Update AI docs #6728 — Directly modified .claude/commands/upgrade-pylib.md which this PR substantially reorganizes and expands with new workflow structure.
  • Complement upgrade-pylib Claude Code command #6742 — Updated the upgrade-pylib documentation and test-upgrade behavior, overlapping with this PR's enhancements to test-failure workflow and guidance.

Suggested reviewers

  • youknowone
  • ShaharNaveh

Poem

🐰 With tools and steps, we chart our way,
Testing failures fade to gray,
Upgrades flow in ordered grace,
Automation sets the pace—
A rabbit's gift, docs bright and clear!

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Introduce /upgrade-pylib-next' directly and specifically describes the main change: a new command being added to the system.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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 and usage tips.

- **Test assertion failure** → `@unittest.expectedFailure` with `# TODO: RUSTPYTHON` comment
- **Panic/crash** → `@unittest.skip("TODO: RUSTPYTHON; <panic message>")`
- **Class-specific markers**: If a test fails only in the C implementation (TestCFoo) but passes in the Python implementation (TestPyFoo), or vice versa, add the marker to the specific subclass, not the base class:
3. **Mark remaining test failures with auto-mark**
Copy link
Member

Choose a reason for hiding this comment

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

quick now auto-mark newly added failing tests. only regressions are remained failing.
Before step 3, let's add review the failing tests and analyze If that's justified to mark failure or not.
Lots of them will be better to report issue or worth to try fix them; otherwise upgrade the dependency lib first.

Copy link
Contributor Author

@moreal moreal Jan 22, 2026

Choose a reason for hiding this comment

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

I'm dogfooding this command, and as your suggestion, it fixes a failed test automatically!

38ff638

(Other tests (snippets) seem to fail but anyway 😅)

Copy link
Member

Choose a reason for hiding this comment

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

Great, it is good as long as it doesn't blindly mark everything expectedFailure

@moreal moreal force-pushed the upgrade-pylib-next branch from cb9edb5 to eb416e9 Compare January 21, 2026 09:47
@youknowone youknowone added the skip:ci Skip running the ci label Jan 21, 2026
@moreal moreal force-pushed the upgrade-pylib-next branch 2 times, most recently from 273678f to fc57173 Compare January 22, 2026 05:39
@moreal moreal force-pushed the upgrade-pylib-next branch from fc57173 to 50abeca Compare January 23, 2026 13:20
youknowone pushed a commit that referenced this pull request Jan 23, 2026
This pull request updates `types` module to v3.14.2. While doing it, it
fixes also async-related feature. This pull request's base is generated
by #6827.

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **New Features**
* Generators that act as iterable coroutines are now recognized as
awaitable, improving async behavior.
* Yield-from and await interactions now handle coroutine-iterable
sources more consistently.

* **Bug Fixes**
* Reduces spurious TypeError cases when awaiting or yielding from
wrapped coroutine-like generators.

<sub>✏️ Tip: You can customize this high-level summary in your review
settings.</sub>
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
@moreal moreal force-pushed the upgrade-pylib-next branch 3 times, most recently from 23e2a99 to d24423b Compare January 23, 2026 15:40
@moreal moreal force-pushed the upgrade-pylib-next branch from d24423b to 2783211 Compare January 30, 2026 21:53
@moreal moreal self-assigned this Jan 30, 2026
@moreal moreal force-pushed the upgrade-pylib-next branch from 2783211 to 01c614d Compare January 30, 2026 22:32
@moreal moreal marked this pull request as ready for review January 30, 2026 22:35
@moreal
Copy link
Contributor Author

moreal commented Jan 30, 2026

Can we merge this pull request? I haven't been able to do much dogfooding these past few days, but I still find it useful. cc #6833

@moreal moreal requested a review from youknowone January 30, 2026 22:37
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🤖 Fix all issues with AI agents
In @.claude/commands/upgrade-pylib.md:
- Around line 110-120: Update the fenced "Example Usage" code block to include a
language identifier so syntax highlighting is applied; specifically add "bash"
after the opening triple backticks for the block that contains the
/upgrade-pylib usage examples (lines showing "/upgrade-pylib inspect",
"/upgrade-pylib json", "/upgrade-pylib asyncio" and the path examples) so the
block begins with ```bash instead of ```; no other changes to the content are
needed.
- Around line 51-71: Step 3's markdown code blocks lack language identifiers;
update the code fences around the shell commands in the “Investigate test
failures with subagent” section to use ```bash (or ```sh) for the three examples
containing the commands `cargo run --release -- scripts/update_lib deps
$ARGUMENTS`, `cargo run --release -- -m test test_xxx test_yyy ... 2>&1 | grep
-E "^(FAIL|ERROR):"`, and the example `cargo run --release -- -m test test_bdb
test_inspect test_linecache test_traceback test_zipimport 2>&1 | grep -E
"^(FAIL|ERROR):"` so they render with proper syntax highlighting.
- Around line 1-3: The allowed-tools header currently permits only Bash(git
add:*), Bash(git commit:*), Bash(python3 scripts/update_lib quick:*), and
Bash(python3 scripts/update_lib auto-mark:*), but the workflow runs cargo run
--release -- scripts/update_lib deps; update the allowed-tools header to also
include Bash(python3 scripts/update_lib deps:*) (or the equivalent pattern used
for quick/auto-mark) so the `deps` subcommand is allowed; ensure the new entry
matches the existing pattern for `quick` and `auto-mark` to permit the deps
invocation and related test commands.

Comment on lines +1 to +3
---
allowed-tools: Bash(git add:*), Bash(git commit:*), Bash(python3 scripts/update_lib quick:*), Bash(python3 scripts/update_lib auto-mark:*)
---
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

Add missing deps subcommand to allowed-tools.

The workflow in step 3 (line 54) uses cargo run --release -- scripts/update_lib deps, but the allowed-tools header only permits quick and auto-mark subcommands. This will cause the command to be blocked during execution.

🔧 Proposed fix
 ---
-allowed-tools: Bash(git add:*), Bash(git commit:*), Bash(python3 scripts/update_lib quick:*), Bash(python3 scripts/update_lib auto-mark:*)
+allowed-tools: Bash(git add:*), Bash(git commit:*), Bash(python3 scripts/update_lib quick:*), Bash(python3 scripts/update_lib auto-mark:*), Bash(cargo run:*)
 ---

Note: This allows cargo run for both the deps command (line 54) and the test execution commands (lines 59, 63).

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
---
allowed-tools: Bash(git add:*), Bash(git commit:*), Bash(python3 scripts/update_lib quick:*), Bash(python3 scripts/update_lib auto-mark:*)
---
---
allowed-tools: Bash(git add:*), Bash(git commit:*), Bash(python3 scripts/update_lib quick:*), Bash(python3 scripts/update_lib auto-mark:*), Bash(cargo run:*)
---
🤖 Prompt for AI Agents
In @.claude/commands/upgrade-pylib.md around lines 1 - 3, The allowed-tools
header currently permits only Bash(git add:*), Bash(git commit:*), Bash(python3
scripts/update_lib quick:*), and Bash(python3 scripts/update_lib auto-mark:*),
but the workflow runs cargo run --release -- scripts/update_lib deps; update the
allowed-tools header to also include Bash(python3 scripts/update_lib deps:*) (or
the equivalent pattern used for quick/auto-mark) so the `deps` subcommand is
allowed; ensure the new entry matches the existing pattern for `quick` and
`auto-mark` to permit the deps invocation and related test commands.

Comment on lines +51 to +71
3. **Investigate test failures with subagent**
- First, get dependent tests using the deps command:
```
cargo run --release -- scripts/update_lib deps $ARGUMENTS
```
- Look for the line `- [ ] $ARGUMENTS: test_xxx test_yyy ...` to get the direct dependent tests
- Run those tests to collect failures:
```
cargo run --release -- -m test test_xxx test_yyy ... 2>&1 | grep -E "^(FAIL|ERROR):"
```
- For example, if deps output shows `- [ ] linecache: test_bdb test_inspect test_linecache test_traceback test_zipimport`, run:
```
cargo run --release -- -m test test_bdb test_inspect test_linecache test_traceback test_zipimport 2>&1 | grep -E "^(FAIL|ERROR):"
```
- For each failure, use the Task tool with `general-purpose` subagent to investigate:
- Subagent should follow the `/investigate-test-failure` skill workflow
- Pass the failed test identifier as the argument (e.g., `test_inspect.TestGetSourceBase.test_getsource_reload`)
- If subagent can fix the issue easily: fix and commit
- If complex issue: subagent collects issue info and reports back (issue creation on user request only)
- Using subagent prevents context pollution in the main conversation
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Add language identifiers to code blocks in step 3.

Multiple code blocks in the test failure investigation step are missing language specifications, which reduces readability and prevents syntax highlighting.

📝 Proposed fix
 3. **Investigate test failures with subagent**
    - First, get dependent tests using the deps command:
-     ```
+     ```bash
      cargo run --release -- scripts/update_lib deps $ARGUMENTS
      ```
    - Look for the line `- [ ] $ARGUMENTS: test_xxx test_yyy ...` to get the direct dependent tests
    - Run those tests to collect failures:
-     ```
+     ```bash
      cargo run --release -- -m test test_xxx test_yyy ... 2>&1 | grep -E "^(FAIL|ERROR):"
      ```
    - For example, if deps output shows `- [ ] linecache: test_bdb test_inspect test_linecache test_traceback test_zipimport`, run:
-     ```
+     ```bash
      cargo run --release -- -m test test_bdb test_inspect test_linecache test_traceback test_zipimport 2>&1 | grep -E "^(FAIL|ERROR):"
      ```
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
3. **Investigate test failures with subagent**
- First, get dependent tests using the deps command:
```
cargo run --release -- scripts/update_lib deps $ARGUMENTS
```
- Look for the line `- [ ] $ARGUMENTS: test_xxx test_yyy ...` to get the direct dependent tests
- Run those tests to collect failures:
```
cargo run --release -- -m test test_xxx test_yyy ... 2>&1 | grep -E "^(FAIL|ERROR):"
```
- For example, if deps output shows `- [ ] linecache: test_bdb test_inspect test_linecache test_traceback test_zipimport`, run:
```
cargo run --release -- -m test test_bdb test_inspect test_linecache test_traceback test_zipimport 2>&1 | grep -E "^(FAIL|ERROR):"
```
- For each failure, use the Task tool with `general-purpose` subagent to investigate:
- Subagent should follow the `/investigate-test-failure` skill workflow
- Pass the failed test identifier as the argument (e.g., `test_inspect.TestGetSourceBase.test_getsource_reload`)
- If subagent can fix the issue easily: fix and commit
- If complex issue: subagent collects issue info and reports back (issue creation on user request only)
- Using subagent prevents context pollution in the main conversation
3. **Investigate test failures with subagent**
- First, get dependent tests using the deps command:
🧰 Tools
🪛 LanguageTool

[style] ~68-~68: Consider using a different verb for a more formal wording.
Context: ...getsource_reload`) - If subagent can fix the issue easily: fix and commit - I...

(FIX_RESOLVE)

🪛 markdownlint-cli2 (0.20.0)

[warning] 53-53: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


[warning] 58-58: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


[warning] 62-62: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

🤖 Prompt for AI Agents
In @.claude/commands/upgrade-pylib.md around lines 51 - 71, Step 3's markdown
code blocks lack language identifiers; update the code fences around the shell
commands in the “Investigate test failures with subagent” section to use ```bash
(or ```sh) for the three examples containing the commands `cargo run --release
-- scripts/update_lib deps $ARGUMENTS`, `cargo run --release -- -m test test_xxx
test_yyy ... 2>&1 | grep -E "^(FAIL|ERROR):"`, and the example `cargo run
--release -- -m test test_bdb test_inspect test_linecache test_traceback
test_zipimport 2>&1 | grep -E "^(FAIL|ERROR):"` so they render with proper
syntax highlighting.

Comment on lines 110 to 120
## Example Usage
```
# Using module names (recommended)
/upgrade-pylib inspect
/upgrade-pylib json
/upgrade-pylib asyncio

# Using library paths (alternative)
/upgrade-pylib cpython/Lib/inspect.py
/upgrade-pylib cpython/Lib/json/
```
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Add language identifier to example usage code block.

The example usage code block is missing a language specification.

📝 Proposed fix
 ## Example Usage
-```
+```bash
 # Using module names (recommended)
 /upgrade-pylib inspect
 /upgrade-pylib json
 /upgrade-pylib asyncio
 
 # Using library paths (alternative)
 /upgrade-pylib cpython/Lib/inspect.py
 /upgrade-pylib cpython/Lib/json/

</details>

<!-- suggestion_start -->

<details>
<summary>📝 Committable suggestion</summary>

> ‼️ **IMPORTANT**
> Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

```suggestion
## Example Usage
🧰 Tools
🪛 markdownlint-cli2 (0.20.0)

[warning] 111-111: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

🤖 Prompt for AI Agents
In @.claude/commands/upgrade-pylib.md around lines 110 - 120, Update the fenced
"Example Usage" code block to include a language identifier so syntax
highlighting is applied; specifically add "bash" after the opening triple
backticks for the block that contains the /upgrade-pylib usage examples (lines
showing "/upgrade-pylib inspect", "/upgrade-pylib json", "/upgrade-pylib
asyncio" and the path examples) so the block begins with ```bash instead of ```;
no other changes to the content are needed.

@youknowone youknowone merged commit 0c17462 into RustPython:main Jan 30, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip:ci Skip running the ci

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants