Repository navigation
report: /topicsVizReport/<report id> is the first-party topic map as a clean, reusable page - #3477
Closed
colinmegill wants to merge 3 commits into
Closed
colinmegill wants to merge 3 commits into
colinmegill wants to merge 3 commits into
Conversation
…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
Member
Author
|
Superseded by a single-commit branch of the same change. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
/topicsVizReport/<report id>becomes the topic map alone: the first-party map fromclient-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
job_idin 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=0hides it.?job_id=<id>draws that run's map;?selection=participant_visible|all_but_moderated_out|all_comments(withoutjob_id) the current map under that comment rule, if the route lets this reader have it;?theme=lightthe package's neutral theme (white ground);?theme=dark, the default, a dark theme derived from it (#121212ground). The default is one constant,DEFAULT_THEMEinclient-topic-map-embed/src/themes.js.This route no longer renders the report client's React
TopicsVizReportcomponent. 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", noAuthorization):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. Nosourceparameter, so the route serves its served map.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.GET /api/v3/reports?report_id=<id>(only for the conversation id, which the comment list needs and the map does not carry), thenGET /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/visualizationsor/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.jsis the Solid component; the page (src/page.js) is a thin shell that maps the address to its props. Props:reportId; optionaljobIdorselection;theme; optionaldocument(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; andtoken, 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 besideclient-topic-map. The map package is imported and used as it is; nothing inclient-topic-mapchanges.solid-js2.0.3,@solidjs/web2.0.3 and@solidjs/h2.0.2, written with hyperscript so no JSX compiler is needed (the Solid Babel preset has no stable 2.x release). Bundled byesbuild0.28.2 into one script of about 86 KB. Every version is exact and in a lockfile.npm run buildwritesdist/static/topic-map/index.html,page.<hash>.jsand the map's font, each with its.headersJson(script and font cached for a year, the pageno-cache). A stage infile-server/Dockerfileruns the tests and the build and copiesdist/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./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.topicsVizReportleaves the report pages' location.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_idandselectionnever 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=lightand?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 byclient-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 itsjob_idand 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.jsno longer visits/topicsVizReportas a report client page;report-authentication.cy.jschecks the topic map page there.Not in this change
list=jobs, the page shows no menu.🤖 Generated with Claude Code