An open-source, self-hosted system for apps built with web technologies.
findOrCreate finds by name; the launch is only for creating
zohayrslileh0856a8b3510f
diff --git a/source/server/core/link-manager/auth-manager/program-manager/program-manager.ts b/source/server/core/link-manager/auth-manager/program-manager/program-manager.tsindex 8784c1e..0a3883d 100644--- a/source/server/core/link-manager/auth-manager/program-manager/program-manager.ts+++ b/source/server/core/link-manager/auth-manager/program-manager/program-manager.ts@@ -1351,12 +1351,9 @@ export default class ProgramManager extends TheLink {const existing = [...this.authManager.processManager.processes.values()].find(process => process.program === program && process.name === launch.name)- if (existing && !launch.replace) {-- if (!isDeepStrictEqual(existing.launch, resolved.intent)) throw new Error(`The process "${launch.name}" already exists with a different launch`)-- return existing.identity- }+ // Finding is the request; the launch belongs to creating, the fallback, so a Process found+ // by its name is returned however it was launched. A launch that must win replaces it.+ if (existing && !launch.replace) return existing.identityconst creator = typeof parent === "string" ? this.authManager.processManager.processes.get(parent) : parentdiff --git a/tests/process-find-or-create.test.ts b/tests/process-find-or-create.test.tsindex 2d40595..2357a91 100644--- a/tests/process-find-or-create.test.ts+++ b/tests/process-find-or-create.test.ts@@ -80,15 +80,14 @@ test("process find or create contract", async () => {assert.equal(first, second)assert.equal(starts, 1)- await assert.rejects(- manager.findOrCreateProcess(program, {- name: "shared",- server: false,- client: true,- options: { alpha: "1", beta: "2" }- }),- /different launch/- )+ // Found by its name, the Process is returned however it was launched: the launch is for creating it.+ assert.equal(await manager.findOrCreateProcess(program, {+ name: "shared",+ server: false,+ client: true,+ options: { alpha: "1", beta: "2" }+ }), first)+ assert.equal(starts, 1)const omitted = fixture.resolveLaunch(program, { name: "defaults" }).intentassert.deepEqual(fixture.resolveLaunch(program, {}).options, {})diff --git a/tests/request-outcome.test.ts b/tests/request-outcome.test.tsindex 3a5d96f..e9115ae 100644--- a/tests/request-outcome.test.ts+++ b/tests/request-outcome.test.ts@@ -2,8 +2,8 @@ import { expect, test } from "vitest"import { failed } from "@libs/request-outcome"test("a refusal the System wrote reaches the one who asked, even when nothing else may", () => {- expect(failed(new Error(`The process "settings" already exists with a different launch`), false))- .toEqual({ success: false, error: "The process \"settings\" already exists with a different launch" })+ expect(failed(new Error("This program declared no client half"), false))+ .toEqual({ success: false, error: "This program declared no client half" })})test("what fails beneath the System stays hidden unless disclosure is allowed", () => {