Implement workspace evolution, migrations, and runtime continuity
Enable evolution by default for source-backed workspaces. Add stable conformance ownership, semantic-major review, candidate typechecking, and durable fenced cutover with explicit migrations and forward recovery. Independently supervise package runtimes so unchanged resource owners keep their processes and connections across cutover. Add scoped invocation authority, resource sessions, and typed callback rebinding. Wire opaque object references through generated bindings and RPCs. Add canonical relationship sets, keyed maps, and ordered lists with scoped transactional mutations, revision checks, and inverse consistency. Support planned cascade deletion, protection, tombstones, and lifecycle foundations. Add journaled structural edits, package/function/migration scaffolding, managed repository creation, and resumable bottom-up dependency pin publication. Document lifetime boundaries, revision pinning, prototype compatibility policy, commands, and deferred work. Validate with 210 tests, user-systemd process/connection continuity, generated-package TypeScript checks, and Nix host/protocol checks. TTL handoff, physical reclamation, general multi-step migrations, and root-systemd migration isolation acceptance remain deferred.
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
import test from "node:test";
|
||||
import assert from "node:assert/strict";
|
||||
import {createMigrationContext, migrationObjectId} from "../dist/migration.js";
|
||||
test("migration context offers restricted ports and deterministic helper identities", () => {
|
||||
const input = {schemaVersion: 1, executionId: "operation:transition", exportId: "migrate", ports: [
|
||||
{name: "old", binding: "slot:name", view: "old", access: ["read"], states: [{objectId: "obj:one", value: "Alice"}]},
|
||||
{name: "new", binding: "slot:name", view: "new", access: ["write"]}, {name: "newRead", binding: "slot:name", view: "new", access: ["read"]},
|
||||
{name: "helpers", binding: "atom:helper", view: "new", access: ["create"]},
|
||||
]};
|
||||
const {context, result} = createMigrationContext(input);
|
||||
assert.equal(context.read("old", "obj:one"), "Alice");
|
||||
assert.throws(() => context.write("old", "obj:one", "Bob"), /does not grant/);
|
||||
assert.throws(() => context.read("new", "obj:one"), /does not grant/);
|
||||
context.write("new", "obj:one", "Alice");
|
||||
assert.equal(context.read("newRead", "obj:one"), "Alice");
|
||||
context.write("new", "obj:one", "Bob");
|
||||
assert.equal(context.read("newRead", "obj:one"), "Bob");
|
||||
assert.equal(context.read("old", "obj:one"), "Alice");
|
||||
const helper = context.create("helpers", "one");
|
||||
assert.equal(helper, migrationObjectId(input.executionId, "helpers", "one"));
|
||||
assert.equal(context.create("helpers", "one"), helper);
|
||||
assert.equal(result().creates.length, 1);
|
||||
assert.deepEqual(input.ports[0].states, [{objectId: "obj:one", value: "Alice"}]);
|
||||
});
|
||||
Reference in New Issue
Block a user