Skip to content

[BUG-P0] dashboard_engine.py:655 f-string backslash breaks dashboard command on Python 3.11 (CI runtime) #74

Description

@Wolfvin

Summary

scripts/dashboard_engine.py:655 contains a backslash inside an f-string expression part ({...}), which is a SyntaxError on Python 3.11 and earlier. This silently breaks the dashboard command on Python 3.11 (CI's quality-gate (3.11) runtime).

Root cause

Line 655:

{"<button onclick=\"showSection('compare')\">Compare</button>" if comparison else ""}

The \" inside the {...} expression is the backslash. Python 3.11 disallows backslashes in f-string expression parts. Python 3.12 (PEP 701) relaxed this rule, so the file imports fine on 3.12 but fails on 3.11.

Evidence

CI log from PR #71 quality-gate (3.11) job:

[codelens] ERROR: Failed to import command module 'dashboard.py': f-string expression part cannot include a backslash (dashboard_engine.py, line 1331)

Python 3.11 reports the error at line 1331 (the closing triple-quote of the f-string), but the actual backslash is at line 655.

Local repro:

uv run --python 3.11 python3 -c "import dashboard_engine"
# SyntaxError: f-string expression part cannot include a backslash

Impact

  1. dashboard command broken on Python 3.11 — module fails to import, auto-import catches the exception silently (see [BUG-09] Command auto-import silently drops broken modules — registry missing commands with no CI signal #39), command missing from registry.
  2. CI quality-gate workflow red for ALL PRs — blocks merge of unrelated PRs (fix: consolidate _default_db_path to utils.py — closes #40 #71, feat: rule-validate + rule-test commands — closes #51 #72, etc.).
  3. Python 3.11 users cannot use codelens dashboard.

Fix

Replace the backslash-escaped quotes with a triple-quoted string inside the expression (no backslash needed). The current line 655 uses escaped double-quotes inside the f-string expression; swap to single-quote triple-quoted string inside the expression to avoid the backslash entirely.

Using single-quote triple-quoted string inside the double-quote triple-quoted f-string body avoids both the backslash and the delimiter conflict.

Acceptance criteria

Related

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions