Skip to content

Characterize what the batch scripts run, as the README describes it - #52

Merged
dmccoystephenson merged 1 commit into
mainfrom
feature/characterize-batch-scripts
Oct 28, 2026
Merged

dmccoystephenson merged 1 commit into
mainfrom
feature/characterize-batch-scripts

Conversation

@dmccoystephenson

Copy link
Copy Markdown
Member

Summary

  • tests/test_batch_scripts.py previously checked only that the Windows batch scripts use REM rather than # comments (Batch scripts start with '#' lines, which cmd.exe runs as a command #37). Nothing guarded the behaviour that the README documents for them.
  • Characterization tests are added (Stage B, no production code changed) for the commands each script runs, with REM lines and blank lines ignored:
    • up.bat / down.bat run exactly the Compose commands the README gives as their equivalents, including down.bat's --volumes, which the README warns deletes Viron's database volumes.
    • create_environments.bat defaults the maximum size to 100 and reads it from %~1, runs sizes 1 up to and including the maximum, deletes environments.json before the loop, invokes main.py <size> --exit-after-create with stdout appended to output.txt and stderr to error_log.txt, and prints Error occurred while running with size <n>. on a non-zero exit status.
    • The --exit-after-create token the script passes is checked against the literal main.py compares argv[2] with, so renaming the flag on one side only fails the suite.

Work selection

A documentation accuracy sweep of README.md against main.py, graphik.py, render_window.py, headless_run.py, usage_reporting.py and the three .bat scripts found no drift, so this cycle fell back to test expansion. Every open issue was deferred:

Test plan

  • python3 -m unittest discover -s tests — 150 tests ran, OK (141 before this change).
  • Mutation check: with --volumes removed from down.bat and --exit-after-create removed from create_environments.bat, the two corresponding new tests failed; with the scripts restored, all 10 tests in the file passed.
  • Live Viron / pygame anchor: not applicable — no rendering or service-call file is modified.

No tracking issue — gap found during triage.

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

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

Copy link
Copy Markdown
Member Author

Self-review rubric (anchor: Tests workflow green on the PR head; locally python3 -m unittest discover -s tests ran 150 tests, OK):

  • Scope: PASS — only tests/test_batch_scripts.py is modified; no production file or .bat script is changed.
  • Tests-new: PASS — no new public functions; readCommands is a test helper, used by every new test.
  • Tests-fix: not applicable (no bug fix). As an equivalent check, --volumes was removed from down.bat and --exit-after-create from create_environments.bat; test_down_removes_orphans_and_deletes_the_volumes and test_main_is_invoked_with_the_size_and_the_exit_after_create_flag failed, and passed again once the scripts were restored.
  • Sibling structure: PASS — the new classes follow the existing TestCommentSyntax pattern (camelCase module helpers, repositoryRoot-relative paths, one docstring per class).
  • Sibling renames: not applicable — nothing renamed.
  • Docs: PASS — the README's "Running the tests" paragraph says tests/test_batch_scripts.py "reads the Windows batch scripts as text, so it needs no Windows either", which still holds. The Starting Viron and Batch environment creation sections were re-checked against each new assertion and match.
  • Issue resolution: not applicable — no Closes; the deferral reason for each open issue is in the PR body.
  • Manual validation: UNVERIFIED-not-applicable for the live Viron / pygame run — no rendering or service-call file is touched.

Judgment call:

  • tests/test_batch_scripts.py — test_the_flag_is_the_one_main_compares_its_second_argument_against asserts on the source text argv[2] == "--exit-after-create" instead of calling main.parseArgs, so that this file does not have to duplicate the Viron sys.modules stubs from tests/test_main.py. The drawback: a behaviour-preserving refactor of parseArgs (for example, moving the flag into a constant) would fail this test, and it would have to be updated alongside. That is accepted here because the test exists to fail when the two sides drift apart.
  • The assertions match whole lines exactly, so reformatting a script (for example, re-aligning the set lines) would also fail them. That trade-off is intentional for characterization tests.

Verdict: ready to merge.

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 92367c6 into main Oct 28, 2026
1 check passed
@dmccoystephenson
dmccoystephenson deleted the feature/characterize-batch-scripts branch October 28, 2026 10:44
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.

1 participant