diff --git a/.context/handoff.md b/.context/handoff.md index f440beac..f53f06dd 100644 --- a/.context/handoff.md +++ b/.context/handoff.md @@ -93,7 +93,7 @@ open "http://localhost:4321/dataset/nm000104?qa=fixture" ```bash cd /Users/yahya/Documents/git/nemar/epic-website-redesign rm -rf dist && bun run build -CLOUDFLARE_ACCOUNT_ID=da8d7a2a8680dab01592bbbc6f67f12c \ +CLOUDFLARE_ACCOUNT_ID= \ bunx cfman wrangler --account sccn pages deploy dist \ --project-name nemar-website \ --branch feature/issue-1-epic-nemar-redesign \ @@ -134,7 +134,7 @@ In rough priority order: - **Discover pagination is server-side offset-based.** Multi-modality AND/OR filtering across selections >1 is a known tradeoff with this pagination model — the `total_count` reflects server total, not client-filtered count. Move AND/OR server-side when the backend supports it. - **Provenance fallback is in place** but useless for `on005262` because the upstream catalog row also has nulls. Real fix is nemar-cli#512. - **Download links route through `data.nemar.org///`**, not the manifest's direct presigned URL. This puts the Worker in the chain so nemar-cli#513's `response-content-disposition` fix will start producing BIDS-shaped filenames as soon as it deploys, without any further frontend change. -- **Cloudflare token doesn't have memberships scope** — always pass `CLOUDFLARE_ACCOUNT_ID=da8d7a2a8680dab01592bbbc6f67f12c` explicitly with `bunx cfman wrangler --account sccn ...`. +- **Cloudflare token doesn't have memberships scope** — always pass `CLOUDFLARE_ACCOUNT_ID=` explicitly with `bunx cfman wrangler --account sccn ...`. ## Files to know diff --git a/.context/research.md b/.context/research.md index b664c985..0204e0cd 100644 --- a/.context/research.md +++ b/.context/research.md @@ -93,7 +93,7 @@ LIKE-based search hits the catalog's `search_text` precomputed column. Doesn't h ## Deploy auth on the SCCN Cloudflare account ```bash -CLOUDFLARE_ACCOUNT_ID=da8d7a2a8680dab01592bbbc6f67f12c \ +CLOUDFLARE_ACCOUNT_ID= \ bunx cfman wrangler --account sccn pages deploy dist \ --project-name nemar-website --branch --commit-dirty=true ``` diff --git a/.context/scratch_history.md b/.context/scratch_history.md index 4c353d68..c46244fa 100644 --- a/.context/scratch_history.md +++ b/.context/scratch_history.md @@ -46,7 +46,7 @@ Failed attempts, gotchas hit, and lessons that don't fit cleanly into rules yet. **Fix:** Pass `CLOUDFLARE_ACCOUNT_ID=` as env var. Wrangler skips the memberships lookup when account ID is supplied. -**Account ID:** `da8d7a2a8680dab01592bbbc6f67f12c` (SCCN). Now baked into `.context/handoff.md`. +**Account ID:** `` (SCCN). Now baked into `.context/handoff.md`. ## Browse skill expected Playwright Chromium 1208, system had 1217 diff --git a/AGENTS.md b/AGENTS.md index 6903f976..5467a88b 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -68,12 +68,14 @@ bun run lint # biome # Build rm -rf dist && bun run build -# Deploy — CLOUDFLARE_ACCOUNT_ID is required because the SCCN token lacks -# the memberships scope wrangler tries to call when enumerating accounts. -CLOUDFLARE_ACCOUNT_ID=da8d7a2a8680dab01592bbbc6f67f12c \ +# Deploy — CLOUDFLARE_ACCOUNT_ID must be set in your shell because the SCCN +# token lacks the memberships scope wrangler tries to call when enumerating +# accounts. The account id is org-internal; export it from your shell rc or +# read it from a password manager rather than committing it here. +CLOUDFLARE_ACCOUNT_ID="${CLOUDFLARE_ACCOUNT_ID:?set SCCN account id in env}" \ bunx cfman wrangler --account sccn pages deploy dist \ --project-name nemar-website \ - --branch feature/issue-1-epic-nemar-redesign \ + --branch main \ --commit-dirty=true ``` diff --git a/CLAUDE.md b/CLAUDE.md index f89f0172..571d9782 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -40,4 +40,4 @@ Don't reimplement these in the frontend — the website already has fallbacks; t ### Deploy authentication -`cfman wrangler --account sccn` for everything. The token doesn't have memberships scope so always pass `CLOUDFLARE_ACCOUNT_ID=da8d7a2a8680dab01592bbbc6f67f12c` explicitly. Don't write the token anywhere in this repo. +`cfman wrangler --account sccn` for everything. The token doesn't have memberships scope so always pass `CLOUDFLARE_ACCOUNT_ID="$CLOUDFLARE_ACCOUNT_ID"` explicitly (export the SCCN account id from your shell rc or pull it from a password manager). Don't write the account id or the token anywhere in this repo. diff --git a/src/components/ProvenanceCard.astro b/src/components/ProvenanceCard.astro deleted file mode 100644 index 2ef0dc54..00000000 --- a/src/components/ProvenanceCard.astro +++ /dev/null @@ -1,220 +0,0 @@ ---- -import type { DerivedProvenance } from "../lib/provenance"; -import DoiBadge from "./DoiBadge.astro"; - -interface Props { - datasetId: string; - nemarDoi: string | null; - provenance: DerivedProvenance; -} - -const { datasetId, nemarDoi, provenance } = Astro.props; -const originalId = provenance.originalDatasetId; -const mirrorVersions = provenance.allMirrorVersions ?? []; -const showMultiMirror = mirrorVersions.length > 1; ---- - -
-
- -

