fix(#84+#86): denial stream 用 compact chunk + 补丁 42 升级 plainConfig

#84: denialStream 之前打 type:text-chunks 带 .chunks 字段,
但宿主 firstRunMemberTime 认的是 .texts —— 字段错配继续炸。
改成逐 chunk 包成 { type:"chunk", time, chunk } 走单条路径。

#86: 补丁 42 register/commitLegacy 两个 validate 前漏 plainConfig,
cosmokit volatile 字段作为 live 对象引用灌进 validate,日志爆红。
两处 replace 加 plainConfig 包裹;markers 改成 #86 新串,
再加两条升级 pattern 匹配老用户已清洗、缺 plainConfig 的产物,
确保 skipIfMarked 短路后老用户也能走升级补齐。
This commit is contained in:
叫我小杨同学 committed 2026-10-09 15:47:04 +08:00
1 parent f8de7686e9
commit 704eee142b
2 files changed
+34 -14

No files matched your search

+22 -3
View File
@@ -3817,7 +3817,7 @@ const NEW_TOOL_PATCHES = [
"\t\tthis.ensureLegacyDocument();\n" +
"\t\tconst stored = this.legacyDocument[ns];\n" +
"\t\tconst user = isPlainObject(stored) ? stored : void 0;\n" +
"\t\tconst resolved = schema(mergeLayers(options?.base, user));\n" +
"\t\tconst resolved = plainConfig(schema(mergeLayers(options?.base, user))); // [dsh-purge] #86 plainConfig before validate\n" +
"\t\toptions?.validate?.(resolved);\n" +
"\t\tconst registration = {\n" +
"\t\t\tns,\n" +
@@ -3891,7 +3891,7 @@ const NEW_TOOL_PATCHES = [
"\t\tif (registration === void 0) throw new Error(`settings namespace \"${ns}\" is not registered`);\n" +
"\t\tif (expectedRevision !== void 0 && registration.revision !== expectedRevision) throw new SettingsConflictError(ns, expectedRevision, registration.revision);\n" +
"\t\tconst user = change(registration.user);\n" +
"\t\tconst next = registration.schema(mergeLayers(registration.base, user));\n" +
"\t\tconst next = plainConfig(registration.schema(mergeLayers(registration.base, user))); // [dsh-purge] #86 plainConfig before validate\n" +
"\t\tregistration.validate?.(next);\n" +
"\t\tconst prev = registration.resolved;\n" +
"\t\tregistration.user = user;\n" +
@@ -3958,8 +3958,27 @@ const NEW_TOOL_PATCHES = [
'this.ownerContext.emit("settings/document-updated", previous.ns, revision);\n' +
'\t\t\tthis.ownerContext.emit("settings/updated", previous.ns);',
},
{
// #86 升级:老用户早期产物没过 plainConfig,volatile 字段漏进 validate。
pattern:
"\t\tconst resolved = schema(mergeLayers(options?.base, user));\n" +
"\t\toptions?.validate?.(resolved);",
replace:
"\t\tconst resolved = plainConfig(schema(mergeLayers(options?.base, user))); // [dsh-purge] #86 plainConfig before validate\n" +
"\t\toptions?.validate?.(resolved);",
},
{
// #86 升级:commitLegacy 同根问题。
pattern:
"\t\tconst next = registration.schema(mergeLayers(registration.base, user));\n" +
"\t\tregistration.validate?.(next);",
replace:
"\t\tconst next = plainConfig(registration.schema(mergeLayers(registration.base, user))); // [dsh-purge] #86 plainConfig before validate\n" +
"\t\tregistration.validate?.(next);",
},
],
markers: ["[dsh-purge] legacy settings api"],
// #86 换 marker:老用户已带 "legacy settings api",但缺 plainConfig —— 必须进 replacements 走升级。
markers: ["[dsh-purge] #86 plainConfig before validate"],
},
{
id: 45, name: "OFFICIAL_DESKTOP_UPDATE_HANDOFF", layer: "代码", layer_en: "Code",