Skip to content

Import gates run in a fixed order and roll back what they generated

Importing a bundle can create node types before it knows whether the workflow is acceptable. The fixed order, and the rollback, are what keep a refused import from leaving debris behind.

The rule

Normative: this is the rule
  1. A bundle import MUST apply its gates in this order: envelope format, publisher trust, capability manifest, node-type generation, workflow validation, flow-id shape, id collision.
  2. Any refusal after node-type generation MUST roll the generated node types back, so that a refused import leaves nothing behind.
  3. An unsupported envelope format MUST be refused with 422 and the code UNSUPPORTED_BUNDLE_FORMAT.
  4. An untrusted publisher MUST be refused with 403 and the code UNTRUSTED_PUBLISHER, unless the caller both confirms the publisher and is permitted to do so.
  5. A processor the installation does not have MUST be refused with 422 and the code MISSING_PROCESSOR.
  6. That refusal MUST be reported ahead of validation, so that a missing processor is actionable rather than surfacing as a structural error.
  7. A workflow that fails validation MUST be refused with 422, the code VALIDATION_FAILED and details.
  8. An id that already exists MUST be refused with 409 and the code WORKFLOW_ID_TAKEN, and the existing workflow MUST NOT be overwritten.
  9. An absent flow id MUST be accepted, and one MUST be minted.
  10. A flow id that is present MUST match ^[a-z0-9_]+$, so an empty one is refused.
  11. A flow id MUST be at most 64 characters.
  12. A flow id that breaks either MUST be refused with 422 and the code INVALID_FLOW_ID.
  13. Every refusal MUST carry at least one details entry identifying the cause.
  14. A flow-id refusal MUST locate itself at flow.id.
  15. Exposure entries are normalised before validation for every bundle, a trusted one included: an entry keeps only its name, node_id and port, and only where those are scalar, cast to string; an entry that is not an object, or is wholly malformed, becomes empty but keeps its index, so validation reports it against its own position instead of shifting every later one.
  16. What is stored MUST be the entry as submitted, so an author's additional entry metadata survives the import.

What it means

Generating node types happens before the workflow is known to be acceptable, because a bundle can only be validated once the processors it describes exist to validate against. That ordering choice is what forces the rest of the rule: anything the import creates ahead of validation — a node type, most of all — is rolled back the moment a later gate refuses, or a refused import would leave behind exactly the debris a caller has no way to see or undo.

The exposure-entry coercion runs even for a bundle whose publisher is trusted. Trust decides whether the bundle can be imported at all, not whether the entries inside it are safe to hand to the workflow validator: a malformed entry is normalised to an empty one that keeps its original position, so a validation error still names the entry it belongs to instead of shifting onto whichever entry happened to land at that index next. What is stored, though, is the entry as the bundle submitted it — the coercion protects the validator's reads, not what ends up on record.

A missing processor is reported ahead of workflow validation for the same reason node-type generation runs early: without the processor, the workflow would fail validation with a wall of structural errors that all trace back to one absent capability. Naming the capability first is what makes the refusal actionable.

Example

A bundle from an untrusted publisher403 — UNTRUSTED_PUBLISHER
POST /api/flowdrop/workflows/import

{"format": "flowdrop.bundle/v1", "payload": {"flow": {"id": "imported_flow", "label": "Imported Flow", "nodes": [ … ], "edges": []}}}
A bundle needing a processor the installation lacks422 — MISSING_PROCESSOR
POST /api/flowdrop/workflows/import

{"format": "flowdrop.bundle/v1", "payload": {"publisher": "acme", "flow": {"id": "imported_flow", "label": "Imported Flow", "nodes": [{"id": "g.1", "data": {"metadata": {"node_type_id": "ghost", "executor_plugin": "ghost_module:ghost"}}}], "edges": []}}}
A bundle whose flow id is already taken409 — WORKFLOW_ID_TAKEN
POST /api/flowdrop/workflows/import

{"format": "flowdrop.bundle/v1", "payload": {"publisher": "acme", "flow": {"id": "imported_flow", "label": "Imported Flow", "nodes": [ … ], "edges": []}}}

The 409 never overwrites: the workflow already on record under that id is untouched, and nothing from the rejected bundle — including any node type it would have generated — survives the refusal.

Why

Recorded under OPEN-19, OPEN-25, OPEN-26, OPEN-49.

Rule identifiers are permanent and are never renumbered. Each implementation publishes its own standing against these rules; this specification does not.spec 1.0 · STORE-9 · changed in spec 1.1