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): keep the requested row in place [H12,H5,N26]

Corey Olsonecc9db12bf60
diff --git a/src/cockpit.js b/src/cockpit.js
index 32aadafe..80c3c002 100644
--- a/src/cockpit.js
+++ b/src/cockpit.js
@@ -2304,7 +2304,8 @@ async function decideRow(kind, command, args, anchor) {
const feedback = { kind, root, id: ids[0], next, from: anchor?.closest('#' + kind + '-detail') ? 'detail' : 'list', tone: '', text: 'Recording decision…' };
view.specFeedback = feedback;
render();
- window.scrollTo({ top: scroll, behavior: 'instant' });
+ // A waiting request keeps its row; let browser anchoring follow growth above it.
+ if (!requests) window.scrollTo({ top: scroll, behavior: 'instant' });
try {
const move = pageMove(command, kind === 'doctrine' ? { ...args, ids: ids.map((id) => 'doctrine:' + id).join(' ') } : args);
const result = requests ? await sendPersonRequest(root, move.body) : await api(boardPath(root) + '/moves', move.body);
@@ -2323,7 +2324,7 @@ async function decideRow(kind, command, args, anchor) {
}
if (root === view.root && view.specFeedback === feedback) {
render();
- window.scrollTo({ top: scroll, behavior: 'instant' });
+ if (!requests) window.scrollTo({ top: scroll, behavior: 'instant' });
// A phone row click jumps to its detail. A later list-key decision returns the next pick to view,
// instead of restoring that detail's scroll position with the focused list still offscreen.
if (feedback.from === 'list' && feedback.tone === 'ok' && next && view.row[kind] === next) {
diff --git a/src/view.css b/src/view.css
index a4b84135..ee29cba1 100644
--- a/src/view.css
+++ b/src/view.css
@@ -581,7 +581,6 @@ code.inline.long { white-space: break-spaces; overflow-wrap: anywhere; }
.snapshot #new-item, .snapshot form, .snapshot [data-new], .snapshot [data-release], .snapshot [data-shout], .snapshot [data-go^="decide:"] { display: none !important; }
.read-only:not(.requests) #new-item, .read-only:not(.requests) form, .read-only:not(.requests) [data-new], .read-only:not(.requests) [data-release], .read-only:not(.requests) [data-shout], .read-only:not(.requests) [data-go^="decide:"] { display: none !important; }
.person-requests { margin-bottom: 12px; padding: 12px; min-width: 0; }
-html:has(body.read-only.requests:not(.snapshot)) { overflow-anchor: none; }
.person-requests h2 { margin: 0 0 8px; font-size: 14px; }
.request-list { list-style: none; margin: 0; padding: 0; max-height: 240px; overflow-y: auto; }
.request-list li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; padding: 8px 0; border-top: 1px solid var(--line); }
diff --git a/test/cockpit/relay.test.js b/test/cockpit/relay.test.js
index 0997637c..7d7320b5 100644
--- a/test/cockpit/relay.test.js
+++ b/test/cockpit/relay.test.js
@@ -350,11 +350,11 @@ test('relay person requests stay explicit, read-only and visible [H12,H5]', { ti
assert.deepEqual(intents.at(-1), { verb: 'spec-approve', args: { ids: 'G2' } }, 'the detail click creates the exact second literal intent');
await chrome.waitFor("data?.project?.personRequests?.length === 2 && document.querySelector('[data-person-request=\"request-2\"] .request-status')?.textContent === 'Waiting'");
assert.match(await chrome.stable("document.querySelector('#spec-detail .spec-feedback')?.textContent.trim() || ''"), /G2/);
- const afterApproval = JSON.parse(await chrome.stable(`JSON.stringify({ root: view.root, row: view.row.spec, scroll: window.scrollY, selected: document.querySelector('#spec-list [data-row=\"spec:G2\"]')?.classList.contains('on'), visible: (() => { const row = document.querySelector('#spec-list [data-row=\"spec:G2\"]')?.getBoundingClientRect(); return !!row && row.top >= 0 && row.bottom <= innerHeight; })(), browserTrace: window.__personRequestReadingTrace?.serialize() ?? null })`));
+ const afterApproval = JSON.parse(await chrome.stable(`JSON.stringify({ root: view.root, row: view.row.spec, scroll: window.scrollY, rowTop: document.querySelector('#spec-list [data-row=\"spec:G2\"]')?.getBoundingClientRect().top, selected: document.querySelector('#spec-list [data-row=\"spec:G2\"]')?.classList.contains('on'), visible: (() => { const row = document.querySelector('#spec-list [data-row=\"spec:G2\"]')?.getBoundingClientRect(); return !!row && row.top >= 0 && row.bottom <= innerHeight; })(), browserTrace: window.__personRequestReadingTrace?.serialize() ?? null })`));
t.diagnostic(`person-request reading capture: ${JSON.stringify({ clocks: { browser: 'performance.now()', fixture: 'Date.now()' }, reading, afterApproval, requestTimeline })}`);
diagnosticEmitted = true;
assert.deepEqual([afterApproval.root, afterApproval.row, afterApproval.selected], [reading.root, 'G2', true], 'the request keeps the selected board and G2 row');
- assert.ok(Math.abs(afterApproval.scroll - reading.scroll) <= 1, 'the request keeps the page at the same reading position');
+ assert.ok(Math.abs(afterApproval.rowTop - reading.rowBox.top) <= 1, 'the request keeps the row at the same viewport reading position');
assert.equal(afterApproval.visible, true, 'G2 remains visible beside its inline feedback');
assert.deepEqual(intents.at(-1), { verb: 'spec-approve', args: { ids: 'G2' } });
assert.equal(await chrome.stable("data.project.spec.find(row => row.id === 'G2').decision === undefined"), true, 'waiting for a request never approves the row optimistically');
@@ -601,6 +601,7 @@ test('a person request never moves the reading position under a 6× CPU throttle
};
const nativeScrollTo=window.scrollTo;
const trace=window.__personRequestGrowthTrace={ initial:box(), events:[], mutationBatches:0, growth:null, scrollToCalls:[], preRestore:null, disposed:false };
+ trace.snapshot=box;
window.scrollTo=function(...args){
const before=box();
const growingPanel=before.requestCount===2 && before.panel.height>trace.initial.panel.height;
@@ -630,16 +631,16 @@ test('a person request never moves the reading position under a 6× CPU throttle
traceArmed = true;
await press(chrome, "document.querySelector('#spec-detail button[data-row-decision=\"approve\"]')");
await chrome.waitFor("data?.project?.personRequests?.length === 2 && document.querySelector('[data-person-request=\"request-2\"] .request-status')?.textContent === 'Waiting'");
- const capture = JSON.parse(await chrome.stable('JSON.stringify(window.__personRequestGrowthTrace ?? null)'));
+ const capture = JSON.parse(await chrome.stable('JSON.stringify({ ...window.__personRequestGrowthTrace, settled: window.__personRequestGrowthTrace.snapshot() })'));
assert.ok(capture?.growth, 'the actual second-request DOM mutation captures the panel-growth instant');
assert.equal(capture.growth.requestCount, 2, 'the captured mutation contains the real second request');
assert.ok(capture.growth.panel.height > before.panel.height, 'the person panel grew before the browser movement assertion');
- assert.ok(capture.preRestore, 'the actual product restoration call is measured after panel growth');
- assert.equal(capture.preRestore.before.scrollY, before.scrollY,
- 'person-request panel growth does not move the reading position before product restoration');
- assert.equal(capture.preRestore.after.scrollY, before.scrollY,
- 'the existing product restoration keeps the original page position');
- assert.equal(capture.growth.pageOverflowAnchor, 'none', 'the live person-request page opts out of viewport anchoring');
+ const positions = [capture.initial, ...capture.events, ...capture.scrollToCalls.flatMap(call => [call.before, call.after]), capture.settled];
+ for (const position of positions) {
+ assert.ok(position.row?.connected, 'the reading row remains present through each redraw and restoration');
+ assert.ok(Math.abs(position.row.top - before.row.top) <= 1,
+ `the row stays at viewport top ${before.row.top} through request growth: ${JSON.stringify(position)}`);
+ }
assert.equal(capture.growth.selected, 'G2', 'the selected reading row stays the same through panel growth');
assert.deepEqual(intents[1], { verb: 'spec-approve', args: { ids: 'G2' } }, 'the measured action is the real G2 approval request');
t.diagnostic(`sixfold person-request growth capture: ${JSON.stringify({ throttle, before, capture, intent:intents[1], timeline:requestTimeline,