Skip to content

Add extract_template_body edge cases and main() tests - #159

Merged
dmccoystephenson merged 1 commit into
mainfrom
feature/test-extract-template-body-and-main
Oct 18, 2026
Merged

dmccoystephenson merged 1 commit into
mainfrom
feature/test-extract-template-body-and-main

Conversation

@dmccoystephenson

Copy link
Copy Markdown
Member

Summary

Stage B (unit-test expansion) cycle — characterization tests for the two parts of scripts/check_docs.py with the thinnest coverage. No production code is changed.

  • extract_template_body (previously happy path + two missing-fence errors only): six new cases covering
    • backslash-escaped inner fences (\``bash`, the form the real template uses) not closing the template body
    • a fence with an info string (```bash) not closing the body
    • an indented ``` not closing the body (closing fence must be exactly ``` at column 0)
    • the opening line being strip()ped before comparison, unlike the closing line
    • a closing fence with trailing whitespace not being recognized (reported as a missing closing fence)
    • the first ```markdown fence winning when there are several
  • main() (previously untested): new MainTests class, with REPO_ROOT / TEMPLATE_FILE / README_FILE pointed at a temp directory and restored in tearDown
    • consistent docs → exit 0 and the "passed" line
    • one failure from each of the three checks → exit 1, all three printed under "FAILED"
    • a missing template fence → the placeholder check is skipped, so only the fence error is reported

All assertions describe current behavior. None of the cases turned up a bug that needs a fix.

No tracking issue — gap found during triage.

Deferred backlog: every other open issue was left for a later cycle. Most of them (#123–#158, labeled template-rule) change the generated-skill template. Their only behavioral anchor is a real /create-dev-loop run, which would create a GitHub repo and write outside the checkout, so a headless dispatch cannot verify or auto-merge them. The other open issues (#106, #109, #114, #128, #133, #135, #141–#143) would need either CLAUDE.md edits, which the harness blocks, or decisions about process/design that a maintainer should make.

Doc sync check

Not applicable — only tests/test_check_docs.py changed.

Test plan

  • python3 -m unittest discover -s tests -v — Ran 41 tests ... OK locally (32 before this PR, 9 added)
  • python3 scripts/check_docs.py — Doc consistency check passed.
  • CI doc-consistency green on the PR 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

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

Copy link
Copy Markdown
Member Author

Self-review rubric (posted as a plain comment; the review was performed inline during this headless run):

  • Scope: PASS — the diff touches only tests/test_check_docs.py (+91 lines). No production code, docs, or formatting churn.
  • Tests-new: PASS — no new public functions were added. The diff adds cases for extract_template_body (6) and for main() (3, a function that had no tests until now).
  • Tests-fix: N/A — this is a characterization-only PR with no bug fix. To show the new cases can fail, the closing-fence comparison in extract_template_body was temporarily changed to lines[i].strip().startswith("```"). Three of the new tests then failed (test_closing_fence_with_trailing_whitespace_is_not_recognized, test_fence_with_info_string_does_not_close_template, test_indented_fence_does_not_close_template). After git checkout -- scripts/check_docs.py, all 41 tests passed again.
  • Sibling structure: PASS — MainTests follows the existing pattern. It has one TestCase class per function under test, resets check_docs.errors = [] in setUp(), restores the patched module globals in tearDown() the same way CheckLocalLinksTests restores REPO_ROOT, builds its fixtures inline in a tempfile.TemporaryDirectory, and sits last so the class order matches the source file.
  • Sibling renames: N/A — nothing was renamed.
  • Docs: PASS — the module docstring's statement that "any new test class added here must do the same in its own setUp()" still holds for MainTests. No other doc describes the test inventory.
  • Issue resolution: N/A — no tracking issue. This is a Stage B cycle, as the PR body states.
  • CI: PASS — doc-consistency is green on the PR head. The CI log shows Doc consistency check passed. and Ran 41 tests (it was 32 on main).
  • Placeholder parity / README Step parity / Fence escaping / Phase numbering / Version comments: N/A — create-dev-loop.md and README.md are not touched.
  • Research grounding: N/A — the template is not touched. Stage B rests on RESEARCH.md §3 (regression guards).
  • No back-ported specifics / gardener interface / Retrofit note / Behavioral validation: N/A — no template or Step changes.

Judgment call noted, not blocking: test_closing_fence_with_trailing_whitespace_is_not_recognized pins down an asymmetry. The opening fence is strip()ped but the closing fence is not, so a closing fence with trailing spaces currently reads as "missing closing fence". The test records that behavior and does not endorse it. If the asymmetry is ever treated as a bug, this test is the one that should flip.

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


drafted by Claude on behalf of Daniel Stephenson

@dmccoystephenson
dmccoystephenson merged commit 2a74031 into main Oct 18, 2026
1 check passed
@dmccoystephenson
dmccoystephenson deleted the feature/test-extract-template-body-and-main branch October 18, 2026 07:18
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