fix(ci): 校正守卫后的五条前端源码合同跟着搬家(BUG-940)
This commit is contained in:
@@ -50,9 +50,12 @@ test("generating does not disable the textarea; Enter queues instead of dropping
|
||||
assert.match(composer, /COMPOSER_QUEUE_RECALL_LABEL/);
|
||||
assert.doesNotMatch(styles, /composer-queue[\s\S]{0,400}spinner|composer-queue[\s\S]{0,400}skeleton/i);
|
||||
|
||||
// 原值:`inputDisabled={sessionMessagesLoading || rectificationSurfaceOpen || (!profileComplete && ...)}`
|
||||
// 新值:中间多了 `activeRectificationSession`
|
||||
// 原因:BUG-924/935 校正会话占位时普通输入框必须禁用,生成中仍不得 disabled textarea。
|
||||
assert.match(
|
||||
page,
|
||||
/inputDisabled=\{sessionMessagesLoading \|\| rectificationSurfaceOpen \|\| \(!profileComplete && \(onboardingStep !== "name" \|\| !presetMessageFinished \|\| profileSaving\)\)\}/,
|
||||
/inputDisabled=\{sessionMessagesLoading \|\| rectificationSurfaceOpen \|\| activeRectificationSession \|\| \(!profileComplete && \(onboardingStep !== "name" \|\| !presetMessageFinished \|\| profileSaving\)\)\}/,
|
||||
);
|
||||
assert.doesNotMatch(page, /inputDisabled=\{isLoading \|\| sessionMessagesLoading \|\| cancellationPending/);
|
||||
assert.match(page, /if \(isLoading \|\| cancellationPending\) return void enqueueQueuedDraft\(composerDraftSnapshot\(\)\);/);
|
||||
|
||||
@@ -177,11 +177,18 @@ test("creating and leaving a session keep the address bar in sync", () => {
|
||||
assert.match(startNewChat, /writeSessionUrl\(nextSession\.id, "push"\)/);
|
||||
assert.match(startNewChat, /window\.history\.replaceState\(null, "", previousHref\)/);
|
||||
|
||||
// 原值:delete/archive 函数体内直接 `writeSessionUrl(fallbackId || null, "replace")`
|
||||
// 新值:删/归档当前会话走 `activateFallbackSession`,由它 `writeSessionUrl(null|fallbackId, "replace")`
|
||||
// 原因:BUG-924 回退优先非校正会话,落到校正会话时要走 selectSession,不能在 delete 里写死 URL。
|
||||
const deleteSession = sourceBetween(page, "async function deleteSession(", "function togglePinnedSession");
|
||||
assert.match(deleteSession, /writeSessionUrl\(fallbackId \|\| null, "replace"\)/);
|
||||
assert.match(deleteSession, /if \(activeSessionId === session\.id\) \{\s*activateFallbackSession\(nextSessions\);/);
|
||||
|
||||
const archiveSession = sourceBetween(page, "function toggleArchivedSession(", "async function shareSession");
|
||||
assert.match(archiveSession, /writeSessionUrl\(fallbackId \|\| null, "replace"\)/);
|
||||
assert.match(archiveSession, /activateFallbackSession\(visibleSessions\.filter\(\(item\) => item\.id !== sessionId\)\)/);
|
||||
|
||||
const fallback = sourceBetween(page, "function activateFallbackSession(", "async function loadMoreSessions");
|
||||
assert.match(fallback, /writeSessionUrl\(null, "replace"\)/);
|
||||
assert.match(fallback, /writeSessionUrl\(fallbackId, "replace"\)/);
|
||||
|
||||
const recovery = sourceBetween(
|
||||
page,
|
||||
|
||||
@@ -205,7 +205,10 @@ test("homepage opens through the server Case API and merges the returned session
|
||||
assert.ok(reveal > merge);
|
||||
assert.match(handler, /rectificationOpenInFlight\.current = true;[\s\S]*?finally \{[\s\S]*?rectificationOpenInFlight\.current = false;/);
|
||||
assert.doesNotMatch(handler, /onNarrativeDelta/);
|
||||
assert.match(source, /const rectificationSurfaceOpen = activeRectificationSession\s*&& activeSession\.id === rectificationSessionId/);
|
||||
// 原值:`const rectificationSurfaceOpen = activeRectificationSession && activeSession.id === rectificationSessionId`
|
||||
// 新值:包一层 `Boolean(...)`,并先判 `activeSession`,避免无活跃会话时读 `.id`
|
||||
// 原因:BUG-935 列表只剩校正时 activeSession 可为 undefined。
|
||||
assert.match(source, /const rectificationSurfaceOpen = Boolean\(activeRectificationSession && activeSession && activeSession\.id === rectificationSessionId\)/);
|
||||
// 原值:同一守卫内 JSX 写 pendingConsultationQuestion={rectificationPendingQuestion}
|
||||
// 新值:同一守卫内 JSX 写 panel={rectificationPanel};pending 字段在 hook panel
|
||||
// 原因:校正面子树状态收到 panel
|
||||
@@ -226,8 +229,13 @@ test("the page never creates the session shell locally; the server owns session
|
||||
|
||||
test("rectification cards render only inside the active rectification session", () => {
|
||||
const source = homeSurface;
|
||||
const guard = readFileSync(new URL("../src/lib/rectification-session-composer-guard.ts", import.meta.url), "utf8");
|
||||
|
||||
assert.match(source, /activeSession\?\.sessionType === "birth_time_rectification"/);
|
||||
// 原值:page 里 `activeSession?.sessionType === "birth_time_rectification"`
|
||||
// 新值:Home 读 `composerLocksAsRectification(activeSession, sessions)`,类型判断在守卫 `session?.sessionType === "birth_time_rectification"`
|
||||
// 原因:BUG-924/935 把「这是不是校正会话」收到守卫,卡片仍只在 `rectificationSurfaceOpen` 里渲染。
|
||||
assert.match(source, /composerLocksAsRectification\(activeSession, sessions\)/);
|
||||
assert.match(guard, /session\?\.sessionType === "birth_time_rectification"/);
|
||||
assert.match(source, /session_type:\s*session\.sessionType/);
|
||||
assert.match(source, /rectification_case_id:\s*session\.rectificationCaseId/);
|
||||
assert.doesNotMatch(source, /这个会话保存了生时校正入口|恢复生时校正<\/button>/);
|
||||
|
||||
@@ -105,7 +105,11 @@ test("tab-local pending ids drive strict bootstrap recovery before the global fa
|
||||
);
|
||||
|
||||
assert.match(bootstrap, /readStoredPendingConsultation\([\s\S]*pendingConsultationStorageKey[\s\S]*nextSessions\.map\(\(session\) => session\.id\)/);
|
||||
assert.match(bootstrap, /if \(!storedPending && sessionStorage\.getItem\(pendingConsultationStorageKey\)\) \{\s*sessionStorage\.removeItem\(pendingConsultationStorageKey\)/);
|
||||
// 原值:`if (!storedPending && sessionStorage.getItem(...)) { sessionStorage.removeItem(...) }`
|
||||
// 新值:`if (!storedPending) sessionStorage.removeItem(...)`,读存储前先 `dropRectificationStoredPending`
|
||||
// 原因:校正会话上的 pending 不得进普通咨询恢复;无 pending 时直接清 key,不必再 getItem。
|
||||
assert.match(bootstrap, /dropRectificationStoredPending\([\s\S]*readStoredPendingConsultation/);
|
||||
assert.match(bootstrap, /if \(!storedPending\) sessionStorage\.removeItem\(pendingConsultationStorageKey\)/);
|
||||
assert.ok(bootstrap.indexOf("if (storedPending)") < bootstrap.indexOf("fetchActiveConsultationStatus(controller.signal)"));
|
||||
assert.match(bootstrap, /if \(storedPending\) \{[\s\S]*fetchConsultationStatus\([\s\S]*storedPending\.sessionId,[\s\S]*storedPending\.requestId,[\s\S]*\} else \{[\s\S]*fetchActiveConsultationStatus/);
|
||||
assert.match(bootstrap, /status\.status === "reserved"[\s\S]*reservedConsultation = status;[\s\S]*else \{[\s\S]*sessionStorage\.removeItem\(pendingConsultationStorageKey\)/);
|
||||
|
||||
Reference in New Issue
Block a user