Fix artifact-page tab buttons (Discussion / Provenance / Versions / Links)

← All Specs

Fix artifact-page tab buttons (Discussion / Provenance / Versions / Links)

Task ID: artifact-tabs-jsquote-2026-05-10 Layer: Atlas (artifact_detail + dataset_detail_page) Date: 2026-05-10

Symptom

On https://scidex.ai/artifact/<id> the Discussion / Provenance / Versions
/ Links tab buttons did nothing on click. Same affected /dataset/<id> pages.

Root cause

The Discussion / Comment JS block shares a single <script> tag with the showArtifactTab tab handler. Inside that block, several html += '...'
lines build buttons whose onclick= attributes need an inner single
quote:

html += '<button onclick="submitArtifactComment(\'' + artifactId + '\')"...

That JS source is embedded in a Python f"""...""" template. Python
processes \' as a single-quote escape before shipping the string to
the browser, so the wire content collapsed to:

html += '<button onclick="submitArtifactComment('' + artifactId + '')"...

The empty '' strings closed and immediately re-opened the JS string,
producing a SyntaxError: Unexpected string. Because parsing fails for
the whole <script> tag, showArtifactTab was never defined — so every
tab button became a no-op.

Confirmed by piping the rendered page through node -c:

SyntaxError: Unexpected string

Fix

api.py: replace \'\\' in every submitArtifactComment / reactToComment JS-generation line. Python now emits the literal
two-byte sequence \' (backslash + apostrophe), which JS reads as a
properly escaped quote inside the single-quoted JS string.

Eight lines changed across two identical script blocks:

locationblock owner
api.py:36763, 36791-36793artifact_detail
api.py:72510, 72538-72540dataset_detail_page

Verification

  • python3 -c "import ast; ast.parse(open('api.py').read())" → OK
  • Extract the rendered <script> block from a live artifact page and
pipe through node -c — no SyntaxError.
  • Live: visit /artifact/<any-id>, click Discussion / Provenance /
Versions / Links — tabs switch.

File: artifact-tabs-jsquote-2026-05-10_spec.md
Modified: 2026-05-18 04:17
Size: 2.0 KB