Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
88 commits
Select commit Hold shift + click to select a range
d426778
Record golden calibration tree outputs from the current builder
anth-volk Oct 15, 2026
6886fce
Move the calibration tree builder into a workspace package
anth-volk Oct 19, 2026
035e204
Run the calibration tree publisher from the package
anth-volk Oct 19, 2026
ed710c0
Install frontend dependencies before the deploy job's calibration checks
anth-volk Oct 19, 2026
72c3bc6
Read package imports from the TypeScript syntax tree in the boundary …
anth-volk Oct 19, 2026
1190deb
Skip lifecycle scripts in the deploy job's dependency install
anth-volk Oct 19, 2026
62cd502
Turn off Bun's automatic installs in the deploy job's calibration checks
anth-volk Oct 19, 2026
38da4f0
Import the country registry only from the calibration-tree package
anth-volk Oct 19, 2026
3fed47b
Serve a checked national pointer in the golden repair harness
anth-volk Oct 19, 2026
6e65097
Keep same-named UK areas at different geography levels apart
anth-volk Oct 19, 2026
53fa9d3
Compare UK local-area candidates with the local-area release
anth-volk Oct 19, 2026
ca4edf5
Keep overlapping golden harness scopes from undoing each other
anth-volk Oct 20, 2026
6931416
Keep same-named UK areas at different geography levels apart
anth-volk Oct 19, 2026
19699ac
Record a staging build that cannot be reconciled and keep going
anth-volk Oct 20, 2026
0820b3f
Document level-qualified geography labels
anth-volk Oct 20, 2026
6fb5ee6
Compare UK local-area candidates with the local-area release
anth-volk Oct 19, 2026
ba0bdd4
Read releases.json and build-folder names in the calibration-tree pac…
anth-volk Oct 20, 2026
810bda1
Move the comparison map's From build to the local-area build when the…
anth-volk Oct 20, 2026
965c8e0
Name the local-area release in the target-change map and target detail
anth-volk Oct 20, 2026
2e0dc12
Order local-area builds with the calibration build sort the map uses
anth-volk Oct 20, 2026
1814155
Type the comparison the staging compare route loads
anth-volk Oct 20, 2026
59b29a8
Publish calibration trees from releases.json for build-folder countries
anth-volk Oct 20, 2026
753fb5c
Document the local-area comparison and local_area_pipelines
anth-volk Oct 20, 2026
aa5408e
List build-folder releases from releases.json in the picker and Staging
anth-volk Oct 20, 2026
2bb680f
Merge #239's head 753fb5c into the releases.json readers
anth-volk Oct 20, 2026
4b68e4c
Read the UK's releases from releases.json only
anth-volk Oct 20, 2026
b307630
Record golden calibration tree outputs from the current builder
anth-volk Oct 15, 2026
cecd7cf
Move the calibration tree builder into a workspace package
anth-volk Oct 19, 2026
5933a40
Run the calibration tree publisher from the package
anth-volk Oct 19, 2026
1336d1d
Install frontend dependencies before the deploy job's calibration checks
anth-volk Oct 19, 2026
1ddb071
Read package imports from the TypeScript syntax tree in the boundary …
anth-volk Oct 19, 2026
891df5b
Skip lifecycle scripts in the deploy job's dependency install
anth-volk Oct 19, 2026
2592a42
Turn off Bun's automatic installs in the deploy job's calibration checks
anth-volk Oct 19, 2026
4f4f188
Import the country registry only from the calibration-tree package
anth-volk Oct 19, 2026
83b1247
Serve a checked national pointer in the golden repair harness
anth-volk Oct 19, 2026
c60479c
Keep overlapping golden harness scopes from undoing each other
anth-volk Oct 20, 2026
9fac288
Keep same-named UK areas at different geography levels apart
anth-volk Oct 19, 2026
d62f43e
Record a staging build that cannot be reconciled and keep going
anth-volk Oct 20, 2026
fdb77ff
Document level-qualified geography labels
anth-volk Oct 20, 2026
38a1518
Compare UK local-area candidates with the local-area release
anth-volk Oct 19, 2026
a62ae35
Move the comparison map's From build to the local-area build when the…
anth-volk Oct 20, 2026
bc3a689
Name the local-area release in the target-change map and target detail
anth-volk Oct 20, 2026
c83d73f
Order local-area builds with the calibration build sort the map uses
anth-volk Oct 20, 2026
cfe169f
Type the comparison the staging compare route loads
anth-volk Oct 20, 2026
3ca39f3
Document the local-area comparison and local_area_pipelines
anth-volk Oct 20, 2026
f0eec0e
Name tagged builds and release folders literally in the new comments
anth-volk Oct 20, 2026
f021dd4
Merge #239's head 3ca39f3 into the releases.json readers
anth-volk Oct 20, 2026
ff16c55
Keep same-named UK areas at different geography levels apart
anth-volk Oct 19, 2026
f1588d0
Record a staging build that cannot be reconciled and keep going
anth-volk Oct 20, 2026
a3b3d70
Document level-qualified geography labels
anth-volk Oct 20, 2026
4348259
Compare UK local-area candidates with the local-area release
anth-volk Oct 19, 2026
309ebdc
Move the comparison map's From build to the local-area build when the…
anth-volk Oct 20, 2026
e496e90
Name the local-area release in the target-change map and target detail
anth-volk Oct 20, 2026
79a19e8
Order local-area builds with the calibration build sort the map uses
anth-volk Oct 20, 2026
0e1604a
Type the comparison the staging compare route loads
anth-volk Oct 20, 2026
ee84664
Document the local-area comparison and local_area_pipelines
anth-volk Oct 20, 2026
2e43079
Merge the rebased #239 (now on main with #219) into the releases.json…
anth-volk Oct 20, 2026
e8bfe63
Merge main (#239's final code and #243) into the releases.json readers
anth-volk Oct 20, 2026
71bef39
Test that releases.json's current build must be a listed build, whate…
anth-volk Oct 20, 2026
e03ef2e
Look up releases.json's current build among the listed builds only
anth-volk Oct 20, 2026
708a186
Test that the Staging target-change view accepts a build in its own f…
anth-volk Oct 20, 2026
1c311ab
Accept a build folder in the Staging target-change loader
anth-volk Oct 20, 2026
b32e1f4
Test that the build-folder inventory keeps the dashboard's latest rel…
anth-volk Oct 20, 2026
53845a5
Keep the dashboard's latest release in the build-folder inventory
anth-volk Oct 20, 2026
79cd203
Test that "View on Hugging Face" opens a build folder at its commit
anth-volk Oct 20, 2026
43348c0
Open a build folder on Hugging Face at its pinned commit
anth-volk Oct 20, 2026
d0dfb1d
Document the build-folder inventory's latest release and build-folder…
anth-volk Oct 20, 2026
6f0e193
Merge main (#258 and later) into the releases.json readers
Oct 22, 2026
13564ff
Test that a build-folder entry does not stop the tagged builds being …
Oct 22, 2026
50c501f
List only tags and folders in loadPublishedCutReleases
Oct 22, 2026
9bd2471
Test that both readers refuse a releases.json over the writer's size …
Oct 22, 2026
5a53794
Refuse a releases.json over 4 MiB, as the release writer does
Oct 22, 2026
6c3a498
Merge main (#253 to #276) into the releases.json readers
anth-volk Nov 4, 2026
aac028e
Test that a build folder that cannot be read fails only its own build
anth-volk Nov 4, 2026
5c4b634
Report a build folder that cannot be read as that build's failure
anth-volk Nov 4, 2026
c0822b0
Test that the readers find releases.json instead of a registration se…
anth-volk Nov 4, 2026
ba95f64
Read releases.json wherever a repository has it, not where a setting …
anth-volk Nov 4, 2026
9cafbdb
Describe the test repositories by whether they have releases.json
anth-volk Nov 4, 2026
b26c767
Test that a stalled build folder listing times out and fails only its…
anth-volk Nov 4, 2026
640f8e9
Give the build folder listing the locator's 30-second timeout
anth-volk Nov 4, 2026
8213181
Write single-build publications through the manifest store
anth-volk Nov 4, 2026
a16ba8c
Test the single-build modes, head lookups and messages review round 1…
anth-volk Nov 4, 2026
746e2c4
Promote by name, read each layout at one commit, and say why the late…
anth-volk Nov 4, 2026
2571995
Say "a local-area Staging candidate" and describe the single-build modes
anth-volk Nov 4, 2026
7542eb8
Test that a current build whose folder can't be read is named in the …
anth-volk Nov 4, 2026
a6b9879
Name the read failure when the current build could not be reconciled
anth-volk Nov 4, 2026
d06face
Require the store's upload method, so Blob is written only through it
anth-volk Nov 4, 2026
7e9d380
Merge main into microcosm-releases-json-readers
anth-volk Nov 5, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
91 changes: 89 additions & 2 deletions docs/calibration-tree-artifacts.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,12 +140,15 @@ removed targets read only the source side that exists.
release repository update
-> POST <basePath>/api/hf-webhook
-> one GitHub workflow_dispatch per webhook delivery
-> enumerate the union of release directories and immutable repository tags
-> read releases.json at the head of main; with it, enumerate the builds it
lists; without it, the union of release directories and immutable
repository tags
-> resolve every eligible release to an exact Hugging Face commit
-> audit the existing Blob build for each release
-> skip complete builds without downloading their diagnostics
-> build and upload only missing builds or missing files
-> update latestReleaseBuildArtifactId from the country's upstream pointer
-> update latestReleaseBuildArtifactId from releases.json's current build
of its default release, or, without releases.json, the upstream pointer
```

A release directory or tag without calibration diagnostics is reported as
Expand Down Expand Up @@ -195,6 +198,90 @@ for inspection only, such as the UK dense local-area line, has no copy on
- The release picker adds every published cut beside the folders on `main` and
hides a line folder unless the dashboard's latest release still points at it.

These readers apply to a dataset repository with no `releases.json` (next
section). The UK repository stays this way until Microcosm's switch commit
writes `releases.json` and deletes its pointer files; the dashboard then reads
it from `releases.json` with no change of its own.

#### Build folders and `releases.json`

A dataset repository with a root `releases.json` publishes every build in its
own folder, never changed after publishing, and that record names every build
and each release's current build:

```text
releases.json
releases/<release>/<build>/release_manifest.json
releases/<release>/<build>/calibration_diagnostics.json
releases/<release>/<build>/...
```

`releases.json` follows microcosm-emitter's
`microcosm_emitter_interface.releases` (microcosm-emitter#24), whose release
writer is the only program that changes it. `release-record.ts` reads it with
the same rules: at most 4 MiB, exact keys, `schema_version` 1, safe release
and build names, each `current` listed and not withdrawn, and `default`
listed. (JavaScript reads a `schema_version` of `1.0` as 1, which the writer
refuses; the writer itself writes `1`.) For such a repository the dashboard
reads `releases.json` and nothing else: no tags, no `latest*.json` pointer
files and no listing of `releases/`.

Every reader finds the layout the same way, whatever the country: it asks
Hugging Face for `releases.json` (the tree publisher at the commit it
publishes, the release picker and the Staging page at the configured
revision). No country registration names the layout.

- Only Hugging Face's 404 for the file means the repository has no
`releases.json`, and then the tags and pointer files are read. A 404 whose
error code (`X-Error-Code`) is `RepoNotFound` or `RevisionNotFound`, any
other failure, and a record the writer's rules refuse are errors: the
release picker answers 502 for that country, reconciliation publishes
nothing and leaves the latest release as it was, and a local-area Staging
candidate has no comparison baseline. No reader falls back to tags or
pointer files.

- A build's release id is its folder, `<release>/<build>`. Its manifest entry
records no separate `releaseDirectory`, and readers fetch
`releases/<release>/<build>/` at the entry's commit.
- Reconciliation reads `releases.json` at the head of `main` and publishes
every listed build whose folder holds `calibration_diagnostics.json` and
whose `release_manifest.json` names the same `release` and `build` in its
top-level fields. The build is pinned to the newest commit behind its
folder's files (the commit that wrote the folder) and dated by its
`published_at`, so a build copied into its folder later keeps its
original date. A build whose folder or release manifest cannot be read is
reported as `failed`, and the other builds are still reconciled.
A build the manifest already holds is not looked up again.
- The latest release is the current build of the record's default release.
While the record names none, or that build cannot be published,
reconciliation publishes the other listed builds and fails without moving
the latest release, naming the reason.
- `--latest` and `--release <release>/<build>` publish one listed build. The
promotion check that follows compares the build with the record's current
build by name, and reads that build's folder only when they match; if the
folder cannot be read then, the build stays published and the next
reconciliation moves the latest release.
- Entries published from tags or release folders stay in the manifest and
stay readable by their ids; reconciliation no longer repairs them, and the
picker no longer lists them. The one exception is the dashboard's latest
release: until reconciliation makes the record's current build the latest
release, the latest release is still such an entry, and the picker keeps
it listed as the default dataset. The deployment's pre-promotion check
requires the latest release to be listed.
- The release picker lists every build `releases.json` names, dated by
`published_at`, with its release's role (the default release is the
default dataset; Microcosm's roles are `national` and `local_area`) and its
`withdrawn` flag. A build is selectable for comparison once its tree is
published. A withdrawn build stays listed and selectable, labelled
"Withdrawn".
- The Staging page compares a local-area candidate with the newest published
build of a `local_area` release that is not withdrawn.
- Every release id the dashboard accepts may be a build folder,
`<release>/<build>`, including the Staging target-change view's; the
"View on Hugging Face" link opens the folder at the build's pinned commit,
since a build folder has no tag.
- The timestamp migration leaves build-folder entries alone.

### Finalized staging builds

```text
Expand Down
7 changes: 6 additions & 1 deletion docs/spec-driven-countries.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,12 @@ Face commit and reads `releases/<folder>/calibration_diagnostics.json`: the
release's own folder, or its line's folder for a Microcosm cut tag (see
[the release lines note](calibration-tree-artifacts.md#microcosm-release-lines)).
The country's current release comes from `latest.json` unless the registration
names a per-line pointer in `pointer_path` (the UK: `latest-national.json`).
names another pointer file in `pointer_path`. A dataset repository with a root
`releases.json` reads neither: each build is in `releases/<release>/<build>/`,
and `releases.json` alone names the builds and the current one (see
[the build folders note](calibration-tree-artifacts.md#build-folders-and-releasesjson)).
The readers look for that file in every repository; the registration does not
name the layout.
`build_manifest.json`,
`release_manifest.json`, and `demographics.json` are optional enrichments. The
diagnostics artifact owns fit values and target metadata; the build manifest owns
Expand Down
140 changes: 139 additions & 1 deletion frontend/app/api/microcosm/releases/route.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
import { expect, test } from "bun:test";

import { emptyCalibrationTreeManifest } from "@policyengine/calibration-tree/calibration-tree-manifest";
import {
emptyCalibrationTreeManifest,
withCalibrationTreeManifestEntry,
type CalibrationTreeManifest,
} from "@policyengine/calibration-tree/calibration-tree-manifest";
import type { ReleaseEntry } from "@policyengine/calibration-tree/latest-artifact";
import { parseReleasesRecord } from "@policyengine/calibration-tree/release-record";
import { createMicrocosmReleasesHandler } from "./route";

// Synthetic Microcosm line (microcosm#823): a folder on main and its cuts.
Expand All @@ -27,8 +32,10 @@ const FOLDERS = [
release(LINE, LINE),
];

// A repository without releases.json: its folders on main and its tags.
function handler(options: { manifestFails?: boolean } = {}) {
return createMicrocosmReleasesHandler({
loadReleasesRecord: async () => null,
loadReleases: async () => FOLDERS,
loadPointerReleaseId: async () => ({
release_id: CUT,
Expand Down Expand Up @@ -78,6 +85,136 @@ test("without the dashboard manifest the inventory keeps the folder listing", as
);
});

// A repository with releases.json (microcosm-emitter#24): it lists every
// build, named by its folder.
const CURRENT_BUILD = `${LINE}/uk-frs-calibration-attempt-20261019T083323Z-6cba5d71`;
const UNPUBLISHED_BUILD = `${LINE}/uk-frs-calibration-attempt-20261020T000000Z-11111111`;
const DENSE_BUILD = "microcosm-uk-2024-25-dense/uk-local-candidate-f100-s42-20261019T000432Z-ee5c2dbe";
const RECORD = parseReleasesRecord({
schema_version: 1,
default: LINE,
releases: {
[LINE]: {
role: "national",
current: CURRENT_BUILD.split("/")[1],
builds: {
[CURRENT_BUILD.split("/")[1]]: { published_at: "2026-10-19T08:33:23+00:00", withdrawn: false },
[UNPUBLISHED_BUILD.split("/")[1]]: { published_at: "2026-10-20T00:00:00+00:00", withdrawn: false },
},
},
"microcosm-uk-2024-25-dense": {
role: "local_area",
current: DENSE_BUILD.split("/")[1],
builds: {
[DENSE_BUILD.split("/")[1]]: { published_at: "2026-10-19T00:04:32+00:00", withdrawn: false },
},
},
},
});

// The dashboard manifest holds the trees of the current and dense builds.
function publishedTrees(): CalibrationTreeManifest {
return [CURRENT_BUILD, DENSE_BUILD].reduce(
(manifest, releaseId, index) => withCalibrationTreeManifestEntry(manifest, "uk", {
buildArtifactId: String(index + 1).repeat(64),
kind: "release",
sourceId: releaseId,
label: releaseId,
releaseId,
stagingRunId: null,
hfRepo: "policyengine/populace-uk-private",
hfCommitSha: String(index + 1).repeat(40),
treeSchemaVersion: 6,
indexSha256: "e".repeat(64),
indexBytes: 10,
createdAt: null,
updatedAt: null,
}, releaseId === CURRENT_BUILD),
emptyCalibrationTreeManifest(),
);
}

function buildFolderHandler(options: { manifestFails?: boolean } = {}) {
const calls: string[] = [];
const refuse = (name: string) => async () => {
calls.push(name);
throw new Error(`${name} is not read for a repository with releases.json`);
};
return {
calls,
handle: createMicrocosmReleasesHandler({
loadReleasesRecord: async () => {
calls.push("loadReleasesRecord");
return RECORD;
},
loadReleases: refuse("loadReleases"),
loadPublishedCutReleases: refuse("loadPublishedCutReleases"),
loadPointerReleaseId: async () => ({
release_id: CURRENT_BUILD,
updated_at: "2026-10-19T08:33:23.000Z",
}),
readManifest: async () => {
if (options.manifestFails) throw new Error("Blob unavailable");
return { manifest: publishedTrees(), etag: '"manifest"' };
},
}),
};
}

test("for a repository with releases.json, the inventory is the builds it lists", async () => {
const { calls, handle } = buildFolderHandler();
const response = await handle(
new Request("https://dashboard.example/api/microcosm/releases?country=uk"),
);
expect(response.status).toBe(200);
const body = await response.json();
expect(body.default_release_id).toBe(CURRENT_BUILD);
expect(body.latest_release_id).toBe(CURRENT_BUILD);
expect(body.all_releases.map((entry: ReleaseEntry) => entry.release_id)).toEqual([
UNPUBLISHED_BUILD,
CURRENT_BUILD,
DENSE_BUILD,
]);
// Only builds with a published calibration tree can be compared.
expect(body.releases.map((entry: ReleaseEntry) => entry.release_id)).toEqual([
CURRENT_BUILD,
DENSE_BUILD,
]);
expect(body.releases[1]).toMatchObject({ dataset_role: "local_area", is_local_area: true });
// No release-folder listing, tags or pointer files.
expect(calls).toEqual(["loadReleasesRecord"]);
});

test("for a repository with releases.json, the inventory fails without the dashboard manifest", async () => {
const { handle } = buildFolderHandler({ manifestFails: true });
const response = await handle(
new Request("https://dashboard.example/api/microcosm/releases?country=uk"),
);
expect(response.status).toBe(502);
});

test("a releases.json that cannot be read or is refused fails the inventory, with no fallback to tags", async () => {
const calls: string[] = [];
const response = await createMicrocosmReleasesHandler({
loadReleasesRecord: async () => {
throw new Error("releases.json is not a readable JSON document.");
},
loadReleases: async () => {
calls.push("loadReleases");
return FOLDERS;
},
loadPublishedCutReleases: async () => {
calls.push("loadPublishedCutReleases");
return [];
},
loadPointerReleaseId: async () => ({ release_id: CUT, updated_at: null }),
readManifest: async () => ({ manifest: emptyCalibrationTreeManifest(), etag: '"manifest"' }),
})(new Request("https://dashboard.example/api/microcosm/releases?country=uk"));
expect(response.status).toBe(502);
expect((await response.json()).detail).toBe("releases.json is not a readable JSON document.");
expect(calls).toEqual([]);
});

test("the manifest reader receives the folder listing, so releases published only as a tag are listed", async () => {
const folderRelease = release("populace-us-2024-folder-20260915", "20260915");
const tagOnlyRelease = release(
Expand All @@ -86,6 +223,7 @@ test("the manifest reader receives the folder listing, so releases published onl
);
const foldersSeenByManifestReader: unknown[] = [];
const response = await createMicrocosmReleasesHandler({
loadReleasesRecord: async () => null,
loadReleases: async () => [folderRelease],
loadPointerReleaseId: async () => ({
release_id: folderRelease.release_id,
Expand Down
67 changes: 51 additions & 16 deletions frontend/app/api/microcosm/releases/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,23 @@ import { NextResponse } from "next/server";

import { requestedCountry } from "@/lib/api/request-country";
import { readCalibrationTreeManifest } from "@policyengine/calibration-tree/calibration-tree-blob";
import type { MicrocosmCountry } from "@policyengine/calibration-tree/countries";
import {
loadPointerReleaseId,
loadPublishedCutReleases,
loadReleases,
loadReleasesRecord,
mergeReleaseInventory,
recordedReleaseInventory,
scrub,
type ReleaseEntry,
} from "@policyengine/calibration-tree/latest-artifact";
import type { ReleasesRecord } from "@policyengine/calibration-tree/release-record";

export const revalidate = 60;

interface MicrocosmReleasesRouteDependencies {
loadReleasesRecord: typeof loadReleasesRecord;
loadReleases: typeof loadReleases;
loadPointerReleaseId: typeof loadPointerReleaseId;
readManifest: typeof readCalibrationTreeManifest;
Expand All @@ -21,32 +27,61 @@ interface MicrocosmReleasesRouteDependencies {

export function createMicrocosmReleasesHandler(
dependencies: MicrocosmReleasesRouteDependencies = {
loadReleasesRecord,
loadReleases,
loadPointerReleaseId,
readManifest: readCalibrationTreeManifest,
loadPublishedCutReleases,
},
) {
// A repository with releases.json lists the builds it names and nothing
// else; which of them are calibrated comes from the dashboard manifest, so
// the listing needs it.
async function recordedInventory(country: MicrocosmCountry, record: ReleasesRecord) {
const { manifest } = await dependencies.readManifest();
return recordedReleaseInventory(record, country, manifest);
}

// A repository without releases.json lists the folders on main beside its
// published tagged builds.
async function folderInventory(
country: MicrocosmCountry,
latestReleaseId: Promise<string | null>,
): Promise<ReleaseEntry[]> {
const [folders, manifest, latest] = await Promise.all([
dependencies.loadReleases(revalidate, country),
dependencies.readManifest()
.then(({ manifest }) => manifest)
.catch(() => null),
latestReleaseId,
]);
// Per-attempt tags and releases published only as a tag are named only
// by the dashboard manifest; without it the picker keeps the folder
// listing.
const cuts = manifest
? await dependencies
.loadPublishedCutReleases(revalidate, country, manifest, folders)
.catch(() => [])
: [];
return mergeReleaseInventory(folders, cuts, latest);
}

return async function GET(request: Request) {
const country = requestedCountry(new URL(request.url).searchParams);
if (country instanceof Response) return country;
try {
const [folders, pointer, manifest] = await Promise.all([
dependencies.loadReleases(revalidate, country),
dependencies.loadPointerReleaseId(revalidate, country).catch(() => ({ release_id: "", updated_at: null })),
dependencies.readManifest()
.then(({ manifest }) => manifest)
.catch(() => null),
]);
// Per-attempt tags and releases published only as a tag are named only
// by the dashboard manifest; without it the picker keeps the folder
// listing.
const cuts = manifest
? await dependencies
.loadPublishedCutReleases(revalidate, country, manifest, folders)
.catch(() => [])
: [];
const releases = mergeReleaseInventory(folders, cuts, pointer.release_id || null);
// The dashboard's latest release, from its manifest.
const pointerRead = dependencies.loadPointerReleaseId(revalidate, country)
.catch(() => ({ release_id: "", updated_at: null }));
// releases.json decides which listing applies. One that cannot be read
// or is refused fails the request: tags and pointer files are never
// read in its place.
const inventory = dependencies.loadReleasesRecord(revalidate, country).then((record) =>
record
? recordedInventory(country, record)
: folderInventory(country, pointerRead.then((read) => read.release_id || null))
);
const [pointer, releases] = await Promise.all([pointerRead, inventory]);
return NextResponse.json(
scrub({
latest_release_id: pointer.release_id,
Expand Down
Loading
Loading