Skip to content

Document how main.py treats a misplaced flag and extra arguments - #66

Merged
dmccoystephenson merged 2 commits into
mainfrom
feature/document-main-argument-handling
Nov 12, 2026
Merged

dmccoystephenson merged 2 commits into
mainfrom
feature/document-main-argument-handling

Conversation

@dmccoystephenson

Copy link
Copy Markdown
Member

Summary

  • The README's Running section now states that --exit-after-create is recognised only as the second argument. Given first (python main.py --exit-after-create), it is read as an unparseable grid size: Invalid grid size argument, using default of 50. is printed and the render loop is entered. Any other second argument, and every argument after the second, is ignored without a message. This matches parseArgs in main.py:43-65.
  • Three characterization tests are added to TestParseArgs in tests/test_main.py: the flag given first, the flag after the second position, and arguments after the second being ignored. The existing test_ignores_an_unrecognized_second_argument already covered the remaining case.

No production code is changed. This is a Stage A documentation sweep; no tracking issue exists — the gap was found during triage.

The usage line Usage: python main.py [gridSize] [--exit-after-create] could be read as allowing the flag on its own. It is left unchanged here, since changing it is a code change outside a documentation cycle.

Skipped issues

Every open issue is waiting on an owner decision, so none was picked this cycle:

Test plan

  • python3 -m py_compile *.py
  • python3 -m unittest discover -s tests — Ran 209 tests, OK
  • CI Tests workflow green on this head

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 November 12, 2026 00:15
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@dmccoystephenson

Copy link
Copy Markdown
Member Author

Self-review rubric (head f417a8f):

  • Scope: PASS — only README.md (one paragraph) and tests/test_main.py (three tests) are touched; no production code changed.
  • Tests-new: PASS — no new public functions; three characterization tests pin parseArgs behaviour that the new paragraph describes.
  • Tests-fix: N/A — no bug fix; the tests characterize current behaviour.
  • Sibling structure: PASS — the new tests follow the one-assertion TestParseArgs style of their neighbours.
  • Sibling renames: N/A — nothing renamed.
  • Docs: FAIL → fixed — the first draft said every other second argument is ignored, which contradicted --help/-h being honoured in any position (wantsUsage, main.py:31-41, checked before parseArgs). Commit f417a8f exempts them explicitly. create_environments.bat always passes <size> --exit-after-create, so it is unaffected.
  • Issue resolution: N/A — no Closes reference; gap found during a Stage A sweep.
  • Manual validation: PASS — python3 -m py_compile *.py clean; python3 -m unittest discover -s tests ran 209 tests, OK; the Tests workflow passed on f417a8f (run 43174063368). The Pygame/Viron anchor is not applicable: no rendering or service-call code changed.

Out-of-diff note: main.py:26 — the usage line [gridSize] [--exit-after-create] could be read as allowing the flag on its own, which parseArgs does not support. It is left for an implementation cycle.

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 d3d2742 into main Nov 12, 2026
1 check passed
@dmccoystephenson
dmccoystephenson deleted the feature/document-main-argument-handling branch November 12, 2026 07:17
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