Skip to content

report: /topicsVizReport/<report id> is the first-party topic map as a clean, reusable page - #3477

Closed
colinmegill wants to merge 3 commits into
edgefrom
topic-map/embeddable-page
Closed

colinmegill wants to merge 3 commits into
edgefrom
topic-map/embeddable-page

Conversation

@colinmegill

Copy link
Copy Markdown
Member

/topicsVizReport/<report id> becomes the topic map alone: the first-party map from client-topic-map, drawn by a small, reusable Solid view. The page can load any of the report's stored maps by choice, and it shows held-back comments as grey dots marked "Moderated out", so a reader can see how much was submitted against how much is shown.

What a person sees

  • While the topic map route is switched off (production today): a dark page with one quiet line, "No topic map is stored for this report yet." No error, no sign-in, no "No visualization jobs found".
  • Once the route serves a stored map: the map fills the window. Above it, one button per level ("124 topics", "42 topics", ...), "All N together", then "Names as datamapplot draws them today" and "Largest topic first". Drag, zoom and click to select a topic work as the map package does them. No topic list, no event log, no datamapplot frame.
  • Held-back comments (in a public map, the comments moderated out, inactive or muted when the page asked: a position only, no id, no topic) are drawn as the map package draws any point with no topic: grey, beneath the others. Pointing at one shows "Moderated out". One line under the buttons states the counts the map gives, only when something is held back, for example "3,948 comments · 986 moderated out, shown grey".
  • A choice of maps, when the report has more than one run with a stored map: a plain "Map:" menu above the buttons. Each choice says which comments the map was made from ("what participants see", "everything not moderated out", "every comment"), how its topics were named ("keyword names", or the model's name), when it ran (UTC) and how many comments it places; the current one says "current". Choosing one draws it and puts job_id in the address, so that map can be linked to. With one run, or while the route does not list runs, there is no menu and the page draws the current map. ?chooser=0 hides it.
  • Tooltips of ordinary points show the comment's text when the report's comment list gives it (to a public reader, the comments participants can see). It is asked for only when the pointer first moves over the map. A comment the list does not return has no text.
  • The address: ?job_id=<id> draws that run's map; ?selection=participant_visible|all_but_moderated_out|all_comments (without job_id) the current map under that comment rule, if the route lets this reader have it; ?theme=light the package's neutral theme (white ground); ?theme=dark, the default, a dark theme derived from it (#121212 ground). The default is one constant, DEFAULT_THEME in client-topic-map-embed/src/themes.js.
  • Each answer of the route has its own plain words: no map stored for this report (or run) yet; this run has not finished yet; there is no report at this address; this report has no run with that id; the map of this run is not public; too many requests just now, reload in a moment; too large; could not be read; could not be loaded. The list of runs failing in any way never stops the map.

This route no longer renders the report client's React TopicsVizReport component. The component itself, and the topic map narrative report (/topicMapNarrativeReport/<id>) that renders it, are unchanged.

Every request the page makes

All are in one module, client-topic-map-embed/src/load.js, sent with no credential (credentials: "omit", no Authorization):

  1. GET /api/v3/delphi/topicMap?report_id=<id> with &job_id=<id> or &selection=<rule> when the address names one (never both: the route refuses the pair). Once per report, run and rule. No source parameter, so the route serves its served map.
  2. GET /api/v3/delphi/topicMap?report_id=<id>&list=jobs: the report's runs with a stored map, asked once, beside the map and never before it; not asked with ?chooser=0.
  3. At the first pointer move over the map, once per page: GET /api/v3/reports?report_id=<id> (only for the conversation id, which the comment list needs and the map does not carry), then GET /api/v3/comments?conversation_id=<id>&report_id=<id>&moderation=true, the comment list the report pages read. To anyone but the conversation's moderators it holds only what participants can see.

The page never requests /api/v3/delphi/visualizations or /api/v3/delphi, and loads its script and font from our own build and nothing from any other host.

The view, for other places

client-topic-map-embed/src/TopicMap.js is the Solid component; the page (src/page.js) is a thin shell that maps the address to its props. Props: reportId; optional jobId or selection; theme; optional document (draw one in hand, ask nothing); controls: false (no buttons); counts: false (no count line); commentText: false (ask for no text); conversationId (a host that knows it saves the report request); header (shown above the buttons; the page puts its chooser there); onTopicSelect, onTopicHover, onLevelChange; fetch; and token, a Bearer token for a placement whose reader is signed in. The public page passes no token; the moderator's placement is not built here. The chooser (src/JobChooser.js, src/jobs.js) belongs to the page, so a place that embeds the view can bring its own.

How it is served

  • client-topic-map-embed/, a package beside client-topic-map. The map package is imported and used as it is; nothing in client-topic-map changes.
  • Solid 2: solid-js 2.0.3, @solidjs/web 2.0.3 and @solidjs/h 2.0.2, written with hyperscript so no JSX compiler is needed (the Solid Babel preset has no stable 2.x release). Bundled by esbuild 0.28.2 into one script of about 86 KB. Every version is exact and in a lockfile.
  • Build: npm run build writes dist/static/topic-map/index.html, page.<hash>.js and the map's font, each with its .headersJson (script and font cached for a year, the page no-cache). A stage in file-server/Dockerfile runs the tests and the build and copies dist/ into the file-server's build. node build.mjs --standalone <document or set of runs> <out.html> writes one file that opens from disk; built from a set of runs, it answers its own map and list requests from what it holds.
  • nginx: a location for /topicsVizReport/<id>, ahead of the report pages, rewrites to /static/topic-map/index.html (the query kept) and sends it the way every /static/ file goes. topicsVizReport leaves the report pages' location.
  • Why its own package and not client-report: the report client is a React 18 webpack application; this view is reused on other routes and wants no React.

Tests

  • make check-client-topic-map-embed (Node 24.22.1; also a hosted workflow): npm ci, 31 unit tests (node --test), then the build. They cover the request module (each URL; job_id and selection never together; no credential unless a token is given; every answer of the map, the list and the comment reads, including failures, mapped without throwing), the mapping from props to requests, the chooser's states (no list, one run, two runs, a named run, a run not in the list, no run matching the map drawn), each run in plain words, the tooltip text and count line for held-back points, the fixture tool, and the themes.
  • e2e/cypress/e2e/self-contained/topic-map-page.cy.js, with every non-local host blocked: the map draws and its level buttons change the drawing; ?theme=light and ?job_id; the route off and its other answers, each asked once; a map with held-back points (the public biodiversity fixture in the route's public form, written by client-topic-map-embed/tools/held-back-fixture.mjs): it draws, the count line shows, pointing at a grey point shows "Moderated out", the comment text is asked for only at the first pointer move (the two reads, with their exact parameters, once) and an ordinary point then shows its text; two runs in the list: the menu names both, choosing the second asks for its job_id and puts it in the address; the list missing: no menu, the map draws; ?chooser=0: no list asked for. No request leaves for another host and neither datamapplot listing is asked for.
  • file-server/nginx/test-edge-routing.py: /topicsVizReport/<id>?job_id=… reaches Node as /static/topic-map/index.html?job_id=…, never as the report shell.
  • third-party-hosts.cy.js no longer visits /topicsVizReport as a report client page; report-authentication.cy.js checks the topic map page there.

Not in this change

  • The route itself: who may read which map, the list of runs, and the public form with held-back points are the route's, in their own change. Until the route answers list=jobs, the page shows no menu.
  • No group graphics, densities or zoom behaviour; the map package is not redesigned.
  • No schema change. No Node handler change. Nothing on the vote, comment or next-comment path: the page reads the topic map route (its own pools and its own bound) and, on first hover, two existing report reads.

🤖 Generated with Claude Code

colinmegill and others added 3 commits November 23, 2026 21:26
…round client-topic-map

/topicsVizReport/<report id> no longer renders the report client's React
page. nginx serves one static page from the build in its place
(/static/topic-map/index.html, through Node to the static files host, the
query kept). The page draws the first-party topic map and the row of
buttons above it (one per level, all levels together, and the two rules for
which names show), and nothing else: no topic list, no event log, no
datamapplot frame.

It asks GET /api/v3/delphi/topicMap?report_id=<id> once, with no
credential (?job_id=<id> adds job_id to name one Delphi run), and never
the datamapplot listings (/api/v3/delphi/visualizations, /api/v3/delphi).
Every answer has plain words on the page. While the route is switched off
the address reaches Node's 404, and the page says quietly that no topic map
is stored for this report yet.

?theme=light draws on the package's neutral theme; ?theme=dark (the
default, one constant in themes.js) on a dark theme derived from it at the
host. The map package is used as it is.

The new package client-topic-map-embed holds the component (TopicMap.js,
props: report id, optional run, theme; the map's events passed out as
callbacks) and the thin page around it. It is built with solid-js 2.0.3,
@solidjs/web 2.0.3 and @solidjs/h 2.0.2 (hyperscript, so no JSX compiler:
no stable 2.x of the Solid Babel preset is published), bundled by esbuild
0.28.2, all pinned with a lockfile. The file-server image builds it in its
own stage and copies dist/ into the build, so the static asset deploy
carries it with its .headersJson sidecars. The font is served from the
build; nothing loads from another host.

The React TopicsVizReport component and the topic map narrative report
that uses it are unchanged.

Tests: unit tests of the request and every answer's state and of the
themes (node --test, make check-client-topic-map-embed); a Cypress test in
the self-contained suite that answers the route with a stored document
(written by polis-topic-map from its public biodiversity fixture, no
comment text) and checks in a real browser that the canvas is drawn, that
the level buttons change what is drawn, that no request leaves for another
host and that neither datamapplot listing is asked for, plus the route-off
and refusal states. The nginx edge routing test checks the page reaches
Node as its static file with the query kept. The report self-contained test
no longer visits /topicsVizReport as a report client page.

No schema change. No Node handler change. Nothing on the vote, comment or
next-comment path.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KvftUARCjBArGpuPBmjRZ1
…eld-back comments grey

The view takes what to load as props: the report id, optionally a run's
job id or a comment rule (selection, never sent with a job id), the theme,
callbacks, and a token prop left for a signed-in placement (the public page
sends none). The page maps ?job_id=, ?selection=, ?theme= and ?chooser=0
from its address to those props.

- A quiet chooser of runs, part of the page and not of the component,
  shown only when the report lists more than one run with a stored map
  (GET /api/v3/delphi/topicMap?report_id=<id>&list=jobs). Each run is named
  by which comments, how its topics were named, when it ran and how many
  comments it places. Choosing one draws it and puts its job_id in the
  address. When the list does not answer, there is no chooser and the map
  draws as before.
- Held-back comments (the last points.moderatedOut points of a public map:
  a position, no id, no topic) are drawn as the map package draws a point
  with no topic, grey, and their tooltip says "Moderated out". One line
  under the buttons gives the document's counts, only when something is
  held back.
- Other points' tooltips take their text from the report's comment list,
  asked for at the first pointer move over the map and kept in memory:
  GET /api/v3/reports?report_id=<id> for the conversation id (skipped when
  a host passes one), then GET /api/v3/comments?conversation_id=<id>&
  report_id=<id>&moderation=true. Comments it does not return get no text.
- Every request lives in src/load.js. A standalone page built from a set
  of runs answers its own requests from what it holds.

Tests: unit tests for the request module, the props-to-requests mapping,
the chooser's states, the tooltip text and the count line; the browser
test gains a held-back fixture (written by tools/held-back-fixture.mjs),
two runs in the list, a missing list, and ?chooser=0.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KvftUARCjBArGpuPBmjRZ1
@colinmegill

Copy link
Copy Markdown
Member Author

Superseded by a single-commit branch of the same change.

@colinmegill
colinmegill deleted the topic-map/embeddable-page branch November 24, 2026 11:11
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