Skip to content

Release 0.8.35: summary.json schema 1.1 + page-bundle + webhook secret untangle - #628

Merged
neuromechanist merged 20 commits into
mainfrom
dev
May 26, 2026
Merged

neuromechanist merged 20 commits into
mainfrom
dev

Conversation

@neuromechanist

Copy link
Copy Markdown
Contributor

Summary

Dev → main release including the epic #618 perf work plus the in-flight webhook + docs fixes.

Included

Epic #618 — summary.json schema 1.1 + page-bundle (perf for ww2 dataset detail)

Merged into dev via #625 today. Three phases:

  • Phase 1 (nemarDatasets/.github#15, separate repo): emit_manifest.py bumped to schema 1.1, embeds readme.content (raw markdown, up to 256 KB) so consumers stop roundtripping raw.githubusercontent.com per page load.
  • Phase 2 (Phase 2: summary.json coverage report + backfill dispatch #623): nemar admin summary check [--fix] CLI + GET /admin/summary/coverage + POST /admin/manifest/dispatch + weekly drift cron with P1 escalation on majority-error.
  • Phase 3 (Phase 3: page-bundle endpoint for one-RTT dataset detail SSR #624): GET /<id>/page-bundle.json?v=<v> endpoint that returns landing + metadata + summary + catalog in one JSON for ww2 to collapse its 4-parallel-SSR + 2-deferred-client waterfall to 1 RTT.

Other dev work

Post-merge plan

  1. Verify worker auto-deploys to prod via deploy-backend.yml.
  2. nemar admin summary check --json against prod → expect ~130 stale (every existing version is schema 1.0).
  3. nemar admin summary check --fix --yes → dispatches ~130 repository_dispatch[generate-manifest] runs at 1.5 s throttle, ~3 min of dispatching; Actions queue drains in ~10–20 min.
  4. nemar admin summary check again → expect zero drift.
  5. Smoke /<id>/page-bundle.json?v=v1.0.0 against a known healthy on* dataset; confirm complete: true and summary.readme.content populated.
  6. Hand off to website agent: Eliminate per-pageload GitHub roundtrip for README website#63 ships its consumer change once backfill clears.

Test plan

  • Every phase reviewed via /pr-review-toolkit:review-pr with 4 parallel agents (code, tests, errors, comments); findings addressed before merge
  • Cross-phase review on the epic→dev PR (Epic: summary.json schema 1.1 + page-bundle (dataset detail perf) #625) caught two real cross-phase bugs (visibility filter, cache-bust probe) — fixed
  • 75+ unit tests passing across phases (45 generator + 13 manifest-coverage + 17 page-bundle helpers + 3 page-bundle route)
  • Backend typecheck clean
  • Full CI green on the epic→dev PR (api-test, e2e-sandbox, lint, unit-test, unit-test-all, zenodo-sandbox, publish)
  • One more /review-pr against this dev→main PR (Sonnet model per project convention)
  • Post-merge smoke + backfill steps above

Follow-ups filed

Merge strategy

Regular merge (gh pr merge --merge) per project rule Git Merge Rules — preserve the individual commit history. The auto-tag pipeline strips the -dev2 suffix on merge and tags v0.8.35, then npm-publish.yml ships, then sync-dev.yml bumps dev to 0.8.36-dev0.

nemar-bot and others added 14 commits May 23, 2026 17:35
/publish-version-doi and /llm-enrich now read X-Webhook-Token against
NEMAR_WEBHOOK_TOKEN, with a fallback to GITHUB_WEBHOOK_SECRET for the
rollout window. Updates github-app-setup.md to activate the App webhook
(missed in Phase 1) and document the two-secret model.
fix(webhooks): untangle App HMAC from dataset bearer token
* feat(admin): summary.json coverage report + backfill dispatch

Phase 2 of epic #618.

Backend:
- new service backend/src/services/manifest-coverage.ts walks
  dataset_versions, probes data.nemar.org/<id>/<v>/summary.json for
  each, and classifies as ok/stale/missing/error against the target
  schema (currently 1.1). Bounded parallelism (8) protects the
  upstream rate limit.
- new admin route GET /admin/summary/coverage returns the report.
- new admin route POST /admin/manifest/dispatch fires
  repository_dispatch[generate-manifest] for a single version with
  skip_callback=true so the worker doesn't need a seeded manifest_jobs
  row.
- triggerManifestGeneration() extended with skipCallback option.

CLI:
- new `nemar admin summary check [--fix] [--id <id>] [--only-stale]
  [--json]` walks the coverage report, prints a colored table or
  emits JSON, and with --fix dispatches generate-manifest for every
  stale or missing version (throttled 1.5s).
- new typed api helpers getSummaryCoverage + dispatchManifest.

Cron:
- .github/workflows/check-summary-drift.yml runs weekly (Mon 09:00
  UTC), opens or updates a drift issue when coverage is not clean.

Tests:
- 10 unit tests for schema-comparison + URL normalisation logic.

Closes #620 (phase 2 of #618).

* review(#623): drift cron resilience, labels, abort wiring, comments
* feat(data): page-bundle endpoint for one-RTT dataset detail SSR

Phase 3 of epic #618 / Closes #621.

New `GET /<id>/page-bundle.json?v=<v>` returns landing + enriched
metadata + summary + catalog row in one JSON response so the website
can render the dataset detail page in a single SSR fetch instead of
its current 4-parallel-SSR + 2-deferred-client waterfall.

Internals:
- backend/src/services/page-bundle.ts owns the fan-in. Each upstream is
  wrapped in Promise.allSettled and surfaces as a tagged union
  ({ok: true, data} | {ok: false, error}) so a single failure doesn't
  blank the whole bundle.
- bundle.complete drives the cache header: success path gets long
  s-maxage + SWR, partial-failure path gets no-store so a transient
  blip isn't pinned at the edge for 24h.
- Skips the latestManifest read (multi-MB) — the website renders the
  tree progressively from summary.paths per nemarOrg/website#64, so
  metadata.bids_index would be unused work here.
- pickVersion falls back to landing.latest when the requested version
  is missing or unknown rather than 404-ing the whole bundle; the
  consumer can render a 'version not found, showing latest' UI from
  the bundle's own data.

Route is registered before /:datasetId/:version so Hono doesn't treat
'page-bundle.json' as a version param. Mirrors the metadata.json
registration order.

Tests: 10 new unit tests for the pure helpers (pickVersion + settled).
Per project policy, no D1/S3 mocks for the full buildPageBundle —
end-to-end coverage is via the post-deploy smoke against a real
dataset.

* review(#624): hard-fail D1, extract isBundleComplete, enrichment_degraded
… no-store coverage, P1 cron escalation, route registration test)
Epic: summary.json schema 1.1 + page-bundle (dataset detail perf)
…c logs, page-bundle E2E

Addresses cross-component review on the dev->main PR:

- code-reviewer 85%: backend/wrangler-sccn.toml secrets comment block was
  missing NEMAR_WEBHOOK_TOKEN after #622 introduced the two-secret split.
  Fresh dev/test installs would silently miss it (prod is unaffected because
  GITHUB_WEBHOOK_SECRET is already set, but that fallback masks the gap).
- code-reviewer 82%: 2 stale 'see CLAUDE.md' refs after the AGENTS.md
  migration (wrangler-sccn.toml header, NEMAR_USER_ROLES.md operator note).
- silent-failure MEDIUM: webhooks.ts:246 and :1357 use NEMAR_WEBHOOK_TOKEN
  ?? GITHUB_WEBHOOK_SECRET. ?? only falls through on null/undefined; an
  empty string sticks and produces the same generic 'Invalid webhook token'
  401 as a real mismatch. Added structured console.error so an on-call can
  grep for the misconfiguration class.
- pr-test-analyzer severity 8: page-bundle endpoint shipping to prod with
  zero E2E happy-path coverage. Added 4 tests to data-route.test.ts: bundle
  returns all 4 components ok, Cache-Control matches the complete flag
  (defends the partial-cache-poisoning class), unknown ?v= falls back to
  landing.latest, unknown dataset 404s. Uses the existing TEST_DATASET
  pattern; no DB/AWS mocks.
@neuromechanist

Copy link
Copy Markdown
Contributor Author

Cross-component /review-pr complete (3 agents). All inline-fixable findings addressed; one deferred to a follow-up.

Fixed inline:

  • code-reviewer 85% (epic ↔ fix(webhooks): untangle App HMAC from dataset bearer token #622 deploy hygiene): backend/wrangler-sccn.toml secrets comment block was missing NEMAR_WEBHOOK_TOKEN after fix(webhooks): untangle App HMAC from dataset bearer token #622 carved it out as a distinct Worker secret. Prod is unaffected because GITHUB_WEBHOOK_SECRET is set and the ?? fallback masks the gap, but a fresh dev/test install would silently accept any token until DOI minting broke. Added with a comment cross-referencing fix(webhooks): untangle App HMAC from dataset bearer token #622.

  • code-reviewer 82% (AGENTS.md migration ↔ everything else): two stale CLAUDE.md references missed by per-phase reviews — wrangler-sccn.toml:2 and docs/disaster-recovery/NEMAR_USER_ROLES.md:233. Both updated to point at AGENTS.md.

  • silent-failure MEDIUM (fix(webhooks): untangle App HMAC from dataset bearer token #622 secret-resolution UX): webhooks.ts:246 and :1357 use c.env.NEMAR_WEBHOOK_TOKEN ?? c.env.GITHUB_WEBHOOK_SECRET. ?? only falls through on null/undefined; an empty-string secret sticks and expectedToken === "" produces the same generic "Invalid webhook token" 401 as a real mismatch. Added structured console.error so an on-call can grep for the misconfiguration class.

  • pr-test-analyzer severity 8 (epic ↔ release safety): GET /<id>/page-bundle.json was shipping to prod with zero E2E happy-path coverage. Added 4 tests in test/data-route.test.ts using the existing TEST_DATASET pattern (no mocks):

    • bundle returns all 4 components ok + enrichment_degraded: boolean
    • Cache-Control matches the complete flag — defends the partial-cache-poisoning regression class directly at the wire
    • unknown ?v= falls back to landing.latest (no 404)
    • unknown dataset 404s without leaking existence

Deferred (acknowledged + filed):

No CRITICAL or HIGH cross-component issues. The epic ↔ #622 interaction is clean (orthogonal secret namespaces; manifest callbacks use MANIFEST_CALLBACK_SECRET + HMAC, not the touched env vars). The phase-2 dispatch path's skipCallback: true + empty callback contract is unchanged by #622's secret split, and the internal assertion guard pins it.

Backend typecheck clean. CI re-run pending on this push.

Adds a glob-based scope filter to `nemar admin summary check`. Supports
wildcards (* and ?) and is anchored. Complements the existing exact
--id <id> flag.

Examples:
  nemar admin summary check --match 'on*'              # all on-prefix
  nemar admin summary check --match 'nm*' --fix --yes  # all nm-prefix
  nemar admin summary check --match 'nm00010?'         # nm000100..109
  nemar admin summary check --match '*99999'           # any *99999

Used for staged backfills (on* first, monitor, then nm*) and for
scoping any future ops without per-id loops. The cron will adopt this
once its CLI consumer wants prefix scoping.

globToRegExp is exported + unit-tested (8 cases pinning the semantics:
* matches a run including empty, ? matches exactly one, anchored, .
treated as literal, other regex metacharacters escaped, mid-string
wildcards work).
@neuromechanist

Copy link
Copy Markdown
Contributor Author

Added --match <glob> to nemar admin summary check directly on dev (cf61137). Supports */? wildcards, anchored.

Use cases:

  • nemar admin summary check --match 'on*' --fix --yes — staged backfill (on-prefix first)
  • nemar admin summary check --match 'nm*' --fix --yes — then nm-prefix
  • nemar admin summary check --match 'nm00010?' — narrow range

The exact---id flag is unchanged; --match is additive. 8 unit tests pin the glob semantics (. is literal, other regex metachars escaped, mid-string wildcards work, anchored not prefix-match).

CI re-running on this push.

@neuromechanist
neuromechanist merged commit c12b05f into main May 26, 2026
23 checks passed

This branch was previously deployed

2 inactive deployments
npm — d0052294 Deployed May 26, 2026 by neuromechanist via publish #1168
development — d0052294 Deployed May 26, 2026 by neuromechanist via deploy-dev #408
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