Commit efa4846
authored
fix(flows): stop the flow migration copying non-flow objects, and remove the rows it already wrote (#3408)
MigrateRegisterFlowsToTable asked ObjectService::findAll() for
register `flows` / schema `flow` at the TOP LEVEL of the config.
prepareFindAllConfig() reads $config['filters']['register'] and
$config['filters']['schema'] and no other key, so both were inert:
setRegister()/setSchema() were never called and the read ran against
whatever $currentRegister/$currentSchema the SHARED ObjectService
instance was still carrying.
saveObject() sets that context and never restores it - find() puts it
back in a finally, saveObject() has no such block - and
ImportCredentialBrokerRegister runs four repair steps ahead of the
migration, saving credential_broker_register.json's two example objects
through it. So the migration inherited credential-broker /
brokeredcredential and copied both examples into openregister_flows:
empty nodes, empty edges, no trigger, owner __system__ (which is only
what OpenRegister stamps on a sessionless write, not a convention).
Every other findAll() caller under lib/ nests the pair under filters.
This step was the outlier, and no test looked at the argument because
every fixture mocked findAll() to answer regardless of what was asked.
Two independent guards, because they fail independently:
- selection: the pair moves under `filters`, with _rbac/_multitenancy
off since a repair step has no session;
- validity: isFlowDefinition() refuses any row with no nodes, no edges
and no trigger. It depends on nothing but the row in front of it,
where the scoping guard depends on shared mutable service state
staying correct for a whole occ upgrade - which is what broke.
PurgePhantomMigratedFlows removes what already shipped, on the full
conjunction only: openregister-owned, disabled, no nodes, no edges, no
trigger/triggerRegister/triggerSchema/cron, never dispatched (lastRun*
all null AND zero rows in openregister_flow_runs), AND its uuid still
resolves to a register object whose schema is not `flow`.
It spares a row with one node or one edge, a graph-less draft that names
a trigger, any enabled flow, anything with run history, any other app's
flow, and the ambiguous case - an unrunnable shell resolving to nothing
or to a real flow object is named in the output, never deleted. Erring
toward keeping an unrunnable row is recoverable; erring the other way is
not. Idempotent; post-migration only, since the fixed migration cannot
produce these rows on a fresh install.
Also completes Flow's @method roster: status, statusMessage and the four
lastRun* accessors were added as columns by Version1Date20260805100000
and never declared, so phpstan could not see them.1 parent cabd410 commit efa4846
7 files changed
Lines changed: 1024 additions & 7 deletions
File tree
- appinfo
- lib
- Db
- Repair
- tests/Unit/Repair
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
217 | 217 | | |
218 | 218 | | |
219 | 219 | | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
220 | 241 | | |
221 | 242 | | |
222 | 243 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
96 | 96 | | |
97 | 97 | | |
98 | 98 | | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
99 | 111 | | |
100 | 112 | | |
101 | 113 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
674 | 674 | | |
675 | 675 | | |
676 | 676 | | |
| 677 | + | |
| 678 | + | |
| 679 | + | |
| 680 | + | |
| 681 | + | |
| 682 | + | |
| 683 | + | |
| 684 | + | |
| 685 | + | |
| 686 | + | |
| 687 | + | |
| 688 | + | |
| 689 | + | |
| 690 | + | |
| 691 | + | |
| 692 | + | |
| 693 | + | |
| 694 | + | |
| 695 | + | |
| 696 | + | |
| 697 | + | |
| 698 | + | |
| 699 | + | |
| 700 | + | |
| 701 | + | |
| 702 | + | |
| 703 | + | |
| 704 | + | |
| 705 | + | |
| 706 | + | |
| 707 | + | |
| 708 | + | |
| 709 | + | |
| 710 | + | |
| 711 | + | |
677 | 712 | | |
678 | 713 | | |
679 | 714 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
175 | 175 | | |
176 | 176 | | |
177 | 177 | | |
| 178 | + | |
178 | 179 | | |
179 | 180 | | |
180 | 181 | | |
| |||
184 | 185 | | |
185 | 186 | | |
186 | 187 | | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
187 | 198 | | |
188 | 199 | | |
189 | 200 | | |
| |||
211 | 222 | | |
212 | 223 | | |
213 | 224 | | |
214 | | - | |
| 225 | + | |
215 | 226 | | |
216 | 227 | | |
| 228 | + | |
217 | 229 | | |
218 | 230 | | |
219 | 231 | | |
220 | 232 | | |
221 | 233 | | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
222 | 268 | | |
223 | 269 | | |
224 | 270 | | |
225 | 271 | | |
226 | 272 | | |
227 | 273 | | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
228 | 296 | | |
229 | | - | |
230 | | - | |
231 | | - | |
232 | | - | |
233 | | - | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
234 | 306 | | |
235 | 307 | | |
236 | 308 | | |
| |||
0 commit comments