Skip to content

Add check_placeholders cases for conditionals, section bounds, and trimming - #155

Merged
dmccoystephenson merged 1 commit into
mainfrom
feature/check-placeholders-test-expansion
Oct 9, 2026
Merged

dmccoystephenson merged 1 commit into
mainfrom
feature/check-placeholders-test-expansion

Conversation

@dmccoystephenson

Copy link
Copy Markdown
Member

Summary

Stage B (unit-test expansion) cycle targeting check_placeholders in scripts/check_docs.py — the check that enforces CLAUDE.md's "every {{placeholder}} has a Step 4 row" rule. Six fixture cases are added to CheckPlaceholdersTests, each characterizing current behavior; no production code is changed.

  • Undeclared {{#if FLAG}} errors — the conditional-flag failure branch had only a happy-path case. The error names {{FLAG}} and never reports the closing {{/if}}.
  • Rows after the Step 4 section do not count — a matching row placed under the next ### heading still leaves the placeholder reported missing.
  • Step 4 as the last section — with no following ### heading, the table is read to end of file.
  • Multiple missing placeholders — reported in one error, sorted ({{ALPHA}}, {{ZED}}).
  • Whitespace inside braces — {{ NAME }}, {{#if FLAG }}, and {{ /if }} are trimmed before matching.
  • Unused table rows are not reported — only the template → table direction is enforced. This is documented as current behavior rather than treated as a bug: the check_docs.py docstring and CLAUDE.md state only the forward direction. A probe of the live file found no genuinely unused row today; the only row with no template use is the path/to/file example row in the DOC_SOURCES_TABLE guidance (line 651), so a naive reverse check would false-positive on it.

No tracking issue — gap found during triage (Phase 2 Stage B: the failure branches of check_placeholders had no fixture case).

Research grounding

RESEARCH.md §3 — regression guards on behavior-bearing code. No template or phase definition is changed, so no Implementations entry applies.

Doc sync check

No docs, template, Step, or placeholder changed. python3 scripts/check_docs.py passes.

Test plan

  • python3 -m unittest discover -s tests -v — Ran 19 tests, OK (13 before this change)
  • python3 scripts/check_docs.py — "Doc consistency check passed."
  • /create-dev-loop behavioral run — not applicable (test-only change; nothing the generated skill receives is touched)

Skipped issues

This cycle was spent on test expansion rather than the open backlog, for the same reasons recorded in #153:

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

…imming

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@dmccoystephenson
dmccoystephenson requested a balanced review from Copilot October 9, 2026 07:55
@dmccoystephenson

Copy link
Copy Markdown
Member Author

Self-review rubric (scored against CI run 37901826523 and the diff):

  • Scope: PASS — the diff touches only tests/test_check_docs.py, +42 lines, all inside CheckPlaceholdersTests.
  • Tests-new: PASS (n/a) — no new production function; six new cases target the existing check_placeholders.
  • Tests-fix: n/a — no bug fix. Each new case was checked by reasoning against the mutation it should catch. If #if prefix stripping were dropped, the error would name {{#if FLAG}}, which does not contain the asserted {{FLAG}}. If /if were not skipped, the assertNotIn("/if", ...) would fire. If the table section were widened to the whole file, LATER would be declared and the expected error would be missing.
  • Sibling structure: PASS — the new cases reuse the class's _table helper and setUp reset, and assert on message content per the module docstring.
  • Sibling renames: n/a — nothing renamed.
  • Docs: PASS — no documented behavior changed. The unused-row case records a limitation that the check_docs.py docstring already implies (it only enforces the forward direction).
  • Issue resolution: n/a — Stage B cycle, no Closes.
  • CI: PASS — doc-consistency is green on the PR head. Locally: 19 tests ran, OK (13 before this change), and the doc consistency check passed.
  • Placeholder parity / README Step parity / Fence escaping / Phase numbering / Version comments / No back-ported specifics / gardener interface / Retrofit note: n/a — create-dev-loop.md and README.md are untouched.
  • Research grounding: PASS — the PR body cites RESEARCH.md §3.
  • Behavioral validation: UNVERIFIED-not-applicable — the change is test-only.

Judgment flag: test_unused_table_row_is_not_reported pins the current one-directional behavior. A future reverse-direction check would need to update this case, and would also need to exempt the path/to/file example row at create-dev-loop.md:651. The test comment marks this as characterization, so a deliberate change is not blocked.

Summary: no blocking findings. Merge-ready once the review poll completes.

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 14e5174 into main Oct 9, 2026
2 checks passed
@dmccoystephenson
dmccoystephenson deleted the feature/check-placeholders-test-expansion branch October 9, 2026 07:56

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The focused tests accurately characterize the existing implementation and introduce no unresolved issues.

0 open findings

What changed in this PR

Adds regression coverage for check_placeholders without changing production behavior.

Changes:

  • Adds six fixture cases covering conditionals, section boundaries, sorting, whitespace, and unused rows.
  • Confirms existing one-way template-to-table validation behavior.
File Description
tests/​test_check_docs.py Expands check_placeholders unit-test coverage.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

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.

2 participants