Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
14 changes: 4 additions & 10 deletions apps/server/src/release-checks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,19 +57,13 @@ async function runCheck(
}

async function checkRuntimeArtifact(ctx: CheckContext): Promise<CheckResult> {
const webDist = path.join(ctx.serverDir, "apps/web/dist/index.html");
const platformBinary = selectPlatformBinary(ctx.serverDir);
const missing = [
...(existsSync(webDist) ? [] : [webDist]),
...(platformBinary.ok ? [] : [platformBinary.message]),
];
return {
name: "expected_runtime_artifact",
ok: missing.length === 0,
message:
missing.length === 0
? `Runtime assets present: ${webDist}, ${platformBinary.message}`
: `Missing: ${missing.join(", ")}`,
ok: platformBinary.ok,
message: platformBinary.ok
? `Platform binary present: ${platformBinary.message}`
: platformBinary.message,
};
}

Expand Down
20 changes: 3 additions & 17 deletions apps/server/test/release-checks.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,44 +46,30 @@ function setReleaseRecord(record: StoreRecord) {
}

describe("expected_runtime_artifact", () => {
it("passes when the web build and host Bun binary exist", async () => {
it("passes when the host Bun binary exists", async () => {
const bunDist = path.join(tmpServerDir, "dist/bun");
const webDist = path.join(tmpServerDir, "apps/web/dist");
await mkdir(bunDist, { recursive: true });
await mkdir(webDist, { recursive: true });
await writeFile(
path.join(bunDist, `dispatch-0.19.0-bun-${hostPlatform()}-${hostArch()}`),
"binary"
);
await writeFile(
path.join(webDist, "index.html"),
"<!doctype html><html></html>"
);

const [result] = await runRequiredChecks(["expected_runtime_artifact"], {
serverDir: tmpServerDir,
targetTag: "v0.19.0",
});

expect(result.ok).toBe(true);
expect(result.message).toMatch(/Runtime assets present/);
expect(result.message).toMatch(/Platform binary present/);
});

it("fails when an artifact is missing", async () => {
const bunDist = path.join(tmpServerDir, "dist/bun");
await mkdir(bunDist, { recursive: true });
await writeFile(
path.join(bunDist, `dispatch-0.19.0-bun-${hostPlatform()}-${hostArch()}`),
"binary"
);

it("fails when no platform binary exists", async () => {
const [result] = await runRequiredChecks(["expected_runtime_artifact"], {
serverDir: tmpServerDir,
targetTag: "v0.19.0",
});

expect(result.ok).toBe(false);
expect(result.message).toMatch(/Missing:.*apps\/web\/dist\/index\.html/);
});
});

Expand Down
2 changes: 1 addition & 1 deletion docs/10-operations-runbook.md
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ inspect → prepare → apply → restarting → validate → done

When the agent moves to `validate`, the server runs `runAndRecordChecks`, which evaluates the required checks listed in the manifests/metadata. The known check names (defined in `apps/server/src/release-metadata.ts`):

- `expected_runtime_artifact` — the platform-matching `dist/bun/dispatch-*` binary and `apps/web/dist/index.html` both exist after deploy
- `expected_runtime_artifact` — the platform-matching `dist/bun/dispatch-*` binary exists after deploy
- `service_entrypoint` — `apps/server/package.json` has a `scripts.start` entry
- `service_restarted` — `~/.dispatch/release.json` is present (lenient proxy for restart; the deeper check is `health_endpoint`)
- `version_converged` — `~/.dispatch/release.json` tag matches the target tag
Expand Down