@reddoorla/maintenance 0.54.4 → 0.55.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.
package/dist/index.d.ts CHANGED
@@ -272,6 +272,11 @@ type WebsiteRow = {
272
272
  /** Explicit Search Console property for this site (`sc-domain:...` or `https://.../`).
273
273
  * Null = auto-resolve from the SA's visible properties by host. */
274
274
  searchConsoleProperty: string | null;
275
+ /** ISO timestamp of the last draft run where THIS site's GA/Search enrichment
276
+ * ERRORED (vs a legitimate "not configured" skip). Set by drafting on a soft-fail,
277
+ * cleared (null) on a clean enrichment, so the per-site analytics-failure signal
278
+ * self-heals. Null when the operator-added `Analytics soft-fail at` column is absent. */
279
+ analyticsSoftFailAt: string | null;
275
280
  /** GitHub repo identity as `owner/repo`. Null = no git wiring → self-update ops skip
276
281
  * (or, for local runs, fall back to the checkout's origin remote). */
277
282
  gitRepo: string | null;
@@ -693,7 +698,7 @@ type AttentionStatus = "new" | "worse" | "standing";
693
698
  type AttentionItem = {
694
699
  /** Stable identity for diffing: `vuln:<siteId>`, `delivery:<reportId>`. */
695
700
  key: string;
696
- kind: "vuln" | "delivery" | "renovate" | "lighthouse" | "ci";
701
+ kind: "vuln" | "delivery" | "renovate" | "lighthouse" | "ci" | "analytics";
697
702
  /** Grouping key in the (component-3) render. */
698
703
  siteName: string;
699
704
  title: string;
package/dist/index.js CHANGED
@@ -3024,6 +3024,7 @@ function mapRow(rec) {
3024
3024
  ga4PropertyId: f["GA4 property ID"] ?? null,
3025
3025
  searchQuery: f["Search query"] ?? null,
3026
3026
  searchConsoleProperty: f["Search Console property"] ?? null,
3027
+ analyticsSoftFailAt: f["Analytics soft-fail at"] ?? null,
3027
3028
  gitRepo: f["Git repo"] ?? null,
3028
3029
  reportRecipientsTo: f["Report recipients (To)"] ?? null,
3029
3030
  reportRecipientsCc: f["Report recipients (CC)"] ?? null,
@@ -3106,6 +3107,10 @@ function parseSecurityAdvisories(raw) {
3106
3107
  if (!Array.isArray(parsed)) return null;
3107
3108
  return parsed.map(normalizeSecurityAdvisory).filter((a) => a !== null);
3108
3109
  }
3110
+ async function updateAnalyticsHealth(base, recordId, at) {
3111
+ const fields = { "Analytics soft-fail at": at };
3112
+ await base(WEBSITES_TABLE).update([{ id: recordId, fields }]);
3113
+ }
3109
3114
  async function updateLaunched(base, recordId, at) {
3110
3115
  const fields = { Status: "maintenance", "Launched at": at };
3111
3116
  await base(WEBSITES_TABLE).update([{ id: recordId, fields }]);
@@ -4247,6 +4252,17 @@ async function draftReportForSite(base, siteRow, reportType, options = {}) {
4247
4252
  return { reportRow: null, htmlPath: path, html, softFailures, queued: null, supersededIds: [] };
4248
4253
  }
4249
4254
  if (base === null) throw new Error("base required when previewOnly=false");
4255
+ if (readGaConfig() !== null && Boolean(siteRow.ga4PropertyId || siteRow.searchQuery)) {
4256
+ try {
4257
+ await updateAnalyticsHealth(
4258
+ base,
4259
+ siteRow.id,
4260
+ softFailures.length > 0 ? today.toISOString() : null
4261
+ );
4262
+ } catch (e) {
4263
+ console.warn(`\u26A0 analytics-health write skipped for ${siteRow.name}: ${e.message}`);
4264
+ }
4265
+ }
4250
4266
  if (options.completeRowId) {
4251
4267
  await uploadDraftHtml(options.completeRowId, slug, periodEnd, html);
4252
4268
  const outcome2 = await queueDraft(base, {