Skip to content

CI guard against multi-line Django {# #} comments (+ fix 3 existing)#1358

Merged
jonfroehlich merged 2 commits into
masterfrom
ci-template-comment-check
Jun 20, 2026
Merged

CI guard against multi-line Django {# #} comments (+ fix 3 existing)#1358
jonfroehlich merged 2 commits into
masterfrom
ci-template-comment-check

Conversation

@jonfroehlich

Copy link
Copy Markdown
Member

Adds the mechanical check we discussed for the recurring multi-line {# #} bug (a multi-line Django comment renders as visible page text; most recently fixed in 2.14.2).

The check

website/tests/test_template_comments.py — a SimpleTestCase (no DB) that scans every *.html under templates/ and fails on any {# … #} that opens but doesn't close on the same line. It runs automatically in the existing .github/workflows/test.yml suite on every push/PR, and locally via manage.py test. Includes a self-test pinning the detector both ways, so the guard can't silently rot.

It immediately found 3

The check flagged pre-existing multi-line {# #} header comments in news_item.html, member.html, and project.html. These sit outside any {% block %} in child templates, so they don't actually render (verified: 0 occurrences on prod) — but they're malformed Django and would leak if moved into a block. Converted all three to {% comment %}.

No release needed

No rendered output changes, so no version bump / no prod tag — merging to master (→ test) is enough; the guard then protects future PRs.

🤖 Generated with Claude Code

jonfroehlich and others added 2 commits June 19, 2026 18:13
…ent %}

Caught by the new template-comment guard. These sit outside any {% block %} in
child templates, so they don't render (verified on prod), but a multi-line {# #}
is malformed Django and would leak if ever moved into a block. No output change.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
SimpleTestCase that scans templates and fails on any multi-line {# #} (which
Django renders as visible text). Runs in the existing test.yml CI suite and
locally via manage.py test; includes a self-test of the detector. Backstops the
recurring bug documented in CLAUDE.md (last hit: 2.14.2).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@jonfroehlich jonfroehlich merged commit d4b8fd1 into master Jun 20, 2026
3 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.

1 participant