Skip to content

API Reference parrot_formdesigner.services.autonomous_storage

github-actions[bot] edited this page Dec 2, 2026 · 4 revisions

parrot_formdesigner.services.autonomous_storage

View source

AutonomousFormStorage — pointer-indexed form definitions.

The second half of "autonomous": a form's definition body lives in its own store (a :class:~parrot_formdesigner.core.persistence. FileDefinitionTarget, for v1), while the registry still indexes a lightweight pointer row so listing, RBAC and multi-tenancy keep working unchanged (spec section 8, resolved).

Implemented as a decorator over an existing FormStorage — not a new registry — because satisfying the same interface means :meth:~parrot_formdesigner.services.registry.FormRegistry._read_through needs NO changes at all. FormRegistry itself is never modified by this feature.

WARNING (the single biggest trap in this feature): FormStorage. load_by_slug is not declared on the ABC (services/registry.py:63-238) yet FormRegistry calls it (services/registry.py:418 and :1075). This class MUST implement it — its absence is an AttributeError at runtime, not a type error at build time.

Class AutonomousFormStorage

Decorates a FormStorage, externalizing the definition body.

Forms WITHOUT a persistence.definition block pass straight through to the inner storage, unchanged — this class introduces no behaviour difference for ordinary forms.

Parameter Type Default Description
inner FormStorage The wrapped storage (e.g. PostgresFormStorage) — the pointer row's home. MUST implement load_by_slug (not on the ABC, but required by FormRegistry).
aliases SinkAliasRegistry Resolves a FileDefinitionTarget.connection to a base directory and contains path within it.

Method AutonomousFormStorage.save

Persist form, externalizing the body when declared.

save(form: FormSchema, style: StyleSchema | None = None, *, tenant: str | None = None) -> str

Parameter Type Default Description
form FormSchema The form to persist.
style StyleSchema | None None Optional associated style.
tenant str | None None Optional per-call tenant override.

Returns: str — The form_id of the saved form (per the inner storage).

Method AutonomousFormStorage.load

Load a form by its immutable form_uid, hydrating if pointed.

load(form_uid: uuid.UUID, version: str | None = None, *, tenant: str | None = None) -> FormSchema | None

Parameter Type Default Description
form_uid uuid.UUID The form's immutable UUID (matches the concrete/ caller contract used by FormRegistry — NOT the ABC's form_id: str docstring).
version str | None None Optional specific version.
tenant str | None None Optional per-call tenant override.

Returns: FormSchema | None — The full FormSchema (hydrated if pointer-indexed), or None if not found.

Method AutonomousFormStorage.load_by_slug

Load a form by its mutable slug, hydrating if pointer-indexed.

REQUIRED even though FormStorage (the ABC) omits it — FormRegistry._read_through calls it directly (services/registry.py:1075).

load_by_slug(form_id: str, tenant: str, version: str | None = None) -> FormSchema | None

Parameter Type Default Description
form_id str The form's human-readable slug.
tenant str Tenant to query (required, matching the concrete PostgresFormStorage.load_by_slug contract).
version str | None None Optional specific version.

Returns: FormSchema | None — The full FormSchema (hydrated if pointer-indexed), or None if not found.

Method AutonomousFormStorage.delete

Delete both the pointer row and (if any) the externalized body.

delete(form_uid: uuid.UUID, *, tenant: str | None = None) -> bool

Parameter Type Default Description
form_uid uuid.UUID The form's immutable UUID.
tenant str | None None Optional per-call tenant override.

Returns: bool — Whatever the inner storage's delete() returns.

Method AutonomousFormStorage.list_forms

Delegate to the inner storage — pointer rows list identically.

list_forms(*, tenant: str | None = None) -> list[dict[str, Any]]

Parameter Type Default Description
tenant str | None None

Returns: list[dict[str, Any]]

Method AutonomousFormStorage.list_versions

Delegate to the inner storage.

list_versions(form_uid: uuid.UUID, *, tenant: str | None = None) -> list[dict[str, Any]]

Parameter Type Default Description
form_uid uuid.UUID
tenant str | None None

Returns: list[dict[str, Any]]

Method AutonomousFormStorage.promote

Delegate to the inner storage.

Coordinate/definition immutability means promote() needs no special handling here: the destination never changes across versions (spec section 2, "Destination immutability").

promote(form_uid: uuid.UUID, version: str, schema_json: str, *, tenant: str | None = None) -> bool

Parameter Type Default Description
form_uid uuid.UUID
version str
schema_json str
tenant str | None None

Returns: bool

Method AutonomousFormStorage.close

Delegate to the inner storage.

close() -> None

Alias FormSchema

Re-exported from parrot_formdesigner.core.schema.FormSchema.

Alias FormStorage

Re-exported from parrot_formdesigner.services.registry.FormStorage.

Alias SinkAliasRegistry

Re-exported from parrot_formdesigner.services.sink_aliases.SinkAliasRegistry.

Alias StyleSchema

Re-exported from parrot_formdesigner.core.style.StyleSchema.

Architecture

Clients

Bots & Agents

Memory

Knowledge

Tools & Toolkits

Flows

Experts

Skills

Stores & Loaders

MCP & A2A

Server & APIs

Integrations

Outputs & A2UI

Prompts

Security

Operations

Migration

SDD Tooling

LLM Wiki

Deployment

Decisions

API Reference

Clone this wiki locally