Artifact 2271bccd2a41501287b9bc758e5520a96023b9b3824eb1d882d5a893db08490e:
- File
cmd/quarry/topic_test.go
— part of check-in
[526e25a5d6]
at
2026-08-17 00:32:09
on branch trunk
— notify: address repo activity as a topic, with a key notify accepts
Running the real companion found two faults no stub would have.
NotifyEvent.To is documented as "a user, or a repo:<name> topic", but quarry put that string in subscriberId. notify addresses the two through DIFFERENT fields, so an activity event did not fan out — it invented a subscriber literally named repo:synthetic and every watcher heard nothing. Verified against notify: the message existed, addressed to nobody real.
notify also refuses a topic key containing a colon (lowercase, digits, hyphen, underscore only) and rejects the whole trigger, so quarry's own convention could never have been a valid key. repoTopicKey translates at the boundary; quarry keeps its internal vocabulary. Names differing only in punctuation or case collapse to one key, which is documented rather than hashed away — an operator has to be able to read the key they subscribe someone to.
End to end on a real notify + dagnats: a wiki save reaches every member of repo-synthetic, an @mention reaches the person, and both render in quarry's inbox. (user: dmestas, size: 1294) [annotate] [blame] [check-ins using]
package main import "testing" // notify accepts lowercase letters, digits, hyphens and underscores in a // topic key and REJECTS the whole trigger otherwise. quarry's internal // convention is "repo:<name>" and its repo names allow dots, dashes, // underscores and uppercase, so the boundary has to translate — running // the real companion is what surfaced this: a colon key was refused with // unprocessable_entity and every activity event went nowhere. func TestRepoTopicKeyIsAcceptableToNotify(t *testing.T) { for in, want := range map[string]string{ "synthetic": "repo-synthetic", "libfossil": "repo-libfossil", "My.Repo": "repo-my-repo", "a_b-c": "repo-a_b-c", "UPPER": "repo-upper", "dots.and.dashes-x": "repo-dots-and-dashes-x", } { if got := repoTopicKey(in); got != want { t.Errorf("repoTopicKey(%q) = %q, want %q", in, got, want) } } // Whatever the input, the result must satisfy notify's rule. for _, in := range []string{"Weird!!Name", "with spaces", "tr'ailing..."} { got := repoTopicKey(in) for _, c := range got { if !(c >= 'a' && c <= 'z') && !(c >= '0' && c <= '9') && c != '-' && c != '_' { t.Errorf("repoTopicKey(%q) = %q contains %q, which notify refuses", in, got, c) } } } }