Commit 94878ec5b8

94878ec5b809f0bf1bd01e03d2ba3bf3a1cdec9b

parent: 57f3ffe0ab

Verified · cmc

cmc <hello@cleberg.net> · 2026-09-20 09:13 UTC

docs: preflight corrections to the push plan

Task 5's response-mapping test asserted a nil error on results that
carry one. Task 4 declared config dependencies token.go does not have.

Ref #89
docs/plans/2026-09-20-ios-push-notifications.md +9 −5
@@ -105,8 +105,7 @@ func TestPushDevices(t *testing.T) {
105105 s := testStore(t)
106106 uid := testUser(t, s, "alice")
107107
108 id, err := s.AddPushDevice(uid, "tok-a", "iphone")
109 if err != nil {
108 if _, err := s.AddPushDevice(uid, "tok-a", "iphone"); err != nil {
110109 t.Fatalf("AddPushDevice: %v", err)
111110 }
112111 devices, err := s.PushDevices(uid)
@@ -141,7 +140,6 @@ func TestPushDevices(t *testing.T) {
141140 if d, _ := s.PushDevices(bob); len(d) != 0 {
142141 t.Fatalf("device survived removal: %+v", d)
143142 }
144 _ = id
145143}
146144
147145func TestPushEnabledDefaultsOn(t *testing.T) {
@@ -806,7 +804,7 @@ Ref #89"
806804- Test: `internal/push/token_test.go`
807805
808806**Interfaces:**
809- Consumes: `config.Push`, `config.LoadAPNSKey` from Task 3.
807- Consumes: nothing. `token.go` takes a parsed key and two strings; it imports no `config` symbol.
810808- Produces:
811809 - `type tokenSource struct { key *ecdsa.PrivateKey; keyID, teamID string; now func() time.Time; mu sync.Mutex; cached string; issued time.Time }`
812810 - `func newTokenSource(key *ecdsa.PrivateKey, keyID, teamID string) *tokenSource`
@@ -1146,9 +1144,15 @@ func TestSendMapsResponses(t *testing.T) {
11461144 io.WriteString(w, tc.body)
11471145 })
11481146 res, after, err := c.Send(context.Background(), "T", "t", "b", "p")
1149 if err != nil && tc.want != resultDead && tc.want != resultReap {
1147 // Only a delivered push has no error. Every other result
1148 // carries the status and reason, which is what the drainer
1149 // records on the queue row.
1150 if tc.want == resultSent && err != nil {
11501151 t.Fatalf("err = %v", err)
11511152 }
1153 if tc.want != resultSent && err == nil {
1154 t.Fatalf("want an error explaining %v, got nil", tc.want)
1155 }
11521156 if res != tc.want {
11531157 t.Fatalf("res = %v, want %v", res, tc.want)
11541158 }