Skip to content

Add a CI workflow running py_compile and the test suite - #18

Merged
dmccoystephenson merged 4 commits into
mainfrom
feature/ci-workflow
Aug 30, 2026
Merged

Add a CI workflow running py_compile and the test suite#18
dmccoystephenson merged 4 commits into
mainfrom
feature/ci-workflow

Conversation

@dmccoystephenson

@dmccoystephenson dmccoystephenson commented Aug 30, 2026

Copy link
Copy Markdown
Member

Summary

  • A CI workflow is added at .github/workflows/tests.yml. It runs on every push to main and on every pull request, and performs three steps: python -m py_compile over both modules, python -m unittest discover -s tests -v, and one full run of the program with a 15-line fixture redirected onto stdin.
  • The end-to-end step exists because the test suite patches every prompt, so no automated check previously exercised the invocation README.md actually documents. The step asserts that exactly five lines were written to ideas/ideas-<timestamp>.txt — one per pair.
  • The matrix covers Python 3.8 (the floor declared in README.md) and 3.13 (a current release). fail-fast is disabled so a failure on one version does not hide the other's result.
  • actions/checkout@v5 and actions/setup-python@v6 are used rather than the previous major versions, which are annotated by the runner as targeting a deprecated Node runtime. No other action, and no dependency, is installed.
  • README.md's Tests section is extended with a sentence recording what CI runs, so the workflow and the documentation cannot drift apart silently.
  • No source file is touched. The prompts, the ['keyword', 'keyword']: idea output line, the ideas/ideas-<timestamp>.txt filename, and the camelCase house style are all unchanged.

This completes the last outstanding part of #13. The __main__ guard and the unittest suite were landed in #17, and the Python floor was declared in README.md in #16; the CI workflow was the remaining item.

Closes #13

Test plan

Locally, from the repository root, on Python 3.8.10

  • python3 --versionPython 3.8.10
  • python3 -m py_compile src/collide.py src/ideaCollisionGenerator.pycompile OK
  • python3 -m unittest discover -s testsRan 16 tests in 0.005s / OK
  • python3 src/collide.py < collide-ci-workflow-and-debugpy-stdin.txt (a 15-line fixture: 10 keywords then 5 ideas) completed without error and printed:
Enter 1st keyword: Enter 2nd keyword: Enter 3rd keyword: Enter 4th keyword: Enter 5th keyword: Enter 6th keyword: Enter 7th keyword: Enter 8th keyword: Enter 9th keyword: Enter 10th keyword: Enter an idea based off of these keywords: ['complex relationships', 'interaction']
Enter an idea: Enter an idea based off of these keywords: ['exploration', 'antagonist']
Enter an idea: Enter an idea based off of these keywords: ['social mobility', 'branching choices']
Enter an idea: Enter an idea based off of these keywords: ['mining', 'world modification']
Enter an idea: Enter an idea based off of these keywords: ['community', 'fishing']
Enter an idea:
  • wc -l ideas/ideas-2026-08-30_01.13.03.txt5, one line per pair, in the committed format:
['complex relationships', 'interaction']: An innkeeper who buys fish from the docks.
['exploration', 'antagonist']: A mine that keeps every block a player breaks.
['social mobility', 'branching choices']: A rumour that spreads faster the further it travels.
['mining', 'world modification']: A rival who moves into the house next door.
['community', 'fishing']: A map that only fills in where two players have both walked.
  • git status --porcelain shows no __pycache__, no generated ideas/ideas-*.txt, and no editor or harness state staged.

In CI, on this pull request

The workflow's pull_request trigger runs it from this branch, so it was observed green here rather than only after merge. Run 33298802589 succeeded on both matrix entries with all three steps passing, and the two earlier runs on this branch recorded Ran 16 tests on both 3.8 and 3.13.

Protected path — human merge required

