Repository navigation
Phase 2: summary.json coverage report + backfill dispatch - #623
neuromechanist merged 2 commits into
Conversation
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).
|
Addressed PR review (4 agents). HIGH (silent-failure-hunter): cron Python heredoc could crash silently, skipping every downstream conditional. Now wraps parse in try/except, writes HIGH 88% (code-reviewer): 82% (code-reviewer): Severity 7 (pr-test-analyzer): added 3 tests — empty Comment fixes (comment-analyzer): moved the "Sentinel value the generator emits" docstring from Out of scope (acknowledged, not addressed): integration test of Tests: 13/13 passing (was 10). Backend typecheck clean. CI pending on this push. |
📦 Package PreviewYour package is ready to test! bun install -g nemar-cli@PR623Version: 🤖 Updated on each push. |
f9ae17d
into
feature/issue-618-epic-summary-11
…#630) * fix(admin): probe summary.json directly from S3 (not via self-Worker) Discovered on first post-deploy smoke of /admin/summary/coverage: all 130 published versions classified as kind: error, status: 522 (Cloudflare 'origin connection timed out'). Direct curl to the same data.nemar.org/<id>/<v>/summary.json URL from outside returned 200 in ~730ms. The 522 only happens when the call originates inside the Worker. Root cause: probeSummary used globalThis.fetch against data.nemar.org/<id>/<v>/summary.json, but that URL is served by the SAME Worker that hosts /admin/summary/coverage. Fanning out 8 concurrent × 130 ids triggers Worker-to-Worker subrequest behavior that 522s under load. Cross-component code-reviewer flagged this as 'option c' on PR #623 (the cleaner alternative to the cache-bust fix we shipped at the time); the bill came due on first prod run. Fix: refactor probeSummary to read S3 directly via loadSummary() — the same code path Phase 3's page-bundle service uses for its summary fan-in. Bypasses CF + the self-call entirely, so no subrequest limit and no 24h s-maxage to cache-bust around. Wiring: introduce SummaryFetcher type + defaultSummaryFetcher(env) builder, and dependency-inject the fetcher into probeSummary / buildCoverageReport. Tests stub the fetcher directly instead of swapping globalThis.fetch. Tests: 11 unit tests cover the schema classifier (ok / stale / forward-compat 1.2 / forward-compat 2.0 / missing / error / malformed JSON / empty schema_version / missing key / non-string schema / fetcher-args wire contract). Backend typecheck clean. * review(#630): hang-protection timeout, default-arg fix, ordering + totals tests
Summary
manifest-coverage.tswalksdataset_versions, probesdata.nemar.org/<id>/<v>/summary.jsonfor each, classifies asok | stale | missing | erroragainst the target schema (currently 1.1) with bounded parallelism (8 concurrent fetches).GET /admin/summary/coverage— returns the full report.POST /admin/manifest/dispatch— firesrepository_dispatch[generate-manifest]for one (dataset_id, version) withskip_callback: trueso no manifest_jobs row needs to be seeded for backfill.nemar admin summary check [--fix] [--id <id>] [--only-stale] [--json]— colored table + opt-in dispatch loop, throttled 1.5s between dispatches..github/workflows/check-summary-drift.ymlopens or updates a drift issue when coverage isn't clean.triggerManifestGeneration()extended withskipCallbackoption (additive).error(notmissing), URLvprefix normalisation.Closes #620
Phase 2 of epic #618.
Why this exists
After Phase 1 (
nemarDatasets/.github#15) shipped schema 1.1, every existing version is still at 1.0 until something re-runsgenerate-manifest. Without a coverage tracker + backfill tool we'd manually inventory ~120 versions and dispatch each by hand. This phase makes both routine and continuous.Test plan
bun test test/manifest-coverage.unit.test.ts— 10/10 passcd backend && bun run typecheck— cleanbunx tsc --noEmitat repo root — cleannemar admin summary check --jsonagainst prod (admin token)nemar admin summary check --id <one-on-dataset> --fixto backfill one stale version end-to-endworkflow_dispatchonce after deploy to confirm the issue-creation pathCompanion / next
dev, run the full backfill against all ~120 published versions, then verify drift is clean.