Files
Pulse/internal/api
rcourtman bb7ba8de27 Add inbound push and heartbeat availability checks (Stage 2 Build) (#5057)
Adds inbound push and heartbeat availability checks (`protocol: "push"`)
for cron jobs, backups, and scheduled tasks, strictly gated behind
`availabilityPushChecks` at `stage: "build"` in
`frontend-modern/src/utils/featureReleases.json`.

### Summary
- **Feature release gate**: Registered `availabilityPushChecks` at
`stage: "build"` with no shipped guide links. Verified on a production
build that no push preset, protocol option, or wording is exposed.
- **Config and cron schedule**: Added `AvailabilityProbePush` (`push`),
interval and 5-field UTC cron schedules plus grace windows, 256-bit
base64url token generation, and encrypted persistence in
`availability_targets.enc`.
- **Monitoring and alerting**: Added local 15-second deadline
evaluation, `/start` duration measurement, explicit `/fail` handling,
push validity windows for `availability_history` and evidence envelopes,
and unified `availability_unreachable` incidents.
- **Inbound API and security**: Added token-authenticated
`GET`/`POST`/`HEAD /api/push/{token}` (supporting `/start`, `/fail`,
`?status=up|down`, `?msg=`, `?ping=`) with constant-time token
comparison, per-target and per-IP rate limiting, a 1 KiB POST body cap,
and admin-only `POST /api/availability-targets/{id}/rotate-push-token`.
- **Frontend**: Added feature-gated push preset, schedule editor,
post-create Ping URL and `curl` snippet display with copy actions,
two-step token rotation, and mobile-safe wrapping.

### Verification
- Go tests: `internal/config`, `internal/availabilityprobe`,
`internal/monitoring`, and `internal/api` (including router public-path,
auth-bypass, and route inventory tests)
- Frontend tests: `tsc --noEmit`, `AvailabilityTargetSlot.test.tsx`
(24/24), `npm run lint:feature-releases`, and production `npm run build`
- Browser verification: Verified production build hides push checks
(`1280x800`), development build creates a cron push check, ingests live
unauthenticated `curl` pings (`/start`, success, 413 oversized body, 404
unknown/revoked token, `/fail`, recovery), rotates tokens, and renders
cleanly at `1280x800` and `390x844`
(`frontend-modern/browser-verification/bf6c955c53a21415.json`).
2026-11-24 17:00:54 +00:00
..
2026-10-11 22:20:25 +01:00
2026-03-18 16:06:30 +00:00
2026-03-18 16:06:30 +00:00
2026-03-18 16:06:30 +00:00
2026-03-18 16:06:30 +00:00
2026-03-18 16:06:30 +00:00
2026-03-18 16:06:30 +00:00
2026-03-18 16:06:30 +00:00
2026-08-31 19:47:01 +01:00
2026-03-18 16:06:30 +00:00
2026-03-18 16:06:30 +00:00
2026-03-18 16:06:30 +00:00
2026-03-18 16:06:30 +00:00
2026-03-18 16:06:30 +00:00
2026-03-18 16:06:30 +00:00
2026-03-18 16:06:30 +00:00
2026-04-26 17:26:16 +01:00
2026-01-22 00:30:15 +00:00
2026-03-18 16:06:30 +00:00
2026-03-18 16:06:30 +00:00
2026-03-18 16:06:30 +00:00
2026-09-01 01:02:17 +01:00

Internal API Package

This directory contains the API server implementation for Pulse.

Important Note About frontend-modern/

The frontend-modern/ subdirectory that appears here is:

  • AUTO-GENERATED during builds
  • NOT the source code - just a build artifact
  • IN .gitignore - never committed
  • REQUIRED BY GO - The embed directive needs it here

Frontend Development Location

👉 Edit frontend files at: ${PULSE_REPOS_DIR}/pulse/frontend-modern/src/

Why This Structure?

Go's //go:embed directive has limitations:

  1. Cannot use ../ paths to access parent directories
  2. Cannot follow symbolic links
  3. Must embed files within the Go module

This is a known Go limitation and our structure works around it.