Repository navigation
Commit 974b9fd
authored
refactor(auth): delete ordered deliveries and the event consumer cursor, which nothing used (#491)
Auth carried two pieces of machinery nothing in production used, but
that were maintained, tested and documented anyway. Ordered deliveries
were one: no channel ever set an ordering key, yet `delivery_orderings`
grew, claims checked ordinals, and cleanup abandoned stuck keys. The
event consumer cursor was the other: `event_consumers`, `read_after` and
`acknowledge` had callers only in tests. Both are gone, about 540 lines
of code and tests.
Every delivery now retries and cancels the same way, as every real
delivery already did. An operator may retry any failed or cancelled
delivery, and cleanup deletes either after 30 days. The CLI's `ORDER`
column, the dashboard's "ordered" line and the wording about deliveries
"ordered after" one are gone. `EventCursor` stays, as the audit chain's
place for an event, and `in_safe_order!` stays as the sealer's reading
rule.
**Schema.** Migration 0044 drops `event_consumers`, which no release
reads or writes. `deliveries.ordering_key`, `deliveries.ordinal` and
`delivery_orderings` stay under a `PENDING CONTRACT`. The release before
this one still names them when it inserts, claims and lists deliveries,
and the [expand-then-contract
rule](https://github.com/sourceorigin-dev/sourceorigin/blob/main/docs/dev/architecture/database.md)
keeps it working during a deploy. A contract migration drops them once
this release is in production.
The back-channel bug #252 names shipped on its own in #490. #83's alerts
will add the smallest cursor they need when they read the stream.
Closes #252.
**Proof:** `just db test` passes on a scratch cluster: 468 tests,
including the inventory, runtime-role and provisioning tests that list
every table. `operators_retry_and_cancel_deliveries` replaces the three
ordering tests and keeps what they covered without ordering: retry,
cancel, a discarded outcome after cancelling mid-attempt, and a retry
waiting for that attempt's lease. Clippy, `just db prepare-check`, `just
docs reference` and `just docs` pass.
Reviewed with review-loop: 1 round with Claude Opus 5.5 over #491 and
#492; all GPT 6.1 Sol reviewers failed on a Codex usage limit. Its one
finding is fixed: the CleanupFailing alert no longer says stuck
deliveries hold others back. So are its nits on the cleanup metric's
description and the migration's stale note; renaming the migration was
declined, since it also records the deliveries' pending contract.
> [!NOTE]
> Written by Claude Opus 5.5 in Claude Code (via T3 Code)
🤖 Generated with [Claude Code](https://claude.com/claude-code)1 parent 5337eb6 commit 974b9fd
49 files changed
Lines changed: 258 additions & 932 deletions
File tree
- apps/auth-service/src
- admin
- service
- tests
- cli
- deliveries
- jobs
- web/admin
- crates
- common/src
- events
- database
- .sqlx
- migrations
- src
- connection
- inventory
- repositories
- audit
- deliveries
- events
- maintenance
- ui/src/admin
- docs/dev
- architecture
- extending
- operations
- security
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
155 | 155 | | |
156 | 156 | | |
157 | 157 | | |
158 | | - | |
159 | | - | |
| 158 | + | |
160 | 159 | | |
161 | 160 | | |
162 | 161 | | |
| |||
167 | 166 | | |
168 | 167 | | |
169 | 168 | | |
170 | | - | |
| 169 | + | |
171 | 170 | | |
172 | 171 | | |
173 | 172 | | |
174 | 173 | | |
175 | | - | |
176 | | - | |
| 174 | + | |
177 | 175 | | |
178 | 176 | | |
179 | 177 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
48 | | - | |
49 | 48 | | |
50 | 49 | | |
51 | 50 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
27 | | - | |
| 27 | + | |
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
35 | | - | |
| 35 | + | |
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
| |||
82 | 82 | | |
83 | 83 | | |
84 | 84 | | |
85 | | - | |
86 | 85 | | |
87 | 86 | | |
88 | 87 | | |
| |||
94 | 93 | | |
95 | 94 | | |
96 | 95 | | |
97 | | - | |
98 | | - | |
99 | | - | |
100 | | - | |
101 | | - | |
102 | 96 | | |
103 | 97 | | |
104 | 98 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
376 | 376 | | |
377 | 377 | | |
378 | 378 | | |
379 | | - | |
380 | 379 | | |
381 | 380 | | |
382 | 381 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
256 | 256 | | |
257 | 257 | | |
258 | 258 | | |
259 | | - | |
| 259 | + | |
260 | 260 | | |
261 | 261 | | |
262 | 262 | | |
| |||
273 | 273 | | |
274 | 274 | | |
275 | 275 | | |
276 | | - | |
277 | | - | |
278 | | - | |
| 276 | + | |
| 277 | + | |
279 | 278 | | |
280 | 279 | | |
281 | 280 | | |
| |||
394 | 393 | | |
395 | 394 | | |
396 | 395 | | |
397 | | - | |
398 | | - | |
| 396 | + | |
399 | 397 | | |
400 | | - | |
401 | | - | |
402 | | - | |
403 | | - | |
| 398 | + | |
404 | 399 | | |
405 | 400 | | |
406 | | - | |
407 | | - | |
| 401 | + | |
408 | 402 | | |
409 | 403 | | |
410 | 404 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
79 | 79 | | |
80 | 80 | | |
81 | 81 | | |
82 | | - | |
83 | | - | |
| 82 | + | |
84 | 83 | | |
85 | 84 | | |
86 | 85 | | |
87 | 86 | | |
88 | 87 | | |
89 | | - | |
90 | | - | |
| 88 | + | |
91 | 89 | | |
92 | 90 | | |
93 | 91 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1715 | 1715 | | |
1716 | 1716 | | |
1717 | 1717 | | |
1718 | | - | |
1719 | 1718 | | |
1720 | 1719 | | |
1721 | 1720 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
942 | 942 | | |
943 | 943 | | |
944 | 944 | | |
945 | | - | |
946 | | - | |
947 | 945 | | |
948 | 946 | | |
949 | 947 | | |
| |||
955 | 953 | | |
956 | 954 | | |
957 | 955 | | |
958 | | - | |
959 | | - | |
| 956 | + | |
960 | 957 | | |
961 | 958 | | |
962 | | - | |
963 | | - | |
964 | | - | |
965 | | - | |
966 | | - | |
| 959 | + | |
| 960 | + | |
| 961 | + | |
| 962 | + | |
967 | 963 | | |
968 | 964 | | |
969 | 965 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
157 | 157 | | |
158 | 158 | | |
159 | 159 | | |
160 | | - | |
161 | | - | |
| 160 | + | |
162 | 161 | | |
163 | 162 | | |
164 | 163 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
360 | 360 | | |
361 | 361 | | |
362 | 362 | | |
363 | | - | |
| 363 | + | |
364 | 364 | | |
365 | 365 | | |
366 | 366 | | |
367 | 367 | | |
368 | 368 | | |
369 | | - | |
| 369 | + | |
370 | 370 | | |
371 | 371 | | |
372 | 372 | | |
| |||
0 commit comments