dsh-unlag 1.9.79 → 1.9.80

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.
Files changed (2) hide show
  1. package/index.js +18 -2
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -1144,7 +1144,13 @@ async function currentBundleAnswer(clientModules, method, url, deadline = Date.n
1144
1144
  }
1145
1145
  }
1146
1146
  }
1147
- return (await regroupedBundleAnswer(clientModules, graph, request, deadline)) ?? survivingBundleAnswer(clientModules, graph, request, deadline)
1147
+ const regrouped = await regroupedBundleAnswer(clientModules, graph, request, deadline)
1148
+ if (regrouped !== null) return regrouped
1149
+ // What is left is the last resort: the set itself is gone and the body is a stand-in that
1150
+ // registers nothing. The check passes, and the answer says so, because a page booting that row
1151
+ // comes up without the plugin rather than failing.
1152
+ const surviving = await survivingBundleAnswer(clientModules, graph, request, deadline)
1153
+ return surviving === null ? null : { ...surviving, standIn: true }
1148
1154
  }
1149
1155
 
1150
1156
  /** Answer one stale request over the plain request/response route an app registers. */
@@ -1663,6 +1669,7 @@ export async function verifyStartupRows(graph, fetchBody, rows, budgetMs = MAX_V
1663
1669
  const bodies = []
1664
1670
  const began = Date.now()
1665
1671
  let totalBytes = 0
1672
+ let standInRows = 0
1666
1673
  for (const item of wanted) {
1667
1674
  if (Date.now() - began > budgetMs) {
1668
1675
  return { status: 'blocked', reason: 'slow', detail: 'the startup list took longer than this check waits' }
@@ -1688,6 +1695,9 @@ export async function verifyStartupRows(graph, fetchBody, rows, budgetMs = MAX_V
1688
1695
  if (!readable || response === null || response === undefined || status !== 200) {
1689
1696
  return { status: 'blocked', reason: 'missing', detail: `${item.url} answers ${readable ? String(status ?? 'nothing') : 'nothing readable'}` }
1690
1697
  }
1698
+ try {
1699
+ if (response?.standIn === true) standInRows += 1
1700
+ } catch {}
1691
1701
  let bytes = null
1692
1702
  try {
1693
1703
  bytes = Buffer.from(await response.arrayBuffer())
@@ -1742,6 +1752,7 @@ export async function verifyStartupRows(graph, fetchBody, rows, budgetMs = MAX_V
1742
1752
  revision: typeof graph?.rev === 'string' ? graph.rev : null,
1743
1753
  scripts: bodies.map((body) => ({ url: body.url, digest: body.digest, ids: body.ids })),
1744
1754
  ...(leftOut.size > 0 ? { leftOut: [...leftOut] } : {}),
1755
+ ...(standInRows > 0 ? { standInRows } : {}),
1745
1756
  }
1746
1757
  }
1747
1758
 
@@ -1757,7 +1768,9 @@ export async function verifyStartupRows(graph, fetchBody, rows, budgetMs = MAX_V
1757
1768
  export async function readStartupScript(clientModules, url) {
1758
1769
  try {
1759
1770
  const answer = await currentBundleAnswer(clientModules, 'GET', url)
1760
- if (answer !== null) return { status: 200, arrayBuffer: async () => answer.body }
1771
+ // `standIn` rides along: these bytes stand in for a plugin the set no longer has, and the check
1772
+ // says so when it passes, so the log can tell that from a body the app really serves.
1773
+ if (answer !== null) return { status: 200, standIn: answer.standIn === true, arrayBuffer: async () => answer.body }
1761
1774
  } catch (error) {
1762
1775
  // The fallback is still the right answer; the failure itself must not vanish.
1763
1776
  log(`cannot answer ${oneLine(url)} at the revision the app serves now: ${oneLine(error?.message ?? error)}; asking the app's own route`)
@@ -1892,6 +1905,9 @@ function serveButton(ctx, controller, config) {
1892
1905
  if (verdict?.status !== 'ok') {
1893
1906
  log(`a startup check refused the page: ${String(verdict?.reason ?? 'list')} (${String(verdict?.detail ?? 'no detail')})`)
1894
1907
  }
1908
+ if (typeof verdict?.standInRows === 'number' && verdict.standInRows > 0) {
1909
+ log(`a startup check passed with ${String(verdict.standInRows)} row(s) answered by a stand-in script`)
1910
+ }
1895
1911
  if (Array.isArray(verdict?.leftOut) && verdict.leftOut.length > 0) {
1896
1912
  log(`a startup row names a plugin this app no longer serves: ${verdict.leftOut.join(', ')}; the page comes up without it`)
1897
1913
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-unlag",
3
- "version": "1.9.79",
3
+ "version": "1.9.80",
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",