.github/workflows/* is a do-not-auto-merge path, so this pull request is left open for review rather than merged. Merging was also not authorized for the session that produced it.

Backlog deferred this cycle

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


drafted by Claude on behalf of Daniel Stephenson

dmccoystephenson and others added 4 commits August 30, 2026 01:13
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@dmccoystephenson

Copy link
Copy Markdown
Member Author

Self-review

A structured rubric was applied to the diff at f4c95c7, anchored on the local validation run and on the CI runs this branch produced. Findings that are not clean PASSes are folded in below as path:line — finding notes, since a formal review object could not be created by the session that produced this pull request.

  • Scope: PASSgit diff --name-only origin/main...HEAD lists exactly .github/workflows/tests.yml and README.md. No source file, no test, and no unrelated formatting is touched.
  • Tests-new: PASS — no new function or method is introduced; the workflow itself is the new surface, and it was executed three times on this branch (runs 33298725836, 33298754253, 33298802589) rather than reasoned about.
  • Tests-fix: not applicable — no bug is fixed here, so there is no regression to demonstrate by revert.
  • Sibling structure: PASS — no sibling exists; .github/workflows/ is created by this change. The file follows the ordinary GitHub Actions layout and keeps the repository's habit of lowercase comment fragments above the block they describe.
  • Sibling renames: PASS — no identifier is renamed.
  • Docs: PASS after a fix — the README.md sentence added in the first commit said "the same two commands", which stopped being true once the end-to-end step was added. It was corrected in f4c95c7 to describe all three steps. Every other row of the documentation table is unaffected: no prompt string, no output format, no filename, and no license statement is touched.
  • Issue resolution: PASS#13 asks for a __main__ guard (landed in Guard main() behind __name__ and add a unittest suite #17), characterization tests (landed in Guard main() behind __name__ and add a unittest suite #17), a declared Python version (landed in Rewrite README and narrow .gitignore #16, and now enforced by the 3.8 matrix entry), and a minimal CI workflow running py_compile and the test suite (this change). Nothing in that issue is left unaddressed.
  • Manual validation: PASS — locally on Python 3.8.10: py_compile clean, Ran 16 tests / OK, and a full 15-line redirected-stdin run producing five correctly formatted lines. In CI on the head commit: run 33298829047 succeeded on both matrix entries.
  • Ran, not read: PASS — every prompt line, pairing, and output line quoted in the pull-request body came from the run performed on this branch, not from reading the source.
  • Stdin always redirected: PASS — the only invocation of the program anywhere in the diff is python src/collide.py < fixture.txt, and the fixture is built from printf with exactly 10 keyword lines and 5 idea lines.
  • camelCase preserved: PASSgit diff origin/main...HEAD -- src/ is empty.
  • Stdlib only: PASS — no import is added, no manifest file is created, and the workflow installs nothing.
  • Python 3.8-safe: PASS — no Python is written, and the 3.8 matrix entry passes, which is stronger evidence than inspection.
  • Output contract preserved: PASSideas/example.txt is untouched, and the end-to-end step asserts five written lines from a ten-keyword run.
  • Prompt strings intact: PASS — no input() or print() string is in the diff.
  • Entry point still runnable: PASSsrc/collide.py is unmodified and was run to completion this cycle, both locally and in CI.
  • License claims consistent: PASS — no file stating a license, an owner, or a repository URL is modified.
  • No artifacts committed: PASSgit status --porcelain shows nothing beyond the intended files; the fixture.txt the workflow writes exists only inside the runner's checkout.
  • No inflation: PASS — 37 lines of YAML and four lines of prose. No packaging layout, no CLI framework, no test framework beyond stdlib unittest, and no new top-level source directory.

Findings folded in from inline notes

  • .github/workflows/tests.yml:37 — the end-to-end assertion checks the line count only. A change that broke the ['keyword', 'keyword']: idea line format while still writing five lines would pass this step; the format is guarded by tests/test_ideaCollisionGenerator.py instead. Tightening the step to a format assertion was considered and left out to keep the shell snippet readable, but it is a real gap in what a green check means here.
  • .github/workflows/tests.yml:33fixture.txt is written into the checkout root. That is harmless on an ephemeral runner, but .gitignore no longer covers root-level *.txt (it was narrowed to ideas/*.txt in Rewrite README and narrow .gitignore #16), so anyone copying this snippet locally is left with an untracked stray file.
  • .github/workflows/tests.yml:15 — Python 3.8 is tested because README.md declares it as the floor, not because it was independently judged the right floor. Python 3.8 has reached end of life upstream; whether the floor should be raised is a separate decision for the repository owner and is not made here.
  • .github/workflows/tests.yml:24py_compile covers only the two src/ modules. Files under tests/ are compiled implicitly by being imported during discovery, so the gap is covered in practice rather than by that step.

One rubric item required a fix during review (the README.md drift noted above); the rest passed on evidence. Per the one-pass rule, this rubric is not re-run — only a reviewer comment or a failing check should reopen it.

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 912e064 into main Aug 30, 2026
2 checks passed
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.

No test suite, no CI, and no declared Python version

1 participant