Skip to content

docs: expand AGENTS.md with test marker guidance and CI audit notes - #7963

Merged
youknowone merged 3 commits into
RustPython:mainfrom
JamesClarke7283:agents-md-2
May 25, 2026
Merged

docs: expand AGENTS.md with test marker guidance and CI audit notes#7963
youknowone merged 3 commits into
RustPython:mainfrom
JamesClarke7283:agents-md-2

Conversation

@JamesClarke7283

@JamesClarke7283 JamesClarke7283 commented May 23, 2026

Copy link
Copy Markdown
Contributor

Summary

Four additive updates to AGENTS.md to capture guidance that contributors keep asking about. No existing wording was changed β€” everything is appended in place.

  • Test marker decision rule. Documents the four forms (@unittest.expectedFailure / expectedFailureIf / skip / skipIf) with the TODO: RUSTPYTHON; <reason> format, and explains when to use which: prefer expectedFailure so a future fix surfaces an unexpected pass; reach for skip only when running the test would take down the test process (segfault, Rust panic, abort, hang).
  • Avoiding zizmor's impostor-commit audit. Explains why hash-pinned uses: lines can still be rejected when the SHA only exists on a fork, the canonical-repo verification recipe (gh api repos/<owner>/<repo>/commits/<sha>), and the repo's existing convention of pinning to a full 40-char SHA with a trailing # vX.Y.Z comment.
  • Wiki link to the "How to update test files" guide for syncing tests from upstream CPython.
  • Grep recipe for locating partly-modified WIP test entries: grep -d recurse 'TODO: RUSTPYTHON' Lib/test/.

Test plan

  • Rendered AGENTS.md reads cleanly (headings, code fences, link targets)
  • Existing sections (lines 1–266 in the prior version) are untouched
  • No code or behavior changes β€” documentation only

πŸ€– Generated with Claude Code

