mirror of
https://github.com/pbakaus/impeccable.git
synced 2026-09-21 18:47:02 +03:00
overlay: a lane session shows the variant bar and nothing else
The generate lane hides the helper's global bar, but the overlay drew it first and hid it on `connected`, the Tune chip spun for the seconds between the variants mounting and the done reply even though the lane declares no knobs, and the agent-target pick rendered the edit-copy pencil with its "disabled while applying" tooltip. The served script's prelude now says when the bar is hidden so it is never drawn; a session records who fired its Go (`sessionOrigin`, saved with the session) and never shows the pending Tune chip when the generate verb did; the agent-target pick suppresses the edit-copy badge for the session. A user's own pick, Go, and session are unchanged, and the source test pins every gate. Written with AI assistance (Claude). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
committed by
Abdul Wahab
co-authored by
Claude Fable 5
parent
e06c152ad2
commit
496b386504
@@ -846,6 +846,38 @@ describe('live-browser source contracts', () => {
|
||||
);
|
||||
});
|
||||
|
||||
it('never shows a pending Tune chip for a session the generate verb started', () => {
|
||||
// The generate lane declares no knobs, so the chip that spins between
|
||||
// the variants mounting and the done reply is noise there; a user's Go
|
||||
// keeps the chip exactly as before (origin null).
|
||||
assert.equal((SOURCE.match(/parameterGenerationState = 'pending';\s*sessionOrigin = agentTargetForGo \? 'agent' : null;/g) || []).length, 2, 'every Go records who fired it');
|
||||
assert.match(
|
||||
SOURCE,
|
||||
/const paramsPending = !hasParams && sessionOrigin !== 'agent' && \(parameterGenerationState === 'pending' \|\| parameterGenerationState === 'loading'\);/,
|
||||
'the pending chip is gated on the origin and nothing else changed',
|
||||
);
|
||||
assert.match(SOURCE, /origin: sessionOrigin \|\| undefined,/, 'the origin is saved with the session');
|
||||
assert.match(SOURCE, /sessionOrigin = saved\.origin === 'agent' \? 'agent' : null;/, 'and restored across a reload');
|
||||
assert.equal((SOURCE.match(/parameterGenerationState = 'idle';\s*sessionOrigin = null;/g) || []).length, 3, 'every session reset clears the origin');
|
||||
});
|
||||
|
||||
it('shows no edit-copy badge on a selection the generate verb made', () => {
|
||||
// The lane never edits copy in the browser; the pencil badge (and its
|
||||
// "disabled while applying" tooltip) belongs to a user's own pick.
|
||||
assert.match(SOURCE, /function renderEditBadge\(mode\) \{\s*if \(editBadgeSuppressed \|\| sessionOrigin === 'agent'\) mode = 'hidden';/);
|
||||
assert.match(SOURCE, /showBar\('configure'\);\s*editBadgeSuppressed = true;\s*renderEditBadge\('hidden'\);/, 'the agent-target pick sets the suppression before its first render');
|
||||
assert.equal((SOURCE.match(/sessionOrigin = null;\s*editBadgeSuppressed = false;/g) || []).length, 3, 'every session reset clears it');
|
||||
});
|
||||
|
||||
it('mounts the global bar hidden when the helper served the lane preference', () => {
|
||||
// The generate lane's helper says so in the script prelude, so the bar
|
||||
// is never drawn and then hidden (no entrance flash, no leftover); a
|
||||
// plain helper serves no such line and the bar mounts exactly as before.
|
||||
assert.match(SOURCE, /const barHiddenFromStart = window\.__IMPECCABLE_LIVE_BAR_HIDDEN__ === true;/);
|
||||
assert.match(SOURCE, /display: barHiddenFromStart \? 'none' : 'flex', alignItems: 'stretch',/);
|
||||
assert.match(SOURCE, /if \(barHiddenFromStart\) \{\s*liveBarHiddenByHelper = true;\s*globalBarEl\.dataset\.liveBarDisplay = 'flex';\s*\}/);
|
||||
});
|
||||
|
||||
it('re-claims busy-declined agent targets only while the overlay can still serve them', () => {
|
||||
const teardownSource = SOURCE.match(/function teardown\(\) \{[\s\S]*?\n \}/)?.[0] || '';
|
||||
const clearAt = teardownSource.indexOf('busyDeclinedTargets.clear();');
|
||||
|
||||
Reference in New Issue
Block a user