- {originalId - ? `NEMAR-curated copy of OpenNeuro ${originalId}` - : "NEMAR-curated copy of an OpenNeuro dataset"} -

-
- -

- This is the NEMAR-curated copy. We pull from OpenNeuro periodically; each - pull is a major version bump (vN.0.0). Versions between - pulls (vN.x.y) are NEMAR-side fixes and improvements. - {!originalId && ( - The exact OpenNeuro identifier could not be auto-resolved — see the manual lookup link below. - )} -

- -
-
-
NEMAR DOI
- {nemarDoi ? : not published} -
-
-
OpenNeuro DOI
- {provenance.originalDoi - ? - : unknown} -
-
- -
- {provenance.originalUrl && ( - - View original on OpenNeuro - - - )} - {provenance.mirrorVersion && ( - - View as-imported mirror ({provenance.mirrorVersion}) - - )} - {!originalId && ( - - Search OpenNeuro - - )} -
- - {showMultiMirror && ( -
- All mirror snapshots ({mirrorVersions.length}) -
    - {mirrorVersions.map((v) => ( -
  • - {v} - as-imported from a separate OpenNeuro pull -
  • - ))} -
-
- )} -
- - diff --git a/src/lib/data-api.ts b/src/lib/data-api.ts index 7d003784..82d1a0de 100644 --- a/src/lib/data-api.ts +++ b/src/lib/data-api.ts @@ -99,9 +99,14 @@ export async function fetchManifestEntryText( try { const res = await fetch(url, { signal: controller.signal }); - if (!res.ok) return null; + if (res.status === 404) return null; + if (!res.ok) { + console.warn(`[data-api] manifest entry ${url}: ${res.status} ${res.statusText}`); + return null; + } return await res.text(); - } catch { + } catch (err) { + console.warn(`[data-api] manifest entry ${url}: ${(err as Error).message ?? err}`); return null; } finally { clearTimeout(timer); @@ -158,7 +163,15 @@ export async function fetchGithubReadme( return res.text(); }), ); - } catch { + } catch (err) { + // AggregateError when all 12 candidate URLs fail; flatten its inner + // errors so a GitHub outage or rename leaves a triageable tail-log + // entry instead of a silent null. + const detail = + err instanceof AggregateError + ? err.errors.map((e) => (e as Error).message).join(" | ") + : ((err as Error).message ?? String(err)); + console.warn(`[data-api] github readme ${owner}/${repo}: ${detail}`); return null; } finally { clearTimeout(timer); diff --git a/src/pages/dataset/[id].astro b/src/pages/dataset/[id].astro index 214cb176..200286a6 100644 --- a/src/pages/dataset/[id].astro +++ b/src/pages/dataset/[id].astro @@ -44,8 +44,14 @@ const versionParam = url.searchParams.get("v"); const [landing, metadata, catalogRow, qaAggregates] = await Promise.all([ getLanding(id), getMetadata(id), - getDataset(id).catch(() => null), - getQaAggregates(id).catch(() => null), + getDataset(id).catch((err) => { + console.warn(`[dataset/${id}] catalog row unavailable: ${(err as Error).message ?? err}`); + return null; + }), + getQaAggregates(id).catch((err) => { + console.warn(`[dataset/${id}] qa aggregates unavailable: ${(err as Error).message ?? err}`); + return null; + }), ]); if (!landing || !metadata) {