修复过期断言
Project CI / Frontend tests (pull_request) Failing after 31s
Project CI / Repository checks (pull_request) Failing after 53s
Project CI / Backend tests (pull_request) Successful in 4m38s
Project CI / Native shell tests (pull_request) Successful in 10m47s

This commit is contained in:
2026-07-27 07:46:42 +00:00
parent c2d2eb7ea9
commit 95b8197235
2 changed files with 41 additions and 6 deletions
+40 -6
View File
@@ -26,6 +26,18 @@ const aiGameCreatorShellAppSource = fs.readFileSync(
'apps/ai-game-creator-shell/src/App.tsx',
'utf8',
);
const aiGameCreatorShellAppModelSource = fs.readFileSync(
'apps/ai-game-creator-shell/src/features/app-shell/model.ts',
'utf8',
);
const aiGameCreatorShellProjectWorkspaceChatPaneSource = fs.readFileSync(
'apps/ai-game-creator-shell/src/features/project-workspace/ProjectWorkspaceChatPane.tsx',
'utf8',
);
const aiGameCreatorShellDeveloperProjectPanelsSource = fs.readFileSync(
'apps/ai-game-creator-shell/src/features/project-workspace/DeveloperProjectPanels.tsx',
'utf8',
);
const aiGameCreatorProjectDevelopmentSource = fs.readFileSync(
'apps/ai-game-creator-shell/src/view/project-development/index.tsx',
'utf8',
@@ -1937,31 +1949,53 @@ function assertAiGameCreatorShellUserDevBoundary() {
'function isDeveloperMode()',
'if (!import.meta.env.DEV)',
"return params.has('dev') || window.location.hash === '#dev';",
]) {
if (!aiGameCreatorShellAppModelSource.includes(snippet)) {
throw new Error(
`AI game creator developer mode boundary drifted: missing ${snippet}`,
);
}
}
for (const snippet of [
'projectSupervisorOnly ? false : isDeveloperMode()',
"{devMode ? (",
'className="developer-pane"',
'className="chat-pane"',
]) {
if (!aiGameCreatorShellAppSource.includes(snippet)) {
throw new Error(`AI game creator user/dev UI boundary drifted: missing ${snippet}`);
}
}
if (
!aiGameCreatorShellAppSource.includes('<ProjectWorkspaceChatPane') ||
!aiGameCreatorShellProjectWorkspaceChatPaneSource.includes(
'className="chat-pane"',
)
) {
throw new Error('AI game creator user chat pane boundary drifted');
}
const previewFrameIndexes = [
...aiGameCreatorShellAppSource.matchAll(/<iframe\b/g),
const developerProjectPanelIndexes = [
...aiGameCreatorShellAppSource.matchAll(/<DeveloperProjectPanels\b/g),
].map((match) => match.index ?? -1);
const previewFrameCount = [
...aiGameCreatorShellDeveloperProjectPanelsSource.matchAll(/<iframe\b/g),
].length;
const devModeBranchIndex = aiGameCreatorShellAppSource.indexOf('{devMode ? (');
const developerPaneIndex = aiGameCreatorShellAppSource.indexOf('className="developer-pane"');
if (previewFrameIndexes.length !== 1) {
if (previewFrameCount !== 1) {
throw new Error('AI game creator developer pane preview frame count drifted');
}
if (developerProjectPanelIndexes.length !== 1) {
throw new Error('AI game creator developer project panels mount count drifted');
}
if (
devModeBranchIndex < 0 ||
developerPaneIndex < 0 ||
previewFrameIndexes.some(
developerProjectPanelIndexes.some(
(index) => index < devModeBranchIndex || index < developerPaneIndex,
)
) {
throw new Error('AI game creator preview iframe must stay inside the dev-only pane');
throw new Error('AI game creator preview panels must stay inside the dev-only pane');
}
const clientPreviewFrameCount = [