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.
JavaScript agentic-codingai-agentsai-governanceautonomous-agentsclaude-codeclicode-reviewcodexcoding-agentsdeveloper-toolsgit-hooksllmlocal-firstmulti-agentsoftware-factoryspec-driven-developmentverificationvibe-coding
refactor(relay): bound exclusion publishing module [H5,H17]
Corey Olson0bba33818b26
diff --git a/src/relay-excluded.js b/src/relay-excluded.jsindex 1267e6b4..5ab8e398 100644--- a/src/relay-excluded.js+++ b/src/relay-excluded.js@@ -44,3 +44,22 @@ export async function publishExcludedBoards(session, io, request) {await request(session, '/api/v1/devices/exclusions', { method: 'POST', body: publication }, io);updateRelayMachine(state => { state.exclusionsPublished = names.length ? { account: session.account, url: session.url } : null; });}++/**+ * Publish changed exclusions without retaining a person session or blocking local opt-out.+ * Link readers and transport come from the caller to keep this module independent of relay.js.+ */+export async function publishOffExclusions(state, io, { loadLink, linkFile, request }) {+ const machine = readRelayMachine();+ const candidates = state ? [state] : [];+ for (const project of listApiProjects()) {+ try { const linked = loadLink(linkFile(project.root)); if (linked) candidates.push(linked); }+ catch { /* An unrelated broken link cannot prevent local exclusion. */ }+ }+ const publisher = candidates.find(value => value.machine === machine.machine+ && value.account === machine.owner?.account && value.url === machine.owner?.url+ && /^pm_[A-Za-z0-9_-]{43}$/u.test(value.token ?? ''));+ if (!publisher) return;+ try { await publishExcludedBoards(publisher, io, request); }+ catch { io.err('Excluded locally; the relay exclusion notice could not be updated. Run pullboard relay on --all when the relay is reachable.'); }+}diff --git a/src/relay.js b/src/relay.jsindex 82ba6e07..f6f46f44 100644--- a/src/relay.js+++ b/src/relay.js@@ -1,6 +1,9 @@import { beginCommandPhase } from './command-phase.js';import { recordedMoveRefusal } from './recorded-move.js';-import { publishExcludedBoards } from './relay-excluded.js';+import {+ publishExcludedBoards,+ publishOffExclusions,+} from './relay-excluded.js';import {recoverySummary,unlinkedRelayStatus,@@ -1665,29 +1668,13 @@ export async function relayOn(root, address, io, { session, credential, quiet =});}-/** Publish this machine's changed exclusions without retaining a person session or blocking local opt-out. */-async function publishOffExclusions(state, io) {- const machine = readRelayMachine();- const candidates = state ? [state] : [];- for (const project of listApiProjects()) {- try { const linked = loadLink(linkFile(project.root)); if (linked) candidates.push(linked); }- catch { /* An unrelated broken link cannot prevent local exclusion. */ }- }- const publisher = candidates.find(value => value.machine === machine.machine- && value.account === machine.owner?.account && value.url === machine.owner?.url- && /^pm_[A-Za-z0-9_-]{43}$/u.test(value.token ?? ''));- if (!publisher) return;- try { await publishExcludedBoards(publisher, io, relayDeviceRequest); }- catch { io.err('Excluded locally; the relay exclusion notice could not be updated. Run pullboard relay on --all when the relay is reachable.'); }-}-/** Unlink locally without approval, then request a separate phone-approved remote deletion if possible. */export async function relayOff(root, io) {updateRelayMachine(machine => { const project = repoInfo(root).root; if (!machine.excluded.includes(project)) machine.excluded.push(project); });const file = linkFile(root);return locked(file, async () => {const state = loadLink(file);- if (!state) { await publishOffExclusions(null, io); return summary(root, null); }+ if (!state) { await publishOffExclusions(null, io, { loadLink, linkFile, request: relayDeviceRequest }); return summary(root, null); }let joined = [];try {const roster = await request(state, '/auth/machines?board=' + state.board, {}, io);@@ -1705,7 +1692,7 @@ export async function relayOff(root, io) {rmSync(file, { force: true });try { forgetBoardKey(state.board, state.keyStorage); }catch { /* The local opt-out is complete even when secure key storage is temporarily locked. */ }- await publishOffExclusions(state, io);+ await publishOffExclusions(state, io, { loadLink, linkFile, request: relayDeviceRequest });let requested = false;let remote;try {