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 @@
|
||||
/** Execution completion, not HTTP disconnection, is the drain boundary. */
|
||||
export const createInvocationRegistry = () => {
|
||||
const entries = new Map<string, { state: string; controller: AbortController }>();
|
||||
return {
|
||||
begin(id: string) {
|
||||
if (!id || entries.has(id)) throw new Error("Invocation ID is missing or already used; invocations are never replayed implicitly");
|
||||
// Completed identities remain until process retirement. A bounded process
|
||||
// may reject new work; it must not evict and accidentally replay a call.
|
||||
if (entries.size >= 100_000) throw new Error("Invocation registry full; explicit runtime retirement required");
|
||||
const entry = { state: "running", controller: new AbortController() };
|
||||
entries.set(id, entry);
|
||||
return { signal: entry.controller.signal, finish(failed = false) { entry.state = failed ? "failed" : "completed"; } };
|
||||
},
|
||||
status(id: string) { return { invocationId: id, state: entries.get(id)?.state ?? "unknown" }; },
|
||||
cancel(id: string) {
|
||||
const entry = entries.get(id);
|
||||
if (entry && ["running", "cancellation-requested"].includes(entry.state)) {
|
||||
entry.state = "cancellation-requested";
|
||||
entry.controller.abort();
|
||||
}
|
||||
return this.status(id);
|
||||
},
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user