继续收敛资源布局错误正文
把布局读写失败的脱敏底层原因附到工作台提示 更新资源布局回归断言和错误展示记录
This commit is contained in:
+10
-15
@@ -34,13 +34,7 @@ function describeResourceCanvasLayoutFailure(error: unknown) {
|
||||
return visibleClientErrorMessage(error).slice(0, 400);
|
||||
}
|
||||
|
||||
type LayoutNotice =
|
||||
| ''
|
||||
| '布局已保存'
|
||||
| '布局读取失败,已使用当前会话布局'
|
||||
| '布局保存失败,已保留当前会话布局'
|
||||
| '布局保存失败,已恢复上次布局'
|
||||
| '布局已在其他窗口更新';
|
||||
type LayoutNotice = string;
|
||||
|
||||
type LayoutScope = {
|
||||
key: string;
|
||||
@@ -762,8 +756,8 @@ export function useProjectResourceCanvasLayout({
|
||||
}
|
||||
setNotice(
|
||||
intent.kind === 'resources'
|
||||
? '布局保存失败,已保留当前会话布局'
|
||||
: '布局保存失败,已恢复上次布局',
|
||||
? '布局保存失败:布局状态无效;已保留当前会话布局'
|
||||
: '布局保存失败:布局状态无效;已恢复上次布局',
|
||||
);
|
||||
void Promise.resolve().then(() => pumpWritesRef.current());
|
||||
return;
|
||||
@@ -867,9 +861,8 @@ export function useProjectResourceCanvasLayout({
|
||||
}
|
||||
// 原因先落一行脱敏日志:下面那条提示在部分分支里是刻意不显示的,
|
||||
// 若不记日志,这种"用户看不到、排障也看不到"的失败就完全消失。
|
||||
console.warn(
|
||||
`[resource-canvas-layout] 布局保存失败:${describeResourceCanvasLayoutFailure(error)}`,
|
||||
);
|
||||
const failureDetail = describeResourceCanvasLayoutFailure(error);
|
||||
console.warn(`[resource-canvas-layout] 布局保存失败:${failureDetail}`);
|
||||
removeWriteIntent(intent);
|
||||
rebuildOptimisticLayout(
|
||||
currentScope.epoch,
|
||||
@@ -885,8 +878,8 @@ export function useProjectResourceCanvasLayout({
|
||||
) {
|
||||
setNotice(
|
||||
intent.kind === 'resources'
|
||||
? '布局保存失败,已保留当前会话布局'
|
||||
: '布局保存失败,已恢复上次布局',
|
||||
? `布局保存失败:${failureDetail};已保留当前会话布局`
|
||||
: `布局保存失败:${failureDetail};已恢复上次布局`,
|
||||
);
|
||||
}
|
||||
})
|
||||
@@ -1031,7 +1024,9 @@ export function useProjectResourceCanvasLayout({
|
||||
epoch,
|
||||
automaticPositionPolicy(rederiveAutomaticPositions),
|
||||
);
|
||||
setNotice('布局读取失败,已使用当前会话布局');
|
||||
setNotice(
|
||||
`布局读取失败:${describeResourceCanvasLayoutFailure(error)};已使用当前会话布局`,
|
||||
);
|
||||
pumpWritesRef.current();
|
||||
});
|
||||
return () => {
|
||||
|
||||
@@ -5870,7 +5870,7 @@ export function registerProjectWorkbenchFoundationTests() {
|
||||
);
|
||||
|
||||
expect(
|
||||
await screen.findByText('布局保存失败,已保留当前会话布局'),
|
||||
await screen.findByText(/布局保存失败:.*disk full.*已保留当前会话布局/),
|
||||
).not.toBeNull();
|
||||
await openResourceBookCategory('文档');
|
||||
expect(
|
||||
|
||||
@@ -442,7 +442,9 @@ describe('useProjectResourceCanvasLayout', () => {
|
||||
);
|
||||
|
||||
await waitFor(() =>
|
||||
expect(result.current.notice).toBe('布局读取失败,已使用当前会话布局'),
|
||||
expect(result.current.notice).toContain(
|
||||
'布局读取失败:layout response revision or coordinates are invalid',
|
||||
),
|
||||
);
|
||||
expect(
|
||||
invoke.mock.calls.filter(
|
||||
@@ -490,7 +492,10 @@ describe('useProjectResourceCanvasLayout', () => {
|
||||
act(() => result.current.commitPosition('resource-a', 'document', 100, 30));
|
||||
|
||||
await waitFor(() =>
|
||||
expect(result.current.notice).toBe('布局保存失败,已恢复上次布局'),
|
||||
expect(result.current.notice).toContain('布局保存失败:'),
|
||||
);
|
||||
expect(result.current.notice).toContain(
|
||||
'layout response revision or coordinates are invalid',
|
||||
);
|
||||
expect(result.current.layout.positions[0]).toMatchObject({ x: 10, y: 20 });
|
||||
expect(result.current.saving).toBe(false);
|
||||
@@ -1519,7 +1524,10 @@ describe('布局落盘 / 读盘失败的原因不再被吞掉', () => {
|
||||
|
||||
act(() => result.current.commitPosition('resource-a', 'document', 100, 30));
|
||||
await waitFor(() =>
|
||||
expect(result.current.notice).toBe('布局保存失败,已恢复上次布局'),
|
||||
expect(result.current.notice).toContain('布局保存失败:'),
|
||||
);
|
||||
expect(result.current.notice).toContain(
|
||||
'layout response revision or coordinates are invalid',
|
||||
);
|
||||
|
||||
// 用户可见文案保持原样(不把内部原因塞进面板),原因落到日志里可查。
|
||||
@@ -1556,8 +1564,9 @@ describe('布局落盘 / 读盘失败的原因不再被吞掉', () => {
|
||||
}),
|
||||
);
|
||||
await waitFor(() =>
|
||||
expect(result.current.notice).toBe('布局读取失败,已使用当前会话布局'),
|
||||
expect(result.current.notice).toContain('布局读取失败:'),
|
||||
);
|
||||
expect(result.current.notice).toContain('读取布局失败');
|
||||
|
||||
const logged = warnMessages(warn).filter((message) =>
|
||||
message.includes('[resource-canvas-layout] 布局读取失败'),
|
||||
@@ -2564,8 +2573,9 @@ describe('资源画布整理与批量坐标写入', () => {
|
||||
act(() => result.current.organizeNow(['document']));
|
||||
|
||||
await waitFor(() =>
|
||||
expect(result.current.notice).toBe('布局保存失败,已保留当前会话布局'),
|
||||
expect(result.current.notice).toContain('布局保存失败:'),
|
||||
);
|
||||
expect(result.current.notice).toContain('layout write rejected');
|
||||
expect(
|
||||
invoke.mock.calls.filter(
|
||||
([command]) =>
|
||||
|
||||
@@ -75,3 +75,4 @@ DirectProject 回合失败在确认不是客户端内部不可归类故障时,
|
||||
- 前端继续实测发现预览活体复用的 IPC / 权限拒绝会被当成“没有活体”并静默重启,资源生成事件订阅失败也只回退轮询;现在两条回退仍保留,但分别把复用失败正文附到重启结果、把订阅失败正文附到任务阶段。预览与生成队列定向测试 25 项通过。
|
||||
- 继续扫前端外围又发现 Direct 回合后的清单刷新、资源卡片预览未知错误、UI 编辑器单图预览读取失败仍会静默或使用无因固定句;现分别进入运行错误出口、保留脱敏后的预览错误正文并在编辑器状态提示中显示。
|
||||
- 资源依赖图读取失败原先只切到 fallback 布局状态,用户看不到 IPC/权限正文;现把安全错误保存到状态并在依赖画布内联显示。
|
||||
- 资源画布布局读写失败原先只把原因写日志、界面仍显示固定“布局失败”;现把脱敏后的 revision/IPC/权限/磁盘正文附到读取与保存提示,原有回退布局行为不变。
|
||||
|
||||
Reference in New Issue
Block a user