Skip to content

feat(lore-0147): alarm when production runs an older @x402/stellar - #191

Open
karolko9 wants to merge 10 commits into
developfrom
lore-0147-upstream-library-behind-alarm
Open

karolko9 wants to merge 10 commits into
developfrom
lore-0147-upstream-library-behind-alarm

Conversation

@karolko9

@karolko9 karolko9 commented Nov 16, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

The facilitator verifies and settles through upstream's @x402/stellar. No alarm says when production runs an older one than npm's latest: on 2026-11-16 production ran 2.28.0, while npm and develop had 2.31.0. upstream-changed (#149) stays silent, because it reads spec files, not the library.

The off-server check's 08:00 UTC run gets a library section, beside the upstream one:

08:00 UTC run
  upstream section (#149)       4 spec files at the gate's pin vs upstream main
  library section (new)
    GET /health                 -> commit production runs
    GET raw GitHub, that commit -> apps/facilitator/package.json, "@x402/stellar": "~X.Y.Z"
    GET npm @x402/stellar/latest -> version
    publish upstream_library_behind = (X.Y.Z == latest) ? 0 : 1

Both upstream alarms now read a day with no point as a breach, so upstream-silent goes:

 upstream group (off in production until 0026's deploy)
   upstream-changed          FILL(upstream_files_changed, 1) >= 1, 1 day
+  upstream-library-behind   FILL(upstream_library_behind, 1) >= 1, 1 day
-  upstream-silent           SampleCount < 1, 2 of 2 days

Both read whole UTC days (WallClockWindow): CloudWatch's default sliding 24 hours loses yesterday's 08:00 point before today's lands, and would fire and clear every morning. A day's result reaches the channel after 00:00 UTC.

Situation Before After
Production 2.28.0, npm 2.31.0 (today) silent upstream-library-behind fires
Production on npm's latest silent OK
/health has no commit, a range not ~X.Y.Z, GitHub, npm or /health down nothing upstream-library-behind fires after 00:00 UTC, the log names the read
A spec file read fails upstream-silent after 2 days upstream-changed after 00:00 UTC, the log names the file

Unchanged: the four spec files and the pin, 08:00 UTC, the 30 s deadline, the other alarms.

Evidence

  • Live read, 2026-11-16, the built runLibrary against production, GitHub and npm:
    {"msg":"watch_library","commit":"5d2e26ba…","production":"2.28.0","latest":"2.31.0"} and upstream_library_behind = 1.
  • Tests: infra 368/368, metrics-catalog 31/31, lint and prettier clean.
    • watch-library.test.ts: 1 when production asks for another version, 0 when equal; no point and watch_section_failed for a missing commit, a ^ range, npm 404 and GitHub 404.
    • alarms.test.ts: both upstream alarms are FILL(m, 1), Maximum, one day, breaching, over whole UTC days; the group holds upstream-changed and upstream-library-behind.
    • watch-handler.test.ts: the 08:00 run publishes both points; the handler refuses to start without WATCH_HEALTH_URL.
  • make check-series GROUP=upstream: lists both series, both missing until the Watch deploy.

Considered and rejected

  • A dependency bot opening PRs: it doesn't reach the alarm channel, and doesn't see a raise merged but not deployed.
  • The version from develop: it misses today's case, merged on develop and not deployed.
  • A fifth entry in upstream_files_changed: production is behind most of the time, which would hide spec changes behind one ALARM state.
  • Counting minors behind, or a rule for a new major: the question is only "same as npm's latest?".
  • A separate silence alarm for the new read: the alarm itself reads a missing day as "not confirmed up to date".
  • A 25-hour period instead of whole UTC days: the alarm would clear a day late.
  • treatMissingData: breaching alone: a breaching-only alarm missed a 3-hour halt in the Prices API (0222); the factory's FILL shape is used, with breaching for a series never written.

Merge Danger

Door: two-way

The upstream group is off in production, so merging creates and removes no alarm there. A revert restores upstream-silent.

Blast Radius: Watch Lambda

The handler now needs WATCH_HEALTH_URL, set by the Watch stack from uptime.url; a Watch deploy without this stack change would fail every run. The library section adds three GETs to the 08:00 run only.

🤖 Generated with Claude Code

karolko9 and others added 10 commits November 16, 2026 13:11
A daily read takes the commit production's /health names, the
@x402/stellar range in the facilitator's package.json at that commit,
and npm's latest, and publishes 1 when they differ. Both upstream
alarms now read a day with no point as a breach, so upstream-silent
goes.

Co-Authored-By: Claude <209825114+claude[bot]@users.noreply.github.com>
Name the URL when a body is not JSON, keep one constant for this
repo's raw URL, drop a test that only compared constants, and move
0026's criterion and 0147's decision 3 off upstream-silent.

Co-Authored-By: Claude <209825114+claude[bot]@users.noreply.github.com>
A one-day, one-period alarm is evaluated every minute on a sliding
window, which loses yesterday's 08:00 point before today's lands: both
alarms would fire and clear every morning.

Co-Authored-By: Claude <209825114+claude[bot]@users.noreply.github.com>
Co-Authored-By: Claude <209825114+claude[bot]@users.noreply.github.com>
…-library-behind-alarm

# Conflicts:
#	docs/monitoring.md
#	infra/README.md
#	infra/src/lib/alarms/upstream.ts
#	lore/1-tasks/archive/0027_FEATURE_alerts-and-metrics/notes/G-metrics.md
…failure case

The harness already answers 404 for a key that holds undefined, and
"GitHub without the file" ran the same path as "npm down".

Co-Authored-By: Claude <209825114+claude[bot]@users.noreply.github.com>
Co-Authored-By: Claude <209825114+claude[bot]@users.noreply.github.com>
…-library-behind-alarm

# Conflicts:
#	docs/monitoring.md
…-library-behind-alarm

# Conflicts:
#	docs/monitoring.md
…-library-behind-alarm

# Conflicts:
#	docs/monitoring.md

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant