You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit ba73b4d
Browse filesBrowse the repository at this point in the historyBrowse files
* Restore the isotope catalog query (prod was serving sample data)
7819662 changed the isotope list query to `SELECT * FROM c OFFSET/LIMIT` with no
ORDER BY. Cosmos rejects `OFFSET LIMIT` without `ORDER BY`, so the query threw on
any real database. Azure SWA managed functions run with
AZURE_FUNCTIONS_ENVIRONMENT=Development, so the handler's catch fell through to
`if (isLocalDevelopmentEnvironment())` and returned the 3 built-in mock isotopes
with `mocked: true` instead of a 500 — which is why production showed "sample
data".
- isotopes.js: query is back to `SELECT TOP <limit> * FROM c` (the form that ran
in production for months). limit cap raised 100 -> 1000 so the whole catalog
loads without paging; `hasMore` is always false.
- isotopes.js + reference-materials.js: the catch-fallback to mock data now also
requires `!hasCosmosConfiguration()`. A configured-DB query error is a real
error (500) — never silently served as sample data again.
- IsotopeViewer requests the full catalog in one go (no server paging to page).
- buildSearchQuery is exported + tested to never emit OFFSET / ORDER BY.
44 API tests pass; check + build clean.
* Quiet Dependabot CI noise
Dependabot PRs don't get repo secrets, so the Azure deploy step always failed on
them with "deployment_token was not provided".
- azure workflow: skip build_and_deploy_job for dependabot[bot], and add
skip_deploy_on_missing_secrets so fork PRs don't fail either.
- dependabot.yml: group ALL github-actions updates (majors included) into one
weekly PR instead of one PR per action.
* Get test files out of the deployed function app; add continuation-token paging
## The sample-data bug (real root cause)
`api/package.json` has `"main": "src/functions/*.js"`, and the Azure Functions
host imports *every* file that glob matches at startup. The four
`api/src/functions/*.test.js` files I had added each run
`process.env.MOCK_COSMOS = 'true'` at module scope — so once deployed, the whole
function app came up with MOCK_COSMOS set and every endpoint served the 3
built-in sample isotopes regardless of the Cosmos config. (Loading a test file
with top-level `await` + `node:test` calls also broke host startup outright on
the PR preview → the 404.)
Fix: moved all four to `api/test/` (outside the functions glob, still picked up
by `node --test`) and added `api/.funcignore` so `*.test.js` is never packaged.
## Proper pagination for /api/isotopes
- `buildSearchQuery` now emits a plain `SELECT * FROM c [WHERE …]` — no `TOP`,
`ORDER BY`, or `OFFSET` (Cosmos rejects `OFFSET LIMIT` without `ORDER BY`, and
an `ORDER BY` on an unindexed path fails).
- Paging is the Cosmos SDK continuation token: `query(spec, { maxItemCount,
continuationToken }).fetchNext()`. Response carries `continuation` (+ `hasMore`).
- `IsotopeViewer` sends `?continuation=…` and loads the next page on scroll;
`loadIsotopeCatalog` in the wizard pages through the whole catalog.
- Mock path paginates too (token = next offset).
45 API + 60 unit tests; check + build clean.
* Never serve sample data when a database is configured
`shouldUseMockCatalog()` used to return true when NODE_ENV /
AZURE_FUNCTIONS_ENVIRONMENT looked like "development" AND the Cosmos config was
incomplete. Azure SWA managed functions default AZURE_FUNCTIONS_ENVIRONMENT to
"Development", so on prod the only thing keeping real data on was all four
COSMOSDB_* vars being set — and a stray MOCK_COSMOS (from the deployed test
files) or a missing COSMOSDB_CONTAINER flipped it to sample data.
- shouldUseMockCatalog() is now just: `MOCK_COSMOS set` OR `no COSMOSDB_*`.
isLocalDevelopmentEnvironment() is deleted.
- hasCosmosConfiguration() needs only endpoint + key (db/container have defaults).
- The catch block no longer falls back to mocks — a configured-DB query error is
a real 500.
- New api/test/mock-detection.test.js locks this in.
48 API + 60 unit tests; check + build clean.
* docs: describe the two pagination styles + sample-data behaviour
* Warn when a known proxy nuclide is set to report its own element
Some nuclides (Np-239, Pa-233) are almost always counted as a delayed stand-in
for another element. If someone adds "Pa-233" labelled as protactinium (not
thorium), the wizard now shows a warning on the isotope card — "Pa-233 is
usually detected to measure thorium … record that relationship" — with the same
"Record how this is measured" button as the name/label mismatch prompt.
- knownProxyHint(isotope) in catalogWrite.ts, driven by a small
KNOWN_PROXY_ISOTOPES map (add pairs there). Suppressed when the entry is
already labelled as the target element (isotopeElementMismatch covers that) or
a relationship is already recorded.
- 63 unit tests; check + build clean.
* Drop invalid skip_deploy_on_missing_secrets input (the job-level dependabot guard is enough)
* Auto-expand newly added isotope cards
A "did you mean" proxy warning (Pa-233 → thorium, Np-239 → uranium) lives inside
the isotope's CollapsibleCard, which is collapsed by default for catalog-picked
isotopes — so the prompt was never seen. New isotopes (from the catalog picker
or "Add custom isotope") now open expanded.
* Show the proxy / mismatch warning outside the isotope card
The "did you mean X?" prompt (Pa-233 → thorium, Np-239 → uranium) and the
name/label mismatch warning were inside the CollapsibleCard body, only visible
when expanded. Moved them to a sibling of the card so they show whether it's open
or collapsed. Reverts the auto-expand from 916f286.
* Also move the 'measured via' proxy note outside the isotope card
* Bump APP_VERSION to 7.1.1 BETA
* Surface isotope warnings as a summary at the top of Step 1
The name/label mismatch and known-proxy ("did you mean thorium?") prompts now
appear in one "⚠ Check these isotopes" box directly under the step heading —
above the catalog picker and the isotope list — instead of one per card lower
down. Each row keeps its "Record how this is measured" button.
* Move the isotope warning box right under the 'Isotopes to analyze' heading
Copy file name to clipboardExpand all lines: README.md
+6-1Lines changed: 6 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -75,7 +75,12 @@ and `POST` are registered; other methods 404.
75
75
The frontend isotope viewer calls `/api/isotopes` by default. You can override that by setting `PUBLIC_ISOTOPE_API_URL`.
76
76
The reference material viewer calls `/api/reference-materials` by default. You can override that by setting `PUBLIC_REFERENCE_MATERIAL_API_URL`.
77
77
78
-
Both GET endpoints accept `q` (search), `limit` (clamped to 100), and `offset` query parameters, and respond with `{ items, count, search, hasMore }`. `hasMore` signals that another batch is available at `offset + items.length`; the catalog viewers use it to fetch the next batch when the user scrolls to the bottom of the list.
78
+
Both GET endpoints accept `q` (search) and `limit` (page size) and respond with `{ items, count, search, hasMore, ... }`; the catalog viewers fetch the next page when the user scrolls to the bottom.
79
+
80
+
-`/api/isotopes` pages with a **Cosmos continuation token**: the response carries `continuation` (an opaque string, `null` on the last page); send it back as `?continuation=…` for the next page. The query is a plain `SELECT * FROM c` — no `ORDER BY`/`OFFSET`, so it needs no index.
81
+
-`/api/reference-materials` pages with `?offset=…` (`ORDER BY c._ts DESC OFFSET … LIMIT …`).
82
+
83
+
When no `COSMOSDB_*` settings are present (or `MOCK_COSMOS=true`), both endpoints serve a small built-in sample catalog with `"mocked": true`, and the app shows a "sample data" banner. A configured database is always used.
0 commit comments