Skip to content

Commit 4ffac51

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 3fca422 commit 4ffac51

6 files changed

Lines changed: 739 additions & 2 deletions

File tree

.github/ISSUE_TEMPLATE/bug_report.yml

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

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Interpreters for the 65xx family, from the 6502 to the 65816, driveable from a c
44

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

7-
**16** parts, **17,900,000** state cases and **17,870,080** cycle-exact cases, **0** unexplained failures, **1,256** tests, **100%** statement and branch coverage, no dependencies
7+
**16** parts, **17,900,000** state cases and **17,870,080** cycle-exact cases, **0** unexplained failures, **1,298** tests, **100%** statement and branch coverage, no dependencies
88

99
```python
1010
from mos65xx import Cpu, SparseMemory

mos65xx/doctor.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ def _version(where: Path | None = None) -> str:
5151

5252
ROOT = Path(__file__).resolve().parent.parent
5353

54+
from mos65xx import environment # noqa: E402
55+
5456
VERSION = _version()
5557

5658

@@ -262,6 +264,10 @@ def report(found: Sequence[Finding]) -> list[str]:
262264
"""The lines a person pastes into an issue."""
263265
unwell = [one for one in found if not one.ok]
264266
lines = [f"mos65xx {VERSION} on {platform.python_version()}, {platform.system()}", ""]
267+
lines.append(" the machine")
268+
lines.extend(environment.lines(ROOT))
269+
lines.append("")
270+
lines.append(" this package")
265271
lines.extend(one.report for one in found)
266272
lines.append("")
267273
if unwell:

0 commit comments

Comments
 (0)