修复过期断言
This commit is contained in:
@@ -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 = [
|
||||
|
||||
Reference in New Issue
Block a user