Skip to content

fix(chat): repair the line-numbered chat template merged by #336 - #498

Merged
Ayinkx merged 1 commit into
mainfrom
fix/chat-template-line-numbers
Oct 14, 2026
Merged

Ayinkx merged 1 commit into
mainfrom
fix/chat-template-line-numbers

Conversation

@Ayinkx

@Ayinkx Ayinkx commented Oct 14, 2026

Copy link
Copy Markdown
Collaborator

Problem

app/templates/chat/index.html on main is not a template any more - it is a patch pasted into a file. The squash merge of #336 (79a2442, "fix: streaming indicator and typing feedback for chat") carried line numbers into the file:

-<%extends "base.html" %}          <- opening tag corrupted
-2<aside class="chat-sidebar">     <- its own line number, no indentation
-3    <div class="sidebar-header">
-5      <button ...>+ New</button> <- also gained a U+200B zero-width space

121 of 135 lines are prefixed with their source line number and two zero-width spaces were introduced. The template still compiles and every test still passed, so the corruption has been live on main since 2026-10-06 - the digits simply render into the chat page.

I hit this while resolving conflicts on the open chat PRs (#346, #318, #319, #342, #347, #348, #354, #355): every one of them conflicts with this file, and resolving "against main" would mean resolving against the corrupted text.

Fix

Restore the last known-good revision (f0dbbde, the commit before #336) and re-apply the only semantic change #336 made to this template: the per-conversation

<span class="conversation-status" hidden aria-hidden="true"></span>

that app/static/js/chat.js writes the streaming indicator into. Everything else in that commit (app/chat/api.py, app/chat/routes.py, app/services/streaming.py, app/static/js/chat.js, tests/test_streaming.py) is unaffected and untouched.

Verified by diffing the restored file against main with the numbers stripped - the only remaining differences are whitespace, the corrupted <%extends, and the zero-width spaces.

Regression guard

New tests/test_template_hygiene.py:

  • fails if any file under app/templates/ contains a line starting with a 1-4 digit number followed by markup (the exact shape this corruption took). Only chat/index.html is flagged by it on main, so it does not create false positives.
  • asserts the chat page still starts with {% extends "base.html" %} and keeps the conversation-status span.
pytest tests/test_template_hygiene.py tests/test_chat.py -q
..................................  66 passed

ruff check .   -> All checks passed!
black --check . -> all files unchanged

The squash merge of #336 pasted the patch itself into
`app/templates/chat/index.html`: every line from the sidebar down carried its
own line number (`2<aside class="chat-sidebar">`, `3    <div ...`), the opening
tag became `<%extends "base.html" %}`, and two U+200B zero-width spaces were
introduced. The template still compiles, so nothing failed and the corruption
has been on `main` since 2026-10-06 - the digits simply render into the page.

Restore the last known-good template (`f0dbbde`) and re-apply the only
semantic change #336 made to it: the per-conversation
`<span class="conversation-status" hidden aria-hidden="true"></span>` the
streaming indicator writes to.

Adds `tests/test_template_hygiene.py`, which fails when any template contains a
line that starts with a 1-4 digit number followed by markup - the exact shape
this corruption took - plus a check that the chat page still extends the shared
layout and keeps its status span.
@Ayinkx
Ayinkx merged commit f2d942f into main Oct 14, 2026
5 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