Repository navigation
Phase 4b: upstream-status CLI, weekly section, mirror flag - #1935
Merged
neuromechanist merged 12 commits intoOct 24, 2026
Merged
neuromechanist merged 12 commits into
neuromechanist merged 12 commits into
Conversation
Walks GET /admin/upstream-status page by page and recounts from the rows. Exit 0 with stale mirrors; exit 2 for an unchecked row, a refused page, errors[] on a 200, --max-pages or a changed population; exit 1 for a failed request. Tested through the real CLI against a local server, with mutations.
Counts only (no dataset named), unknown never as zero: the section, upstream_stale and upstream_unchecked in the log line, the headline rule for a missing pass, and a gather that lists unchecked rows, batch problems and a pass that stopped early as part failures. Stale itself is not attention. import-weekly prints an upstream line. Tested on real SQLite against stand-ins for OpenNeuro and its GitHub mirror.
mirror is true for an N.0.0 of an on###### mirror with a known tag, false for anything else that is not a mirror, and null when the tag is unknown or never examined (unknown is not no). Derived at read time on GET /datasets/:id/versions and on the public landing, which exposes the flag only. Truth table, real-route test and Miniflare D1 check, with mutations.
Dated amendment: the command and its exit codes, the weekly section (counts only, stale is not attention, blindness is), the three-valued mirror flag and what each surface exposes. Docs only, not tested.
Mint the GitHub token once per pass and remember a failed mint. State the 2,000-mirror page ceiling and the recomputed subrequest worst case (about 151). Drop the dead row dedupe. Tests: the 25-probe budget across pages, a withdrawn-plus-created mirror mid-pass, exactly at the cap, past the cap, the token asked once. Mutation-checked.
The line now reads Examined N of M and gives the number actually compared with upstream. Rewords a sentence that would rot once the scheduler ships, notes the stale split depends on the 25-probe budget, and narrows the attention type. Drops a test that could not fail.
Exit 0 is not a clean fleet; import-weekly exits 2 when the pass threw and 1 when the backend predates the field; the subrequest arithmetic and the 2,000-mirror ceiling; the website shows a chip, not a tag. Docs only, not tested.
📦 Package PreviewYour package is ready to test! bun install -g nemar-cli@PR1935Version: 🤖 Updated on each push. |
neuromechanist
merged commit Oct 24, 2026
83686ca
into
feature/issue-1046-epic-upstream-freshness
14 checks passed
This branch was previously deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds the operator and reporting surfaces for the upstream staleness report (ADR 0111):
nemar admin upstream-status, a counts-only## Upstream freshnesssection in the weekly import report, and a three-valued per-version mirror flag. The CLI walks the 4a route's pages, recounts from deduped rows (a row on two pages counts once) and exits 0 for stale rows alone, 2 when anything is unchecked, a page returned 502,errors[]came back on a 200,--max-pageswas reached or the population changed, and 1 when a request failed. The weekly section names no dataset, caps the pass at 20 pages and 25 probes, and treats a missing or nullupstreamas "could not be determined", never as zero.mirrorFlagOfreturnstrue,falseornullfromsource_versionand theN.0.0version, derived at read time; it is on/datasets/:id/versionsand the public landing, and the landing carries only that flag.metadata.jsonis unchanged.Phase 4b of epic #1046 (4a is merged; 4c adds
--measure). Part of #1910, which stays open until 4c.What is in it
src/commands/admin-upstream-status.ts,src/lib/upstream-status-report.ts,src/lib/api/admin.ts: the command, the recount and the exit-code rules.backend/src/services/import-weekly-summary-sweep.ts,import-weekly-summary.ts,shared/contract/weekly-attention.ts,src/commands/import-weekly: the weekly section, the attention rule and theupstream:line.shared/source-snapshot.ts(mirrorFlagOf),backend/src/routes/datasets/manifests.ts,backend/src/services/data-router.ts: the mirror flag on the versions route and the landing.backend/test/helpers/raw-mirror-standin.ts, shared by the route and sweep tests.Test plan
bun test: 19138 pass, 242 skip, 1 fail (test/account-copy-parity.test.tswebsite parity, which compares against a stale sibling website checkout and failed the same way before this PR).bun run typecheckandbun run lintclean; the Miniflare D1 test covers the fleet summary andPUBLIC_DATASET_VERSIONS_SQL.