dsh-unlag 1.9.102 → 1.9.103

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-unlag",
3
- "version": "1.9.102",
3
+ "version": "1.9.103",
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",
@@ -193,6 +193,35 @@ const pressGate = await probe.prepareInterface().catch((error) => String(error?.
193
193
  const pressPath = pressGate === null
194
194
  ? { ready: true }
195
195
  : { ready: false, held: pressGate === 'blocked' ? `blocked:${probe.startupHoldReason() ?? 'unknown'}` : pressGate }
196
+ // The same judgement over the same rows, asked of the running host directly. A check that always
197
+ // says ok would prove nothing, so one row is pointed at a file no plugin serves: the real answer
198
+ // has to turn that down. The smoke never presses anything either way.
199
+ const verifyWith = async (askRows) => {
200
+ const reply = await fetch(`${HOST}/dsh-unlag/verify`, {
201
+ method: 'POST',
202
+ headers: { 'x-dsh-unlag': '1', 'content-type': 'application/json' },
203
+ body: JSON.stringify({ rows: askRows }),
204
+ })
205
+ return reply.ok ? await reply.json().catch(() => null) : null
206
+ }
207
+ // The host side takes the script addresses a document would request, one per row.
208
+ const addressesOf = (askRows) =>
209
+ askRows
210
+ .filter((row) => row.kind === 'script-src' || row.kind === 'script-preload')
211
+ .map((row) => (String(row.src).startsWith('/') ? String(row.src) : `/${String(row.src)}`))
212
+ const soundRows = addressesOf(rows)
213
+ const firstBatchId = graph.entries.map((entry) => (typeof entry === 'string' ? entry : entry?.id)).find((id) => typeof id === 'string') ?? 'unknown'
214
+ const brokenRows = [...soundRows, `/plugins/${firstBatchId}/no-such-file.js?rev=0000000000ff`]
215
+ const sound = await verifyWith(soundRows).catch(() => null)
216
+ const broken = await verifyWith(brokenRows).catch(() => null)
217
+ const verifyProbe = {
218
+ sound: sound?.status ?? null,
219
+ broken: broken?.status ?? null,
220
+ refuses: broken !== null && broken.status !== 'ok',
221
+ accepts: sound?.status === 'ok',
222
+ }
223
+ const verifyHeld = verifyProbe.accepts && verifyProbe.refuses
224
+
196
225
  console.log(JSON.stringify({
197
226
  host: HOST,
198
227
  version: running.version,
@@ -202,9 +231,10 @@ console.log(JSON.stringify({
202
231
  verdict,
203
232
  holdReason: verdict ? null : probe.startupHoldReason(),
204
233
  pressPath,
234
+ verify: verifyProbe,
205
235
  shim: shimBehaviour,
206
236
  rehearsal: { ok: rehearsalOk, ...rehearsal },
207
237
  asked: requests,
208
238
  contract: Object.fromEntries(contract.map(([label, got, want]) => [label, `${got}${got === want ? '' : ` (wanted ${want})`}`])),
209
239
  }, null, 2))
210
- process.exitCode = verdict === true && contractHeld && shimHeld && rehearsalOk ? 0 : 1
240
+ process.exitCode = verdict === true && contractHeld && shimHeld && rehearsalOk && verifyHeld ? 0 : 1