fix(desktop): stability batch — LCS bound / barge-in flush / refresh throttle / history bucket / fusion seed dedupe

P0-2 artifacts-board.js: guard against LCS OOM on large blob diffs; fall back to note-based render when either side exceeds bound.
P1-2 chat-side-drawer.js: flush pending turn on barge-in (user sends before assistant frame flushes), so drawer stays in sync with graph.
P1-3 chat-refresh-throttle.js (new) + renderer.js: coalesce chat + graph refreshes into per-frame flush to prevent visual jitter under high-frequency intervention/refresh events.
P1-4 artifacts.js: history entries bucket by sessionId; cross-session artifacts no longer bleed into the currently-open session's history rail.
P1-5 rubric-fusion-model.js: seedOnce idempotency guard — repeated seed calls no longer duplicate rubric fixture rows (was surfacing as double-counted evolution nodes).
test/code-bugs-batch.test.js (new, 9 assertions) covers all 5 fixes; test/artifact-evolution-board.test.js updated to align with bySession bucket shape.

9 files, +520/-43. Behavioral fixes only, no API surface change.
This commit is contained in:
ZiyaZhang
2026-07-19 01:31:39 -07:00
parent 6c4d0ae805
commit 88bd4ac244
9 changed files with 520 additions and 43 deletions

View File

@@ -274,11 +274,19 @@ test('artifacts.js: version chip is a <button> that toggles the evolution strip'
)
})
test('artifacts.js: history map tracks per-version records', () => {
test('artifacts.js: history map tracks per-version records (session-scoped)', () => {
// fix/code-bugs-batch P1-4: history is bucketed per sessionId to prevent
// A→B→A version bleed, but the shape it exposes to callers stays
// Map-like. Assert the bucket structure + the recordHistory helper.
assert.match(
artifactsSrc,
/const\s+history\s*=\s*new\s+Map\(\)/,
'history map must exist to seed the evolution / timeline views',
/const\s+bySession\s*=\s*new\s+Map\(\)/,
'session-bucketed history map must exist to isolate versions across sessions',
)
assert.match(
artifactsSrc,
/history:\s*new\s+Map\(\)/,
'each session bucket must own a fresh history Map for its artifacts',
)
assert.match(
artifactsSrc,
@@ -296,7 +304,7 @@ test('artifacts.js: switchView flips the panel dataset + aria-selected', () => {
assert.match(
artifactsSrc,
/panelEl\.dataset\.view\s*=\s*v/,
'view state must be reflected on panel.dataset.view for CSS + QA',
'view state must be reflected on the current bucket panel dataset.view for CSS + QA',
)
assert.match(
artifactsSrc,