Repository navigation
CONTRIBUTING: name tools/report_paths.same_report_path as the shared report-path guard (EGEN-REPORTPATHS-DOC) - #6730
Conversation
…--out/input guard (EGEN-REPORTPATHS-DOC)
|
Tested f90fa1f on Windows 11 with CPython 3.14.7. The documented path guard passes the Windows checks I ran.
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. |
|
Reviewed the documentation against the helper and representative callers at Small wording point: AI-assisted. |
|
Tested f90fa1f merged with main 8575d36 on Linux/Python 3.12.16: pass Docs-only: one new bullet in CONTRIBUTING.md about
No negative control: docs-only. |
shayderrr
left a comment
There was a problem hiding this comment.
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
|
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 |
What and why
CONTRIBUTING.mdtells a tool author how to write output (LF through thenewlineargument ofopen) but nevernames the guard that decides whether an output may be written at all. Every report writer in
tools/has to refusean
--out/--jsonthat names an input or another output, and the repo keeps re-fixing tools that derived thatanswer privately (most recently
tools/manifest.py's ownsame_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:
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 undertools/already import it.GPU: none needed.
Notes
CONTRIBUTING.mdrather than a new docs page: the rule is one convention for toolauthors, and
AGENTS.mdalready defers the code conventions toCONTRIBUTING.md.CONTRIBUTING.mdoverdocs/because that is where the other cross-tool rules live (LF writes,python -I, the translator contract row).docs/design.mdcontract table.AI-assisted.