{% extends "base.html" %} {% block title %}Workspace — {{ doc.title or doc_id }} — ICDEV™{% endblock %} {% block content %} {# dwr-ws-02 — the two-pane workspace. LEFT is the document. RIGHT is one card per proposal, fetched from GET /api/change-set?doc_id= — dwr-ws-01's endpoint, which had no consumer until this page. There is ONE assembler, so the rail cannot describe a change set the API does not. Modelled on tools/dashboard/templates/delta_review/page.html: the .dr-side-by-side two-column shape, and its :182-209 distinction between DOCUMENT-level and span-anchored findings. placeholder_guard and citation_guard report at document level, so a page showing only anchored findings renders a blocked draft as having nothing wrong with it. Vanilla JS, no framework, no bundler. The CSRF shim in base.html signs every same-origin mutating fetch, so nothing here touches a token. escHtml and safeMarkdown come from static/js/esc.js, which is deferred — hence the DOMContentLoaded wrapper. Nothing is fetched from a CDN. #}
CUI // SP-CTI

🪟 Workspace

{% if doc.title %}{{ doc.title }}{% else %}untitled — no catalogue row{% endif %} {{ doc_id }}

← All workspaces Document detail →
{# ── Who else is here, and is this page still hearing from the server? (dwr-collab-01) ─────────────────────────────────────────────────────────── Two facts, side by side and never merged, because they fail independently and a reviewer needs both before deciding a change somebody else may be deciding right now: WHO read from `dic_presence_sessions` via presence_registry. "Only you" is a MEASURED verdict; a registry that could not be read says so. LIVE whether the change-state poll is landing. A page whose poll has been failing for two minutes looks EXACTLY like a quiet document, so the dot going amber/red is the only thing that tells those apart. Rendered empty and filled by the poll — nothing here is server-rendered, because a presence list drawn at render time is stale by the time it is read, which is the defect this whole card is about. #}
Connecting to the change feed… · Checking who else is in this document…
{# ── Document-level findings ──────────────────────────────────────────────── These anchor to no single proposal. Rendering only span-anchored findings would draw a blocked draft as clean — the delta_review precedent, restated for this page. A gate over an EMPTY denominator reads `unmeasured`, never `clean`: measured 2026-09-08, dic_doc_28e2ee4d984f3f35 has a version row, ZERO sections and 47 pending proposals, and an unguarded gate drew two green ticks for a document nothing had ever scanned. #}
Document-level findings These anchor to no single proposal — placeholder_guard and citation_guard report at document level. A rail showing only anchored changes would render a blocked draft as clean.
{% for key, label in [('placeholder', 'Placeholders'), ('citation', 'Citations'), ('numeric', 'Numeric claims')] %} {% set g = document_findings[key] %}
{{ label }}
{% if g.state == 'findings' %}
{{ g.count }} finding{{ '' if g.count == 1 else 's' }}
    {% for f in g.findings[:6] %}
  • {{ f.issue or f.type or 'placeholder' }} {% if f.item_number %} — {{ f.item_number }}{% endif %} {% if f.detail %} — {{ f.detail }}{% elif f.message %} — {{ f.message }}{% endif %} {% if f.placeholders %} — {{ f.placeholders|join(', ') }}{% endif %}
  • {% endfor %} {% if g.count > 6 %}
  • …and {{ g.count - 6 }} more
  • {% endif %}
{% elif g.state == 'clean' %}
clean
The gate ran over {% if key == 'citation' %}{{ g.ai_section_count }} AI-authored section{{ '' if g.ai_section_count == 1 else 's' }}{% else %}this version's sections{% endif %} and found nothing. A measured pass.
{% else %}
not assessed
{% if g.reason == 'no_version' %}This document has no version row, so the gate has never been run against it. {% elif g.reason == 'no_sections' %}The version holds no sections, so the gate had nothing to scan. This is not a pass. {% elif g.reason == 'no_ai_sections' %}No section on this version is AI-authored, so the citation gate had no claim to check. {% else %}The gate could not be run ({{ g.reason or 'unknown' }}). This is not a pass. {% endif %}
{% endif %}
{% endfor %} {# The third document-level finding is this page's own and is filled from the change set: a proposal that names no section at all cannot be drawn on any span-anchored rail. On this board that is every proposal. #}
Unplaced proposals
not assessed
Waiting for the change set.
{# ── The two panes ────────────────────────────────────────────────────────── .dws-two-pane is delta_review's .dr-side-by-side shape with an asymmetric split: the document is the thing being read, the rail is the thing being acted on. #}
{# LEFT — the document. Which rendering mode is available is MEASURED by workspace.document_body, never chosen. #}
📄 Document {% if body.basis == 'positioned' %}
{% endif %}
{% if body.basis == 'positioned' %} {# POSITIONED — the content of record, verbatim, in a pre-wrap layer. An anchor's content[start:end] on screen is the same span verify_anchor checks and the accept door splices, so a mark here is EXACT. #}
Rendered verbatim from dic_sections.content — the content of record. Character offsets on screen are the offsets an anchor addresses, so a highlighted span is exactly what Accept would replace.
{% for s in body.sections %}
{{ s.heading or 'Untitled section' }} {{ s.section_id }} {% if s.origin %}· {{ s.origin }}{% endif %} {% if s.status %}· {{ s.status }}{% endif %} · {{ (s.content or '')|length }} chars
{{ s.content or '' }}
{% endfor %}
{% elif body.basis == 'chunks' %} {# DEGRADED CHUNK VIEW — the document has NO dic_sections row. Its text survives only as retrieval chunks, and api_suggestion_accept writes dic_sections.content and nothing else, so no proposal can ever be applied against what is shown here. That is stated, not implied. #}
Degraded view — this document has no sections. What follows is {{ body.chunk_count }} retrieval chunk{{ '' if body.chunk_count == 1 else 's' }} from rag_chunks, not the content of record. Nothing here is addressable: Accept writes dic_sections.content, so every proposal on this document is a preview and none of them can be applied. The repair is a re-scan that derives sections (section_deriver), not a change on this page.
{% for c in body.chunks %}
Chunk {{ (c.chunk_index if c.chunk_index is not none else loop.index0) + 1 }}{% if c.total_chunks %} of {{ c.total_chunks }}{% endif %} {{ c.id }} · not addressable
{{ c.content or '' }}
{% endfor %}
{% elif body.basis == 'no_body' %}
Measured: this document has no body. Both stores were read — no dic_sections row for its {% if body.version_id %}active version{% else %}(absent) version{% endif %}, and no rag_chunks row for its id. The proposals on the right, if any, describe text this deployment no longer holds.
{% else %}
Unmeasured — the document could not be read. This is not the same as an empty document and must not be read as one (reason: {{ body.reason or 'unknown' }}).
{% endif %}
{# RIGHT — one card per proposal. Filled from /api/change-set. #}
{% set iqe_canvas = "dic" %} {% set iqe_api_route = "/document-intelligence/api/iqe-query" %} {% set iqe_title = "IQE Query — Workspace" %} {% set iqe_examples = [ {"label": "Pending proposals", "query": "foreach s in dic.suggestions where s.status == \"pending\" select s.suggestion_id, s.doc_id, s.canvas_source, s.created_at"}, {"label": "Unanchored proposals", "query": "foreach s in dic.suggestions where s.anchor_basis == \"\" select s.suggestion_id, s.doc_id, s.status"} ] %} {% include "includes/iqe_query_widget.html" %} {% endblock %}