Skip to content

Use REM for the first comment line of each batch script - #38

Merged
dmccoystephenson merged 2 commits into
mainfrom
feature/bat-rem-comments
Oct 8, 2026
Merged

dmccoystephenson merged 2 commits into
mainfrom
feature/bat-rem-comments

Conversation

@dmccoystephenson

@dmccoystephenson dmccoystephenson commented Oct 8, 2026 •

Copy link
Copy Markdown
Member

Summary

  • The first line of up.bat, down.bat and create_environments.bat is changed from a # line to a REM line. cmd.exe has no # comment syntax, so each of these lines was being run as a command named #, printing a "not recognized as an internal or external command" error at the start of every run. Every other comment in the scripts already uses REM.
  • tests/test_batch_scripts.py is added as a regression guard: it reads the three scripts as text and fails if any line starts with #. It needs no Windows, and the README's test section mentions it.
  • The module docstring of headless_run.py now states the exit status 2 for invalid arguments, which the code (sys.exit(2)) and the README already describe; the docstring previously listed only 0 and 1.

The cycle was run as a documentation accuracy sweep (the open backlog being gated or large, see below). The README, the batch scripts and the CLI argument handling in main.py and headless_run.py were checked against source; apart from the items above, no drift was found.

Closes #37

Test plan

  • python -m py_compile of every top-level module passes
  • python3 -m unittest discover -s tests — 123 tests ran, OK (Python 3.8.10, pygame 2.1.2)
  • The new test was run against the pre-fix scripts (git checkout origin/main -- *.bat) and failed for all three, then passed with the fix restored
  • python3 headless_run.py — all three scenarios PASS
  • python3 headless_run.py x exits with status 2, matching the updated docstring
  • The batch scripts could not be run, since no Windows cmd.exe is available in the environment the change was made in; the fix rests on REM being the documented cmd.exe comment command and on the scripts' existing REM lines. Running up.bat once on Windows and confirming no '#' is not recognized line appears would verify it.

Deferred issues

This PR description was drafted during a Gardener session (https://github.com/Stephenson-Software/gardener).

🤖 Generated with Claude Code


drafted by Claude on behalf of Daniel Stephenson

dmccoystephenson and others added 2 commits October 8, 2026 02:27
cmd.exe has no '#' comment syntax, so the leading '#' line of up.bat,
down.bat and create_environments.bat was run as a command named '#' and
printed a "not recognized" error before the real work. The rest of each
script already uses REM.

Also document headless_run.py's exit status 2 for invalid arguments in
its module docstring, matching the README and the code.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The test fails against the scripts as they were before the REM change
and passes after it, and needs no Windows since it reads the scripts as
text.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@dmccoystephenson

Copy link
Copy Markdown
Member Author

Self-review rubric (head b720b7d):

  • Scope: PASS, with one judgment note. The three .bat edits and tests/test_batch_scripts.py serve Batch scripts start with '#' lines, which cmd.exe runs as a command #37 directly. The headless_run.py docstring line and the one-sentence README addition are not covered by Batch scripts start with '#' lines, which cmd.exe runs as a command #37: the first is the documentation-sweep finding stated in the PR body, and the second documents the new test. Both are small and declared, but they sit outside Closes #37.
  • Tests-new: PASS. No new public function is added; the new test file covers the changed scripts.
  • Tests-fix: PASS. Checked empirically: with up.bat, down.bat and create_environments.bat checked out from origin/main, python3 -m unittest tests.test_batch_scripts gave FAILED (failures=3) ([1] != [] for each script). With the fix restored it passed.
  • Sibling structure: PASS. tests/test_batch_scripts.py follows the existing tests/test_*.py files: stdlib unittest, one TestCase class with a docstring naming the issue it guards (as TestConstruction in tests/test_graphik.py does for Graphik defines __init__ twice, so the no-argument constructor is dead code #20), and no __main__ block.
  • Sibling renames: PASS. Nothing is renamed.
  • Docs: PASS. The README's batch-script commands and create_environments.bat description are unchanged and still match the scripts. The test section of the README now mentions the new test. The headless_run.py docstring now matches sys.exit(2) and the README.
  • Issue resolution: PASS. All three # lines named in Batch scripts start with '#' lines, which cmd.exe runs as a command #37 are now REM lines, and no #-prefixed line is left in any of the scripts (checked by the new test).
  • Manual validation: PASS for what can run here. py_compile is clean, 123 unit tests ran and passed, and headless_run.py passed all three scenarios. CI Tests passed on b720b7d. The batch scripts themselves are UNVERIFIED-not-applicable: no cmd.exe is available, and none of the rendering or Viron-service files that the live anchor checks are touched.

Observations outside the diff:

  • create_environments.bat and the other scripts are committed with LF line endings, and create_environments.bat relies on goto loop. cmd.exe label lookup is known to misbehave in some cases with LF-only files. This is not addressed here and has not been reproduced.
  • create_environments.bat:28 sets log_file, which is never used.

Summary: a small, contained fix with an empirically confirmed regression guard. No blocking findings.

This review was drafted during a Gardener session (https://github.com/Stephenson-Software/gardener).


drafted by Claude on behalf of Daniel Stephenson

@dmccoystephenson
dmccoystephenson merged commit 05a0912 into main Oct 8, 2026
1 check passed
@dmccoystephenson
dmccoystephenson deleted the feature/bat-rem-comments branch October 8, 2026 08:30
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.

Batch scripts start with '#' lines, which cmd.exe runs as a command

1 participant