Skip to content

Commit 3fea4ba

Browse files
committed
refactor: Move notifications to config.edn
1 parent f17b334 commit 3fea4ba

10 files changed

Lines changed: 254 additions & 470 deletions

File tree

docs/bark-manual.org

Lines changed: 117 additions & 106 deletions
Original file line numberDiff line numberDiff line change
@@ -644,7 +644,6 @@ removes false positives on common English words such as "Done.",
644644
| Supersede | =Superseded-by: <mid>= | =!Superseded-by: <mid>= |
645645
| Supersede (sym.) | =Supersedes: <mid>= | =!Supersedes: <mid>= |
646646
| Role control | =Add maintainer: a@b.c= | =!Add maintainer: a@b.c= |
647-
| Notify | =Notify: on= | =!Notify: on= |
648647

649648
Set globally or per source (per-source wins):
650649

@@ -709,15 +708,13 @@ retains a full override in every case.
709708

710709
** All controls
711710

712-
A _control_ manages a role or a notification preference. Role
713-
controls must be sent through the source's public channel;
714-
notification controls may be sent privately.
711+
A _control_ manages a role. Role controls must be sent through
712+
the source's public channel.
715713

716-
| ID | Syntax / Words | Permission | Channel |
717-
|--------+------------------------------------+-----------------+---------|
718-
| notify | =Notify: on= / =off= / =d:7 p:2 s:4 ...= | maintainer | any |
719-
| role | =Add maintainer: addr@host= | maintainer | public |
720-
| role | =Remove maintainer: addr@host= | lead maintainer | public |
714+
| ID | Syntax / Words | Permission | Channel |
715+
|------+--------------------------------+-----------------+---------|
716+
| role | =Add maintainer: addr@host= | maintainer | public |
717+
| role | =Remove maintainer: addr@host= | lead maintainer | public |
721718

722719
* Exploring reports
723720

@@ -821,67 +818,39 @@ look forward.
821818

822819
* Notifications
823820

