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
5 changes: 4 additions & 1 deletion scripts/live-scenario-product.ts
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,10 @@ const materializeDevelopmentRepositoryUpdateSource = async (input: {

const manifestPath = join(input.repositoryRoot, ".bearing/manifest.json");
const manifest = JSON.parse(await readFile(manifestPath, "utf8")) as Record<string, unknown>;
if (manifest["packageVersion"] !== "0.1.2-dev" || manifest["runtime"] !== "development") {
if (
manifest["packageVersion"] !== runtimeManifest.packageVersion ||
manifest["runtime"] !== "development"
) {
fail("Active configuration repair did not establish the target Development Configuration.");
}
await writeFile(
Expand Down
8 changes: 4 additions & 4 deletions tests/development-version-lifecycle.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { releaseCandidateId } from "../scripts/release-candidate-lib";

const repositoryRoot = join(import.meta.dirname, "..");

test("the source repository starts the accepted 0.1.2 development line coherently", async () => {
test("the source repository keeps the accepted 0.1.2 development or final version coherent", async () => {
const [packageMetadata, packageLock, build, runtime, portal] = await Promise.all([
readFile(join(repositoryRoot, "package.json"), "utf8").then(JSON.parse),
readFile(join(repositoryRoot, "package-lock.json"), "utf8").then(JSON.parse),
Expand All @@ -17,12 +17,12 @@ test("the source repository starts the accepted 0.1.2 development line coherentl
JSON.parse,
),
]);
const version = "0.1.2-dev";
expect(packageMetadata.version).toBe(version);
const version = packageMetadata.version;
expect(["0.1.2-dev", "0.1.2"]).toContain(version);
expect(packageLock.version).toBe(version);
expect(packageLock.packages[""]?.version).toBe(version);
expect(validSemver(version)).toBe(version);
expect(prerelease(version)).toEqual(["dev"]);
expect(prerelease(version)).toEqual(version === "0.1.2-dev" ? ["dev"] : null);
expect(build.packageVersion).toBe(version);
expect(runtime.packageVersion).toBe(version);
expect(portal.packageVersion).toBe(version);
Expand Down
69 changes: 69 additions & 0 deletions tests/live-scenario-product.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
import { expect, test } from "bun:test";
import { mkdir, readFile } from "node:fs/promises";
import { join } from "node:path";
import { materializeLiveScenarioProductState } from "../scripts/live-scenario-product";
import { loadLiveScenarioRegistry } from "../scripts/live-scenario-registry";
import { installPackedProduct } from "./product-seams/installed-product";

test("Repository Update preparation follows the built package version in a Development runtime", async () => {
const sourceRoot = join(import.meta.dirname, "..");
const registry = await loadLiveScenarioRegistry(
join(sourceRoot, "validation/live-journey/registry.json"),
);
const scenario = registry.scenarios.find(({ id }) => id === "update-repository-integration");
if (scenario === undefined) throw new Error("Repository Update scenario is missing.");
const packageMetadata = JSON.parse(await readFile(join(sourceRoot, "package.json"), "utf8"));
const product = await installPackedProduct();
try {
const repositoryRoot = join(product.root, "repository");
await mkdir(repositoryRoot);
const initialized = Bun.spawnSync(["git", "init", "--quiet"], { cwd: repositoryRoot });
expect(initialized.exitCode).toBe(0);
await materializeLiveScenarioProductState({
scenario,
sourceRoot,
repositoryRoot,
productProgram: product.cliPath,
agentHome: product.homeDir,
});

const manifest = JSON.parse(
await readFile(join(repositoryRoot, ".bearing/manifest.json"), "utf8"),
);
expect(manifest).toMatchObject({
schemaVersion: 1,
packageVersion: "0.1.1",
runtime: "development",
status: "active",
});
const inspected = Bun.spawnSync(
[
"node",
join(repositoryRoot, "dist/cli.js"),
"configure",
"inspect",
"--repo",
repositoryRoot,
],
{ cwd: repositoryRoot, env: { ...process.env, HOME: product.homeDir } },
);
expect(inspected.exitCode).toBe(0);
expect(JSON.parse(inspected.stdout.toString())).toMatchObject({
lifecycle: {
state: "repository-update-required",
update: {
source: { schemaVersion: 1, packageVersion: "0.1.1" },
target: {
manifest: {
schemaVersion: 2,
packageVersion: packageMetadata.version,
runtime: "development",
},
},
},
},
});
} finally {
await product.dispose();
}
}, 30_000);
27 changes: 14 additions & 13 deletions tests/repository-configuration-product-seam.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
writeFile,
} from "node:fs/promises";
import { join } from "node:path";
import packageMetadata from "../package.json";
import { BEARING_DEVELOPMENT_POINTER, BEARING_POINTER } from "../src/agent-surface-entry";
import { renderExecutionProfile } from "../src/executor-registration";
import {
Expand Down Expand Up @@ -333,7 +334,7 @@ test("packed Repository Configuration seals one exact Fresh write set and applie
const manifest = JSON.parse(await readFile(join(root, ".bearing/manifest.json"), "utf8"));
expect(manifest).toEqual({
schemaVersion: 2,
packageVersion: "0.1.2-dev",
packageVersion: packageMetadata.version,
status: "active",
runtime: "stable",
surfaces: ["agent-skills"],
Expand Down Expand Up @@ -749,7 +750,7 @@ test("Repository target requires explicit Runtime and preserves Stable and Devel

const stableTarget = {
schemaVersion: 2,
packageVersion: "0.1.2-dev",
packageVersion: packageMetadata.version,
status: "active",
runtime: "stable",
surfaces: ["agent-skills"],
Expand Down Expand Up @@ -910,7 +911,7 @@ test("Repository target requires explicit Runtime and preserves Stable and Devel
target: {
manifest: {
schemaVersion: 2,
packageVersion: "0.1.2-dev",
packageVersion: packageMetadata.version,
status: "active",
runtime: "development",
surfaces: ["agent-skills"],
Expand Down Expand Up @@ -949,7 +950,7 @@ test("Repository target requires explicit Runtime and preserves Stable and Devel
join(developmentProduct.root, ".bearing/manifest.json"),
`${JSON.stringify({
schemaVersion: 1,
packageVersion: "0.1.2-dev",
packageVersion: packageMetadata.version,
status: "active",
runtime: "development",
surfaces: ["agent-skills"],
Expand All @@ -968,8 +969,8 @@ test("Repository target requires explicit Runtime and preserves Stable and Devel
state: "repository-update-required",
removalRequired: false,
update: {
source: { schemaVersion: 1, packageVersion: "0.1.2-dev" },
target: { manifest: { schemaVersion: 2, packageVersion: "0.1.2-dev" } },
source: { schemaVersion: 1, packageVersion: packageMetadata.version },
target: { manifest: { schemaVersion: 2, packageVersion: packageMetadata.version } },
},
},
});
Expand All @@ -978,7 +979,7 @@ test("Repository target requires explicit Runtime and preserves Stable and Devel
join(developmentProduct.root, ".bearing/manifest.json"),
`${JSON.stringify({
schemaVersion: 2,
packageVersion: "0.1.2-dev",
packageVersion: packageMetadata.version,
status: "active",
runtime: "development",
surfaces: ["agent-skills"],
Expand Down Expand Up @@ -1057,7 +1058,7 @@ test("Repository target requires explicit Runtime and preserves Stable and Devel
removalRequired: false,
update: {
source: { packageVersion: "0.1.1" },
target: { manifest: { packageVersion: "0.1.2-dev", runtime: "stable" } },
target: { manifest: { packageVersion: packageMetadata.version, runtime: "stable" } },
},
},
});
Expand Down Expand Up @@ -1095,7 +1096,7 @@ test("Repository target requires explicit Runtime and preserves Stable and Devel
removalRequired: false,
update: {
source: { packageVersion: "0.1.0" },
target: { manifest: { packageVersion: "0.1.2-dev", runtime: "stable" } },
target: { manifest: { packageVersion: packageMetadata.version, runtime: "stable" } },
},
},
});
Expand Down Expand Up @@ -1179,7 +1180,7 @@ test("active Repository Update follows the installed target contract and retries
join(root, ".bearing/manifest.json"),
`${JSON.stringify({
schemaVersion: 2,
packageVersion: "0.1.2-dev",
packageVersion: packageMetadata.version,
status: "active",
runtime: "stable",
surfaces: ["agent-skills"],
Expand Down Expand Up @@ -1244,7 +1245,7 @@ test("active Repository Update follows the installed target contract and retries
],
manifest: {
schemaVersion: 2,
packageVersion: "0.1.2-dev",
packageVersion: packageMetadata.version,
status: "active",
runtime: "stable",
surfaces: ["agent-skills"],
Expand Down Expand Up @@ -1350,7 +1351,7 @@ test("deactivated Repository Update preserves lifecycle and leaves the active re
target: {
manifest: {
schemaVersion: 2,
packageVersion: "0.1.2-dev",
packageVersion: packageMetadata.version,
status: "deactivated",
runtime: "stable",
surfaces: ["agent-skills"],
Expand Down Expand Up @@ -1616,7 +1617,7 @@ test("a blocked post-target rebuild preserves the target and reports one resumpt
await makeFreshRepository(root);
const targetManifest = {
schemaVersion: 2,
packageVersion: "0.1.2-dev",
packageVersion: packageMetadata.version,
status: "active",
runtime: "stable",
surfaces: ["agent-skills"],
Expand Down
Loading