OpenConceptLab/ocl_issues#2869 | TBv2's apps menu links to the OCL Mapper - #53
Conversation
… OCL Mapper The tile uses the Tools menu's Mapper icon and toMapperURL(), and opens in a new tab like the Tools entry. The popper widens to 390px so the three tiles come out equal. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…nd the apps menu fits phone screens toMapperURL()'s generic app.*.openconceptlab.org branch overwrote the explicit demo/QA mapping, so app.demo linked to map.demo, which doesn't resolve. The branches are now else-if. The apps menu's min width is capped at the viewport (min(390px, 100vw - 16px)). From Codex review pass 1. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
paynejd
left a comment
There was a problem hiding this comment.
Codex adversarial review, pass 1 (codex-cli 0.159.3, commit 68fe6dc)
Found three issues, all P2 (medium):
-
Demo links to the wrong Mapper environment. AppsMenu.jsx:64 calls
toMapperURL(), whose generic hostname branch overwrites its explicit demo → QA mapping. Executing the helper confirmedapp.demo.openconceptlab.orgproducesmap.demo.openconceptlab.org, despite the preceding branch specifyingmap.qa.openconceptlab.org. Fix: make those branches mutually exclusive. This helper defect already affects the Tools entry; the new tile inherits it. -
The wider popup cannot fit common mobile viewports. AppsMenu.jsx:39 imposes a 390px minimum, plus the Paper border. It cannot fit a 375px viewport; Popper repositioning cannot shrink it. This also applies when only two tiles are visible. Fix: use a viewport-constrained width and responsive minimum width; give anchors
flex: 1andmin-width: 0so visible tiles share available space. -
Hiding both existing apps also hides the new Mapper tile. The unconditional tile at AppsMenu.jsx:64 is unreachable when both hide flags are true, because Header.jsx:184 still suppresses the entire menu. Fix: determine menu visibility from all enabled apps, including an explicit Mapper availability flag. That flag can also suppress Mapper on FHIR/custom deployments without a suitable destination.
Render-time URL evaluation avoids the Tools menu’s module-time staleness. The new anchor supports keyboard activation and safely opens a new tab. No additional concrete accessibility regression found.
Review was read-only; URL behavior was checked with Node. Layout findings are from source inspection, without browser rendering.
|
Responses to Codex pass 1 (fixed in 4bf01e1):
|
…ned in from TBv2 pages that have a query string The Mapper reads auth=true from the segment after the first '?' in the referrer's hash. A TBv2 URL with its own query (search, concept lists) put that query there instead, so the Mapper didn't start sign-in. toMapperURL() now drops the page's query from the referrer; the Mapper only uses the referrer to recognise OCL clients and read auth. From Codex review pass 2. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
paynejd
left a comment
There was a problem hiding this comment.
Codex adversarial review, pass 2 (codex-cli 0.159.3, commit 4bf01e1)
One concrete finding:
- P2 — Render-time Mapper URLs embed an unescaped referrer. AppsMenu.jsx:64 calls the helper with the current route, exposing its existing query-encoding bug at utils.js:1191. From
/search?q=diabetes&page=2, it produces:Query parsing truncates…/#/?referrer=https://…/search?q=diabetes&page=2?auth=truereferrerbefore&pageand treatspageas a Mapper parameter. Suggested fix: encode the complete referrer withURLSearchParams, preserving the Mapper’s expected authentication convention.
No other concrete regressions established. The demo/QA ordering is corrected; I did not re-raise the intentional both-hidden behavior. Review was read-only, with the URL issue reproduced in Node; layout and accessibility were inspected statically.
|
Response to Codex pass 2 (fixed in c052580): Unescaped referrer: fixed, though differently from the suggestion. The Mapper's |
paynejd
left a comment
There was a problem hiding this comment.
Codex adversarial review, pass 3 (codex-cli 0.159.3, commit c052580)
No concrete new findings in git diff origin/master...HEAD.
Checked URL selection, render-time evaluation, Mapper auth parsing, accessibility, hidden-app layouts, and FHIR/custom-site behavior. All 16 focused URL/auth cases passed; git diff --check passed.
Layout review was static; I did not run a browser. No files changed.
…enconceptlab.org app hosts CodeQL flagged the unescaped, unanchored 'app.*.openconceptlab.org' pattern on the line this PR touched. The anchored regex matches the same OCL hosts (prod, staging, qa, demo) and no longer matches lookalikes such as app.x.openconceptlab.org.evil.com. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
… an OCL host with a port still maps location.host includes the port, which the anchored regex rejected (the old unanchored pattern accepted it). Both host checks now use location.hostname; the origin replacement still keeps the port. From Codex review pass 4. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
paynejd
left a comment
There was a problem hiding this comment.
Codex adversarial review, pass 4 (codex-cli 0.159.3, commit 4d6dc68)
One concrete finding:
-
[P2] OCL hosts with explicit ports fall back to production Mapper — src/common/utils.js:1188.
window.location.hostincludes the port, so the anchored regex rejectsapp.staging.openconceptlab.org:8443, sending users tohttps://map.openconceptlab.orginstead of staging. Production, QA, and demo with ports also hit this fallback; production loses its port.Suggested fix: Use
window.location.hostnamefor both the QA/demo comparison and the regex. Keep the origin replacement to preserve ports for production/staging; QA/demo then consistently route tohttps://map.qa.openconceptlab.org.
Executed the actual before/after function across the hostname cases. Portless production, staging, QA, demo, localhost with a port, and unrelated hosts retain their mappings. Lookalike domains now correctly fall back to production. No other findings in the incremental diff or its full PR context.
|
Codex passes 3 and 4, plus a CodeQL fix in between:
|
paynejd
left a comment
There was a problem hiding this comment.
Codex adversarial review, pass 5 (codex-cli 0.159.3, commit 669a647)
One finding, pre-existing in the localhost check:
- src/common/utils.js:1184 —
host.includes('localhost')misroutes lookalikes such aslocalhost.evil.testandnotlocalhost.example.orgtohttp://localhost:4004. It also overrides the OCL mapping forapp.localhost.openconceptlab.org. Suggested fix: usewindow.location.hostname === 'localhost'.
No findings in the two-line pass-5 change itself. Executed 24 host/port cases: prod and staging preserve ports; QA and demo map to https://map.qa.openconceptlab.org with or without source ports; localhost maps to port 4004; other tested non-OCL hosts and lookalikes fall back to production Mapper.
Confirmed git diff 4d6dc68d..HEAD changes only the two checks from host to hostname.
Response: the localhost finding predates this PR, and the PR doesn't touch that line. A lookalike host only misroutes its own users to their own localhost:4004, so it stays out of scope here. The PR's own changes are clean as of this pass.
…: demo links to demo, qa to qa Reverts the else-if, anchored-regex and hostname changes from 4bf01e1, 4d6dc68 and 669a647. Each environment's TBv2 links to its own Mapper, which the original routing already did. The referrer query fix (c052580) stays. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
paynejd
left a comment
There was a problem hiding this comment.
Codex adversarial review, pass 6 (codex-cli 0.159.3, commit fbb3d3b)
No concrete findings in the PR’s changes.
Reviewed the full git diff origin/master...HEAD, surrounding menu styles, and Mapper’s forceLoginUser parser. Query stripping preserves auth detection in the checked URL cases. Host routing is unchanged and intentional. git diff --check passes.
Review was read-only; no browser rendering or build was run.
|
Host routing restored to master (fbb3d3b), per Jon. Each environment's TBv2 links to its own Mapper: demo → demo, QA → QA. The demo environment is inactive for now, and when it comes back, demo instances point to other demo instances. That reverts the |
closes OpenConceptLab/ocl_issues#2869
TBv2's apps menu (the grid icon in the header) gets an OCL Mapper tile next to TermBrowser and Bulk Importer.
MotionPhotosAutoOutlined).toMapperURL(), so each environment opens its own Mapper (host routing is unchanged). It opens in a new tab, like the Tools entry.min(390px, 100vw - 16px)so the three tiles come out equal (at 330px the TermBrowser label made its tile wider than the others) and the menu still fits a phone screen.toMapperURL()drops the current page's query string from the referrer. The Mapper readsauth=truefrom the segment after the first?in the referrer's hash, so from TBv2 pages with a query (search, concept lists) signed-in users weren't auto-signed-in on the Mapper. This also fixes the existing Tools link.hideAppsMenulogic is unchanged).Checked: CI's ESLint command passes. Referrer and auth parsing was simulated against the Mapper's parser. The layout was checked at desktop and 375px widths in a static copy of the menu (same SCSS rules, popper width and type), not in a running TBv2: its dev server needs Node 14 + node-sass 4. Codex passes 1–6 are below; pass 6 is clean.
🤖 Generated with Claude Code