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
fix(view): no tabs or panes before the first board arrives [N26]
Corey Olson71170db765c9
diff --git a/src/cockpit.js b/src/cockpit.jsindex 43cba263..2c5c3969 100644--- a/src/cockpit.js+++ b/src/cockpit.js@@ -106,7 +106,7 @@ main { padding: 16px 18px 28px; }.first p { margin: 0; color: var(--ink-muted); }.first code { font: 600 13px var(--mono); color: var(--ink); }.boardless .first { display: block; }-.boardless .top, .boardless [data-pane] { display: none; }+.loading .top, .loading [data-pane], .boardless .top, .boardless [data-pane] { display: none; }.two { display: grid; grid-template-columns: minmax(0, 1fr) clamp(300px, 42%, 600px); gap: 16px; align-items: start; }.two.narrow { grid-template-columns: minmax(0, 1fr) var(--agents-w); }@media (max-width: 900px) {@@ -264,7 +264,7 @@ input, select, textarea { border: 1px solid var(--line-strong); background: var(.console.ok { border-color: var(--accent); } .console.no { border-color: var(--reject); }</style></head>-<body>+<body class="loading"><div class="shell"><aside class="side" id="side" aria-label="Projects"><div class="side-top">@@ -596,7 +596,9 @@ function renderSide() {function render() {const p = data.project;renderSide();- // With no board to show, one message says how a board starts, in place of empty panes.+ // Until the first board arrives the page shows no tabs or panes, so a machine with none never+ // flashes them; with no board to show, one message says how a board starts, in their place.+ document.body.classList.remove('loading');document.body.classList.toggle('boardless', !p);$('products').hidden = !p || !p.products.length;if (!p) return;@@ -893,7 +895,7 @@ $('hold-form').addEventListener('submit', async (event) => {if (await act('hold', { lane: $('hold-lane').value, reason: $('hold-reason').value })) $('hold-reason').value = '';});showTab();-refresh().catch((error) => { $('live').textContent = 'cannot reach the view: ' + error.message; });+refresh().catch((error) => { document.body.classList.remove('loading'); $('live').textContent = 'cannot reach the view: ' + error.message; });setInterval(() => { if (!document.hidden) refresh().catch(() => { $('live').textContent = 'offline: is pullboard view still running?'; }); }, 3000);setInterval(tickAges, 60000);</script>diff --git a/test/cockpit.test.js b/test/cockpit.test.jsindex d029f070..fcb251e9 100644--- a/test/cockpit.test.js+++ b/test/cockpit.test.js@@ -233,10 +233,11 @@ function daysOn(days) {/*** Open the page a view serves, at a window width, and wait for its first board; `later` moves the- * page's clock that many days on, and `store` is its local storage, if it has one. show(id) is- * what that region holds; click() and type() act as the person would.+ * page's clock that many days on, and `store` is its local storage, if it has one. With `hold`, the+ * page's requests wait for release(), so the page shows as it is before its first board. show(id)+ * is what that region holds; click() and type() act as the person would.*/-async function openPage(view, { width = 1280, later = 0, store = null } = {}) {+async function openPage(view, { width = 1280, later = 0, store = null, hold = false } = {}) {const html = await (await fetch(view.link)).text();const script = html.slice(html.indexOf('<script>') + '<script>'.length, html.lastIndexOf('</script>'));const known = new Set([...html.matchAll(/\bid="([^"]+)"/g)].map((match) => match[1]));@@ -255,6 +256,11 @@ async function openPage(view, { width = 1280, later = 0, store = null } = {}) {querySelectorAll: (selector) => (selector === '[data-ago]' ? [...elements.values()].flatMap(ageNodes) : []),addEventListener: (type, listener) => { if (type === 'click') clicks.push(listener); },};+ // The body starts with the classes its markup gives it, as at first paint.+ for (const name of (/<body class="([^"]*)">/.exec(html)?.[1] ?? '').split(' ').filter(Boolean)) document.body.classList.add(name);+ let release = () => {};+ const held = new Promise((done) => { release = done; });+ if (!hold) release();const context = vm.createContext({document,location: { search: `?k=${view.key}` },@@ -268,7 +274,7 @@ async function openPage(view, { width = 1280, later = 0, store = null } = {}) {setTimeout,clearTimeout,fetch: (path, init) => {- const answer = fetch(`${view.base}${path}`, init).then(async (res) => {+ const answer = held.then(() => fetch(`${view.base}${path}`, init)).then(async (res) => {const body = await res.json();return { ok: res.ok, status: res.status, json: async () => body };});@@ -279,9 +285,14 @@ async function openPage(view, { width = 1280, later = 0, store = null } = {}) {},});vm.runInContext(script, context);- await settle(inflight);+ if (!hold) await settle(inflight);return {html,+ // Let the held requests go, and wait for what they bring.+ async release() {+ release();+ await settle(inflight);+ },show: (id) => node(id).innerHTML,element: node,run: (code) => vm.runInContext(code, context),@@ -1179,8 +1190,16 @@ test('a machine with no board says how to start one [N26]', async () => {assert.doesNotMatch(page.html, /init-form|init-path|Start a board|<details/, 'no form to start a board');assert.doesNotMatch(style, /\.start\b/);- assert.equal(page.run("document.body.classList.contains('boardless')"), true, 'with no board, the board steps aside');- assert.match(style, /\n\.first \{ display: none;[^}]*\}\n(?:\.first [^\n]*\n)*\.boardless \.first \{ display: block; \}\n\.boardless \.top, \.boardless \[data-pane\] \{ display: none; \}\n/, 'its bar of tabs and its panes hide, and the message shows');+ const classes = (on) => ['loading', 'boardless'].filter((name) => on.run(`document.body.classList.contains('${name}')`));+ assert.deepEqual(classes(page), ['boardless'], 'with no board, the board steps aside');+ assert.match(style, /\n\.first \{ display: none;[^}]*\}\n(?:\.first [^\n]*\n)*\.boardless \.first \{ display: block; \}\n\.loading \.top, \.loading \[data-pane\], \.boardless \.top, \.boardless \[data-pane\] \{ display: none; \}\n/, 'its bar of tabs and its panes hide, and the message shows');++ // Until the first board arrives the page shows none of a board, so a slow start flashes nothing.+ assert.match(page.html, /\n<body class="loading">\n/, 'the page starts loading');+ const early = await openPage(view, { hold: true });+ assert.deepEqual(classes(early), ['loading'], 'and stays so while the first answer is on its way');+ await early.release();+ assert.deepEqual(classes(early), ['boardless'], 'then the message takes the place of the board');assert.match(page.html, /<main>\n {2}<section class="card-panel first">\n {4}<h2>No boards yet<\/h2>\n {4}<p>Run <code>pullboard init<\/code> in a git repo, or ask an agent to\. Its board shows up here by itself\.<\/p>\n {2}<\/section>\n/, 'the message says how a board starts');assert.equal(page.show('proj-list'), '<div class="empty">None yet.</div>');assert.equal(page.element('products').hidden, true);@@ -1191,6 +1210,13 @@ test('a machine with no board says how to start one [N26]', async () => {assert.equal(page.run("document.body.classList.contains('boardless')"), false, 'a board shows its tabs and panes');assert.equal(page.element('proj-name').textContent, 'alpha');assert.deepEqual(projectRows(page.show('proj-list')).map((row) => [row.name, row.current]), [['alpha', true]]);++ // A view that cannot be reached says so in the bar it shows, rather than show nothing at all.+ const lost = await openPage(view, { hold: true });+ await view.stop();+ await lost.release();+ assert.deepEqual(classes(lost), []);+ assert.match(lost.element('live').textContent, /^cannot reach the view: /);} finally {await view.stop();}