mirror of
https://github.com/Youzini-afk/ST-Bionic-Memory-Ecology.git
synced 2026-05-15 22:30:38 +08:00
fix: harden opfs capability recovery
This commit is contained in:
@@ -2186,6 +2186,47 @@ result = {
|
||||
assert.equal(plan.reasons.includes("resolved-store-mismatch"), true);
|
||||
}
|
||||
|
||||
{
|
||||
const harness = await createGraphPersistenceHarness({
|
||||
chatId: "chat-panel-open-capability-retry",
|
||||
globalChatId: "chat-panel-open-capability-retry",
|
||||
chatMetadata: {
|
||||
integrity: "chat-panel-open-capability-retry-integrity",
|
||||
},
|
||||
});
|
||||
harness.runtimeContext.extension_settings[MODULE_NAME] = {
|
||||
graphLocalStorageMode: "auto",
|
||||
};
|
||||
harness.api.setLocalStoreCapabilitySnapshot({
|
||||
checked: true,
|
||||
checkedAt: Date.now(),
|
||||
opfsAvailable: false,
|
||||
reason: "UnknownError: transient-opfs-init-failure",
|
||||
});
|
||||
harness.api.setGraphPersistenceState({
|
||||
loadState: "loaded",
|
||||
chatId: "chat-panel-open-capability-retry",
|
||||
reason: "healthy",
|
||||
dbReady: true,
|
||||
writesBlocked: false,
|
||||
pendingPersist: false,
|
||||
indexedDbLastError: "",
|
||||
resolvedLocalStore: "indexeddb:indexeddb",
|
||||
storagePrimary: "indexeddb",
|
||||
storageMode: "indexeddb",
|
||||
});
|
||||
|
||||
const plan = harness.api.buildPanelOpenLocalStoreRefreshPlan();
|
||||
|
||||
assert.equal(plan.shouldRefresh, true);
|
||||
assert.equal(plan.forceCapabilityRefresh, true);
|
||||
assert.equal(
|
||||
plan.reasons.includes("capability-retryable-failure"),
|
||||
true,
|
||||
"可恢复的 OPFS 探测失败应在面板打开时触发重新探测",
|
||||
);
|
||||
}
|
||||
|
||||
{
|
||||
const harness = await createGraphPersistenceHarness({
|
||||
chatId: "chat-luker-panel-open",
|
||||
|
||||
Reference in New Issue
Block a user