Commit 3ac2c12
fix(run-engine): key the records gate on the organisation, and pin it properly
The gate took only a run id. The decision it answers is organisation-scoped --
it follows the snapshot store's own rollout -- and an opaque run id cannot
answer that without a lookup, which would put a read back on the path the gate
exists to keep free. Both call sites already hold the organisation on the
snapshot they are transitioning from, so it now travels with the run id and
costs nothing.
The test claimed "once per resume" and did not show it. It blocked the run on a
single waitpoint, where a gate consulted once per waitpoint is
indistinguishable from one consulted once per resume, and asserted containment
rather than a count -- so it passed whether the gate was called once, three
times, or after the scan. It now blocks on three waitpoints and asserts exactly
one consultation carrying the run's own organisation. A per-waitpoint gate
fails it three-to-one, and passing the wrong id fails it outright.
What the test still does not assert is that the gate runs BEFORE the id scan.
That is not observable from outside: the scan is a pure function over ids the
caller already holds, so it leaves no trace, and proving the negative would
need it stubbed. The ordering is held by the code, where the predicate is the
method's first statement, and is recorded as such in the test.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>1 parent 8140d17 commit 3ac2c12
3 files changed
Lines changed: 58 additions & 23 deletions
File tree
- internal-packages/run-engine/src/engine
- systems
- tests
Lines changed: 12 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
35 | 41 | | |
36 | 42 | | |
37 | 43 | | |
38 | 44 | | |
39 | | - | |
| 45 | + | |
40 | 46 | | |
41 | 47 | | |
42 | 48 | | |
| |||
60 | 66 | | |
61 | 67 | | |
62 | 68 | | |
63 | | - | |
| 69 | + | |
64 | 70 | | |
65 | 71 | | |
66 | 72 | | |
| |||
627 | 633 | | |
628 | 634 | | |
629 | 635 | | |
| 636 | + | |
630 | 637 | | |
631 | 638 | | |
632 | 639 | | |
| |||
700 | 707 | | |
701 | 708 | | |
702 | 709 | | |
| 710 | + | |
703 | 711 | | |
704 | 712 | | |
705 | 713 | | |
| |||
792 | 800 | | |
793 | 801 | | |
794 | 802 | | |
| 803 | + | |
795 | 804 | | |
796 | 805 | | |
797 | 806 | | |
798 | 807 | | |
799 | 808 | | |
800 | 809 | | |
801 | | - | |
| 810 | + | |
802 | 811 | | |
803 | 812 | | |
804 | 813 | | |
| |||
Lines changed: 40 additions & 17 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
37 | | - | |
| 37 | + | |
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
| |||
54 | 54 | | |
55 | 55 | | |
56 | 56 | | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
57 | 64 | | |
58 | | - | |
| 65 | + | |
59 | 66 | | |
60 | | - | |
61 | | - | |
62 | | - | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
63 | 70 | | |
64 | 71 | | |
65 | 72 | | |
| |||
98 | 105 | | |
99 | 106 | | |
100 | 107 | | |
101 | | - | |
102 | | - | |
103 | | - | |
104 | | - | |
105 | | - | |
106 | | - | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
107 | 120 | | |
108 | 121 | | |
109 | | - | |
| 122 | + | |
110 | 123 | | |
111 | 124 | | |
112 | 125 | | |
113 | 126 | | |
114 | | - | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
115 | 131 | | |
116 | 132 | | |
117 | 133 | | |
118 | | - | |
119 | | - | |
120 | | - | |
121 | | - | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
122 | 145 | | |
123 | 146 | | |
124 | 147 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
81 | 81 | | |
82 | 82 | | |
83 | 83 | | |
84 | | - | |
85 | | - | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
86 | 89 | | |
87 | | - | |
| 90 | + | |
88 | 91 | | |
89 | 92 | | |
90 | 93 | | |
| |||
0 commit comments