Repository navigation
Commit 9449070
authored
feat(core): persist physical queue identity for flow tasks (#679)
## Summary
Persist physical queue identity independently of flow identity while keeping today's one-flow/one-queue behavior (#650). Replacement for rejected #677. Stacked on the test-harness startup fix #680; each PR contains one commit.
- Store canonical `queue_name` on steps and task snapshots; enforce partial `(queue_name, message_id)` uniqueness while retaining nullable message IDs and the task primary key. Lifecycle operations use stored routes, grouped by queue, with existing concurrency, terminal-state and visibility safeguards.
- **Breaking claim API:** SQL `pgflow.start_tasks(flow_slug, msg_ids, worker_id, queue_name)` and TypeScript `startTasks()` require the canonical queue argument (`lower(flow_slug)` today). The released three-argument SQL overload is removed; no default, fallback or compatibility shim remains. JavaScript message IDs are exact decimal strings.
- **No hot-path queue listing:** PGMQ already normalizes message-operation names. Remove `_effective_queue_name`, its session cache, and worker spelling-resolution plumbing. Pruning also uses canonical routes directly. Public listing remains for provisioning collisions and fresh original-spelling resolution before destructive queue deletion. Existing mixed-case queues remain usable without moving messages or recreating queues.
- Preserve exact-flow ownership checks, ambiguous-match rejection before destructive work, transactional deletion, single-read claiming, and unmatched/wrong-flow message preservation. Keep accepted `set_vt_batch()` and direct archive pruning.
- Regenerate the unreleased `20260913093141_pgflow_persist_queue_identity` migration: nullable adds, populated backfill, constraints, then new functions and removal of the old claim overload. Bounded lock waits and atomic rollback safeguards remain. Update the maintenance guide, pruning instructions, lifecycle diagram and 0.17.0 news article.
## Maintenance upgrade
No mixed-version rolling upgrade. Pause producers; record worker enablement and running process states before changing them; drain active handlers under the old schema; stop workers and re-invocation; quiesce maintenance/recovery/definition writers; apply migrations to the explicit target through Supabase's runner; replace any installed pruning helper; deploy matching packages and callers; restore the saved states and resume producers.
Draining active work does not mean emptying queues. Queued tasks and messages survive the upgrade. A failed migration rolls back; after success, old three-argument workers cannot simply restart.
## Checks
Three GLM implementation / independent Sol review rounds completed. Final code and documentation review: **APPROVED**.
- Full core pgTAP: **300 files / 1,464 tests pass**, including populated 0.16.0 upgrade and conflict rollback fixtures.
- Edge-worker unit: **254 pass**; edge-worker E2E and portable-runtime E2E: **12 each pass**; client E2E: **47 pass**.
- Migration/generated-type checks, website lint/build/link checks, changeset validation and post-commit affected prepush: **pass** (32/32 prepush tasks).
- Current-head GitHub CI **passes edge-worker integration**, core pgTAP, build/test, edge-worker E2E, client/CLI E2E, smoke, type infrastructure and changesets. The local integration timeout did not recur in CI.
- **Remaining CI blocker:** portable-runtime E2E is **11/12**. `portable runtimes - max_concurrency works in supabase` fails with `Timeout after 60000ms waiting for test_seq to increment by 200`. One targeted failed-job rerun reproduced the same failure. Local portable-runtime suites passed twice; that does not establish the cause of the CI failure. No timeout or assertion was weakened. Three authorized correction/review rounds are exhausted.
Closes #650113 files changed
Lines changed: 4629 additions & 380 deletions
File tree
- .changeset
- pkgs
- client/__tests__/helpers
- core
- __tests__/types
- assets
- schemas
- scripts
- benchmarks
- src
- supabase
- migrations
- tests
- _cascade_force_skip_steps
- add_step
- cascade_complete_taskless_steps
- complete_task
- condition_evaluation
- create_flow
- delete_flow_and_data
- fail_task_when_exhausted
- fail_task
- maintenance
- queue_identity
- start_tasks
- type_violations
- upgrade_fixture
- dsl
- __tests__/types
- src
- edge-worker
- src
- core
- flow
- queue
- tests
- integration
- flow
- unit
- example-flows/src
- website/src/content/docs
- concepts
- deploy
- get-started
- news
- reference
- configuration
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 | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
172 | 172 | | |
173 | 173 | | |
174 | 174 | | |
175 | | - | |
| 175 | + | |
176 | 176 | | |
177 | 177 | | |
178 | 178 | | |
| |||
204 | 204 | | |
205 | 205 | | |
206 | 206 | | |
207 | | - | |
| 207 | + | |
208 | 208 | | |
209 | 209 | | |
210 | 210 | | |
| |||
228 | 228 | | |
229 | 229 | | |
230 | 230 | | |
231 | | - | |
232 | | - | |
| 231 | + | |
233 | 232 | | |
234 | 233 | | |
235 | 234 | | |
| |||
313 | 312 | | |
314 | 313 | | |
315 | 314 | | |
316 | | - | |
| 315 | + | |
317 | 316 | | |
318 | 317 | | |
319 | 318 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
53 | 53 | | |
54 | 54 | | |
55 | 55 | | |
56 | | - | |
| 56 | + | |
| 57 | + | |
57 | 58 | | |
58 | | - | |
| 59 | + | |
59 | 60 | | |
60 | 61 | | |
61 | 62 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
288 | 288 | | |
289 | 289 | | |
290 | 290 | | |
291 | | - | |
| 291 | + | |
| 292 | + | |
292 | 293 | | |
293 | 294 | | |
294 | 295 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
29 | | - | |
| 29 | + | |
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
| |||
66 | 66 | | |
67 | 67 | | |
68 | 68 | | |
69 | | - | |
70 | | - | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
71 | 74 | | |
72 | 75 | | |
73 | | - | |
| 76 | + | |
74 | 77 | | |
75 | | - | |
76 | | - | |
| 78 | + | |
| 79 | + | |
77 | 80 | | |
78 | 81 | | |
79 | | - | |
| 82 | + | |
80 | 83 | | |
81 | 84 | | |
82 | | - | |
| 85 | + | |
83 | 86 | | |
84 | 87 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
27 | | - | |
| 27 | + | |
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
38 | 55 | | |
39 | 56 | | |
40 | 57 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
20 | 23 | | |
21 | 24 | | |
22 | 25 | | |
| |||
38 | 41 | | |
39 | 42 | | |
40 | 43 | | |
| 44 | + | |
41 | 45 | | |
42 | 46 | | |
43 | 47 | | |
| |||
63 | 67 | | |
64 | 68 | | |
65 | 69 | | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
0 commit comments