From 6f5b5265b6973cdcde65c3ce6bd8acbaeb562318 Mon Sep 17 00:00:00 2001 From: Quixos Development Agent 01f26965-84fa-4a79-8069-725682c13065 <01f26965-84fa-4a79-8069-725682c13065@agents.gitea.internal.quixos.org> Date: Sat, 31 Oct 2026 14:15:18 +0000 Subject: [PATCH] Exercise alias pin discovery and refresh in always-run Nix fixtures (#713) --- test/pin-upgrades.test.ts | 34 +++++++++++++--------------------- 1 file changed, 13 insertions(+), 21 deletions(-) diff --git a/test/pin-upgrades.test.ts b/test/pin-upgrades.test.ts index 0970491..ef90479 100644 --- a/test/pin-upgrades.test.ts +++ b/test/pin-upgrades.test.ts @@ -156,26 +156,6 @@ test( ); assert.equal(graph.resources[0].directory, "resources/Named"); assert.equal(graph.directResources[0].directory, "resources/Named"); - const alias = `${workbench}-guest-alias`; - await fs.symlink(workbench, alias); - context.after(() => fs.unlink(alias)); - const graphFile = path.join(workbench, ".quixos/resource-graph.json"); - await fs.writeFile( - graphFile, - JSON.stringify({ - ...graph, - resources: graph.resources.map((entry: { directory: string }) => ({ - ...entry, - directory: path.join(alias, entry.directory), - })), - }), - ); - assert.equal((await discoverUpgradeSpec(alias)).nodes[1]!.directory, "resources/Named"); - const aliasPlan = await planPinUpgrades(alias, { ...(await discoverUpgradeSpec(alias)), bootstrap: true }); - await applyPinUpgrades(aliasPlan); - const refreshed = JSON.parse(await fs.readFile(graphFile, "utf8")); - assert.equal(refreshed.resources[0].directory, "resources/Named"); - assert.equal(refreshed.directResources[0].directory, "resources/Named"); // A retained workbench can move without keeping its original absolute path // alive. Recovery journals remain bound to their original writer/root. const relocated = `${workbench}-relocated`; @@ -196,6 +176,9 @@ for (const dependencyKind of ["interface", "build"] as const) test(`${dependencyKind} pin upgrades publish children before parent locks and resume without republishing completed nodes`, async (context) => { const workbench = await fs.mkdtemp(path.join(os.tmpdir(), "qx-upgrade-test-")); context.after(() => fs.rm(workbench, { recursive: true, force: true })); + const alias = `${workbench}-guest-alias`; + await fs.symlink(workbench, alias); + context.after(() => fs.unlink(alias)); const from = "a".repeat(40), to = "b".repeat(40), framework = "c".repeat(40); @@ -264,7 +247,15 @@ for (const dependencyKind of ["interface", "build"] as const) await fs.mkdir(path.join(workbench, ".quixos"), { recursive: true }); await fs.writeFile( path.join(workbench, ".quixos/resource-graph.json"), - JSON.stringify({ resources: [{ ...sources[1], source: { resolver: "git", ...sources[1].source } }] }), + JSON.stringify({ + resources: [ + { + ...sources[1], + directory: path.join(alias, sources[1].directory), + source: { resolver: "git", ...sources[1].source }, + }, + ], + }), ); assert.deepEqual( plan.nodes.map((node) => node.directory), @@ -295,6 +286,7 @@ for (const dependencyKind of ["interface", "build"] as const) assert.deepEqual(published, ["resources/Named", "root"]); const graph = JSON.parse(await fs.readFile(path.join(workbench, ".quixos/resource-graph.json"), "utf8")); assert.equal(graph.resources.length, 1); + assert.equal(graph.resources[0].directory, "resources/Named"); assert.equal(graph.resources[0].source.commit, to); const next = await planPinUpgrades(workbench, { nodes: [sources[0], { ...sources[1], source: graph.resources[0].source }],