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
chore(merge): integrate accepted item thread panel [B33,B29]
Corey Olson556819e966d2
diff --cc test/cockpit.test.jsindex 05fe60cd,45b62e34..9d307d21--- a/test/cockpit.test.js+++ b/test/cockpit.test.js@@@ -3194,117 -3325,197 +3325,308 @@@ test('real Chrome styles shout code an}});+test("item detail merges API facts and moves in one responsive timeline [B33,B29]", { timeout: 120_000 }, async (t) => {+ const executable = chromeExecutable();+ if (!executable) return t.skip('Install Chrome or set PULLBOARD_CHROME for item-thread rendering checks.');++ const box = machine();+ const alpha = project(box, 'item-thread');+ box.run(alpha.repo, 'add', 'web', 'Thread fixture', '--specs', 'G1', '--criterion', 'The item keeps its evidence.');+ box.run(alpha.web, 'claim', '1');+ const sourceHead = box.git(alpha.repo, 'rev-parse', 'HEAD');+ /** Append a real board fact and return the identity the correction must name. */+ const addFact = (kind, text, ...flags) => JSON.parse(box.run(alpha.web, 'fact', '1', kind, text, ...flags, '--json')).fact;+ const oldNote = addFact('note', 'Earlier observation, now replaced.');+ addFact('capture', 'Captured the rendered page.', '--ref', `SPEC.md:1-2@${sourceHead}`);+ box.run(alpha.web, 'release', '1');+ addFact('measurement', 'The view settles in 8 seconds.');+ box.run(alpha.web, 'claim', '1');+ addFact('diff', 'The detail gained a thread.');+ addFact('decision', 'Keep the thread in the item.');+ addFact('rejection', 'The first layout wrapped poorly.');+ const replacement = addFact('supersession', 'Correction: the note is replaced.', '--supersedes', oldNote.id);+ addFact('root-cause', 'The missing projection hid the facts.');++ const view = await startView(box);+ const profile = mkdtempSync(join(tmpdir(), 'pullboard-item-thread-chrome-'));+ let chrome;+ try {+ const apiState = await boardOf(view, alpha.repo);+ const expected = apiState.items.find((item) => item.id === 1).thread;+ assert.deepEqual(expected.filter((entry) => entry.type === 'fact').map((entry) => entry.kind),+ ['note', 'capture', 'measurement', 'diff', 'decision', 'rejection', 'supersession', 'root-cause'],+ 'the API provides every fact in append order');+ chrome = await openSnapshotChrome(executable, view.link.href, profile);+ await chrome.waitFor('typeof data !== "undefined" && data?.project?.items?.find((item) => item.id === 1)?.thread?.length === ' + expected.length);+ await chrome.waitFor('document.querySelectorAll("#detail .tl [data-event-id]").length === ' + expected.length);+ const expectedIds = expected.map((entry) => entry.eventId);+ for (const width of [375, 1280]) {+ await chrome.send('Emulation.setDeviceMetricsOverride', { width, height: 1000, deviceScaleFactor: 1, mobile: false });+ await chrome.waitFor(`innerWidth === ${width} && document.querySelector('#detail .tl')?.getBoundingClientRect().width > 0`);+ const rendered = JSON.parse(await chrome.evaluate(`JSON.stringify((() => {+ const timeline = document.querySelector('#detail .tl');+ const old = document.querySelector('#detail #fact-${oldNote.id}');+ const replacement = document.querySelector('#detail #fact-${replacement.id}');+ const live = document.querySelector('#detail #fact-${expected.find((entry) => entry.type === 'fact' && entry.kind === 'capture').id}');+ const plain = document.querySelector('#detail .tl-fact:not(.tl-judgement):not(.tl-superseded)');+ const judgementColors = Object.fromEntries(['decision', 'rejection', 'supersession', 'root-cause'].map((kind) => {+ const row = [...timeline.querySelectorAll('.tl-fact')].find((entry) => entry.querySelector('.tl-fact-head .chip')?.textContent === kind);+ return [kind, row ? getComputedStyle(row, '::before').backgroundColor : null];+ }));+ return {+ ids: [...timeline.querySelectorAll('[data-event-id]')].map((row) => Number(row.dataset.eventId)),+ rows: timeline.querySelectorAll('li').length,+ kinds: [...timeline.querySelectorAll('.tl-fact-head .chip')].map((chip) => chip.textContent),+ authors: [...timeline.querySelectorAll('.tl-fact-head b')].map((name) => name.textContent),+ ages: timeline.querySelectorAll('.tl-fact small time[data-ago]').length,+ oldClass: old?.className,+ replacementHref: old?.querySelector('.thread-replacement')?.getAttribute('href'),+ oldOpacity: Number(old && getComputedStyle(old).opacity),+ replacementOpacity: Number(replacement && getComputedStyle(replacement).opacity),+ liveOpacity: Number(live && getComputedStyle(live).opacity),+ plainMarker: plain ? getComputedStyle(plain, '::before').backgroundColor : null,+ judgementColors,+ judgementKinds: Object.keys(judgementColors).filter((kind) => judgementColors[kind] !== null),+ ref: timeline.querySelector('.tl-fact button[data-code]')?.dataset.code,+ viewport: document.documentElement.clientWidth,+ pageWidth: Math.max(document.documentElement.scrollWidth, document.body.scrollWidth),+ };+ })())`));+ assert.deepEqual(rendered.ids, expectedIds, `${width}px: moves and facts follow the API's event order`);+ assert.equal(rendered.rows, expected.length, `${width}px: each API event appears exactly once`);+ const expectedFacts = expected.filter((entry) => entry.type === 'fact');+ assert.deepEqual(rendered.kinds, expectedFacts.map((entry) => entry.kind), `${width}px: every fact kind is a visible chip`);+ assert.deepEqual(rendered.authors, expectedFacts.map((entry) => entry.by), `${width}px: each fact names its API author`);+ assert.equal(rendered.ages, expectedFacts.length, `${width}px: each fact shows its age`);+ assert.match(rendered.oldClass, /tl-superseded/, `${width}px: the earlier fact is visibly dimmed`);+ assert.equal(rendered.replacementHref, `#fact-${replacement.id}`, `${width}px: the earlier fact links to its replacement`);+ assert.ok(rendered.oldOpacity < rendered.replacementOpacity && rendered.oldOpacity < rendered.liveOpacity,+ `${width}px: computed opacity dims the superseded fact`);+ assert.deepEqual(rendered.judgementKinds, ['decision', 'rejection', 'supersession', 'root-cause'], `${width}px: all judgement kinds appear`);+ for (const [kind, color] of Object.entries(rendered.judgementColors)) {+ assert.notEqual(color, rendered.plainMarker, `${width}px: ${kind} uses a distinct computed marker color`);+ }+ assert.equal(rendered.ref, `SPEC.md:1-2@${sourceHead}`, `${width}px: the committed code reference is actionable`);+ assert.equal(rendered.pageWidth, rendered.viewport, `${width}px: the timeline causes no sideways page scroll`);+ }+ const scrollBefore = JSON.parse(await chrome.evaluate(`JSON.stringify({ page: document.documentElement.scrollTop, detail: document.querySelector('#detail').scrollTop })`));+ await chrome.evaluate(`document.querySelector('#detail #fact-${oldNote.id} .thread-replacement').click()`);+ await chrome.waitFor(`location.hash === '#fact-${replacement.id}' && document.querySelector('#detail #fact-${replacement.id}')`);+ const target = JSON.parse(await chrome.evaluate(`JSON.stringify((() => {+ const detail = document.querySelector('#detail'), fact = document.querySelector('#detail #fact-${replacement.id}');+ const box = fact.getBoundingClientRect(), panel = detail.getBoundingClientRect();+ return { item: view.item, id: fact.id, text: document.querySelector('#detail h2')?.textContent,+ page: document.documentElement.scrollTop, detail: detail.scrollTop,+ visible: box.top >= panel.top && box.bottom <= panel.bottom };+ })())`));+ assert.equal(target.id, `fact-${replacement.id}`, 'the replacement anchor resolves to a visible fact');+ assert.equal(target.item, 1, 'following the link keeps the same item selected');+ assert.equal(target.text, '#1Thread fixture', 'the item detail stays open after following the replacement link');+ assert.ok(target.page > scrollBefore.page || target.detail > scrollBefore.detail,+ 'following the replacement anchor scrolls to its existing target');+ assert.equal(target.visible, true, 'the replacement is visible after following its link');+ await chrome.evaluate(`document.querySelector('#detail .tl-fact button[data-code]').click()`);+ await chrome.waitFor(`document.querySelector('#detail .tl-fact button[data-code]')?.getAttribute('aria-expanded') === 'true'`);+ await chrome.waitFor(`document.querySelector('#detail .tl-fact .code')?.textContent.includes('Demo spec')`);+ assert.match(await chrome.evaluate(`document.querySelector('#detail .tl-fact .code')?.textContent || ''`), /Demo spec/, 'the code reference opens the committed lines');+ } finally {+ if (chrome) await closeSnapshotChrome(chrome);+ await view.stop();+ rmSync(profile, { recursive: true, force: true });+ }+});++ test('in-text item references stay inline and open their target at phone and desktop widths [N26]', { timeout: 90_000 }, async (t) => {+ const executable = chromeExecutable();+ if (!executable) return t.skip('Install Chrome or set PULLBOARD_CHROME for item-reference layout checks.');++ const box = machine();+ const demo = project(box, 'inline-references', SPEC, { practice: 'ways.md' });+ writeFileSync(join(demo.repo, 'ways.md'), '# Local rules\n\n## Team\n- R1 [approved, must] Items carry the page behavior. | gate: review\n');+ box.run(demo.repo, 'add', 'web', 'Target item', '--specs', 'G1', '--criterion', 'the linked target');+ box.run(demo.repo, 'add', 'web', 'Title links to #1', '--specs', 'G1', '--criterion', 'Criterion links to #1', '--brief', 'Brief links to #1');+ box.run(demo.web, 'claim', '2');+ box.run(demo.repo, 'shout', 'person', 'Please choose #1 next', '--decision');+ const view = await startView(box);+ const profile = mkdtempSync(join(tmpdir(), 'pullboard-inline-references-chrome-'));+ let chrome;+ try {+ chrome = await openSnapshotChrome(executable, view.link.href, profile);+ await chrome.send('Emulation.setDeviceMetricsOverride', { width: 1280, height: 900, deviceScaleFactor: 1, mobile: false });+ await chrome.waitFor('document.querySelectorAll("#chain .row").length >= 2 && document.querySelector("#needs .ny")');++ for (const width of [375, 1280]) {+ await chrome.send('Emulation.setDeviceMetricsOverride', { width, height: 900, deviceScaleFactor: 1, mobile: false });+ // The row inlineReference stays on its title line beside the text.+ const rendered = JSON.parse(await chrome.evaluate(`JSON.stringify((() => {+ const row = document.querySelector('#chain .row[data-item="2"]');+ const plain = document.querySelector('#chain .row[data-item="1"]');+ const titleRef = row?.querySelector('.t button.ref');+ const need = [...document.querySelectorAll('#needs .ny')].find((entry) => entry.textContent.includes('Please choose'));+ const needRef = need?.querySelector('button.ref');+ const needAction = need?.querySelector('.ny-open');+ const realButton = document.querySelector('#new-item');+ /** Measure the element box independently of the inline-link assertion. */+ const rect = node => { const r=node.getBoundingClientRect(); return {height:r.height,width:r.width}; };+ return {+ titleRef: titleRef && { ...rect(titleRef), border:getComputedStyle(titleRef).borderWidth, lineHeight:getComputedStyle(titleRef).lineHeight },+ linkedTitle: row && rect(row.querySelector('.t')),+ plainTitle: plain && rect(plain.querySelector('.t')),+ needRef: needRef && { ...rect(needRef), border:getComputedStyle(needRef).borderWidth, lineHeight:getComputedStyle(needRef).lineHeight },+ needText: need?.querySelector('.ny-text') && rect(need.querySelector('.ny-text')),+ needAction: needAction && rect(needAction), realButton: realButton && rect(realButton),+ };+ })())`));+ assert.ok(rendered.titleRef && rendered.needRef, `${width}: list and Needs-you references are links: ${JSON.stringify(rendered)}`);+ assert.equal(rendered.titleRef.border, '0px', `${width}: the title reference has no button border`);+ assert.equal(rendered.needRef.border, '0px', `${width}: the Needs-you reference has no button border`);+ assert.ok(Math.abs(rendered.linkedTitle.height - rendered.plainTitle.height) < 1,+ `${width}: the title line matches a plain title: ${JSON.stringify(rendered)}`);+ assert.ok(Math.abs(rendered.titleRef.height - rendered.linkedTitle.height) < 1,+ `${width}: the title link has the surrounding line height: ${JSON.stringify(rendered)}`);+ assert.ok(Math.abs(rendered.needRef.height - rendered.needText.height) < 1,+ `${width}: the Needs-you link has the surrounding line height: ${JSON.stringify(rendered)}`);+ assert.ok(rendered.needAction.height >= 44 && rendered.realButton.height >= 44,+ `${width}: real controls keep 44px targets: ${JSON.stringify(rendered)}`);++ for (const section of ['agents', 'spec', 'doctrine']) {+ if (section === 'agents') {+ await chrome.evaluate(`document.querySelector('[data-tab="shouts"]').click()`);+ await chrome.waitFor('document.querySelector("#agents [data-item=\\"2\\"]")');+ } else {+ await chrome.evaluate(`document.querySelector('[data-tab="${section}"]').click()`);+ await chrome.evaluate(`document.querySelector('[data-rows="${section}:all"]').click()`);+ const citedRow = section === 'doctrine' ? 'R1' : 'G1';+ if (section === 'doctrine') {+ // Item citations normally point to SPEC ids; add the distinct practice id to the+ // browser projection to exercise the shared doctrine citing-item renderer.+ await chrome.evaluate("data.project.items.find(item => item.id === 2).specs.push('R1'); render();");+ }+ await chrome.waitFor(`document.querySelector('#${section}-list [data-row="${section}:${citedRow}"]')`);+ await chrome.evaluate(`document.querySelector('#${section}-list [data-row="${section}:${citedRow}"]').click()`);+ await chrome.waitFor(`document.querySelector('#${section}-detail [data-item="2"]')`);+ }+ const selector = section === 'agents' ? '#agents [data-item="2"] .ref' : `#${section}-detail .links [data-item="2"] .ref`;+ const metrics = JSON.parse(await chrome.evaluate(`JSON.stringify((() => {+ const ref = document.querySelector(${JSON.stringify(selector)});+ const container = ref?.closest('[data-item="2"]');+ const r = ref?.getBoundingClientRect();+ const c = container?.getBoundingClientRect();+ return { present:!!ref, border:ref && getComputedStyle(ref).borderWidth,+ refHeight:r?.height, lineHeight:ref && parseFloat(getComputedStyle(ref).lineHeight),+ containerHeight:c?.height, nestedButtons:container ? [...container.querySelectorAll('.ref')].filter(link => link.parentElement.closest('button')).length : 0 };+ })())`));+ assert.ok(metrics.present, `${width}: ${section} citing title renders a compact item reference: ${JSON.stringify(metrics)}`);+ assert.equal(metrics.border, '0px', `${width}: ${section} reference has no button border`);+ assert.ok(Math.abs(metrics.refHeight - metrics.lineHeight) < 1, `${width}: ${section} reference keeps the text line height: ${JSON.stringify(metrics)}`);+ assert.ok(metrics.containerHeight >= 44, `${width}: ${section} containing item keeps a 44px target`);+ assert.equal(metrics.nestedButtons, 0, `${width}: ${section} title has no nested controls`);+ await chrome.evaluate(`document.querySelector(${JSON.stringify(selector)}).click()`);+ await chrome.waitFor("document.querySelector('[data-tab=items].on') && document.querySelector('#detail h2')?.textContent.includes('Target item')");+ await chrome.evaluate(`document.querySelector(${JSON.stringify(selector)}).closest('[data-item="2"]').click()`);+ await chrome.waitFor("document.querySelector('#detail h2')?.textContent.includes('Title links to #1')");+ }++ await chrome.evaluate(`document.querySelector('#chain .row[data-item="2"] .t button.ref').click()`);+ await chrome.waitFor("document.querySelector('#detail h2')?.textContent.includes('Target item')");+ await chrome.evaluate(`document.querySelector('#needs .ny button.ref').click()`);+ await chrome.waitFor("document.querySelector('[data-tab=items].on') && document.querySelector('#detail h2')?.textContent.includes('Target item')");++ await chrome.evaluate(`document.querySelector('[data-tab="activity"]').click()`);+ await chrome.waitFor("document.querySelector('#activity .what button.ref')");+ await chrome.evaluate(`document.querySelector('#activity .what button.ref').click()`);+ await chrome.waitFor("document.querySelector('[data-tab=items].on') && document.querySelector('#detail h2')?.textContent.includes('Target item')");++ await chrome.evaluate(`document.querySelector('#chain .row[data-item="2"]').click()`);+ await chrome.waitFor("document.querySelector('#detail h2')?.textContent.includes('Title links to #1') && document.querySelector('#detail .text button.ref') && document.querySelector('#detail .text.muted button.ref')");+ await chrome.evaluate(`document.querySelector('#detail .text button.ref').click()`);+ await chrome.waitFor("document.querySelector('#detail h2')?.textContent.includes('Target item')");+ await chrome.evaluate(`document.querySelector('#chain .row[data-item="2"]').click()`);+ await chrome.waitFor("document.querySelector('#detail .text.muted button.ref')");+ await chrome.evaluate(`document.querySelector('#detail .text.muted button.ref').click()`);+ await chrome.waitFor("document.querySelector('#detail h2')?.textContent.includes('Target item')");+ }+ } finally {+ if (chrome) await closeSnapshotChrome(chrome);+ rmSync(profile, { recursive: true, force: true });+ await view.stop();+ }+ });++ test('Roadmap and rule prose references stay inline and open the item on their own board [N26,N38]', { timeout: 90_000 }, async (t) => {+ const executable = chromeExecutable();+ if (!executable) return t.skip('Install Chrome or set PULLBOARD_CHROME for prose-reference checks.');+ const box = machine();+ const demo = project(box, 'a-inline-prose', `${SPEC}- G3 [approved, must] Follow #1 first. | gate: review\n`, { practice: 'ways.md' });+ writeFileSync(join(demo.repo, 'ways.md'), '# Local rules\n\n## Team\n- R1 [approved, must] Review #1 first. | gate: review\n');+ box.run(demo.repo, 'add', 'web', 'Local target', '--specs', 'G1', '--criterion', 'target');+ box.run(demo.repo, 'add', 'web', 'Local title links to #1', '--specs', 'G1', '--criterion', 'title');+ build(box, demo, 2, 'title.txt');+ sendBack(box, demo, 2, 'Review #1 before accepting.');+ const other = project(box, 'beacon-prose');+ box.run(other.repo, 'add', 'web', 'Remote target', '--specs', 'G1', '--criterion', 'target');+ box.run(other.repo, 'add', 'web', 'Remote title links to #1', '--specs', 'G1', '--criterion', 'title');+ box.run(demo.repo, 'milestone', 'add', 'Choose #1', '--note', 'Review #1 next.', '--items', '2,beacon-prose#2');+ box.run(demo.repo, 'shout', 'person', 'Choose #1 before shipping.', '--decision');+ const view = await startView(box);+ const profile = mkdtempSync(join(tmpdir(), 'pullboard-prose-references-chrome-'));+ let chrome;+ try {+ chrome = await openSnapshotChrome(executable, view.link.href, profile);+ await chrome.waitFor("document.querySelector('#chain .row[data-item=\"2\"]')");+ for (const width of [375, 1280]) {+ await chrome.send('Emulation.setDeviceMetricsOverride', { width, height: 900, deviceScaleFactor: 1, mobile: false });+ const contexts = [+ ['roadmap', '#roadmap .milestone h2 .ref', 'Local target'],+ ['roadmap', '#roadmap .milestone-note .ref', 'Local target'],+ ['roadmap', '#roadmap .milestone-item[data-go="item:2"]:not([data-board]) .t .ref', 'Local target'],+ ['roadmap', '#roadmap .milestone-item[data-board] .t .ref', 'Remote target'],+ ['spec', '#spec-list [data-row="spec:G3"] .ref', 'Local target'],+ ['doctrine', '#doctrine-list [data-row="doctrine:R1"] .ref', 'Local target'],+ ];+ for (const [tab, selector, target] of contexts) {+ await chrome.evaluate(`document.querySelector('[data-root=${JSON.stringify(demo.repo)}]').click();`);+ await chrome.waitFor("data?.project?.root === view.root && !document.body.classList.contains('switching') && document.querySelector('#proj-name').textContent === 'a-inline-prose'");+ await chrome.evaluate(`document.querySelector('[data-tab="${tab}"]').click()`);+ if (tab !== 'roadmap') await chrome.evaluate(`document.querySelector('[data-rows="${tab}:all"]').click()`);+ const metrics = JSON.parse(await chrome.evaluate(`JSON.stringify((() => {+ const ref = document.querySelector(${JSON.stringify(selector)});+ const row = ref?.closest('.milestone-item');+ const style = ref && getComputedStyle(ref);+ return { present:!!ref, title:ref?.title, border:style?.borderWidth, height:ref?.getBoundingClientRect().height,+ line:style && parseFloat(style.lineHeight), nested:!!ref?.parentElement.closest('button'),+ rowHeight:row?.getBoundingClientRect().height };+ })())`));+ assert.ok(metrics.present, `${width}: ${selector} contains its inline reference`);+ assert.equal(metrics.title, target, `${width}: the reference tooltip names the target on its own board`);+ assert.equal(metrics.border, '0px', `${width}: ${selector} has no box`);+ assert.ok(Math.abs(metrics.height - metrics.line) < 1, `${width}: ${selector} keeps the text line height`);+ assert.equal(metrics.nested, false, `${width}: ${selector} never nests buttons`);+ if (metrics.rowHeight !== undefined) assert.ok(metrics.rowHeight >= 44, `${width}: the containing Roadmap control keeps its touch target`);+ await chrome.evaluate(`document.querySelector(${JSON.stringify(selector)}).click()`);+ await chrome.waitFor("!document.body.classList.contains('switching') && document.querySelector('[data-tab=items].on') && document.querySelector('#detail h2 > span')?.textContent === '#1'");+ assert.ok((await chrome.evaluate("document.querySelector('#detail h2').textContent")).includes(target), 'the reference opens its target title');+ assert.equal(await chrome.evaluate('view.root'), target === 'Remote target' ? other.repo : demo.repo, 'duplicate item numbers stay bound to their own board');+ }+ await chrome.evaluate(`document.querySelector('[data-tab="items"]').click(); document.querySelector('#chain .row[data-item="2"]').click()`);+ await chrome.waitFor("document.querySelector('#detail .verdict .note')");+ assert.equal(await chrome.evaluate("document.querySelectorAll('#detail .verdict .note .ref').length"), 1, 'verdict prose keeps its item reference');+ await chrome.evaluate("document.querySelector('#detail .verdict .note .ref').click()");+ await chrome.waitFor("document.querySelector('#detail h2')?.textContent.includes('Local target')");+ await chrome.evaluate("document.querySelector('#needs .ny-open[data-go^=\"decide:\"]').click()");+ assert.equal(await chrome.evaluate("document.querySelectorAll('#answering-q .ref').length"), 1, 'the answering question keeps its inline item reference');+ await chrome.evaluate("document.querySelector('#answering-q .ref').click()");+ await chrome.waitFor("document.querySelector('#detail h2')?.textContent.includes('Local target') && document.querySelector('[data-tab=items].on')");+ await chrome.evaluate("document.querySelector('[data-tab=roadmap]').click(); document.querySelector('#roadmap .milestone-item[role=button]:not([data-board])').dispatchEvent(new KeyboardEvent('keydown', {key:'Enter',bubbles:true}))");+ await chrome.waitFor("document.querySelector('#detail h2')?.textContent.includes('Local title links to #1') && document.querySelector('[data-tab=items].on')");+ }+ } finally {+ if (chrome) await closeSnapshotChrome(chrome);+ rmSync(profile, { recursive: true, force: true });+ await view.stop();+ }+ });+test('wait references stay on one line and link to every prerequisite at phone and desktop widths [N26]', { timeout: 90_000 }, async (t) => {const executable = chromeExecutable();if (!executable) return t.skip('Install Chrome or set PULLBOARD_CHROME for prerequisite layout checks.');