Skip to content

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

Merged
colinmegill merged 9 commits into
edgefrom
topic-map/embeddable-view
Nov 24, 2026
Merged

colinmegill merged 9 commits into
edgefrom
topic-map/embeddable-view

Conversation

@colinmegill

@colinmegill colinmegill commented Nov 24, 2026 •

Copy link
Copy Markdown
Member

Observable changes to existing tests and behaviour (read first):

  • e2e/cypress/e2e/client-report/report-authentication.cy.js: on /topicsVizReport/<id> the assertion cy.contains('visualization') (text of the old React page) becomes cy.get('.polis-topic-map').should('exist') (the new page: its map, or its quiet message while no map is stored). What it protected stays: the address loads a page, not an error ("Cannot GET" is still refused).
  • e2e/cypress/e2e/self-contained/third-party-hosts.cy.js: /topicsVizReport leaves its list of report client pages, because the report client no longer serves it. The rule it protected (nothing from another host) is checked for this page by topic-map-page.cy.js, with every non-local host blocked.
  • The client error reporter's list of static path names (all five copies, generated by node ci/local/client-error-paths.cjs from the routing table) gains topic-map, so a load failure under /static/topic-map/ is reported with its path name, not redacted.
  • The new page reports its errors as the report client did on this address: the reporter runs inline in its head (client report), so an uncaught error, a failed load of its script or font, or a failed read sends POST /api/v3/clientErrors to our own host. The standalone file carries no reporter.

/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, or "names by a model" when the list names none), when it ran (UTC) and how many comments it places; the current one says "current". A part the list does not give (no levels, no model, no count) is left out, never shown as "null" or an empty count; a run whose names the route records as none or keywords reads "keyword names". 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, asked for as the report pages ask: under the report's own moderation level, and to a public reader only the comments participants can see. So a tooltip never shows text the report would not show that reader. It is asked for only when the pointer first moves over the map. A comment the list does not return has no text; a report whose moderation level cannot be read gets no tooltip text at all.
  • 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

