• Stefy Lanza (nextime / spora )'s avatar
    township: the page's whole script block has been dead since v0.2.41 · 11b0f446
    Stefy Lanza (nextime / spora ) authored
    The template picker rendered as a box you could not choose from. The cause is
    much worse than the symptom: the main <script> block has not parsed since
    v0.2.41, so NOTHING in it ran — status polling, the template buttons, the
    per-stage buttons, Save config, Stop. The page still rendered perfectly, which is
    why screenshots looked right and nothing in the logs complained.
    
    One character did it. The page is emitted from a Python f-string, so
    
        side.textContent = running ? ('Running\n'+(label||'')) : ...
    
    puts a REAL newline inside the JS string literal. The literal never closes, the
    block dies with a SyntaxError, and every function it defines is gone. It needed
    \\n, which is what it has now.
    
    Found by probing the server: the browser never requested /templates, nor /status,
    nor anything else the init block does — and a marker written as the first
    statement of that block never ran either. That ruled out the picker and pointed
    at the parse.
    
    Two things in the picker itself, both real:
    
    - tplRefresh() was only ever called AFTER a save or a delete, from the first
      templates commit (c1a65e1d). A freshly loaded page never listed what was on
      disk, so the picker was empty even with the script working — and my v0.2.40
      claim that "the picker is never an empty box" was simply wrong.
    - The select had no options at all before its first fill, which is why it read as
      an input field rather than a dropdown. It now ships a placeholder and is width-
      constrained.
    
    Verified against the real templates directory: all four script blocks parse, and
    the picker lists "big frames", "LongCat - few long scenes" and "Wan - many short
    scenes" with their dates and option counts.
    
    The test starts the real server, fetches the real page, and parses every script
    block with node. It is verified to FAIL on the defect: reintroducing the bare \n
    makes it fail with the SyntaxError. A dependency-free scanner was written first
    and deleted — it reported the known-broken block as clean, and a check that
    passes on a file proven broken is worse than no check.
    
    115 tests.
    Co-Authored-By: 's avatarClaude Opus 5 (1M context) <noreply@anthropic.com>
    Claude-Session: https://claude.ai/code/session_0182DhR1eFNPQyGmDrpHbedY
    11b0f446
__init__.py 4.21 KB