Repository navigation
feat(notifications, github): WS-N + WS-G - channels, event bus, GitHub App webhooks, auto-deploy - #381
Closed
vsilent wants to merge 9 commits into
Closed
feat(notifications, github): WS-N + WS-G - channels, event bus, GitHub App webhooks, auto-deploy#381vsilent wants to merge 9 commits into
vsilent wants to merge 9 commits into
Conversation
- schema: notification_channel + notification_dispatch (migration 20261124111150); casbin rules for /api/v1/notifications/* (migration 20261124111654) - REST: create/list/update/delete/test channels, list dispatches - adapters: slack, discord, telegram, webhook (HMAC X-Stacker-Signature); email delivery deferred to N4 via the notify service - secrets live only in Vault (notification_secret_path); responses carry a masked targetHint; errors are redacted recursively before storing - delivery is at-least-once: retry x3 with backoff on 429/5xx, shared reqwest client with a 10s timeout - project events go to that project's channels only; global channels require root/group_admin (code-review B1) and are reserved for organization-level events - unauthorized channel access answers 404 (no existence leak) - tests: 8 integration (tests/notification_channels.rs) + unit tests for masking/redaction; reviewed by code-reviewer + migration-checker 2026-11-24 (B1/M1/M2 fixed, M3 accepted as convention deviation) - contracts and BDD fixtures live in config/shared-fixtures (notifications-*)
… N3) - deploy status transitions notify project channels (edge-triggered: completed->deploy.succeeded, failed/error->deploy.failed) from the MQ listener and force-complete; best-effort, never breaks the deploy flow - pure logic moved to the leaf crate crates/notification-core (events, channel payloads, masking, redaction, retry/backoff, HTTP delivery); its 10 unit tests run in ~10ms without building the service - the agreed crate/module strategy for fast compilation going forward - services/notification.rs keeps orchestration only (Vault, dispatch rows, project fan-out with per-channel events filter) - tests: notification-core 10/10, notification_channels 9/9 (new fan-out and dispatch-log cases), lib 2382 passed / 6 skipped (pre-existing)
…S-N N4) - email channels deliver through RabbitMQ -> notify (routing key notify.start.email.notification.all, NotifyEmailMessage shape), recorded in notification_dispatch like every other channel - container.down: edge-detect running->exited/dead between aggregate health reports in the agent report path and fan out the contract event to the project's channels (best-effort, never fails the report) - CLI: stacker notify add/test/list over /api/v1/notifications/* (secrets are write-only and never echoed back) - crates/TODO.md: Slack/Telegram/Discord targets shipped, Teams stays open - tests: notification-core 10/10, notification_channels 9/9, lib 2382 passed / 6 skipped (pre-existing) Closes WS-N (N1-N4).
…h paths (WS-G G1-G3) - schema: github_installation, github_repo (branch, watch_paths, autodeploy, project binding), github_webhook_delivery replay guard (migration 20261124131026); casbin-anonymous webhook rule (migration 20261124131027, precedent: payout webhook) - POST /api/v1/github/webhook: X-Hub-Signature-256 HMAC (constant-time), one processing per X-GitHub-Delivery, webhook secret only in Vault - pure logic in the leaf crate crates/github-events: signature verify, push/pull_request/installation normalization, watch-path matching (globs with ! exclusions); tests run in ~10ms standalone - push handling answers the matched repos seam for the G5 deploy trigger - tests: github-events 7/7, github_webhook 4/4, notification_channels 9/9 (regression), lib 2382 passed / 6 skipped (pre-existing)
- /api/v1/github/repos CRUD (create/list/update/delete), owner-gated: touching another user's project answers 404, duplicate repo+branch 409 - casbin rules for the new endpoints (migration 20261124135149) - installation / installation_repositories webhooks are recorded in github_installation - auto-deploy switch lives on github_repo.autodeploy; the stale catalog form field autodeploy is marked as superseded (forms/project/app.rs) - tests: github_webhook 7/7 (CRUD roundtrip, ownership, installation recording), github-events 7/7, notification_channels 9/9, lib 2382 passed / 6 skipped (pre-existing) G5 (redeploy_saved_project primitive) is designed in the plan and follows.
- src/services/redeploy.rs: redeploy_saved_project rebuilds the Deploy form from the project's recorded request plus its saved server/cloud rows and pins server.server_id, so a push redeploys onto the existing server and never provisions a new VM (deploy.rs:1720 reuse path) - webhook response grows 'triggered': per-repo outcome (queued|skipped|failed) with the reason (e.g. no saved server yet) - acting user for webhook deploys is the connected repo's owner - tests: github_webhook 9/9 including the G5 seam (skip without a saved server, deployment row created with one), github-events 7/7, notification_channels 9/9, lib 2382 passed / 6 skipped Closes WS-G (G1-G5).
- schema: backup_destination, backup_job (source postgres/mysql/mongo/volume, cron schedule, retention 7 daily + 4 weekly), backup_run lifecycle (migration 20261124142356) - crates/backup-core: dump/restore command building for the agent exec queue (single shell commands, per-run token via $BACKUP_TOKEN, never embedded) and the retention policy (B2); 9 unit tests in ~10ms - docs/BACKUPS_SYNCOPIA.md: decisions B1-B3, architecture Contracts and fixtures: config/shared-fixtures (backups-syncopia.json, backups.feature).
Header names for the backup upload/download leg are now passed in (BackupSpec.extra_headers) and rendered generically - nothing vendor-specific is hardcoded in the crate. The service layer will supply them from configuration per destination. Tests updated (10/10).
Collaborator
Author
|
Closing: rework needed (documentation language and quality issues). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two workstreams from
config/PLAN-notifications.mdandconfig/PLAN-github-webhooks.md(2026-11-24).WS-N Notifications (N1-N4)
notification_channel/notification_dispatchschema + casbin rules; secrets only in Vault (targetHintmasked, errors redacted recursively)/api/v1/notifications/*: channels CRUD, test send, dispatch log; global channels areroot/group_admin-only and receive organization-level events only (code-review B1)X-Stacker-Signature); email through RabbitMQ -> notify (notify.start.email.notification.all)container.downedge-detected in the agent report pathstacker notify {add,test,list}WS-G GitHub integration (G1-G5)
github_installation/github_repo/github_webhook_delivery+ casbinPOST /api/v1/github/webhook:X-Hub-Signature-256HMAC (constant-time), replay guard onX-GitHub-Delivery, webhook secret only in Vault!exclusions); Repo Connect API/api/v1/github/reposredeploy_saved_project: rebuilds the Deploy form from the project's saved state and pinsserver.server_id— redeploys onto the existing server, never provisions a new VMCrates (fast-compile strategy)
Pure logic lives in leaf crates:
crates/notification-core(payloads, masking, redaction, retry) andcrates/github-events(signature, normalization, watch paths). Their unit tests (10 + 7) run in ~10ms without building the service.Tests
cargo nextest run -p notification-core10 passedcargo nextest run -p github-events7 passedcargo nextest run -E 'binary(notification_channels)'9 passedcargo nextest run -E 'binary(github_webhook)'9 passedcargo nextest run --lib2382 passed, 6 skipped (pre-existing#[ignore])binary(remote_secrets)15 passed (vault_service touched)Reviewed by code-reviewer + migration-checker before the WS-N merge point (B1/M1/M2 fixed, M3 accepted as a convention deviation matching
db/remote_secret.rs).Contracts and BDD fixtures live in the config repo:
shared-fixtures/api-contracts/notifications-*.json,github-webhooks.json,shared-fixtures/features/notifications.feature,github-autodeploy.feature.