feat(alerts): integrate SAP Alert Notification via cds-alert-notification plugin (dark) - #1457
Conversation
…t-notification plugin
…js (#task-6) Add static `import * as alerting from './alerting.js'` alongside existing imports (ESM file). In the dispatch catch block, after the existing console.error, add a non-blocking `void alerting.raise(...)` with the RebuildDispatchFailed envelope (eventType, severity ERROR, category ALERT, resource rebuild-dispatch/service). Existing no-rethrow semantics unchanged. Append envelope-shape test (7th) to test/unit/alerting.test.js.
- Add tutorials-alert-notification managed-service resource (alert-notification/standard) - Bind to tutorials-srv requires list - srv-qa cp-list: alerting.js added (reachable via content-publish-session.js import graph per Task 3 audit) - Version bump 1.9.0 → 1.10.0 (minor: new feature)
Adds "Alerting (SAP Alert Notification)" section to observability.md: three wired failure paths (PublishRejected/ScheduledJobFailed/ RebuildDispatchFailed), the ALERTS_ENABLED flag, plugin/config block, and a 6-step operator post-merge checklist covering plugin-install caveat, MTA deploy, email-action binding, flag enable, live-verify, and Node floor confirmation. Also registers ALERTS_ENABLED in the feature-flags registry (srv/lib/feature-flags/registry.js) to satisfy the drift test that scans for any _ENABLED env var reads in srv/ without a matching entry.
|
…git-dep - package.json dep: git+github.tools.sap URL → @sap-tutorials/cds-alert-notification ^1.0.0 - cds.requires.alerts.impl → @sap-tutorials scope - add root .npmrc: @sap-tutorials scope → GitHub Packages + NODE_AUTH_TOKEN - observability doc: rewrite dependency section + operator checklist for GH Packages auth (App token/PACKAGES_READ_TOKEN), drop stale git-dep/allow-git narrative
Update: relocated plugin to
|
…1.0.0 is published to GitHub Packages
…read); drop App-token step The 4 npm-ci check jobs auth to the private @sap-tutorials package with the built-in GITHUB_TOKEN — the principal the package's repo-access grant covers (the App installation token was refused: 'installation not allowed to read organization package'). App-token step removed from these 4 only; content-drift /rebuild/deploy workflows keep their App token for org tutorial-fetch.
…ock.json [skip ci]
api-docs-drift (the 'check' job), e2e-coverage-nudge, schema-drift-check all root-npm-ci the alerts dep but lacked packages:read + NODE_AUTH_TOKEN. Same built-in-GITHUB_TOKEN pattern as the other 4 check jobs. (Deploy + nightly workflows that npm ci deferred to a separate pass.)
Summary
Wires the reusable
@sap-devrel/cds-alert-notificationplugin (v1.0.0) into tutorials-ims to push email alerts on three operational failures that today are pull-only (metrics/logs/PipelineLog — nobody is told). Ships dark behindALERTS_ENABLED(default off); no behavior change until an operator provisions + flips it.What's alerted
PublishRejectedcontent-publish-session.jscommitSessionScheduledJobFailedscheduler.jsrunWithLockresourceName)RebuildDispatchFailedrebuild-trigger.jsdispatch catchHow it's built
srv/lib/alerting.js— a fail-openraise()helper mirroringmetrics.js(namespace import, never throws,ALERTS_ENABLEDkill-switch). Each hook is a non-blockingvoid alerting.raise({...})sitting beside the existing signal — never replacing it, never able to break the path it watches (doubly fail-open: helper try/catch + the plugin itself never throws).package.json— plugin git-dep,cds.requires.alertsblock (email channel, ERROR-severity routing, 5-min dedup),engines.nodetightened to>=22.12(plugin floor)..deploy/mta.yaml—alert-notificationmanaged-service resource +tutorials-srvbinding +alerting.jsadded to thesrv-qacp-list (it's transitively imported viacontent-publish-session.js) + minor bump1.9.0→1.10.0.srv/lib/feature-flags/registry.js—ALERTS_ENABLEDdescriptor (true-enables, defaultfalse) to satisfy the repo's flag-drift test; polarity preserves the dark-launch default.Tests
7 new unit tests (
test/unit/alerting.test.js), all green: helper no-op-when-disabled, routes-when-enabled, fail-open on bothraise- andconnect-throw, plus an envelope-shape assertion per hook. Full suite:7259 passed, no new failures (the 9 failing suites are a pre-existing fresh-worktreeparsers.bundle.mjsbuild-artifact issue, unrelated to this change).Not proven here (operator post-merge checklist — see
docs/developers/architecture/observability.md)This PR ships the integration dark and safe. It does not deploy, flip the flag, or bind the email address. The operator checklist covers: (1) regenerate
package-lock.jsonin a git-dep-capable env (the plugin isn't on npm;allow-git:noneblocked it on the authoring workstation — CInpm cijobs will fail until this is done); (2) deploy MTA to provision the instance; (3) bind the email action to the realdevrel-oncalladdress in the ANS cockpit; (4)ALERTS_ENABLED=true+ restart; (5) live-verify one alert end-to-end — the plugin'scds.outboxed()+ real-ANS-POST path is unproven against a live CAP runtime and MUST be verified here; (6) confirm the deploy runtime is Node ≥22.12.Scope notes
srv/(hash is returned to the client, verified CI-side).Design spec + implementation plan under
docs/superpowers/.🤖 Generated with Claude Code