Skip to content

feat: nrc pulsecheck (every PulseCheck operation) - #14

Closed
jansvabik wants to merge 3 commits into
mainfrom
feat/pulsecheck
Closed

jansvabik wants to merge 3 commits into
mainfrom
feat/pulsecheck

Conversation

@jansvabik

@jansvabik jansvabik commented Nov 4, 2026 •

Copy link
Copy Markdown
Member

What

nrc pulsecheck: every PulseCheck operation an organization member has, following DESIGN.md 6.1 (steps 5 to 10 and 14). Needs the backend's PulseCheck scopes for CI use (jetlio/norcube-platform-backend-mono#157); signed-in people can use it as soon as the endpoint is live. The client is generated from that PR's spec.

Commands

  • status (--fail-on critical|warning|none, default none; exit 1 with the new code unhealthy, report printed either way)
  • monitors list | get | create | update | delete | pause | resume | run; monitors bulk pause | resume | delete; monitors results list, status-changes list (alias history), stats get, availability get, certificate get, alerts get | set
  • incidents list | get | acknowledge (ack) | summary
  • channels list | get | create | update | delete | test | verify; channels deliveries list

Monitors and channels are named by id or exact name (ambiguous names are a usage error). monitors run --wait turns the synchronous check's verdict into the exit code (job_failed on critical or inconclusive; --fail-on warning; exit 7 after --wait-timeout). CI tokens: pulsecheck.read, pulsecheck.check, pulsecheck.write, and pulsecheck.channels for alert channels (not included in pulsecheck.write). Secrets: secret headers only from a file or stdin, Slack/Discord URLs only via --url-file, a webhook's signing secret only to --secret-file (0600, never overwritten, never printed), verification codes via a hidden prompt or --code-file.

Shared changes (additive)

  • apierror parses RFC 9457 problems (detail, field errors, reason; INSUFFICIENT_SCOPE → exit 5); details in -o json errors.
  • clierr.CodeUnhealthy (exit 1).
  • output.Object.Text: a fixed -o text record for objects whose fields depend on the resource.
  • Table colours for PulseCheck's status words (Up, Down, Valid, Expiring, ...).
  • New P1 verbs acknowledge, verify, summary (DESIGN.md), decision-log entry, inventory, 6.1 state.

Codegen

make codegen MONO=<backend at feat/pulsecheck-scopes> regenerates specs/pulsecheck.openapi.json and internal/api/pulsecheck byte for byte. make codegen-check against that checkout also shows drift in billing, domainradar and langsync: it is pre-existing (the committed clients match neither origin/master nor origin/staging of the backend) and left out of this PR on purpose.

Not verified against a live service

No credentials were used: everything is tested in-process against the fake backend (golden files in all four formats for every read command, command tests for every write and the key errors, commands-pulsecheck.json).

Checks

go build, go vet, go test -race ./..., go mod tidy -diff (google/uuid becomes a direct dependency), scripts/govulncheck.sh, golangci-lint v2.12.2 (0 issues), make docs DOCS=../docs (43 PulseCheck reference pages; not committed in the docs repo).

Registry entry pulsecheck (Norcube PulseCheck, audience pulsecheck,
https://pulsecheck.api.norcube.com/app/v1, spec apps/pulsecheck/docs/
app_swagger.json), so `nrc api pulsecheck`, --endpoint-url pulsecheck=...
and NORCUBE_PULSECHECK_URL work. The hand-kept tables get it too: the
config switch, the service key constant, the audience constant, `auth
token --audience pulsecheck` and the CI token audiences.

The client is generated from the spec that adds operation ids, security,
problems and x-norcube-scopes to every operation; the Status tag (the
public service status route) is excluded.

Signed-off-by: Jan Švábík <jansvabik@jansvabik.cz>
…er has

- status: open incidents, monitors by status and the ones that need
  attention; --fail-on critical|warning exits 1 with the new code
  unhealthy (the report is printed either way).
- monitors list|get|create|update|delete|pause|resume|run, bulk
  pause|resume|delete, results list, status-changes list, stats get,
  availability get, certificate get, alerts get|set. Typed flags per type
  (http, keyword, ssl, domain) or the API body with --from-file; secret
  headers only from a file or stdin; update starts from the current
  settings. Monitors are named by id or exact name. run --wait makes the
  check's verdict the exit code (job_failed, --fail-on warning).
- incidents list|get|acknowledge|summary with every API filter.
- channels list|get|create|update|delete|test|verify, deliveries list. A
  webhook's signing secret goes to --secret-file and is never printed;
  Slack and Discord URLs come from a file or stdin; verify asks for the
  code on a terminal or reads --code-file.
- Completion for monitor, channel and incident ids.

The shared error formatter reads RFC 9457 problems (detail, field errors,
reason INSUFFICIENT_SCOPE to exit 5, the rest in details).
output.Object.Text keeps -o text columns fixed for objects whose fields
depend on the resource, and tables colour PulseCheck's status words.

Tests: golden files in every format for each read command, the command
tree of the group, and command tests for every write, the usage errors
before any request, confirmations, name resolution, --wait outcomes,
secrets kept off stdout and the problem mapping.

Signed-off-by: Jan Švábík <jansvabik@jansvabik.cz>
The backend adds pulsecheck.channels: CI tokens and scoped sign-ins can
manage alert channels, send test alerts and verification codes with it,
and pulsecheck.write doesn't include it. Help text, DESIGN.md and the
changelog say so instead of calling channels person-only; the spec is
regenerated (x-norcube-scopes only, the client is unchanged), and a test
pins that a refusal naming the scope exits 5.

Signed-off-by: Jan Švábík <jansvabik@jansvabik.cz>
@jansvabik

Copy link
Copy Markdown
Member Author

Superseded by #15: PulseCheck was renamed Norcube Monitor before its first release (backend jetlio/norcube-platform-backend-mono#159), so the commands are now nrc monitor ... on branch feat/monitor. #15 carries these commits plus the rename. No pulsecheck alias, since the old name was never released.

@jansvabik jansvabik closed this Nov 4, 2026
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