diff --git a/packages/bus/tests/reload.test.mjs b/packages/bus/tests/reload.test.mjs index 091b37b26..342d578d0 100644 --- a/packages/bus/tests/reload.test.mjs +++ b/packages/bus/tests/reload.test.mjs @@ -194,7 +194,7 @@ test('T14 a file whose project root differs from the boot copy is not reloaded, }); test('T14 a file whose library mapping differs from the boot copy is not reloaded, because the mirror is ensured at start', async (t) => { - const f = await setup(t, doc => { doc.projects.books = mappingEntry(); }); + const f = await setup(t, doc => { doc.roles.chief.credentials = { gitea: { ...doc.roles.coder.credentials.gitea } }; doc.projects.books = mappingEntry(); }); const doc = JSON.parse(readFileSync(f.file, 'utf8')); doc.projects.books.branch = 'other'; writeFileSync(f.file, JSON.stringify(doc, null, 2) + '\n', { mode: 0o600 }); @@ -202,7 +202,7 @@ test('T14 a file whose library mapping differs from the boot copy is not reloade assert.equal(added.restart, true); assert.equal(f.reloads.length, 0); // The same library entry reloads. - const g = await setup(t, doc => { doc.projects.books = mappingEntry(); }); + const g = await setup(t, doc => { doc.roles.chief.credentials = { gitea: { ...doc.roles.coder.credentials.gitea } }; doc.projects.books = mappingEntry(); }); assert.equal(g.ask('instances.set', { revision: g.revision(), instance: 'sec-1', op: 'add', definition: 'security-reviewer' }).restart, false); assert.equal(g.reloads.length, 1); }); diff --git a/packages/business/tests/business.test.mjs b/packages/business/tests/business.test.mjs index 9d4eda831..f78789250 100644 --- a/packages/business/tests/business.test.mjs +++ b/packages/business/tests/business.test.mjs @@ -6,6 +6,7 @@ import { join } from "node:path"; import { pathToFileURL } from "node:url"; import { BusinessError, businessFilePath, configDir, loadBusiness, validateBusinessDocument } from "../src/index.mjs"; import { THREAD_IDLE_SECONDS } from "../src/business.mjs"; +import { CREATIVE_DEFINITIONS } from "../src/vocabulary.mjs"; import { launchDoc, businessDoc, REPO, REPO_ROLES, rolesCopy, tmp, writeJson } from "./helpers.mjs"; test('C2-04: library mappings load without roots, remain frozen, and retain mapping refusals', async t => { @@ -14,6 +15,7 @@ test('C2-04: library mappings load without roots, remain frozen, and retain mapp const root = tmp(); t.after(() => rmSync(root, { recursive: true, force: true })); const doc = businessDoc(root), file = join(root, 'businesses/acme.json'); doc.projects = { books: mappingEntry(), ...doc.projects }; + doc.roles.chief.credentials = { gitea: { ...doc.roles.coder.credentials.gitea } }; const loaded = validateBusinessDocument(doc, file, { rolesDir: REPO_ROLES }); const { checkMapping } = await import('../../library/src/mapping.mjs'); assert.deepEqual(loaded.projects.books, checkMapping(mappingEntry())); @@ -41,6 +43,7 @@ test('C2-04: an otherwise valid publish grant cannot name a library repo', async const root = tmp(); t.after(() => rmSync(root, { recursive: true, force: true })); const doc = businessDoc(root); doc.projects.books = { ...mappingEntry(), remote: 'https://git.example/writer/books' }; + doc.roles.chief.credentials = { gitea: { ...doc.roles.coder.credentials.gitea } }; doc.roles.coder.identity = { name: 'Coder', email: 'coder@example.invalid', gitea: { url: 'https://git.example', user: 'acme-coder' } }; doc.roles.coder.publish = ['books']; refuses(() => validateBusinessDocument(doc, join(root, 'businesses/acme.json'), { rolesDir: REPO_ROLES }), /publish.*library/); @@ -273,28 +276,58 @@ test("the shipped example refuses as written and validates once filled in", () = assert.equal(id, 15); }); +// Row 285 (C2-08b, #1790, mos-1330): a creative definition declares gitea, so its instance names +// the reference. The store form needs no token file, and the bus reads a missing one as no token. +const CREATIVE_GITEA = Object.freeze({ gitea: Object.freeze({ store: true, rotateBy: "2099-01-01" }) }); + // Row 213 (C2-08, #1714), deviation D1: the persona vars sit on a creative instance only, and // both or neither. The var checks themselves are vars.mjs's. test("persona vars: agent layer, creative definition only, both or neither", () => { const sha = "a".repeat(64); const persona = { "persona.name": "Bean", "persona.sha256": sha }; - const business = check((d) => { d.roles.bean = { definition: "companion", vars: { ...persona } }; }); + const business = check((d) => { d.roles.bean = { definition: "companion", credentials: CREATIVE_GITEA, vars: { ...persona } }; }); assert.deepEqual({ ...business.roles.bean.vars }, persona); - assert.doesNotThrow(() => check((d) => { d.roles.bean = { definition: "ideas" }; })); + assert.doesNotThrow(() => check((d) => { d.roles.bean = { definition: "ideas", credentials: CREATIVE_GITEA }; })); refuses(() => check((d) => { d.vars["persona.name"] = "Bean"; }), /persona\.name can't be set at the business layer/); refuses(() => check((d) => { d.roles.pm.vars = { ...d.roles.pm.vars, ...persona }; }), /roles\.pm\.vars: persona vars need a creative definition \(pm isn't one\)/); refuses(() => check((d) => { d.roles.chief.vars = { ...persona }; }), /chief-of-staff isn't one/); for (const key of Object.keys(persona)) { - refuses(() => check((d) => { d.roles.bean = { definition: "research", vars: { [key]: persona[key] } }; }), + refuses(() => check((d) => { d.roles.bean = { definition: "research", credentials: CREATIVE_GITEA, vars: { [key]: persona[key] } }; }), /roles\.bean\.vars: persona\.name and persona\.sha256 are set together or not at all/); } for (const [key, value] of [["persona.name", "x".repeat(41)], ["persona.name", "Be\nan"], ["persona.name", "Be\u0007an"], ["persona.name", "Be\u2028an"], ["persona.name", "Be\u2029an"], ["persona.name", 7], ["persona.sha256", "A".repeat(64)], ["persona.sha256", sha.slice(1)], ["persona.sha256", `${sha}0`]]) { - refuses(() => check((d) => { d.roles.bean = { definition: "companion", vars: { ...persona, [key]: value } }; }), new RegExp(`variable ${key.replace(".", "\\.")}`), 2); + refuses(() => check((d) => { d.roles.bean = { definition: "companion", credentials: CREATIVE_GITEA, vars: { ...persona, [key]: value } }; }), new RegExp(`variable ${key.replace(".", "\\.")}`), 2); + } +}); + +// Row 285 (C2-08b, #1790, mos-1330): the chief and each creative definition declare gitea, so an +// instance without the reference refuses. Amendment 1 (mos-1580, sage-4060): the chief +// requires its reference only in a library business; creative definitions always require it. +test("row 285: a chief or creative instance without credentials.gitea refuses at load", async () => { + const { mappingEntry } = await import("../../library/tests/helpers.mjs"); + refuses(() => check((d) => { d.projects.books = mappingEntry(); delete d.roles.chief.credentials; }), + /chief-library-gitea-required: .*roles\.chief\.credentials/); + for (const definition of CREATIVE_DEFINITIONS) { + refuses(() => check((d) => { d.roles.bean = { definition }; }), + /roles\.bean\.credentials must reference exactly the services its role definition needs \(gitea; got none\)/); + assert.doesNotThrow(() => check((d) => { d.roles.bean = { definition, credentials: CREATIVE_GITEA }; }), definition); } }); +// Row 285 (C2-08b, brief): a creative instance may carry identity and publish, under the rules at +// business.mjs:155-166, which the grant path reads. The grant itself still refuses it (#giteaRole). +test("row 285: a creative instance with identity and publish loads", () => { + const identity = { name: "Bean", email: "bean@example.test", gitea: { url: "https://git.example", user: "acme-bean" } }; + const business = check((d) => { + d.projects.stack.remote = "https://git.example/acme/stack"; + d.roles.bean = { definition: "companion", credentials: CREATIVE_GITEA, identity, publish: ["stack"] }; + }); + assert.deepEqual({ ...business.roles.bean.identity, gitea: { ...business.roles.bean.identity.gitea } }, identity); + assert.deepEqual([...business.roles.bean.publish], ["stack"]); +}); + // Row 194 (#1692, D2.5, T17): the per-agent forbid and the retired list. test("row 194 keep, noHire and retired validate, and a file without them loads as before", () => { const plain = check(); diff --git a/packages/business/tests/cli.test.mjs b/packages/business/tests/cli.test.mjs index 3aa1d52ee..beb367f8c 100644 --- a/packages/business/tests/cli.test.mjs +++ b/packages/business/tests/cli.test.mjs @@ -11,7 +11,7 @@ const CLI = join(REPO, "packages", "business", "src", "cli.mjs"); test('C2-04: business validate and resolve skip a library before code projects and credential checks', async t => { const { mappingEntry } = await import('../../library/tests/helpers.mjs'); const { rmSync } = await import('node:fs'); - const s = setup(doc => { doc.projects = { books: mappingEntry(), ...doc.projects }; }); + const s = setup(doc => { doc.roles.chief.credentials = { gitea: { ...doc.roles.coder.credentials.gitea } }; doc.projects = { books: mappingEntry(), ...doc.projects }; }); t.after(() => rmSync(s.root, { recursive: true, force: true })); writeJson(projectFilePath(s.doc.projects.stack.root), { projectVersion: 1, id: 'stack', vars: { 'tracker.project': 3 } }); const checked = run(s, 'validate', 'acme'); diff --git a/packages/business/tests/instance-settings.test.mjs b/packages/business/tests/instance-settings.test.mjs index e85366562..54c22e0e0 100644 --- a/packages/business/tests/instance-settings.test.mjs +++ b/packages/business/tests/instance-settings.test.mjs @@ -9,7 +9,7 @@ import { mkdirSync, readdirSync, readFileSync, rmSync, statSync, writeFileSync } import { join } from "node:path"; import { instanceSettings } from "../src/instance-settings.mjs"; import { projectFilePath } from "../src/project.mjs"; -import { businessDoc, REPO, rolesCopy, systemConfig, systemFor, tmp, writeJson } from "./helpers.mjs"; +import { businessDoc, FAR_DATE, REPO, rolesCopy, systemConfig, systemFor, tmp, writeJson } from "./helpers.mjs"; const CLI = join(REPO, "packages", "business", "src", "cli.mjs"); const roots = []; @@ -22,7 +22,7 @@ const LEVELS = { pi: ["off", "minimal", "low", "medium", "high", "xhigh", "max"] test('C2-04: instance settings skip a library while checking a later code project', async () => { const { mappingEntry } = await import('../../library/tests/helpers.mjs'); - const f = fixture(doc => { doc.projects = { books: mappingEntry(), ...doc.projects }; }); + const f = fixture(doc => { doc.roles.chief.credentials = { gitea: { ...doc.roles.coder.credentials.gitea } }; doc.projects = { books: mappingEntry(), ...doc.projects }; }); writeJson(projectFilePath(f.doc.projects.stack.root), { projectVersion: 1, id: 'stack', vars: { 'tracker.project': 3 } }); const before = f.settings.read('acme'); f.settings.set('acme', { revision: before.revision, instance: 'gate-215', op: 'add', definition: 'merge-gate' }, 'jason'); @@ -286,7 +286,8 @@ test("row 213 a creative instance is the human's: add, vars and definition chang writeFileSync(join(f.root, "config", "personas", "acme", "bean.md"), text, { mode: 0o600 }); const persona = { "persona.name": "Bean", "persona.sha256": createHash("sha256").update(text).digest("hex") }; const view = f.settings.read("acme"); - assert.deepEqual(view.definitions.companion, { services: [], accepted: true }); + // Row 285 (mos-1332 item 4): the companion definition declares gitea. + assert.deepEqual(view.definitions.companion, { services: ["gitea"], accepted: true }); const add = { instance: "bean", op: "add", definition: "companion", vars: persona }; for (const actor of ["chief-of-staff.chief", "tester"]) { assert.throws(() => f.settings.set("acme", { revision: view.revision, ...add }, actor), e => e.code === "organization-creative-human-only", actor); @@ -331,8 +332,8 @@ test("row 213 a creative instance is the human's: add, vars and definition chang // every actor, the human included. The listing's endProtected is that same check for its reader. test("row 256 T1-T3, T5 the human deletes a creative instance, no other actor does, and the assistant stays", () => { const f = fixture(doc => { - doc.roles.bean = { definition: "companion" }; - doc.roles.muse = { definition: "ideas" }; + doc.roles.bean = { definition: "companion", credentials: { gitea: { store: true, rotateBy: FAR_DATE } } }; + doc.roles.muse = { definition: "ideas", credentials: { gitea: { store: true, rotateBy: FAR_DATE } } }; doc.roles.assistant = { definition: "assistant", holder: "mos" }; }); const del = (instance, actor) => () => f.settings.set("acme", { revision: f.settings.read("acme").revision, instance, op: "delete" }, actor); @@ -377,7 +378,7 @@ test("row 256 T1-T3, T5 the human deletes a creative instance, no other actor do // instance can't be kept, launch.by or an arbiter, so the check it reaches is the last-listed one. test("row 256 T4 the human's delete of the only listed instance, a creative one, is the last-listed refusal", () => { const f = fixture(doc => { - doc.roles.bean = { definition: "companion" }; + doc.roles.bean = { definition: "companion", credentials: { gitea: { store: true, rotateBy: FAR_DATE } } }; doc.launch.instances = ["bean"]; }); const bytes = readFileSync(f.file, "utf8"); diff --git a/packages/business/tests/library-projects-protected.test.mjs b/packages/business/tests/library-projects-protected.test.mjs index 51672bd7b..d4d09d94f 100644 --- a/packages/business/tests/library-projects-protected.test.mjs +++ b/packages/business/tests/library-projects-protected.test.mjs @@ -14,6 +14,7 @@ function fixture(t) { books.universes.hybrid = { kind: 'hybrid', name: 'An invented crossover', sources: ['harbor', 'second'], books: ['Hybrid Book'], playground: [], constraints: [], notes: 'Fixture only' }; doc.projects = { books, ...doc.projects }; + doc.roles.chief.credentials = { gitea: { ...doc.roles.coder.credentials.gitea } }; const dir = join(root, 'config'), file = writeJson(join(dir, 'businesses/acme.json'), doc); const writer = organizationWriter({ dir, rolesDir: rolesCopy(root) }); // Give both snapshots an existing ordinary committed receipt to preserve. diff --git a/packages/business/tests/library-seats.test.mjs b/packages/business/tests/library-seats.test.mjs index 3cd0f86cf..da76fdbc7 100644 --- a/packages/business/tests/library-seats.test.mjs +++ b/packages/business/tests/library-seats.test.mjs @@ -27,7 +27,9 @@ test("M7/M8: library seats come from library businesses, creative seats from the const { root, dir } = fixture(t); const doc = businessDoc(root, "acme"); doc.projects = { books: mappingEntry(), ...doc.projects }; + doc.roles.chief.credentials = { gitea: { ...doc.roles.coder.credentials.gitea } }; doc.roles.bean = { definition: "companion" }; + doc.roles.bean.credentials = { gitea: { ...doc.roles.coder.credentials.gitea } }; writeJson(join(dir, "businesses", "acme.json"), doc); const found = sets(dir); assert.deepEqual([...found.librarySeats].sort(), ["bean", "chief", "coder", "cto", "pm", "reviewer"]); @@ -39,6 +41,7 @@ test("M8: a business with no library project puts no seat in either set", (t) => const { root, dir } = fixture(t); const doc = businessDoc(root, "other"); doc.roles.bean = { definition: "companion" }; + doc.roles.bean.credentials = { gitea: { ...doc.roles.coder.credentials.gitea } }; writeJson(join(dir, "businesses", "other.json"), doc); const found = sets(dir); assert.equal(found.librarySeats.size, 0); diff --git a/packages/business/tests/resolve.test.mjs b/packages/business/tests/resolve.test.mjs index b1e50f349..2fa106053 100644 --- a/packages/business/tests/resolve.test.mjs +++ b/packages/business/tests/resolve.test.mjs @@ -31,7 +31,7 @@ const resolve = (s, instance) => resolveInstance({ system: s.system, business: s test('C2-04: a library first in projects does not hide a later project layer', async t => { const { mappingEntry } = await import('../../library/tests/helpers.mjs'); const { rmSync } = await import('node:fs'); - const s = setup(doc => { doc.projects = { books: mappingEntry(), ...doc.projects }; }, { vars: { 'tracker.project': 7 } }); + const s = setup(doc => { doc.roles.chief.credentials = { gitea: { ...doc.roles.coder.credentials.gitea } }; doc.projects = { books: mappingEntry(), ...doc.projects }; }, { vars: { 'tracker.project': 7 } }); t.after(() => rmSync(s.root, { recursive: true, force: true })); const result = resolve(s, 'coder'); assert.equal(result.project, 'stack'); diff --git a/packages/cli/tests/case2-install.test.mjs b/packages/cli/tests/case2-install.test.mjs index cc1142510..51b606bda 100644 --- a/packages/cli/tests/case2-install.test.mjs +++ b/packages/cli/tests/case2-install.test.mjs @@ -51,8 +51,11 @@ function world(t, { profile = "library" } = {}) { for (const r of Object.values(doc.roles)) r.vars = { ...r.vars, harness: "pi" }; if (profile === "library") { doc.projects.books = { ...mappingEntry(), user: "writer" }; + doc.roles.chief.credentials = { gitea: { ...doc.roles.coder.credentials.gitea } }; doc.roles.bean = { definition: "companion", vars: { harness: "pi" } }; + doc.roles.bean.credentials = { gitea: { ...doc.roles.coder.credentials.gitea } }; doc.roles.chet = { definition: "companion", vars: { harness: "pi" } }; + doc.roles.chet.credentials = { gitea: { ...doc.roles.coder.credentials.gitea } }; } else doc.vars["bus.tester"] = true; const input = writeJson(join(root, "input", "acme.json"), doc); const staging = join(root, "staging"); @@ -212,6 +215,7 @@ test("the factory install refuses a library project and bus.tester off, before a const x = world(t, { profile: "factory" }); const doc = JSON.parse(readFileSync(x.input, "utf8")); doc.projects.books = { ...mappingEntry(), user: "writer" }; + doc.roles.chief.credentials = { gitea: { ...doc.roles.coder.credentials.gitea } }; writeJson(x.input, doc); refused(install(x, { profile: "factory" }), /profile-library-business/); delete doc.projects.books; diff --git a/packages/cli/tests/launcher.test.mjs b/packages/cli/tests/launcher.test.mjs index baabd843e..eeca18eb0 100644 --- a/packages/cli/tests/launcher.test.mjs +++ b/packages/cli/tests/launcher.test.mjs @@ -1,4 +1,4 @@ -import { launchDoc } from "../../business/tests/helpers.mjs"; +import { FAR_DATE, launchDoc } from "../../business/tests/helpers.mjs"; // The S6 launcher inside a real bus host: real broker child, real runners // in the bwrap sandbox, the fake adapter from packages/harness standing in for the // harness. The chief of staff launches a coder through its `launch` tool (row 119: the @@ -32,7 +32,7 @@ const skip = sandboxProblem() ?? false; test('C2-04: launcher workspace clones code but never the library', { skip, timeout: 30000 }, async t => { const { mappingEntry } = await import('../../library/tests/helpers.mjs'); - const f = await setup(t, doc => { doc.projects = { books: mappingEntry(), ...doc.projects }; return doc; }); + const f = await setup(t, doc => { doc.roles.chief.credentials = { gitea: { ...doc.roles.coder.credentials.gitea } }; doc.projects = { books: mappingEntry(), ...doc.projects }; return doc; }); await f.launcher.launchPm(); const workspace = workspaceDir(f.f.dataRoot, 'acme', 'chief'); assert.equal(existsSync(join(workspace, 'stack', '.git')), true); @@ -766,7 +766,7 @@ test("row 64 a role skill that isn't enabled refuses skill-not-enabled, and one test("row 213 a creative instance's persona is read from /personas: off its digest the launch fails with the mismatch as its reason", { timeout: 30000 }, async (t) => { const text = "Warm. PERSONA-MARKER-d2\n"; const given = prepare(t, (doc) => { - doc.roles.bean = { definition: "companion", vars: { harness: "pi", model: "claude-sonnet-5-5", thinking: "high", "persona.name": "Bean", "persona.sha256": createHash("sha256").update(text).digest("hex") } }; + doc.roles.bean = { definition: "companion", credentials: { gitea: { store: true, rotateBy: FAR_DATE } }, vars: { harness: "pi", model: "claude-sonnet-5-5", thinking: "high", "persona.name": "Bean", "persona.sha256": createHash("sha256").update(text).digest("hex") } }; doc.launch.instances.push("bean"); return doc; }); diff --git a/packages/cli/tests/thread-launch.test.mjs b/packages/cli/tests/thread-launch.test.mjs index fa3adb866..3e313e49d 100644 --- a/packages/cli/tests/thread-launch.test.mjs +++ b/packages/cli/tests/thread-launch.test.mjs @@ -400,6 +400,7 @@ test("REQ-THREAD-1 REQ-LAUNCH-1 the chief can't launch the assistant outside a t test('C2-09a: fromSession refuses a creative instance outside a thread without a sandbox', { timeout: 30000 }, async t => { const prepared = prepare(t, { edit: doc => { doc.roles.bean = { ...doc.roles.assistant, definition: 'companion' }; + doc.roles.bean.credentials = { gitea: { ...doc.roles.coder.credentials.gitea } }; doc.launch.instances.push('bean'); return doc; } }); @@ -465,7 +466,9 @@ test('C2-09a: creative thread messages start distinct runs and keep each instanc const vars = { ...doc.roles.assistant.vars }; delete doc.roles.assistant; doc.roles.bean = { definition: 'companion', vars: { ...vars } }; + doc.roles.bean.credentials = { gitea: { ...doc.roles.coder.credentials.gitea } }; doc.roles.chet = { definition: 'continuity', vars: { ...vars } }; + doc.roles.chet.credentials = { gitea: { ...doc.roles.coder.credentials.gitea } }; doc.launch.instances = ['coder', 'bean', 'chet']; return doc; } }); @@ -501,6 +504,7 @@ test('C2-09a: creative thread messages start distinct runs and keep each instanc test('C2-09a: terminating one creative thread does not signal an unselected peer of the same instance', { skip, timeout: 90000 }, async t => { const prepared = prepare(t, { sonnet: 2, idle: 60, edit: doc => { doc.roles.bean = { ...doc.roles.assistant, definition: 'companion' }; + doc.roles.bean.credentials = { gitea: { ...doc.roles.coder.credentials.gitea } }; delete doc.roles.assistant; doc.launch.instances = ['coder', 'bean']; return doc; diff --git a/packages/cli/tests/trackers-boot.test.mjs b/packages/cli/tests/trackers-boot.test.mjs index 8d1a407c6..e7f50c947 100644 --- a/packages/cli/tests/trackers-boot.test.mjs +++ b/packages/cli/tests/trackers-boot.test.mjs @@ -14,7 +14,7 @@ import { fixture, tmp } from "./helpers.mjs"; test('C2-04: a library-only business with tracker.baseUrl boots without a project tracker', async t => { const { mappingEntry } = await import('../../library/tests/helpers.mjs'); - const f = fixture(tmp(t), 'acme', doc => { doc.projects = { books: mappingEntry() }; return doc; }); + const f = fixture(tmp(t), 'acme', doc => { doc.roles.chief.credentials = { gitea: { ...doc.roles.coder.credentials.gitea } }; doc.projects = { books: mappingEntry() }; return doc; }); const warnings = []; const boot = bootConfig({ system: loadSystem({ env: f.env }), businessId: 'acme', env: f.env, warn: text => warnings.push(text) }); assert.equal(boot.trackers, undefined); @@ -40,6 +40,7 @@ test("bootConfig trackers reach the S3 adapter in the real broker child, which g const f = fixture(root, "acme", (doc) => { doc.projects = { books: mappingEntry(), ...doc.projects }; + doc.roles.chief.credentials = { gitea: { ...doc.roles.coder.credentials.gitea } }; doc.vars["tracker.baseUrl"] = srv.url; doc.tracker.sync.botId = bots.sync; // The chief of staff (row 119) has no tracker bot. @@ -51,7 +52,7 @@ test("bootConfig trackers reach the S3 adapter in the real broker child, which g chmodSync(file, 0o600); }; put(f.doc.tracker.sync.credentials.vikunja.file, fake.token(bots.sync, SCOPES.sync)); - for (const r of Object.keys(f.doc.roles)) if (f.doc.roles[r].credentials) put(f.doc.roles[r].credentials.vikunja.file, fake.token(bots[r], r === "pm" ? SCOPES.pm : SCOPES.worker)); + for (const r of Object.keys(f.doc.roles)) if (f.doc.roles[r].credentials?.vikunja) put(f.doc.roles[r].credentials.vikunja.file, fake.token(bots[r], r === "pm" ? SCOPES.pm : SCOPES.worker)); writeJson(join(root, "project", ".mosaic", "project.json"), { projectVersion: 1, id: "stack", vars: { "tracker.project": project } }); mkdirSync(f.dataRoot, { recursive: true, mode: 0o700 }); diff --git a/packages/control-board/tests/creative-hidden.test.mjs b/packages/control-board/tests/creative-hidden.test.mjs index c2abd348e..12e16866e 100644 --- a/packages/control-board/tests/creative-hidden.test.mjs +++ b/packages/control-board/tests/creative-hidden.test.mjs @@ -20,7 +20,9 @@ function fixture(t) { const dir = join(root, "config"); const doc = businessDoc(root, "acme"); doc.projects = { books: mappingEntry(), ...doc.projects }; + doc.roles.chief.credentials = { gitea: { ...doc.roles.coder.credentials.gitea } }; doc.roles.bean = { definition: "companion" }; + doc.roles.bean.credentials = { gitea: { ...doc.roles.coder.credentials.gitea } }; writeJson(join(dir, "businesses", "acme.json"), doc); const threadDir = join(root, "data", "threads", "acme", "t1", "session"); mkdirSync(threadDir, { recursive: true }); diff --git a/packages/discord/tests/library-seat.test.mjs b/packages/discord/tests/library-seat.test.mjs index 315f69698..a7ac869e5 100644 --- a/packages/discord/tests/library-seat.test.mjs +++ b/packages/discord/tests/library-seat.test.mjs @@ -31,7 +31,9 @@ function setup(overrides = {}) { function business(s, { library, role = "sage", definition = "companion" }) { const doc = businessDoc(s.root, "acme"); if (library) doc.projects = { books: mappingEntry(), ...doc.projects }; + if (library) doc.roles.chief.credentials = { gitea: { ...doc.roles.coder.credentials.gitea } }; doc.roles[role] = { definition }; + doc.roles[role].credentials = { gitea: { ...doc.roles.coder.credentials.gitea } }; writeJson(join(s.root, "businesses", "acme.json"), doc); }