Organization-level and global event rules #35
No reviewers
Labels
No labels
breaking
bug
ci
dependencies
documentation
feature
security
skip-changelog
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
argus/backend!35
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/21-org-global-rules"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #21
Part of the server monitoring plan (phase 2.3). Stacked on #34 (base
feat/23-metric-thresholds).Changes
EventRule.projectbecomes optional andEventRule.organizationis added (check constraint: at most one). Scopes: project, organization (applies to all its projects), global (both empty, applies to every project).scope/scope_labelexposed by the API.EventRuleStategainsproject(state per project, so an org/global rule behaves like one rule per project); events always belong to the report's project.PrCommentgainsproject(an org/global rule comments on several repos).events/0006: adds the fields, copies each rule's project onto existing states and PR comments, then makes them non-null. Checked forward and backward on a database with existing rows.apps.events.scopes.RuleScope) and routed three times:/api/projects/<o>/<r>/event-rules/…(unchanged),/api/organizations/<org>/event-rules/…(org read/write level),/api/event-rules/…(Argus admins only). A project'sGET …/event-rules/?include_inherited=1also lists its organization's and the global rules, read-only and without recipients/extra emails. "Test this rule" on an org/global rule is staged on one of its readable projects.SentTargetrows claimed through a unique constraint (race-free between concurrent deliveries), kept one hour.apps/events/test_scopes.py.Checks
pytest (225 passed), pylint 10/10, autopep8, bandit clean.
🤖 Generated with Claude Code
https://claude.ai/code/session_014BSmBtGWeFBD9z4mYm9SjA
📊 Rapports Argus pour cette PR