Skip to content

CONTRIBUTING: name tools/report_paths.same_report_path as the shared report-path guard (EGEN-REPORTPATHS-DOC) - #6730

Merged
shayderrr merged 1 commit into
ItsNotRexed:mainfrom
evilclanker9000:deepseek/1-reportpaths-doc
Nov 23, 2026
Merged

shayderrr merged 1 commit into
ItsNotRexed:mainfrom
evilclanker9000:deepseek/1-reportpaths-doc

Conversation

@evilclanker9000

@evilclanker9000 evilclanker9000 commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

What and why

CONTRIBUTING.md tells a tool author how to write output (LF through the newline argument of open) but never
names the guard that decides whether an output may be written at all. Every report writer in tools/ has to refuse
an --out/--json that names an input or another output, and the repo keeps re-fixing tools that derived that
answer privately (most recently tools/manifest.py's own same_output_path, #6677).

This adds one bullet under Working on the code, next to the line-ending rule, that names
tools/report_paths.same_report_path(a, b), what it answers (resolved names, the volume's case rules,
os.path.samefile) and the test that covers it. No code changes.

Test

Docs-only change, so no new test. The helper and the test the bullet points at are unchanged and still pass:

python -I tests/test_report_paths.py
Ran 22 tests in 7.327s

OK

exit code 0. The claim in the bullet was checked against tools/report_paths.py:83
(def same_report_path(first, second):) and its docstring, and 52 modules under tools/ already import it.

GPU: none needed.

Notes

  • Kept it to one bullet in CONTRIBUTING.md rather than a new docs page: the rule is one convention for tool
    authors, and AGENTS.md already defers the code conventions to CONTRIBUTING.md.
  • I picked CONTRIBUTING.md over docs/ because that is where the other cross-tool rules live (LF writes,
    python -I, the translator contract row).
  • Not a translator rule, so no row in the docs/design.md contract table.

AI-assisted.

@shdann

shdann commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

Tested f90fa1f on Windows 11 with CPython 3.14.7. The documented path guard passes the Windows checks I ran.

py -3.14 -I tests/test_report_paths.py ran 22 tests. 21 passed. One skipped.

I also tested three pairs in a temporary directory. The guard identified two hard links to one file. It identified two unused names that differed only in letter case as the same path on this volume. It accepted two distinct unused names as separate paths.

Only CONTRIBUTING.md differs from the parent. The helper and its tests are identical on both commits.

AI-assisted.

@wasonidas

Copy link
Copy Markdown

Reviewed the documentation against the helper and representative callers at f90fa1ff1844fffd92f36c65fc9759363099e97e. The Windows report-path, case and documentation tests passed (40 passed, 2 platform skips).

Small wording point: samefile is an intermediate check, not the final fallback. On platforms where normalized keys differ, if samefile raises, the helper can probe name equivalence in a temporary folder on the destination volume. Also, the helper tests path identity. Callers still choose which inputs and outputs to compare and enforce directory containment separately when required. A short link to the helper contract may be clearer than summarizing the fallback order here.

AI-assisted.

@kapitche

Copy link
Copy Markdown
Contributor

Tested f90fa1f merged with main 8575d36 on Linux/Python 3.12.16: pass

Docs-only: one new bullet in CONTRIBUTING.md about tools/report_paths.same_report_path.

  • tools/report_paths.py and tests/test_report_paths.py exist on the merge; same_report_path(first, second) is defined there and does what the bullet says (realpath, then normcase, with a samefile fallback for names that exist); 61 files under tools/ already call it. python -I tests/test_report_paths.py: OK.
  • docs tests (python -I tests/test_docs_<x>.py): all OK except test_docs_cli_flags and test_docs_links, which fail identically on plain main (docs/dev-tools.md), not from this PR.

No negative control: docs-only.

@shayderrr shayderrr left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Summary: CONTRIBUTING.md adds a rule that report writers refuse an output naming one of their inputs or another output, and must call tools/report_paths.same_report_path(a, b) rather than deriving the answer again. That helper resolves both paths, applies the volume's case rules and falls back to os.path.samefile; tests/test_report_paths.py is cited as coverage. No code changes in this PR.

Why merge: Gives new tools one shared answer for output-path collisions, preventing a private partial check from clobbering inputs on case-insensitive filesystems.

Verdict: Approve

@shayderrr

Copy link
Copy Markdown
Collaborator

Summary: CONTRIBUTING.md adds a rule that report writers refuse an output naming one of their inputs or another output, and must call tools/report_paths.same_report_path(a, b) rather than deriving the answer again. That helper resolves both paths, applies the volume's case rules and falls back to os.path.samefile; tests/test_report_paths.py is cited as coverage. No code changes in this PR.

Why merge: Gives new tools one shared answer for output-path collisions, preventing a private partial check from clobbering inputs on case-insensitive filesystems.

Verdict: Approve

@shayderrr
shayderrr merged commit 1ab957b into ItsNotRexed:main Nov 23, 2026
0 of 2 checks passed
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.

5 participants