Skip to content

Commit 27855ef

Browse files
committed
feat(doctor): check the machine, not just the package
Every member had a doctor that knew about its own part and nothing about what it was running on. Most reports that begin "it does not work here" are about the machine, so the doctor now looks at that first. Nine checks, identical in all nineteen repositories and written to be correct on Windows, macOS and Linux without branching on which: Which command runs Python, because the instructions used to say python3 and that is frequently absent on Windows, where the name is python or the launcher is py. A reporter told to run a command that does not exist reports the wrong problem. Whether this terminal can print what the report contains, because the point of a doctor is that its output gets pasted, and a legacy code page turns that paste into a traceback. Whether the checkout was rewritten to carriage returns on the way in. Every digest over a text file disagrees while core.autocrlf is set and none of it is the repository's fault. How much of the 260 character Windows path budget is left. Reported on every system, because the tree is shared, and measured from the repository root so the number means something. Generated directories are named and do not fail the check: pnpm nests deeply, that is real on Windows and it is not this layout. Then the ordinary ones: what this machine is, the default encoding, the filesystem's case behaviour, free space, and whether git is here. A check that throws is caught and reported as what it threw. A doctor that dies while examining is worse than no doctor, and each of the nine was driven against a machine that fails it before being kept. Every issue template now requires that output and gives the command for all three systems. Seven templates asked for nothing at all, and one named the wrong package, so anybody following it reached a module that does not exist.
1 parent 62b9822 commit 27855ef

7 files changed

Lines changed: 754 additions & 11 deletions

File tree

.github/ISSUE_TEMPLATE/bug_report.yml

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,22 @@ body:
1515
attributes:
1616
label: What the doctor says
1717
description: |
18-
Run `python3 -m snesdsp.doctor` from the repository and paste all of it,
19-
including any line that did not pass. Do not trim it: the lines that
20-
failed are the ones worth reading.
21-
render: text
22-
placeholder: |
23-
snesdsp 2.1.0 on 3.13.0, Linux
18+
Run this from the repository and paste every line, including the ones
19+
that did not pass. Those are the ones worth reading, so do not trim it.
20+
21+
macOS and Linux:
22+
23+
python3 -m snesdsp.doctor
2424
25-
ok python: 3.13.0 on Linux x86_64
26-
! dsp2: no image for dsp2
27-
put a copy you own in ...
25+
Windows, whichever of these resolves:
26+
27+
python -m snesdsp.doctor
28+
py -3 -m snesdsp.doctor
29+
30+
It reports the machine as well as the package, so most answers are in
31+
there already. If it will not run at all, say so here and paste whatever
32+
it printed instead.
33+
render: text
2834
validations:
2935
required: true
3036

.github/ISSUE_TEMPLATE/wrong_answer.yml

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,22 @@ body:
1414
id: doctor
1515
attributes:
1616
label: What the doctor says
17-
description: Run `python3 -m snesdsp.doctor` and paste all of it.
17+
description: |
18+
Run this from the repository and paste every line, including the ones
19+
that did not pass. Those are the ones worth reading, so do not trim it.
20+
21+
macOS and Linux:
22+
23+
python3 -m snesdsp.doctor
24+
25+
Windows, whichever of these resolves:
26+
27+
python -m snesdsp.doctor
28+
py -3 -m snesdsp.doctor
29+
30+
It reports the machine as well as the package, so most answers are in
31+
there already. If it will not run at all, say so here and paste whatever
32+
it printed instead.
1833
render: text
1934
validations:
2035
required: true

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ The NEC uPD77C25 as Nintendo shipped it, running the microcode you supply rather
44

55
[![CI](https://github.com/gufranco/snes-dsp-python/actions/workflows/ci.yml/badge.svg)](https://github.com/gufranco/snes-dsp-python/actions/workflows/ci.yml)
66

7-
**6** parts across **5** microcodes, **0** commands described by hand, **112** exchanges read out of **36** real cartridges compared, **0** failures, **878** tests, **100%** statement and branch coverage, no dependencies
7+
**6** parts across **5** microcodes, **0** commands described by hand, **112** exchanges read out of **36** real cartridges compared, **0** failures, **920** tests, **100%** statement and branch coverage, no dependencies
88

99
```python
1010
from snesdsp import Chip

pyproject.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,10 @@ ignore = [
6868
]
6969

7070
[tool.ruff.lint.per-file-ignores]
71+
# The environment checks are the same shape and exist for the same reason: they
72+
# report what a machine is, so a check that throws has to become a line in the
73+
# report rather than end the run, and its output is the product.
74+
"snesdsp/environment.py" = ["BLE001", "T201"]
7175
# A test file sits beside the module it covers and is named after it, so its
7276
# module name carries a dot that N999 rejects. The layout is deliberate: a
7377
# module and its tests are read together.

snesdsp/doctor.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@
3333

3434
ROOT = Path(__file__).resolve().parent.parent
3535

36+
from snesdsp import environment # noqa: E402
37+
3638
if str(ROOT) not in sys.path:
3739
sys.path.insert(0, str(ROOT))
3840

@@ -313,6 +315,10 @@ def report(found: Sequence[Finding]) -> list[str]:
313315
"""The lines a person pastes into an issue."""
314316
unwell = [one for one in found if not one.ok]
315317
lines = [f"snesdsp {VERSION} on {platform.python_version()}, {platform.system()}", ""]
318+
lines.append(" the machine")
319+
lines.extend(environment.lines(ROOT))
320+
lines.append("")
321+
lines.append(" this package")
316322
lines.extend(one.report for one in found)
317323
lines.append("")
318324
if unwell:

0 commit comments

Comments
 (0)