@reddoorla/maintenance 0.78.0 → 0.79.0

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.
@@ -10,6 +10,9 @@ import {
10
10
  import {
11
11
  defaultSpawn
12
12
  } from "./chunk-HVOOCK6L.js";
13
+ import {
14
+ INGEST_TIMEOUT_MS
15
+ } from "./chunk-A3WDWNN5.js";
13
16
  import {
14
17
  siteLabel
15
18
  } from "./chunk-XXTZBPUY.js";
@@ -2024,6 +2027,18 @@ async function smokeAudit(ctx) {
2024
2027
  // src/audits/form-e2e.ts
2025
2028
  var CF_TEST_SITEKEY = "1x00000000000000000000AA";
2026
2029
  var CONTACT_PATHS = ["/contact", "/"];
2030
+ var TESTMODE_SKIPPED_WORK_MS = 1e3;
2031
+ var BUDGET_WARN_RATIO = 0.5;
2032
+ function projectRealSubmissionMs(probeElapsedMs) {
2033
+ return probeElapsedMs + TESTMODE_SKIPPED_WORK_MS;
2034
+ }
2035
+ function isIngestBudgetThin(probeElapsedMs, budgetMs = INGEST_TIMEOUT_MS) {
2036
+ return projectRealSubmissionMs(probeElapsedMs) > budgetMs * BUDGET_WARN_RATIO;
2037
+ }
2038
+ function budgetThinSummary(probeElapsedMs) {
2039
+ const s = (ms) => `${(ms / 1e3).toFixed(1)}s`;
2040
+ return `BUDGET_THIN: probe ${s(probeElapsedMs)} + ~${s(TESTMODE_SKIPPED_WORK_MS)} of sink work the probe skips \u2248 ${s(projectRealSubmissionMs(probeElapsedMs))} projected against a ${s(INGEST_TIMEOUT_MS)} abort budget \u2014 a real submission may be reported to the visitor as failed while central still captures the lead`;
2041
+ }
2027
2042
  var LIVE_ENV_VAR = "REDDOOR_FORM_E2E_LIVE";
2028
2043
  function liveRunnerEnabled(env = process.env) {
2029
2044
  return env[LIVE_ENV_VAR] === "1" || env[LIVE_ENV_VAR] === "true";
@@ -2069,12 +2084,23 @@ async function formE2eAudit(ctx) {
2069
2084
  };
2070
2085
  }
2071
2086
  const ok = outcome.success ? "pass" : "fail";
2087
+ const details = { ok, formPresent: true, checkedAt };
2088
+ if (!outcome.success) {
2089
+ return {
2090
+ audit: "form-e2e",
2091
+ site: label,
2092
+ status: "warn",
2093
+ summary: `form-e2e: synthetic submission failed${outcome.detail ? ` \u2014 ${outcome.detail}` : ""}`,
2094
+ details
2095
+ };
2096
+ }
2097
+ const thin = typeof outcome.elapsedMs === "number" && isIngestBudgetThin(outcome.elapsedMs) ? budgetThinSummary(outcome.elapsedMs) : null;
2072
2098
  return {
2073
2099
  audit: "form-e2e",
2074
2100
  site: label,
2075
- status: outcome.success ? "pass" : "warn",
2076
- summary: outcome.success ? "form-e2e: synthetic submission succeeded" : `form-e2e: synthetic submission failed${outcome.detail ? ` \u2014 ${outcome.detail}` : ""}`,
2077
- details: { ok, formPresent: true, checkedAt }
2101
+ status: thin ? "warn" : "pass",
2102
+ summary: thin ? `form-e2e: synthetic submission succeeded \u2014 ${thin}` : "form-e2e: synthetic submission succeeded",
2103
+ details
2078
2104
  };
2079
2105
  } finally {
2080
2106
  await runner.close?.();
@@ -2154,9 +2180,11 @@ async function defaultFormRunner() {
2154
2180
  const postResponse = page.waitForResponse((r) => r.request().method() === "POST", {
2155
2181
  timeout: PAGE_TIMEOUT_MS2
2156
2182
  }).catch(() => null);
2183
+ const startedAt = Date.now();
2157
2184
  await page.locator('button[type="submit"], input[type="submit"]').first().click({ timeout: PAGE_TIMEOUT_MS2 });
2158
2185
  const ok = await page.locator('[role="status"]').first().waitFor({ state: "visible", timeout: PAGE_TIMEOUT_MS2 }).then(() => true).catch(() => false);
2159
- if (ok) return { formPresent: true, success: true };
2186
+ const elapsedMs = Date.now() - startedAt;
2187
+ if (ok) return { formPresent: true, success: true, elapsedMs };
2160
2188
  const actionResp = await postResponse;
2161
2189
  const alertText = await page.locator('[role="alert"]').first().textContent({ timeout: 1e3 }).catch(() => null);
2162
2190
  const respBit = actionResp ? `POST ${actionResp.status()}${actionResp.status() >= 400 ? ` ${(await actionResp.text().catch(() => "")).slice(0, 80)}` : ""}` : "no POST observed";
@@ -2232,4 +2260,4 @@ export {
2232
2260
  runAudits,
2233
2261
  runAuditsAcross
2234
2262
  };
2235
- //# sourceMappingURL=chunk-YSPA5AUT.js.map
2263
+ //# sourceMappingURL=chunk-3LWKIKZ2.js.map