Summary by CodeRabbit

  • Documentation
    • Added contributor guidance to run pre-commit checks and the full test suite before committing, including re-staging after auto-fixes.
    • Clarified when to use expected-failure vs skip markers for unit tests and how to find WIP test entries.
    • Added a docstring rule for items annotated for Python exposure (avoid /// on those items).
    • Expanded CI notes to require workflow scanning and linked wiki guidance for syncing Lib tests from upstream.

Review Change Stack

Document the four-way test marker decision (expectedFailure /
expectedFailureIf vs skip / skipIf, with skip reserved for tests that
crash the interpreter), add guidance on avoiding zizmor's
impostor-commit audit when pinning third-party actions, link the wiki
guide for syncing tests from upstream CPython, and note the grep recipe
for finding WIP TODO: RUSTPYTHON entries.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented May 23, 2026

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. πŸŽ‰

ℹ️ Recent review info
βš™οΈ Run configuration

Configuration used: Path: .coderabbit.yml

Review profile: CHILL

Plan: Pro

Run ID: 1a91b4bb-42bc-4644-8858-6ae1e9dcbc34

πŸ“₯ Commits

Reviewing files that changed from the base of the PR and between 9ea89fb and 352c5b6.

πŸ“’ Files selected for processing (1)
  • AGENTS.md
βœ… Files skipped from review due to trivial changes (1)
  • AGENTS.md

πŸ“ Walkthrough

Walkthrough

This PR updates AGENTS.md with four contributor-facing additions: a CRITICAL pre-commit and test-running checklist, a β€œChoosing the right marker” subsection for RustPython test failures, a Rust docstring rule for items annotated with py-attributes, and a β€œCI Workflows” note plus a documentation link for syncing Lib/ tests from CPython.

Changes

Contributor and CI Documentation

Layer / File(s) Summary
Pre-commit checks and test run guidance
AGENTS.md
Adds a β€œCRITICAL: Pre-commit Checks” section requiring prek/pre-commit run --all-files and the full test suite before creating commits, including when to run extra snippet tests and how to re-stage after auto-fixes.
Test failure marker selection
AGENTS.md
Introduces β€œChoosing the right marker” guidance: prefer unittest.expectedFailure/expectedFailureIf by default; use unittest.skip/skipIf for interpreter-crashing or hang-blocking failures; includes a grep to locate TODO: RUSTPYTHON test entries.
Rust docstring rule for py-annotated items
AGENTS.md
Adds a rule that Rust /// doc comments must not be used on items annotated with #[pyattr], #[pyclass], or #[pyfunction].
CI workflows and documentation link
AGENTS.md
Adds a β€œCI Workflows” section requiring zizmor scans for .github/workflows/ changes and updates the β€œDocumentation” list with a link for syncing Lib/ test files from upstream CPython.

🎯 1 (Trivial) | ⏱️ ~3 minutes

🐰 I hopped through docs to make things clear,
A checklist here, a marker near,
Docstring rules and workflows too,
Small notes to guide what contributors do,
Crunchy carrots for reviewers, woo! πŸ₯•

πŸš₯ Pre-merge checks | βœ… 5
βœ… Passed checks (5 passed)
Check name Status Explanation
Description Check βœ… Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check βœ… Passed The title clearly and specifically summarizes the main additions to AGENTS.md: test marker guidance and CI audit notes.
Docstring Coverage βœ… Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check βœ… Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check βœ… Passed Check skipped because no linked issues were found for this pull request.

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

✨ Finishing Touches
πŸ§ͺ Generate unit tests (beta)
  • Create PR with unit tests

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.

@coderabbitai coderabbitai 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.

Actionable comments posted: 2

πŸ€– Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@AGENTS.md`:
- Around line 102-106: Update the β€œonly acceptable modifications” section
(currently restricting changes to adding only expectedFailure) to match the new
β€œWhen to use which” guidance: allow contributors to also add skip/skipIf when a
test would crash/hang or otherwise make the test process unusable (segfaults,
Rust panics, aborts, or hangs), and keep expectedFailure/expectedFailureIf as
the default for non-crashing regressions; adjust the text so both sections
consistently state that expectedFailure is preferred but skip/skipIf is
permitted for crash/hang scenarios.
- Line 292: Replace the incorrect capitalization of "Github" with the proper
"GitHub" in the contributor docs; specifically update the occurrences in the
sentences that reference PR CI runs (the line containing "PR CI runs [zizmor] to
audit `.github/workflows/*.yaml`") and the line discussing the `impostor-commit`
audit so both use "GitHub" (and scan the surrounding paragraphs for any other
"Github" instances to ensure consistent capitalization).
πŸͺ„ Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
βš™οΈ Run configuration

Configuration used: Path: .coderabbit.yml

Review profile: CHILL

Plan: Pro

Run ID: d6122385-1f87-4008-a04f-27b504d37e52

πŸ“₯ Commits

Reviewing files that changed from the base of the PR and between d3272e7 and db565a4.

πŸ“’ Files selected for processing (1)
  • AGENTS.md

Comment thread AGENTS.md
Comment thread AGENTS.md Outdated
@ShaharNaveh ShaharNaveh added the skip:ci Skip running the ci label May 23, 2026
@youknowone
youknowone requested a review from ShaharNaveh May 24, 2026 04:45
Comment thread AGENTS.md Outdated
Add a "CRITICAL: Pre-commit Checks" subsection requiring prek and the
full test suite to pass before any commit. Shrink the CI Workflows
section to a single sentence per @ShaharNaveh's review feedback:
contributors only need to know that workflow changes must pass a zizmor
scan in CI, not the full impostor-commit explainer.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

@coderabbitai coderabbitai 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.

♻️ Duplicate comments (1)
AGENTS.md (1)

108-111: ⚠️ Potential issue | 🟠 Major | ⚑ Quick win

Resolve policy conflict with the "only acceptable modifications" section

This guidance correctly allows skip/skipIf for crash/hang cases, but it conflicts with lines 281-283, which currently state "The only acceptable modifications to test files are: [...] Adding @unittest.expectedFailure decorators when tests cannot be fixed." Please update that section to also allow adding skip/skipIf when a test would crash the interpreter or hang the test process, so contributors have a single consistent rule set.

πŸ“ Suggested fix for lines 281-283
 - The only acceptable modifications to test files are:
   1. Removing `@unittest.expectedFailure` decorators and the upper TODO comments when tests actually pass
-  2. Adding `@unittest.expectedFailure` decorators when tests cannot be fixed
+  2. Adding `@unittest.expectedFailure` decorators when tests cannot be fixed (prefer this by default)
+  3. Adding `@unittest.skip` or `@unittest.skipIf` decorators when running the test would crash the interpreter or hang the test process (segfault, Rust panic, abort, or hang)
πŸ€– Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@AGENTS.md` around lines 108 - 111, Update the "The only acceptable
modifications to test files are:" guidance to resolve the conflict by explicitly
allowing adding skip/skipIf in addition to `@unittest.expectedFailure` when a test
would crash or hang the test process; locate the section that currently
references "Adding `@unittest.expectedFailure` decorators when tests cannot be
fixed" and expand that clause to permit adding skip/skipIf (with the same
restriction that these are only for tests that would segfault, panic, abort, or
hang the test process), and ensure you reference both decorators by name
(`@unittest.expectedFailure`, skip, skipIf) so the policy is unambiguous.
πŸ€– Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Duplicate comments:
In `@AGENTS.md`:
- Around line 108-111: Update the "The only acceptable modifications to test
files are:" guidance to resolve the conflict by explicitly allowing adding
skip/skipIf in addition to `@unittest.expectedFailure` when a test would crash or
hang the test process; locate the section that currently references "Adding
`@unittest.expectedFailure` decorators when tests cannot be fixed" and expand that
clause to permit adding skip/skipIf (with the same restriction that these are
only for tests that would segfault, panic, abort, or hang the test process), and
ensure you reference both decorators by name (`@unittest.expectedFailure`, skip,
skipIf) so the policy is unambiguous.

ℹ️ Review info
βš™οΈ Run configuration

Configuration used: Path: .coderabbit.yml

Review profile: CHILL

Plan: Pro

Run ID: 86a57042-bdf9-4815-8d75-c0e05b770c33

πŸ“₯ Commits

Reviewing files that changed from the base of the PR and between db565a4 and 9ea89fb.

πŸ“’ Files selected for processing (1)
  • AGENTS.md

- Note that rustpython-doc supplies CPython docstrings via the derive macros
- Flag that `///` comments override that source and are dropped on `#[pyattr]`
@youknowone
youknowone merged commit 021c786 into RustPython:main May 25, 2026
13 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.

3 participants