Commit 705e5c8
`saveMetaItem` canonicalizes flow bodies before the schema gate (#4542). When
the canonicalizer throws — it is stricter than the gate: strict parse, cycle
detection, control-flow region validation — the save falls back to the raw body
so a WIP draft with a temporary cycle stays saveable. That fallback is correct
and unchanged here. It was also completely silent.
Three of the four postures at this seam announce themselves: a clean pass heals
the row, a refused rename fails with 409 FLOW_CONVERSION_CONFLICT naming the
token, and a host with no automation service is reported by `os migrate meta
--stored`. The throw-fallback said nothing — so a save that skipped
canonicalization was indistinguishable from one that healed the row, and a body
that is BOTH a legacy dialect and unparseable re-persisted verbatim. That is
the #4542 symptom arriving silently, against a boot warning that tells the
author re-saving is the remedy.
The fallback now warns, naming the flow and the canonicalizer's own error,
deduped once per flow per process (the `convertStoredItem` pattern — Studio
autosaves the same draft repeatedly and a WIP cycle throws on every write).
This aligns the write seam with ADR-0087 D2's "loud" posture.
No behavior change: the body still saves, the gate stays the arbiter, and
`registerFlow` still refuses to arm a malformed flow. Refusing the save in
publish mode was considered and rejected — publish is the default mode, so it
would silently tighten validation for every existing caller, and it can only be
enforced where an automation service exists, making the same body saveable on a
control-plane host and a 422 on an automation host.
Tests: 5 new cases in protocol.save-flow-canonicalization.test.ts — warns with
the flow name and reason; deduped across repeat saves; silent on the clean,
conflict, and no-service paths. Full metadata-protocol suite green (206).
Claude-Session: https://claude.ai/code/session_01NDmJ5ASMSzcw1q17vh32MG
Co-authored-by: Claude <noreply@anthropic.com>
1 parent 355e951 commit 705e5c8
3 files changed
Lines changed: 159 additions & 2 deletions
File tree
- .changeset
- packages/metadata-protocol/src
Lines changed: 35 additions & 0 deletions
| 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 | + | |
Lines changed: 90 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
| 19 | + | |
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| |||
143 | 143 | | |
144 | 144 | | |
145 | 145 | | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
146 | 160 | | |
147 | 161 | | |
148 | 162 | | |
| |||
278 | 292 | | |
279 | 293 | | |
280 | 294 | | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
281 | 370 | | |
282 | 371 | | |
283 | 372 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1719 | 1719 | | |
1720 | 1720 | | |
1721 | 1721 | | |
| 1722 | + | |
| 1723 | + | |
| 1724 | + | |
| 1725 | + | |
| 1726 | + | |
| 1727 | + | |
| 1728 | + | |
| 1729 | + | |
1722 | 1730 | | |
1723 | 1731 | | |
1724 | 1732 | | |
| |||
6250 | 6258 | | |
6251 | 6259 | | |
6252 | 6260 | | |
6253 | | - | |
| 6261 | + | |
6254 | 6262 | | |
6255 | 6263 | | |
6256 | 6264 | | |
6257 | 6265 | | |
6258 | 6266 | | |
6259 | 6267 | | |
6260 | 6268 | | |
| 6269 | + | |
| 6270 | + | |
| 6271 | + | |
| 6272 | + | |
| 6273 | + | |
| 6274 | + | |
| 6275 | + | |
| 6276 | + | |
| 6277 | + | |
| 6278 | + | |
| 6279 | + | |
| 6280 | + | |
| 6281 | + | |
| 6282 | + | |
| 6283 | + | |
| 6284 | + | |
| 6285 | + | |
| 6286 | + | |
| 6287 | + | |
| 6288 | + | |
| 6289 | + | |
| 6290 | + | |
| 6291 | + | |
| 6292 | + | |
| 6293 | + | |
6261 | 6294 | | |
6262 | 6295 | | |
6263 | 6296 | | |
| |||
0 commit comments