Skip to content

Autonomous development for real products. Governed agents build from specs you approve, follow the rules you set, and nothing merges until another agent proves it. Your decisions, judgement and taste are the bar that work must clear. Declare your vision and let agents build it.

test(relay): each linked test board has its own repository [E12,E17]

Corey Olson28a0b43d29df
diff --git a/src/cli.js b/src/cli.js
index d83617d7..58bc52b1 100644
--- a/src/cli.js
+++ b/src/cli.js
@@ -104,6 +104,7 @@ import {
configFromSource,
loadConfig,
} from './config.js';
+import { onlyNamedBoardChanged } from './relay-board-config.js';
import { displayAgentName } from './agent-names.js';
import {
doctrineHistory,
@@ -1248,7 +1249,8 @@ export function uncommittedPolicySetup(info) {
*/
export function refuseUncommittedSetup(mainRoot, config) {
const hasCommit = headCommit(mainRoot) !== null;
- const differ = differFromHead(mainRoot, setupFiles(mainRoot, config));
+ const differ = differFromHead(mainRoot, setupFiles(mainRoot, config))
+ .filter(({ path, how }) => !(path === CONFIG_FILE && how === 'changed' && onlyNamedBoardChanged(mainRoot)));
if (hasCommit && !differ.length) return;
const why = hasCommit
? `a new worktree starts from the last commit, and these differ from it here: ${differ.map(({ path, how }) => `${path} (${how})`).join(', ')}`
diff --git a/src/relay-board-config.js b/src/relay-board-config.js
index dbd10c64..aa0654ca 100644
--- a/src/relay-board-config.js
+++ b/src/relay-board-config.js
@@ -6,6 +6,7 @@ import {
writeFileSync,
} from 'node:fs';
import { join } from 'node:path';
+import { execFileSync } from 'node:child_process';
import {
CONFIG_FILE,
loadConfig,
@@ -39,3 +40,20 @@ export function writeNamedBoard(root, board) {
writeFileSync(file, isDeepStrictEqual(parsed, expected) ? edited : JSON.stringify(expected, null, 2) + '\n');
return true;
}
+
+/**
+ * Whether pullboard.json differs from HEAD only by the board id relay on wrote. A new worktree needs no commit for
+ * that: the relay link is shared by every worktree of the clone, and the person commits the id when they choose.
+ */
+export function onlyNamedBoardChanged(root) {
+ /** The config without its relay board id, so only other differences compare. */
+ const withoutBoard = (text) => {
+ const value = JSON.parse(text);
+ if (value.relay) { delete value.relay.board; if (!Object.keys(value.relay).length) delete value.relay; }
+ return value;
+ };
+ try {
+ const committed = execFileSync('git', ['show', 'HEAD:' + CONFIG_FILE], { cwd: root, encoding: 'utf8', stdio: ['ignore', 'pipe', 'ignore'] });
+ return isDeepStrictEqual(withoutBoard(committed), withoutBoard(readFileSync(join(root, CONFIG_FILE), 'utf8')));
+ } catch { return false; }
+}
diff --git a/src/relay-handover.js b/src/relay-handover.js
index 0d76cd26..bb7ea856 100644
--- a/src/relay-handover.js
+++ b/src/relay-handover.js
@@ -68,24 +68,8 @@ function sshSign(bytes) {
});
}
-/** The public SSH keys on a GitHub account, read from GitHub itself so the relay cannot add one. */
-async function githubKeys(login) {
- const base = new URL(process.env.PULLBOARD_GITHUB_API || 'https://api.github.com');
- if (base.protocol !== 'https:' && !(base.protocol === 'http:' && ['127.0.0.1', 'localhost', '[::1]'].includes(base.hostname))) {
- throw new Refused('GITHUB_UNAVAILABLE', 'PULLBOARD_GITHUB_API must be an HTTPS address, or loopback HTTP for tests');
- }
- let keys;
- try {
- const response = await fetch(new URL('users/' + encodeURIComponent(login) + '/keys', base.href.endsWith('/') ? base : base.href + '/'),
- { headers: { accept: 'application/vnd.github+json' }, redirect: 'error', signal: AbortSignal.timeout(10_000) }); // budget: one GitHub read, the same ceiling as a relay request.
- if (!response.ok) throw new Error(String(response.status));
- keys = await response.json();
- } catch { throw new Refused('GITHUB_UNAVAILABLE', `could not read ${login}'s SSH keys from GitHub; the key request waits for the next command`); }
- return (Array.isArray(keys) ? keys : []).map(entry => entry?.key).filter(key => typeof key === 'string' && /^(?:ssh-ed25519|ssh-rsa|ecdsa-sha2-nistp(?:256|384|521)|sk-ssh-ed25519@openssh\.com|sk-ecdsa-sha2-nistp256@openssh\.com) [A-Za-z0-9+/=]+$/u.test(key));
-}
-
/** Whether one of the login's GitHub SSH keys made this signature over this exact statement. */
-async function vouched(statement, signature, login) {
+async function vouched(statement, signature, login, githubKeys) {
const keys = await githubKeys(login);
if (!keys.length) return false;
return scratch(folder => {
@@ -132,8 +116,9 @@ export async function requestBoardKey(link, login, send, io) {
/**
* On a member device, answer every waiting key request for this board: wrap the key to a device key that one of the
* person's GitHub SSH keys signed, and refuse the rest by name. GitHub being unreachable leaves a request waiting.
+ * `send` is the relay transport and `githubKeys` reads a login's public SSH keys from GitHub.
*/
-export async function handOverBoardKeys(state, key, send, io) {
+export async function handOverBoardKeys(state, key, { send, githubKeys }, io) {
const path = '/api/v1/boards/' + state.board + '/key-requests';
const { requests } = await send(state, path, {}, io);
for (const entry of Array.isArray(requests) ? requests : []) {
@@ -143,7 +128,7 @@ export async function handOverBoardKeys(state, key, send, io) {
if (statement?.board !== state.board || statement.repository !== state.repository || statement.login !== entry.login || !(statement.expires > Date.now())) {
throw new Refused('RELAY_KEY_VOUCH', 'the key request names another board, repository or person; run pullboard relay on again in the clone');
}
- if (!await vouched(statement, entry.signature, entry.login)) {
+ if (!await vouched(statement, entry.signature, entry.login, githubKeys)) {
throw new Refused('RELAY_KEY_VOUCH', `no SSH key on ${entry.login}'s GitHub account signed this device key; add the key that signed it to GitHub with gh ssh-key add, then run pullboard relay on again`);
}
const wrapped = await wrapDeviceBoardKey(key, statement.publicKey, { board: state.board, device: statement.device, engine: statement.engine });
diff --git a/src/relay.js b/src/relay.js
index 373a0d69..3eb36337 100644
--- a/src/relay.js
+++ b/src/relay.js
@@ -82,11 +82,6 @@ import {
withSeatName,
} from './relay-seats.js';
import { syncApprovers } from './relay-approvers.js';
-import {
- namedBoard,
- writeNamedBoard,
-} from './relay-board-config.js';
-import { handOverBoardKeys } from './relay-handover.js';
import { ENGINE_VERSION } from './machine.js';
import {
presentationDigest,
@@ -1289,13 +1284,30 @@ export async function syncRelay(root, io) {
}, io);
}
+/** The public SSH keys on a GitHub account, read from GitHub itself so the relay cannot add one. */
+async function githubKeys(login) {
+ const base = new URL(process.env.PULLBOARD_GITHUB_API || 'https://api.github.com');
+ if (base.protocol !== 'https:' && !(base.protocol === 'http:' && ['127.0.0.1', 'localhost', '[::1]'].includes(base.hostname))) {
+ throw new Refused('GITHUB_UNAVAILABLE', 'PULLBOARD_GITHUB_API must be an HTTPS address, or loopback HTTP for tests');
+ }
+ let keys;
+ try {
+ const response = await fetch(new URL('users/' + encodeURIComponent(login) + '/keys', base.href.endsWith('/') ? base : base.href + '/'),
+ { headers: { accept: 'application/vnd.github+json' }, redirect: 'error', signal: AbortSignal.timeout(10_000) }); // budget: one GitHub read, the same ceiling as a relay request.
+ if (!response.ok) throw new Error(String(response.status));
+ keys = await response.json();
+ } catch { throw new Refused('GITHUB_UNAVAILABLE', `could not read ${login}'s SSH keys from GitHub; the key request waits for the next command`); }
+ return (Array.isArray(keys) ? keys : []).map(entry => entry?.key).filter(key => typeof key === 'string' && /^(?:ssh-ed25519|ssh-rsa|ecdsa-sha2-nistp(?:256|384|521)|sk-ssh-ed25519@openssh\.com|sk-ecdsa-sha2-nistp256@openssh\.com) [A-Za-z0-9+/=]+$/u.test(key));
+}
+
/** Commands whose event read named a new device waiting for this board's key. */
const KEY_REQUESTS_SEEN = new WeakSet();
/** Hand this board's key to member devices that asked; a failure here never fails the command that noticed [E17]. */
async function handOverKeys(state, io) {
KEY_REQUESTS_SEEN.delete(io);
- try { await handOverBoardKeys(state, readBoardKey(state.board), request, io); }
+ const { handOverBoardKeys } = await import('./relay-handover.js');
+ try { await handOverBoardKeys(state, readBoardKey(state.board), { send: request, githubKeys }, io); }
catch (error) { if (!(error instanceof Refused)) throw error; io.err(`pullboard: a new device's key request waits: ${error.message}`); }
}
@@ -1598,6 +1610,7 @@ export async function relayOn(root, address, io, { session, credential, quiet =
const repository = originRepository(root);
const file = linkFile(root);
// A clone whose pullboard.json names another board joins that board instead of linking a second one [E12].
+ const { namedBoard, writeNamedBoard } = await import('./relay-board-config.js');
const named = loadLink(file) ? null : namedBoard(repoInfo(root).root);
const relinking = relayRelink(root);
if (named && named !== localRecords(root, store.boardId) && relinking?.previous !== named && relinking?.next !== named) {
diff --git a/test/init-relay-offer.test.js b/test/init-relay-offer.test.js
index 9ac43834..d84fe3f8 100644
--- a/test/init-relay-offer.test.js
+++ b/test/init-relay-offer.test.js
@@ -90,8 +90,9 @@ function initWithoutTerminal(cwd, env) {
function freshRepository(box, name) {
const root = join(dirname(box.root), name);
mkdirSync(root);
+ box.providerState.repositories.push('repository-' + name); // its own repository: one team board per repository [E12]
for (const args of [['init', '-q', '-b', 'main'], ['config', 'user.name', 'Relay Fixture'], ['config', 'user.email', '[email protected]'], ['-c', 'commit.gpgsign=false', 'commit', '--allow-empty', '-q', '-m', 'fixture base'],
- ['remote', 'add', 'origin', '[email protected]:fixture/repository.git']]) {
+ ['remote', 'add', 'origin', `[email protected]:fixture/repository-${name}.git`]]) {
assert.equal(runFixtureChild('git', args, { cwd: root, env: box.env, encoding: 'utf8' }).status, 0);
}
return root;
diff --git a/test/relay-fixture.js b/test/relay-fixture.js
index fa17a6e4..8de79667 100644
--- a/test/relay-fixture.js
+++ b/test/relay-fixture.js
@@ -7,7 +7,7 @@ import { once } from 'node:events';
/** Start a provider with real signed JWT verification and one-use browser/device grants. */
export async function githubFixture(t) {
const { privateKey, publicKey } = generateKeyPairSync('rsa', { modulusLength: 2048 });
- const state = { access: true, permission: 'write', public: false, installed: true, repositoryID: 100, repositories: ['repository'], accountID: 7, permissionAccountID: 7, deviceAuthorized: false, deviceDeclined: false, deviceExpired: false, slow: false, redirect: null, beforeDevicePoll: null, beforeUser: null };
+ const state = { access: true, permission: 'write', public: false, installed: true, repositoryID: 100, repositories: ['repository', 'repository-2', 'repository-3'], accountID: 7, permissionAccountID: 7, deviceAuthorized: false, deviceDeclined: false, deviceExpired: false, slow: false, redirect: null, beforeDevicePoll: null, beforeUser: null };
const calls = [];
const codes = new Map();
// Each user credential remembers who signed in. state.signer picks the next person and state.people gives each
diff --git a/test/relay-http.test.js b/test/relay-http.test.js
index a2bc9fba..dacc8775 100644
--- a/test/relay-http.test.js
+++ b/test/relay-http.test.js
@@ -97,9 +97,9 @@ test('HTTP person controls expose only scoped token metadata, and agent identity
const box = await relay(t);
const signed = await browserLogin(box);
const headers = { cookie: signed.cookie, origin: box.origin, 'content-type': 'application/json' };
- for (const board of ['alpha', 'beta']) {
+ for (const [board, repository] of [['alpha', 'fixture/repository'], ['beta', 'fixture/repository-2']]) { // one team board per repository [E12]
const linked = await fetch(box.origin + '/auth/boards/link', { method: 'POST', headers,
- body: JSON.stringify({ board, repository: 'fixture/repository' }) });
+ body: JSON.stringify({ board, repository }) });
assert.equal(linked.status, 200);
}
const issued = await fetch(box.origin + '/auth/tokens', { method: 'POST', headers,
diff --git a/test/relay-machine-auth.test.js b/test/relay-machine-auth.test.js
index 337b08a7..7c1e82c4 100644
--- a/test/relay-machine-auth.test.js
+++ b/test/relay-machine-auth.test.js
@@ -29,7 +29,7 @@ test('machine credentials mint and list same-board agents but cannot link, revok
const alpha = 'a'.repeat(32);
const beta = 'b'.repeat(32);
await auth.linkBoard(person.token, alpha, 'fixture/repository');
- await auth.linkBoard(person.token, beta, 'fixture/repository');
+ await auth.linkBoard(person.token, beta, 'fixture/repository-2'); // one team board per repository [E12]
const machine = await auth.issueMachine(person.token, { board: alpha, machine: 'mac-alpha' });
assert.match(machine.token, /^pm_[A-Za-z0-9_-]{43}$/u);
@@ -80,7 +80,7 @@ test('deleted-copy receipts grant no access and keep revocation and expiry disti
const person = await signedPerson({ ...provider, advance(ms) { now += ms; } }, auth);
const alpha = 'a'.repeat(32), beta = 'b'.repeat(32);
await auth.linkBoard(person.token, alpha, 'fixture/repository');
- await auth.linkBoard(person.token, beta, 'fixture/repository');
+ await auth.linkBoard(person.token, beta, 'fixture/repository-2'); // one team board per repository [E12]
const live = await auth.issueMachine(person.token, { board: alpha, machine: 'joined-alpha' });
const revoked = await auth.issueMachine(person.token, { board: alpha, machine: 'revoked-alpha' });
const expired = await auth.issueMachine(person.token, { board: alpha, machine: 'expired-alpha', expiresIn: 1 });
diff --git a/test/relay-pages-http.test.js b/test/relay-pages-http.test.js
index 47c21e85..26d3de18 100644
--- a/test/relay-pages-http.test.js
+++ b/test/relay-pages-http.test.js
@@ -29,7 +29,7 @@ async function fixture(t, accountStorageBytes) {
const callback = new URL(redirect.headers.get('location'));
const signed = await auth.finishWeb(callback.searchParams.get('state'), callback.searchParams.get('code'), flow.binding);
await auth.linkBoard(signed.token, BOARD, 'fixture/repository');
- await auth.linkBoard(signed.token, OTHER, 'fixture/repository');
+ await auth.linkBoard(signed.token, OTHER, 'fixture/repository-2'); // one team board per repository [E12]
let handler;
let clock = Date.now();
const server = createServer((req, res) => handler(req, res));
diff --git a/test/relay-retention.test.js b/test/relay-retention.test.js
index 8b4ce3bf..5bcec984 100644
--- a/test/relay-retention.test.js
+++ b/test/relay-retention.test.js
@@ -34,7 +34,7 @@ async function fixture(t) {
const signed = await auth.finishWeb(url.searchParams.get('state'), url.searchParams.get('code'), flow.binding);
// Real auth link time uses its own wall clock; journal activity below is the controlled inactivity origin.
await auth.linkBoard(signed.token, A, 'fixture/repository');
- await auth.linkBoard(signed.token, B, 'fixture/repository');
+ await auth.linkBoard(signed.token, B, 'fixture/repository-2'); // one team board per repository [E12]
const agent = await auth.issueToken(signed.token, { board: A, agent: 'worker' });
const other = await auth.issueToken(signed.token, { board: B, agent: 'other' });
const config = { directory: data, backupsDirectory: backups, auth, now: () => clock };
@@ -155,7 +155,7 @@ test('[H18] explicit unlink removes managed backups immediately and a durable cr
assert.ok(existsSync(join(box.data, B + '.journal.sqlite')));
assert.deepEqual(box.auth.pendingCleanup(), [B]);
await assert.rejects(box.auth.authenticate(box.other.token, { board: B }), { code: 'RELAY_BOARD_DELETED' });
- await assert.rejects(box.auth.linkBoard(box.signed.token, B, 'fixture/repository'), { code: 'RELAY_CLEANUP' });
+ await assert.rejects(box.auth.linkBoard(box.signed.token, B, 'fixture/repository-2'), { code: 'RELAY_CLEANUP' });
const freshAuth = createRelayAuth({ database: join(box.root, 'auth.sqlite'), github: {} });
try {
assert.deepEqual(freshAuth.pendingCleanup(), [B], 'the intent comes from persisted auth state');
@@ -165,7 +165,7 @@ test('[H18] explicit unlink removes managed backups immediately and a durable cr
assert.deepEqual(readdirSync(box.backups), []);
assert.deepEqual(freshAuth.pendingCleanup(), []);
} finally { freshAuth.close(); }
- await box.auth.linkBoard(box.signed.token, B, 'fixture/repository');
+ await box.auth.linkBoard(box.signed.token, B, 'fixture/repository-2');
});
test('[H18] SQLite backups contain current compacted state, stay private, and prune only after fourteen days', async (t) => {
@@ -231,7 +231,7 @@ test('[H18] maintenance is daily, retries storage failures, and refuses symlink
test('[H18] a never-uploaded link expires from its original link time without manufacturing a journal', async (t) => {
const box = await fixture(t);
const C = 'c'.repeat(32);
- await box.auth.linkBoard(box.signed.token, C, 'fixture/repository');
+ await box.auth.linkBoard(box.signed.token, C, 'fixture/repository-3');
const linked = box.auth.linkedBoards().find((row) => row.id === C).linkedAt;
box.set(linked + 60 * DAY);
assert.equal(box.retention.notice(C).inactiveDays, 60);
diff --git a/test/relay-sealed.test.js b/test/relay-sealed.test.js
index c47eb0ec..b9ed387d 100644
--- a/test/relay-sealed.test.js
+++ b/test/relay-sealed.test.js
@@ -1321,7 +1321,7 @@ test('[A4,H7] snapshots compact covered moves, preserve the tail and deletion re
const next = await box.call(box.path + '/moves', { method: 'POST', body: { sequence: 4, sealed: box.clientSeal({ move: 4 }, 'move', 4) } });
assert.equal(next.body.event.event_id, 4);
const other = 'f'.repeat(32) === box.id ? 'e'.repeat(32) : 'f'.repeat(32);
- await box.auth.linkBoard(box.person.token, other, 'fixture/repository');
+ await box.auth.linkBoard(box.person.token, other, 'fixture/repository-2'); // one team board per repository [E12]
const otherPath = '/api/v1/boards/' + other;
assert.equal((await box.call(otherPath + '/state', { method: 'PUT', token: box.person.token, body: { sequence: 0, sealed: box.clientSeal({ other: true }, 'snapshot', 0, other) } })).status, 200);
assert.equal((await box.call(box.path, { method: 'DELETE', token: box.person.token })).status, 200);
diff --git a/test/relay-setup-once.test.js b/test/relay-setup-once.test.js
index 37787145..60bb2157 100644
--- a/test/relay-setup-once.test.js
+++ b/test/relay-setup-once.test.js
@@ -69,8 +69,9 @@ function assertSetupSucceeded(result, calls, origin) {
async function project(box, name) {
const root = join(dirname(box.root), name);
mkdirSync(root);
+ box.providerState.repositories.push('repository-' + name); // its own repository: one team board per repository [E12]
for (const args of [['init', '-q', '-b', 'main'], ['-c', 'commit.gpgsign=false', 'commit', '--allow-empty', '-q', '-m', 'fixture base'],
- ['remote', 'add', 'origin', '[email protected]:fixture/repository.git']]) {
+ ['remote', 'add', 'origin', `[email protected]:fixture/repository-${name}.git`]]) {
assert.equal(spawnSync('git', args, { cwd: root, env: box.env }).status, 0);
}
const initialized = await command(root, box.env, ['init']).done;
@@ -294,7 +295,7 @@ test('set up once links three registered boards, later registration and a persis
const fourthBoard = linkProposal.context.board;
assert.equal(existsSync(join(fourth, '.git/pullboard/relay.json')), false, 'registration does not grant itself a board credential');
assert.equal(linkProposal.context.action, 'link');
- assert.equal(linkProposal.context.target, 'fixture/repository');
+ assert.equal(linkProposal.context.target, 'fixture/repository-fourth-project');
assert.ok(linkProposal.context.expires > Date.now(), 'the proposal carries a visible future expiry');
assert.equal(typeof linkProposal.sealed, 'string', 'the queued link intent is sealed for the paired phone');
assert.equal(linkProposal.published, true);
@@ -462,7 +463,7 @@ test('set up once keeps completed links on interruption and names partial failur
assert.equal(JSON.parse(readFileSync(file, 'utf8')).pending, null, 'interruption leaves no half device enrollment');
assert.equal(JSON.parse(readFileSync(file, 'utf8')).devices.length, 0);
const retained = link(box.root).board;
- assert.equal(spawnSync('git', ['remote', 'set-url', 'origin', '[email protected]:fixture/repository.git'], { cwd: bad, env: box.env }).status, 0);
+ assert.equal(spawnSync('git', ['remote', 'set-url', 'origin', '[email protected]:fixture/repository-invalid-origin-project.git'], { cwd: bad, env: box.env }).status, 0);
const before = box.calls.length;
const retry = command(box.root, box.env, ['relay', 'on', '--all']);
t.after(async () => { if (retry.child.exitCode === null) retry.child.kill('SIGTERM'); await retry.done.catch(() => {}); });
diff --git a/test/relay-setup.test.js b/test/relay-setup.test.js
index d6f319fe..85e2e494 100644
--- a/test/relay-setup.test.js
+++ b/test/relay-setup.test.js
@@ -36,7 +36,7 @@ const expectedLinked = mode === 'excluded' ? 1 : 2;
const other = join(dirname(root), 'second-view-board');
mkdirSync(other);
for (const args of [['init','-q','-b','main'], ['-c','commit.gpgsign=false','commit','--allow-empty','-q','-m','chore: private view board'],
- ['remote','add','origin','[email protected]:fixture/repository.git']]) runFixtureGit(args, {cwd:other,env:process.env});
+ ['remote','add','origin','[email protected]:fixture/repository-2.git']]) runFixtureGit(args, {cwd:other,env:process.env});
const quiet = {cwd:other,stdin:process.stdin,stdout:{isTTY:false,write(){}},stderr:{write(){}}};
assert.equal(await main(['init','--json'], quiet), 0, 'the second board is registered through the production CLI');
const links = [root,other].map(repo => join(repo,'.git','pullboard','relay.json'));
@@ -452,7 +452,7 @@ globalThis.fetch = async (input, options) => {
const other = join(dirname(root), 'waiting-board');
mkdirSync(other);
for (const args of [['init','-q','-b','main'], ['-c','commit.gpgsign=false','commit','--allow-empty','-q','-m','chore: waiting board'],
- ['remote','add','origin','[email protected]:fixture/repository.git']]) runFixtureGit(args, { cwd: other, env: process.env });
+ ['remote','add','origin','[email protected]:fixture/repository-2.git']]) runFixtureGit(args, { cwd: other, env: process.env });
let errors = '';
const streams = { cwd: other, stdin: process.stdin, stdout: { isTTY: false, write() {} }, stderr: { write: part => { errors += part; } } };
const codes = [];
@@ -490,7 +490,7 @@ test('relay on --all says who signed in, what it linked and what it waits for [H
const second = join(dirname(box.root), 'second-board');
mkdirSync(second);
for (const args of [['init', '-q', '-b', 'main'], ['-c', 'commit.gpgsign=false', 'commit', '--allow-empty', '-q', '-m', 'fixture base'],
- ['remote', 'add', 'origin', '[email protected]:fixture/repository.git']]) {
+ ['remote', 'add', 'origin', '[email protected]:fixture/repository-2.git']]) {
assert.equal(runFixtureChild('git', args, { cwd: second, env: box.env }).status, 0);
}
assert.equal(runFixtureChild(process.execPath, [resolve(import.meta.dirname, '../bin/pullboard.js'), 'init', '--json'], { cwd: second, env: box.env }).status, 0,
diff --git a/test/relay-storage-quota.test.js b/test/relay-storage-quota.test.js
index 03787d5a..3e21d545 100644
--- a/test/relay-storage-quota.test.js
+++ b/test/relay-storage-quota.test.js
@@ -40,7 +40,7 @@ async function fixture(t, limitBytes = 300) {
const auth = createRelayAuth({ database, github: createGitHubClient(provider.config) });
const signed = await signIn(auth);
await auth.linkBoard(signed.token, A, 'fixture/repository');
- await auth.linkBoard(signed.token, B, 'fixture/repository');
+ await auth.linkBoard(signed.token, B, 'fixture/repository-2'); // one team board per repository [E12]
const principal = { kind: 'machine', userId: signed.user.id, machine: 'fixture-native' };
const quota = createStorageQuota({ directory, auth, limitBytes });
const opened = [];
@@ -140,7 +140,7 @@ test('an existing storage account is stable across a second authorized link and
box.provider.state.accountID = 8; box.provider.state.permissionAccountID = 8;
const other = await signIn(box.auth);
await box.auth.linkBoard(other.token, A, 'fixture/repository');
- await box.auth.linkBoard(other.token, C, 'fixture/repository');
+ await box.auth.linkBoard(other.token, C, 'fixture/repository-3');
assert.equal(box.auth.storageAccount(A, other.user.id).id, box.signed.user.id);
assert.equal(box.auth.storageAccount(C).id, other.user.id);
assert.deepEqual(box.auth.storageBoards(box.signed.user.id), [A, B]);
diff --git a/test/relay-studio-fixture.js b/test/relay-studio-fixture.js
index 5fbda0ff..f0b47ddb 100644
--- a/test/relay-studio-fixture.js
+++ b/test/relay-studio-fixture.js
@@ -41,8 +41,9 @@ export function studioCommand(box, cwd, args) {
export async function studioProject(box, name) {
const root = join(dirname(box.root), name);
mkdirSync(root);
+ box.providerState.repositories.push('repository-' + name); // its own repository: one team board per repository [E12]
for (const args of [['init', '-q', '-b', 'main'], ['-c', 'commit.gpgsign=false', 'commit', '--allow-empty', '-q', '-m', 'fixture base'],
- ['remote', 'add', 'origin', '[email protected]:fixture/repository.git']]) {
+ ['remote', 'add', 'origin', `[email protected]:fixture/repository-${name}.git`]]) {
assert.equal(runFixtureChild('git', args, { cwd: root, env: box.env }).status, 0);
}
assert.equal((await studioCommand(box, root, ['init']).done).code, 0, 'pullboard init registers ' + name + ' on studio');
diff --git a/test/relay-version.test.js b/test/relay-version.test.js
index 2382296b..bdb46304 100644
--- a/test/relay-version.test.js
+++ b/test/relay-version.test.js
@@ -24,7 +24,7 @@ test('relay enforces the minimum engine ever required by each board [H16,H3]', a
const callback = new URL(grant.headers.get('location'));
const person = await auth.finishWeb(callback.searchParams.get('state'), callback.searchParams.get('code'), flow.binding);
await auth.linkBoard(person.token, A, 'fixture/repository');
- await auth.linkBoard(person.token, B, 'fixture/repository');
+ await auth.linkBoard(person.token, B, 'fixture/repository-2'); // one team board per repository [E12]
const historical = await auth.issueToken(person.token, { board: B, agent: 'once-issued', expiresIn: 1 });
await auth.revoke(person.token, historical.id);
time += 10;
diff --git a/test/relay.test.js b/test/relay.test.js
index 65a8e3f0..7c4099b6 100644
--- a/test/relay.test.js
+++ b/test/relay.test.js
@@ -217,7 +217,7 @@ async function registerSecondProject(box) {
const root = join(dirname(box.root), 'cancel-second-project');
mkdirSync(root);
for (const args of [['init', '-q', '-b', 'main'], ['-c', 'commit.gpgsign=false', 'commit', '--allow-empty', '-q', '-m', 'fixture base'],
- ['remote', 'add', 'origin', '[email protected]:fixture/repository.git']]) {
+ ['remote', 'add', 'origin', '[email protected]:fixture/repository-2.git']]) { // one team board per repository [E12]
assert.equal(spawnSync('git', args, { cwd: root, env: box.env, encoding: 'utf8', timeout: 15_000 }).status, 0);
}
assert.equal((await box.cliAt(root, 'init')).code, 0, 'the second fixture project is registered on this machine');
@@ -704,7 +704,7 @@ test('unreadable links are refused; agent tokens belong to exactly one board [H8
assert.deepEqual(await box.auth.boardsFor(signed.token), []);
box.state.access = true;
await box.auth.linkBoard(signed.token, 'alpha', 'fixture/repository');
- await box.auth.linkBoard(signed.token, 'beta', 'fixture/repository');
+ await box.auth.linkBoard(signed.token, 'beta', 'fixture/repository-2'); // one team board per repository [E12]
const agent = await box.auth.issueToken(signed.token, { board: 'alpha', agent: 'worker-1' });
assert.equal((await box.auth.authenticate(agent.token, { board: 'alpha', write: true })).agent, 'worker-1');
const before = box.calls.length;
@@ -735,7 +735,7 @@ test('person token management lists only owned scoped metadata and preserves ind
const box = await fixture(t);
const person = await login(box);
await box.auth.linkBoard(person.token, 'alpha', 'fixture/repository');
- await box.auth.linkBoard(person.token, 'beta', 'fixture/repository');
+ await box.auth.linkBoard(person.token, 'beta', 'fixture/repository-2'); // one team board per repository [E12]
const first = await box.auth.issueToken(person.token, { board: 'alpha', agent: 'worker-one' });
const second = await box.auth.issueToken(person.token, { board: 'alpha', agent: 'worker-two' });
const other = await box.auth.issueToken(person.token, { board: 'beta', agent: 'worker-one' });