dsh-unlag 1.9.97 → 1.9.98
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/package.json +1 -1
- package/scripts/live-smoke.mjs +16 -1
package/README.md
CHANGED
|
@@ -72,7 +72,7 @@ dsh plugin install dsh-unlag
|
|
|
72
72
|
## 排错
|
|
73
73
|
|
|
74
74
|
- 日志:`~/.dsh/unlag-reload.log`,换代码/跳过/被拦各一行,含原因。
|
|
75
|
-
- 演练:`npm run live-smoke` 不按按钮,只按当前启动清单把下一个文档要加载的字节在沙箱里跑一遍,看每个插件是否都注册(`rehearsal.ok
|
|
75
|
+
- 演练:`npm run live-smoke` 不按按钮,只按当前启动清单把下一个文档要加载的字节在沙箱里跑一遍,看每个插件是否都注册(`rehearsal.ok`),并当场核对两件事:写死的旧版本号仍然拿得到现在的字节(`shim.staleRev`),按下前会做的那个判断此刻是否放行(`pressPath`)——它证明的是「按下去之后新页面能起来、按钮现在真的可按」,不换任何代码。
|
|
76
76
|
- 状态:`GET /dsh-unlag/state` → `{"version":"<当前版本>","code":"<index.js 写入时间>","plugins":true,"page":true,"shim":{...}}`。`code` 用来分清「版本号没刷」和「旧代码真的还在跑」。
|
|
77
77
|
- 重建后的日志带起页面代次:`interface rebuilt; the page runs the plugins as served now (page <rev>)`,据此判断新文档加载的是新脚本还是旧脚本。
|
|
78
78
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-unlag",
|
|
3
|
-
"version": "1.9.
|
|
3
|
+
"version": "1.9.98",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A press applies plugin edits right away and brings a laggy interface back; automatic reloading stays off unless you turn it on, so the press is the only trigger, and nothing restarts.",
|
|
6
6
|
"license": "MIT",
|
package/scripts/live-smoke.mjs
CHANGED
|
@@ -89,6 +89,20 @@ contract.push(['reload without header', await status('/dsh-unlag/reload', { meth
|
|
|
89
89
|
contract.push(['verify without header', await status('/dsh-unlag/verify', { method: 'POST' }), 403])
|
|
90
90
|
const contractHeld = contract.every(([, got, want]) => got === want)
|
|
91
91
|
|
|
92
|
+
// The shim's one promise, asked of the running app: a document that replays the startup list the
|
|
93
|
+
// shell froze must be able to load every script in it, so a fabricated revision still answers the
|
|
94
|
+
// current bytes. A 404 here is the crash this plugin exists to prevent; a plugin the set no longer
|
|
95
|
+
// lists answers nothing, which is the module table's own answer and is left as it is.
|
|
96
|
+
const staleUrl = `/${stale(graph.batches[0]?.url ?? '')}`
|
|
97
|
+
const staleReply = await fetch(`${HOST}${staleUrl}`, { headers: { 'x-dsh-unlag': '1' } }).catch(() => null)
|
|
98
|
+
const staleBytes = staleReply === null ? 0 : (await staleReply.arrayBuffer().catch(() => new ArrayBuffer(0))).byteLength
|
|
99
|
+
const oldestReply = await fetch(`${HOST}/plugins/not-a-plugin/client.js?rev=0000000000ff`, { headers: { 'x-dsh-unlag': '1' } }).catch(() => null)
|
|
100
|
+
const shimBehaviour = {
|
|
101
|
+
staleRev: { status: staleReply?.status ?? 0, bytes: staleBytes },
|
|
102
|
+
unknownPlugin: oldestReply?.status ?? 0,
|
|
103
|
+
}
|
|
104
|
+
const shimHeld = shimBehaviour.staleRev.status === 200 && shimBehaviour.staleRev.bytes > 0 && shimBehaviour.unknownPlugin === 404
|
|
105
|
+
|
|
92
106
|
// Rehearsal, not a press: run the bytes the next document would load for the startup list the
|
|
93
107
|
// desktop shell froze, with the same loader surface a document gives them, and see whether every
|
|
94
108
|
// plugin in the list registers. Nothing is swapped here; when this passes, the press's own page
|
|
@@ -188,8 +202,9 @@ console.log(JSON.stringify({
|
|
|
188
202
|
verdict,
|
|
189
203
|
holdReason: verdict ? null : probe.startupHoldReason(),
|
|
190
204
|
pressPath,
|
|
205
|
+
shim: shimBehaviour,
|
|
191
206
|
rehearsal: { ok: rehearsalOk, ...rehearsal },
|
|
192
207
|
asked: requests,
|
|
193
208
|
contract: Object.fromEntries(contract.map(([label, got, want]) => [label, `${got}${got === want ? '' : ` (wanted ${want})`}`])),
|
|
194
209
|
}, null, 2))
|
|
195
|
-
process.exitCode = verdict === true && contractHeld && rehearsalOk ? 0 : 1
|
|
210
|
+
process.exitCode = verdict === true && contractHeld && shimHeld && rehearsalOk ? 0 : 1
|