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.

fix(view): preserve board refusal codes [A5,A6,N26]

Corey Olson07ade55c3b20
diff --git a/src/cockpit.js b/src/cockpit.js
index c9b4bdc0..1be631be 100644
--- a/src/cockpit.js
+++ b/src/cockpit.js
@@ -648,8 +648,8 @@ function renderSide() {
return '<button class="proj repo' + (on ? ' on' : '') + '"' + (on ? ' aria-current="true"' : '') + ' data-root="' + esc(x.root) + '" title="' + esc(x.root) + '" type="button"><span class="pname">' + (x.owner ? '<span class="owner">' + esc(x.owner) + '/</span>' : '') + esc(x.name) + '</span><small>' + (hosted.local && x.source ? '<span class="src">' + (x.source === 'relay' ? 'shared' : 'this computer') + '</span> · ' : '') + line + '</small></button>';
};
const readableProjects = data.projects.filter((repo) => repo.ok);
- const unreadableProjects = data.projects.filter((repo) => !repo.ok && !repo.id);
- const otherErrors = data.projects.filter((repo) => !repo.ok && repo.id).map(repoButton).join('');
+ const unreadableProjects = data.projects.filter((repo) => !repo.ok && repo.warningCode === 'BOARD_UNAVAILABLE');
+ const otherErrors = data.projects.filter((repo) => !repo.ok && repo.warningCode !== 'BOARD_UNAVAILABLE').map(repoButton).join('');
const groups = projectGroups(readableProjects);
const groupedRoots = new Set(groups.flatMap((group) => group.repos.map((repo) => repo.root)));
const grouped = groups.map((group) => {
diff --git a/src/view/page-script-3.js b/src/view/page-script-3.js
index c3aa89e5..3bfbb35a 100644
--- a/src/view/page-script-3.js
+++ b/src/view/page-script-3.js
@@ -201,7 +201,8 @@ async function boardState(root, mark, fresh = null) {
if (!data) {
// Names are already known: a slow board must not leave the project picker blank.
const projects = listed.boards.map((board) => ({ ...board, ok: true, loading: true }));
- projects.push(...(listed.warnings || []).map((warning) => ({ ...warning, ok: false, error: warning.error.error.message })));
+ projects.push(...(listed.warnings || []).map((warning) => ({ ...warning, ok: false,
+ warningCode: warning.error?.error?.code, error: warning.error?.error?.message || 'This board could not be read.' })));
data = { root: null, project: null, group: null, projects, groups: projectGroups(projects) };
renderSide();
$('project-loading').hidden = projects.length === 0;
@@ -222,7 +223,8 @@ async function boardState(root, mark, fresh = null) {
return { ...board, ok: false, error: String(error.message || error) };
}
}));
- projects.push(...(listed.warnings || []).map((warning) => ({ ...warning, ok: false, error: warning.error.error.message })));
+ projects.push(...(listed.warnings || []).map((warning) => ({ ...warning, ok: false,
+ warningCode: warning.error?.error?.code, error: warning.error?.error?.message || 'This board could not be read.' })));
const groups = projectGroups(projects);
const group = groups.find((entry) => entry.key === root);
return {
diff --git a/test/cockpit/projects.test.js b/test/cockpit/projects.test.js
index b6a7d32c..88a6a7d7 100644
--- a/test/cockpit/projects.test.js
+++ b/test/cockpit/projects.test.js
@@ -538,7 +538,8 @@ test('a machine with no board says how to start one [N26]', async () => {
const page = await openPage(view);
const style = await styleOf(view);
// Agents start boards, so the view offers no form for it.
- assert.doesNotMatch(page.html, /init-form|init-path|Start a board|<details/, 'no form to start a board');
+ assert.equal(page.run("document.querySelector('form, details, #init-form, #init-path')"), null,
+ 'the rendered page has no form or disclosure for starting a board');
assert.doesNotMatch(style, /\.start\b/);
const classes = (on) => ['loading', 'boardless'].filter((name) => on.run(`document.body.classList.contains('${name}')`));
@@ -766,6 +767,8 @@ test('a migration-refused project stays quiet beside a normal board [A5,A6,N26]'
assert.match(sidebar, /merge this code into the main checkout first, or test it against a throwaway board/,
'the quiet card tells the person the next step');
assert.doesNotMatch(sidebar, /class="small bad"|class="bad"|stack trace/);
+ assert.doesNotMatch(sidebar, /class="unreadable-projects"|data-forget-unreadable/,
+ 'a valid board refused for its schema is not classified as missing or offered for forgetting');
assert.ok(projectRows(sidebar).some(row => row.name === 'Normal board'), 'a healthy project stays beside the refusal');
assert.match(page.show('chain'), /Readable beside the refused board/, 'the healthy project still renders its actual item');
unchanged();