824-
BARK sends periodic email digests to maintainers, summarising
825-
open reports. Notifications are restricted to maintainers;
826-
regular users never receive them.
821+
BARK can send email digests of open reports. Subscribers and
822+
their filters are declared by the operator in =config.edn=, under
823+
=:notifications :subscribers= (see [[#notifications-smtp][Notifications (SMTP)]] under
824+
Deploying BARK for the full configuration).
827825

828-
Sending notifications requires SMTP configuration (see [[#config][Config]]).
829-
The =bb notify= task -- typically run from a cron job -- builds
830-
and sends the digests; =bb notify --dry-run= prints them without
831-
sending.
826+
Each digest contains the failed commands relevant to the
827+
recipient, the open bugs, patches and requests they own (with
828+
upcoming deadlines first), and the open bugs, patches and
829+
requests that nobody has acknowledged or owned yet.
832830

833-
Each digest contains two sections: the open bugs, patches and
834-
requests owned by the recipient, and the open bugs, patches and
835-
requests that remain unacked and unowned by anyone.
831+
** Subscribing or changing preferences
836832

837-
** (Un)subscribing
833+
Subscriptions are not managed by email. To subscribe,
834+
unsubscribe, or adjust filters (minimum priority, subject match,
835+
topic), ask the operator to edit =config.edn=. This is a
836+
deliberate trade-off: notifications are configured the same way
837+
as SMTP and the maintainer list, so the operator owns the full
838+
declaration of who receives what.
838839

839-
Maintainers are subscribed to notifications by default the first
840-
time the daemon runs. To unsubscribe, send an email to the BARK
841-
inbox with this body:
840+
The =bb notify= task -- run by the operator from cron or a
841+
systemd timer -- builds and sends the digests; =bb notify
842+
--dry-run= prints them without sending. Cadence is the
843+
operator's choice; the task does not track per-recipient
844+
intervals.
842845

843-
#+begin_example
844-
Notify: off
845-
#+end_example
846-
847-
To re-subscribe:
848-
849-
#+begin_example
850-
Notify: on
851-
#+end_example
852-
853-
** Setting preferences
854-
855-
The =Notify:= control also sets a recipient's preferences.
856-
Parameters can be combined on a single line:
857-
858-
| Parameter | Description | Default |
859-
|-----------+------------------------------------+---------|
860-
| =d:N= | Receive notifications every N days | 30 |
861-
| =p:N= | Minimum priority (0--3) | 1 |
862-
| =s:N= | Minimum status (0--7) | 1 |
863-
| =m:<match>= | Restrict to subject <match> | |
864-
| =t:<topic>= | Restrict to topic <topic> | |
865-
866-
Examples:
867-
868-
#+begin_example
869-
Notify: d:7 -- every 7 days
870-
Notify: d:1 -- daily
871-
Notify: p:1 -- only important reports
872-
Notify: d:3 s:4 p:2 -- every 3 days, only open reports with priority >= 2
873-
#+end_example
874-
875-
Unlike role controls, =Notify:= controls are personal and accepted
876-
on any channel: a private email to the BARK inbox, or a reply on
877-
the mailing list.
878-
879-
* Config
846+
* Deploying BARK
880847

881-
BARK reads its configuration from a single =config.edn= file. To
882-
validate a configuration after editing it, run =bb test-config=.
848+
This section addresses anyone running a BARK instance, whether for
849+
an organisation, a project, or a personal mailbox on a single
850+
machine. BARK reads its configuration from a single =config.edn=
851+
file; validate it after editing with =bb test-config=.
883852

884-
** Minimal example
853+
** Setting up an instance
885854

886855
The shortest valid configuration declares an IMAP mailbox and one
887856
source:
@@ -917,6 +886,22 @@ uses filesystem events rather than polling.
917886
:sources [{:name "my-list" :list "my-list.example.org"}]}
918887
#+end_src
919888

889+
** Monitoring your local mail
890+
891+
BARK can run on a single machine to watch your own mail. In that
892+
mode:
893+
894+
- The mail source is a Maildir (see the example above). Watch mode
895+
reacts to filesystem events -- no polling, no IMAP credentials.
896+
- SMTP notifications are usually unnecessary: you're already reading
897+
the same mailbox BARK watches. Either omit =:notifications= or
898+
set =:enabled false=.
899+
- One source is enough. Match on =:to= or =:list= depending on
900+
which header your local MDA stamps.
901+
902+
To keep BARK in the background, install the user-level systemd unit
903+
from =docs/deploy/bark.service= (see [[#running-bark-in-production][Running BARK in production]]).
904+
920905
** Source types and matching
921906

922907
A source has exactly one type key, which determines how BARK
@@ -1045,7 +1030,7 @@ per-report expiry date using the =Expiry:= directive (see [[#report-expiry][repo
10451030
expiry]]). A per-report expiry overrides the source-level rules: if a
10461031
report has an explicit expiry date, only that date is checked.
10471032

1048-
** Ingestion
1033+
** Tuning ingestion
10491034

10501035
#+begin_src edn
10511036
:ingest {:fetch {:limit 50} ;; or {:since "30d"} or {:start "…" :end "…"}
@@ -1070,26 +1055,57 @@ larger than 1 MB (1,048,576 characters) are skipped with a warning --
10701055
only metadata (filename, size, content-type) is kept. Override the
10711056
limit with =:max-attachment-size= in the =:ingest= config section.
10721057

1073-
** Maintenance
1058+
** Notifications (SMTP)
10741059

1075-
The =bb maintenance= task reports and prunes orphan emails. Run
1076-
it while the daemon is stopped.
1060+
#+begin_src edn
1061+
:notifications
1062+
{:enabled true
1063+
:smtp {:host "smtp.example.com"
1064+
:port 587
1065+
:tls true
1066+
:user "notify@example.com"
1067+
:password "secret"
1068+
:from "bark@example.com"}
1069+
:subscribers
1070+
{"a@example.org"
1071+
[{:source "my-list"}]
1072+
"b@example.org"
1073+
[{:source "my-list" :min-priority 2}
1074+
{:source "another-list" :topic "release"}]}}
1075+
#+end_src
10771076

1078-
#+begin_src shell
1079-
bb maintenance # dry run, show orphan counts
1080-
bb maintenance --delete # actually delete orphan emails
1081-
bb maintenance --verbose # list individual orphan message-ids
1082-
bb maintenance --failures # list recent command failures recorded
1083-
# for maintainers (denied actions, bad
1084-
# syntax, etc.)
1085-
bb maintenance --retention 6m # override default orphan retention
1086-
# (90 days). Accepts "30d", "6m", "1y"
1087-
# or an ISO date.
1088-
bb maintenance -n my-source # scope to a single source
1077+
Each key under =:subscribers= is a recipient's address. The
1078+
associated vector lists their subscriptions, one per source --
1079+
a recipient on three sources receives three separate emails per
1080+
=bb notify= run.
1081+
1082+
Optional per-subscription filters:
1083+
1084+
| Key | Description |
1085+
|-----------------+--------------------------------------------|
1086+
| =:min-priority= | Skip reports below this priority (0--3) |
1087+
| =:min-status= | Skip reports below this activity score |
1088+
| =:subject-match= | Substring match on the report subject |
1089+
| =:topic= | Substring match on the report topic |
1090+
1091+
=bb notify= does not track per-recipient cadence: it sends every
1092+
time it is invoked. Schedule it from cron or a systemd timer.
1093+
=bb test-config= verifies that every =:source= named under
1094+
=:subscribers= matches an existing source =:name=.
1095+
1096+
** Logging
1097+
1098+
#+begin_src edn
1099+
:logging {:file "logs/bark.log"
1100+
:level :warn
1101+
:max-size "10MB"
1102+
:backlog 5
1103+
:email {:to "ops@example.com"
1104+
:level :error}}
10891105
#+end_src
10901106

1091-
An _orphan email_ is one that no report references and that no
1092-
maintainer has sent.
1107+
Log file rotation is automatic. Email alerts require SMTP to be
1108+
configured.
10931109

10941110
** Running BARK in production
10951111

@@ -1113,6 +1129,27 @@ Either mode can be backed by an uberjar instead of =clj -M:run= to
11131129
avoid the Clojure startup cost on every invocation; see the Quick
11141130
start section of =README.org=.
11151131

1132+
** Maintenance
1133+
1134+
The =bb maintenance= task reports and prunes orphan emails. Run
1135+
it while the daemon is stopped.
1136+
1137+
#+begin_src shell
1138+
bb maintenance # dry run, show orphan counts
1139+
bb maintenance --delete # actually delete orphan emails
1140+
bb maintenance --verbose # list individual orphan message-ids
1141+
bb maintenance --failures # list recent command failures recorded
1142+
# for maintainers (denied actions, bad
1143+
# syntax, etc.)
1144+
bb maintenance --retention 6m # override default orphan retention
1145+
# (90 days). Accepts "30d", "6m", "1y"
1146+
# or an ISO date.
1147+
bb maintenance -n my-source # scope to a single source
1148+
#+end_src
1149+
1150+
An _orphan email_ is one that no report references and that no
1151+
maintainer has sent.
1152+
11161153
** Rebuilding history
11171154

11181155
A source's historical evolution -- vocabulary, syntax, maintainer
@@ -1132,32 +1169,6 @@ clj -M:run -- --fresh # interactive confirm, then full replay
11321169
=bb test-config= validates the =:periods= on each source: contiguity, ISO
11331170
date format, =:start= strictly before =:end=.
11341171

1135-
** Notifications (SMTP)
1136-
1137-
#+begin_src edn
1138-
:notifications {:enabled true
1139-
:smtp {:host "smtp.example.com"
1140-
:port 587
1141-
:tls true
1142-
:user "notify@example.com"
1143-
:password "secret"
1144-
:from "bark@example.com"}}
1145-
#+end_src
1146-
1147-
** Logging
1148-
1149-
#+begin_src edn
1150-
:logging {:file "logs/bark.log"
1151-
:level :warn
1152-
:max-size "10MB"
1153-
:backlog 5
1154-
:email {:to "ops@example.com"
1155-
:level :error}}
1156-
#+end_src
1157-
1158-
Log file rotation is automatic. Email alerts require SMTP to be
1159-
configured.
1160-
11611172
* CLI reference
11621173

11631174
The export, notification and maintenance tasks are run through

resources/bark-schema.edn

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -225,17 +225,4 @@
225225
:maint-tenure/email {:db/valueType :db.type/string}
226226
:maint-tenure/from {:db/valueType :db.type/instant}
227227
:maint-tenure/to {:db/valueType :db.type/instant}
228-
:maint-tenure/order {:db/valueType :db.type/long}
229-
230-
;; --- Notification preferences (per subscriber per source) ---
231-
:notify/key {:db/valueType :db.type/string
232-
:db/unique :db.unique/identity}
233-
:notify/source {:db/valueType :db.type/string}
234-
:notify/email {:db/valueType :db.type/string}
235-
:notify/enabled {:db/valueType :db.type/boolean}
236-
:notify/interval-days {:db/valueType :db.type/long}
237-
:notify/min-priority {:db/valueType :db.type/long}
238-
:notify/min-status {:db/valueType :db.type/long}
239-
:notify/subject-match {:db/valueType :db.type/string}
240-
:notify/topic {:db/valueType :db.type/string}
241-
:notify/last-sent {:db/valueType :db.type/instant}}
228+
:maint-tenure/order {:db/valueType :db.type/long}}

resources/emails.edn

Lines changed: 0 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -760,45 +760,6 @@
760760
:email/references "<54@test.org>"
761761
:email/body-text "Approved.\nOwned.\nUrgent.\n"}
762762

763-
;; =========================================================================
764-
;; 56 — Notify: off (unsubscribe)
765-
;; =========================================================================
766-
{
767-
:email/id "56"
768-
:email/source "direct"
769-
:email/message-id "<56@test.org>"
770-
:email/subject "Unsubscribe notifications"
771-
:email/from-address "maint@test.org"
772-
:email/date-sent #inst "2026-01-20T12:00:00"
773-
:email/ingested-at #inst "2026-01-20T12:00:00"
774-
:email/body-text "Notify: off\n"}
775-
776-
;; =========================================================================
777-
;; 57 — Notify: on d:7 p:2 (resubscribe with prefs)
778-
;; =========================================================================
779-
{
780-
:email/id "57"
781-
:email/source "direct"
782-
:email/message-id "<57@test.org>"
783-
:email/subject "Resubscribe with prefs"
784-
:email/from-address "maint@test.org"
785-
:email/date-sent #inst "2026-01-20T13:00:00"
786-
:email/ingested-at #inst "2026-01-20T13:00:00"
787-
:email/body-text "Notify: on d:7 p:2\n"}
788-
789-
;; =========================================================================
790-
;; 58 — Notify command from regular user (ignored)
791-
;; =========================================================================
792-
{
793-
:email/id "58"
794-
:email/source "direct"
795-
:email/message-id "<58@test.org>"
796-
:email/subject "User tries notify"
797-
:email/from-address "user@test.org"
798-
:email/date-sent #inst "2026-01-20T14:00:00"
799-
:email/ingested-at #inst "2026-01-20T14:00:00"
800-
:email/body-text "Notify: d:1\n"}
801-
802763
;; =========================================================================
803764
;; 59 — Properly tagged [BUG] (anchors a thread for 61/62/64)
804765
;; =========================================================================
@@ -1000,20 +961,6 @@
1000961
:email/ingested-at #inst "2026-01-24T12:00:00"
1001962
:email/body-text "Unauthorized change.\n"}
1002963

1003-
;; =========================================================================
1004-
;; 74 — Notify command via mailing list (should be ignored)
1005-
;; =========================================================================
1006-
{
1007-
:email/id "74"
1008-
:email/source "direct"
1009-
:email/message-id "<74@test.org>"
1010-
:email/subject "Notify via list"
1011-
:email/from-address "maint@test.org"
1012-
:email/date-sent #inst "2026-01-24T13:00:00"
1013-
:email/ingested-at #inst "2026-01-24T13:00:00"
1014-
:email/body-text "Notify: d:1\n"
1015-
:email/headers-edn "{\"List-Id\" \"<emacs-orgmode.gnu.org>\" \"List-Post\" \"<mailto:list@test.org>\"}"}
1016-
1017964
;; =========================================================================
1018965
;; 75 — POLL for vote-format tests
1019966
;; =========================================================================

0 commit comments

Comments
 (0)