The reads 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 answers with its served map, or, when nothing served is stored for the report, the shadow one.

  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 a drawn map, once per map read: GET /api/v3/reports?report_id=<id> (for the conversation id, which the comment list needs and the map does not carry, and the report's mod_level), then GET /api/v3/comments?conversation_id=<id>&report_id=<id>&moderation=true&mod_gt=<mod_level>: the comment list with the report's moderation filter, as client-report asks for it. The report pages also send include_voting_patterns, which only adds vote counts to the same rows; the tooltips need none, so it is left out. To anyone but the conversation's moderators the list holds only what participants can see.

  4. Only when something fails: POST /api/v3/clientErrors, from the client error reporter every client installs (inline in the page's head, as the report client did on this address; client report; nothing but our own host).

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 for no map; with a reportId it still asks for comment text on hover); controls: false (no buttons); counts: false (no count line); commentText: false (ask for no text); conversationId and modLevel (a host that knows both saves the report request; with either missing the report is read for them); 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. A new token, or none, reloads the map and its text. Each view keeps comment text for one reader only (report, conversation id, level, token), made afresh with every read of the map; two views never share it, so a signed-in placement and an anonymous one in the same document never see each other's text. A host whose own fetch carries a credential of its own changes the token or mounts another view when its reader changes. 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.
  • Licences: everything the page ships carries its notice. npm run build writes NOTICE.txt beside the script and font: Solid's licence (solid-js, @solidjs/web and @solidjs/h publish no licence file of their own, so it is the Solid repository's LICENSE at their release tags), the one @solidjs/signals publishes, client-topic-map's NOTICE and the font's OFL, whole. The script's first comment and the page name it; the standalone file carries the same text inline. The sources are client-topic-map-embed/NOTICE, client-topic-map/NOTICE and client-topic-map/fonts/OFL.txt.
  • Build: npm run build writes dist/static/topic-map/index.html, page.<hash>.js, the map's font and NOTICE.txt, 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, 43 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; the comment list always under the report's moderation level, checked against a stand-in that filters as Node does; every answer of the map, the list and the comment reads, including failures, mapped without throwing), the comment text kept per reader (a token's text never reaches a reader without it, either way round; a token change reloads the map), the notices in the emitted directory, the script and the standalone file (and every package in the bundle named in the NOTICE), runs without levels, model or count, 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, the themes, and the client error reporter: installed inline in the built page's head, whole, before the font and the script, reporting as the report client, the build commit passed only when it is a commit hash, and none in the standalone file.
  • 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, mod_gt from the report included, 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.
  • make check-client-errors: the reporter's path names match the routing table (now with topic-map), and the page's template and build install the reporter before its font and script.
  • In topic-map-page.cy.js, Simple Analytics closing beacons (https://queue.simpleanalyticscdn.com/append) that pages of earlier specs send while it runs are set aside, by that one address, only while the page has no Simple Analytics of its own (its script from another host is still blocked and counted; window.sa_event must be undefined). The map's font is checked from the page (resource from /static/topic-map/, the Roboto face loaded) rather than by waiting for its request, which a retried attempt never makes.
  • 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 is changed: the page reads the topic map route (its own pools and its own bound) and, on first hover, two existing Node report reads, which use Node's ordinary database pool as the report pages' reads do.

🤖 Generated with Claude Code

colinmegill and others added 9 commits November 24, 2026 03:10
…a clean, reusable page

The page is the topic map alone: a Solid component around client-topic-map, served at /topicsVizReport/<report id>. It loads a run's stored map by report id, lets a reader choose between a report's runs when the route lists more than one, and draws held-back comments as grey points that say so. It requests nothing from another host and neither datamapplot listing.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KvftUARCjBArGpuPBmjRZ1
…nt text, and a new token reloads the map

From an independent review: the module-wide comment text was keyed by report
alone, so a signed-in placement and an anonymous one in the same document
shared one answer, and the map read the token untracked, so a changed token
did not reload it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KvftUARCjBArGpuPBmjRZ1
The build writes NOTICE.txt beside the page's script and font: Solid's
licence (solid-js, @solidjs/web and @solidjs/h publish none of their own, so
it is the Solid repository's LICENSE at their release tags), the one
@solidjs/signals publishes, client-topic-map's notices and the font's OFL,
whole. The script's first comment and the page name it; the standalone file
carries the same text inline. A test checks the emitted files, and that every
package in the bundle is named in the package's NOTICE.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KvftUARCjBArGpuPBmjRZ1
…d is kept for one reader only

The comment list for the tooltips now carries the report's own moderation
level as mod_gt, read from the report as client-report does (a host may give
the conversation id and the level instead); with no level, no text is asked
for. So a tooltip never shows a comment's text the report would not show
that reader.

Each component keeps the text for one reader (report, conversation id,
level, token) and makes it afresh with every read of the map: nothing is
shared between components, and a token added, changed or removed reloads
the map and its text.

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

A run whose list entry has no levels, no model name or no count is
described by what it has, never as null or an empty count; the route
records today's keyword-named runs as "none", and the chooser calls both
"none" and "keywords" keyword names.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KvftUARCjBArGpuPBmjRZ1
…sation props gets the map and its text loaded again

Review round: the two props join the map effect's dependencies, so comment text fetched for one reader's settings is never left showing after the host changes them.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KvftUARCjBArGpuPBmjRZ1
…me, and the page installs the reporter as every client does

The topic map page added /static/topic-map/ to the routing table, so the
reporter's list of static path names, generated from it by
ci/local/client-error-paths.cjs, gains topic-map in all five copies.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KvftUARCjBArGpuPBmjRZ1
… on every other client

/topicsVizReport was served by the report client, which reported its
errors; the static page that took the address over reported none. The
served page now installs the report client's copy of the reporter, inline
before the font and the script, as the report client did (client report,
the build commit when the image is given one, the API on the same host).
The standalone file asks no host and carries none. The file-server's page
stage copies the reporter and the prelude builder, and the package's
workflow runs when either changes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KvftUARCjBArGpuPBmjRZ1
…aside, and the font is read from the page

Run after other specs in one browser, as its hosted shard runs it, the
test counted Simple Analytics closing beacons (queue.simpleanalyticscdn.com
/append) that the admin, report and participation pages of earlier specs
send while it runs, and failed the topic map page for them. Run alone it
passes. They are now set aside, by that one address, only while the page
has no Simple Analytics of its own (its script from another host is still
blocked and counted, and window.sa_event must be undefined); how many were
set aside is logged.

The font was checked by waiting for its request, which a retried attempt
never makes (the first attempt cached it for a year), so the retries failed
on the font and hid the first attempt's failure. It is now read from the
page: the resource from /static/topic-map/ and the Roboto face loaded.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KvftUARCjBArGpuPBmjRZ1
@colinmegill
colinmegill marked this pull request as ready for review November 24, 2026 14:30
@github-actions

Copy link
Copy Markdown
Contributor

Delphi Coverage Report

File Stmts Miss Cover
polismath/init.py 2 0 100%
polismath/benchmarks/bench_pca.py 128 107 16%
polismath/benchmarks/bench_repness.py 81 65 20%
polismath/benchmarks/bench_update_votes.py 38 28 26%
polismath/benchmarks/benchmark_utils.py 34 0 100%
polismath/components/init.py 1 0 100%
polismath/components/config.py 165 70 58%
polismath/conversation/init.py 2 0 100%
polismath/conversation/conversation.py 1293 264 80%
polismath/conversation/group_vote_counts.py 38 2 95%
polismath/conversation/manager.py 131 42 68%
polismath/database/init.py 1 0 100%
polismath/database/dynamodb.py 392 176 55%
polismath/database/postgres.py 414 95 77%
polismath/delphi_storage/init.py 1 0 100%
polismath/delphi_storage/codec.py 300 22 93%
polismath/delphi_storage/embedding_spool.py 58 6 90%
polismath/delphi_storage/golden_corpus.py 60 9 85%
polismath/delphi_storage/import_report.py 51 3 94%
polismath/delphi_storage/legacy_import.py 171 16 91%
polismath/delphi_storage/postgres.py 51 22 57%
polismath/delphi_storage/production_import.py 614 131 79%
polismath/delphi_storage/resource.py 179 32 82%
polismath/delphi_storage/scan_pacing.py 77 0 100%
polismath/delphi_storage/topic_map.py 128 7 95%
polismath/delphi_storage/writer.py 200 13 94%
polismath/embedding_model.py 197 49 75%
polismath/empty_output.py 29 2 93%
polismath/engine_adapter.py 317 265 16%
polismath/job_child/init.py 372 52 86%
polismath/job_child/census.py 74 9 88%
polismath/job_child/input_bundle.py 106 7 93%
polismath/pca_kmeans_rep/init.py 5 0 100%
polismath/pca_kmeans_rep/clusters.py 257 38 85%
polismath/pca_kmeans_rep/corr.py 98 17 83%
polismath/pca_kmeans_rep/group_k_smoother.py 28 0 100%
polismath/pca_kmeans_rep/legacy_kmeans.py 197 8 96%
polismath/pca_kmeans_rep/pca.py 162 19 88%
polismath/pca_kmeans_rep/repness.py 226 5 98%
polismath/poller/init.py 4 0 100%
polismath/poller/admission.py 318 15 95%
polismath/poller/backfill.py 936 32 97%
polismath/poller/capacity.py 485 27 94%
polismath/poller/capacity_queue.py 248 13 95%
polismath/poller/coordinator_bridge.py 317 317 0%
polismath/poller/math_writer.py 120 3 98%
polismath/poller/promotion.py 112 4 96%
polismath/poller/readiness.py 368 13 96%
polismath/poller/rebuild_child.py 133 5 96%
polismath/poller/recompute_line.py 141 9 94%
polismath/poller/service.py 760 50 93%
polismath/poller/worker_pool.py 143 0 100%
polismath/queue/executor.py 221 111 50%
polismath/regression/init.py 4 0 100%
polismath/regression/clojure_comparer.py 188 20 89%
polismath/regression/comparer.py 891 640 28%
polismath/regression/datasets.py 126 27 79%
polismath/regression/recorder.py 36 27 25%
polismath/regression/utils.py 130 85 35%
polismath/replay/init.py 2 0 100%
polismath/replay/attribution_capture.py 49 0 100%
polismath/replay/axis_continuity.py 347 24 93%
polismath/replay/certify.py 999 59 94%
polismath/replay/crosslang.py 128 2 98%
polismath/replay/decision_ties.py 51 8 84%
polismath/replay/diagnostics.py 50 7 86%
polismath/replay/driver.py 73 1 99%
polismath/replay/dsn_admission.py 36 1 97%
polismath/replay/equiv_query.py 10 0 100%
polismath/replay/event_ingress.py 95 1 99%
polismath/replay/fixture_bundle.py 815 62 92%
polismath/replay/fixture_config.py 266 11 96%
polismath/replay/fixture_extract.py 285 12 96%
polismath/replay/fixture_generate.py 103 1 99%
polismath/replay/fixture_samples.py 157 14 91%
polismath/replay/fixture_selection.py 119 0 100%
polismath/replay/fixture_survey.py 147 11 93%
polismath/replay/legacy_pca.py 29 17 41%
polismath/replay/polarity.py 319 25 92%
polismath/replay/poller_equiv.py 776 99 87%
polismath/replay/prodclone.py 193 2 99%
polismath/replay/real_data.py 146 10 93%
polismath/replay/schedule.py 205 10 95%
polismath/replay/served_math.py 159 4 97%
polismath/replay/shard_bench.py 189 65 66%
polismath/replay/stagecompare.py 890 161 82%
polismath/replay/stages.py 256 40 84%
polismath/replay/stepcompare.py 86 1 99%
polismath/replay/store.py 120 11 91%
polismath/replay/tie_capture.py 107 19 82%
polismath/replay/types.py 58 6 90%
polismath/run_math_pipeline.py 284 93 67%
polismath/selection.py 58 0 100%
polismath/step_log.py 127 15 88%
polismath/tools/engine_rebuild.py 230 11 95%
polismath/types.py 6 0 100%
polismath/utils/cli_flags.py 15 0 100%
polismath/utils/clj_hash.py 44 0 100%
polismath/utils/env_flags.py 13 0 100%
polismath/utils/general.py 63 39 38%
polismath/utils/output_profile.py 66 2 97%
polismath/utils/serialization.py 10 5 50%
polismath/utils/vote_convention.py 159 5 97%
umap_narrative/700_datamapplot_for_layer.py 514 470 9%
umap_narrative/701_static_datamapplot_for_layer.py 310 310 0%
umap_narrative/702_consensus_divisive_datamapplot.py 435 275 37%
umap_narrative/801_narrative_report_batch.py 657 209 68%
umap_narrative/803_check_batch_status.py 268 148 45%
umap_narrative/llm_factory_constructor/init.py 2 0 100%
umap_narrative/llm_factory_constructor/model_provider.py 232 106 54%
umap_narrative/narrative_data.py 178 55 69%
umap_narrative/numerical_stages.py 111 21 81%
umap_narrative/polismath_commentgraph/init.py 1 0 100%
umap_narrative/polismath_commentgraph/cli.py 268 268 0%
umap_narrative/polismath_commentgraph/core/init.py 3 3 0%
umap_narrative/polismath_commentgraph/core/clustering.py 108 108 0%
umap_narrative/polismath_commentgraph/core/embedding.py 104 104 0%
umap_narrative/polismath_commentgraph/lambda_handler.py 219 219 0%
umap_narrative/polismath_commentgraph/schemas/init.py 2 0 100%
umap_narrative/polismath_commentgraph/schemas/dynamo_models.py 80 6 92%
umap_narrative/polismath_commentgraph/tests/conftest.py 17 17 0%
umap_narrative/polismath_commentgraph/tests/test_clustering.py 74 74 0%
umap_narrative/polismath_commentgraph/tests/test_embedding.py 55 55 0%
umap_narrative/polismath_commentgraph/tests/test_storage.py 87 87 0%
umap_narrative/polismath_commentgraph/utils/init.py 9 7 22%
umap_narrative/polismath_commentgraph/utils/converter.py 283 50 82%
umap_narrative/polismath_commentgraph/utils/group_data.py 332 279 16%
umap_narrative/polismath_commentgraph/utils/storage.py 616 486 21%
umap_narrative/reset_conversation.py 162 53 67%
umap_narrative/run_pipeline.py 474 171 64%
umap_narrative/topic_naming.py 159 9 94%
Total 26459 7423 72%

@colinmegill
colinmegill merged commit 6c076c4 into edge Nov 24, 2026
70 of 72 checks passed
@colinmegill
colinmegill deleted the topic-map/embeddable-view branch November 24, 2026 14:35
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