441 lines
17 KiB
Plaintext
441 lines
17 KiB
Plaintext
Command: git diff --word-diff=porcelain c53ea7d12 -- packages/bus/tests/reload.test.mjs
|
|
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.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.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);
|
|
~
|
|
});
|
|
~
|
|
Command: git diff --word-diff=porcelain c53ea7d12 -- packages/business/tests/business.test.mjs
|
|
diff --git a/packages/business/tests/business.test.mjs b/packages/business/tests/business.test.mjs
|
|
index b79576af8..f78789250 100644
|
|
--- a/packages/business/tests/business.test.mjs
|
|
+++ b/packages/business/tests/business.test.mjs
|
|
@@ -15,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()));
|
|
~
|
|
@@ -42,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: '[email protected]', 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/);
|
|
~
|
|
Command: git diff --word-diff=porcelain c53ea7d12 -- packages/business/tests/cli.test.mjs
|
|
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.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');
|
|
~
|
|
Command: git diff --word-diff=porcelain c53ea7d12 -- packages/business/tests/instance-settings.test.mjs
|
|
diff --git a/packages/business/tests/instance-settings.test.mjs b/packages/business/tests/instance-settings.test.mjs
|
|
index 4b4860633..54c22e0e0 100644
|
|
--- a/packages/business/tests/instance-settings.test.mjs
|
|
+++ b/packages/business/tests/instance-settings.test.mjs
|
|
@@ -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.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');
|
|
~
|
|
Command: git diff --word-diff=porcelain c53ea7d12 -- packages/business/tests/library-projects-protected.test.mjs
|
|
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.
|
|
~
|
|
Command: git diff --word-diff=porcelain c53ea7d12 -- packages/business/tests/library-seats.test.mjs
|
|
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);
|
|
~
|
|
Command: git diff --word-diff=porcelain c53ea7d12 -- packages/business/tests/resolve.test.mjs
|
|
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.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');
|
|
~
|
|
Command: git diff --word-diff=porcelain c53ea7d12 -- packages/cli/tests/case2-install.test.mjs
|
|
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;
|
|
~
|
|
Command: git diff --word-diff=porcelain c53ea7d12 -- packages/cli/tests/launcher.test.mjs
|
|
diff --git a/packages/cli/tests/launcher.test.mjs b/packages/cli/tests/launcher.test.mjs
|
|
index 9e7518ee5..eeca18eb0 100644
|
|
--- a/packages/cli/tests/launcher.test.mjs
|
|
+++ b/packages/cli/tests/launcher.test.mjs
|
|
@@ -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.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);
|
|
~
|
|
Command: git diff --word-diff=porcelain c53ea7d12 -- packages/cli/tests/thread-launch.test.mjs
|
|
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;
|
|
~
|
|
Command: git diff --word-diff=porcelain c53ea7d12 -- packages/cli/tests/trackers-boot.test.mjs
|
|
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.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)
|
|
+(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 });
|
|
~
|
|
Command: git diff --word-diff=porcelain c53ea7d12 -- packages/control-board/tests/creative-hidden.test.mjs
|
|
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 });
|
|
~
|
|
Command: git diff --word-diff=porcelain c53ea7d12 -- packages/discord/tests/library-seat.test.mjs
|
|
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);
|
|
~
|
|
}
|
|
~
|
|
|
|
~
|