CI guard against multi-line Django {# #} comments (+ fix 3 existing)#1358
Merged
Conversation
…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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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— aSimpleTestCase(no DB) that scans every*.htmlundertemplates/and fails on any{# … #}that opens but doesn't close on the same line. It runs automatically in the existing.github/workflows/test.ymlsuite on every push/PR, and locally viamanage.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 innews_item.html,member.html, andproject.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