feat: add governed assisted form intake

This commit is contained in:
2026-08-19 02:45:53 +02:00
parent eea3db3d2e
commit d83bb92ec8
18 changed files with 1895 additions and 39 deletions
@@ -291,6 +291,57 @@ class FormIntakeSession(Base, TimestampMixin):
)
class FormAssistedConfirmation(Base, TimestampMixin):
__tablename__ = "form_assisted_confirmations"
__table_args__ = (
UniqueConstraint(
"tenant_id",
"confirmation_id",
name="uq_form_assisted_confirmation",
),
UniqueConstraint(
"tenant_id",
"idempotency_key",
name="uq_form_assisted_confirmation_idempotency",
),
Index(
"ix_form_assisted_confirmation_instance",
"tenant_id",
"instance_id",
"instance_revision",
),
)
id: Mapped[str] = mapped_column(String(36), primary_key=True, default=new_uuid)
tenant_id: Mapped[str] = mapped_column(String(36), nullable=False, index=True)
confirmation_id: Mapped[str] = mapped_column(
String(36), nullable=False, index=True
)
intake_session_id: Mapped[str] = mapped_column(
ForeignKey("form_intake_sessions.id", ondelete="RESTRICT"),
nullable=False,
index=True,
)
instance_id: Mapped[str] = mapped_column(String(255), nullable=False, index=True)
instance_revision: Mapped[int] = mapped_column(Integer, nullable=False)
outcome: Mapped[str] = mapped_column(String(30), nullable=False, index=True)
method: Mapped[str] = mapped_column(String(30), nullable=False, index=True)
confirmed_by_ref: Mapped[str] = mapped_column(String(255), nullable=False)
operator_actor_id: Mapped[str] = mapped_column(
String(255), nullable=False, index=True
)
confirmed_at: Mapped[datetime] = mapped_column(
DateTime(timezone=True), nullable=False, index=True
)
payload_sha256: Mapped[str] = mapped_column(String(64), nullable=False)
idempotency_key: Mapped[str] = mapped_column(String(255), nullable=False)
request_sha256: Mapped[str] = mapped_column(String(64), nullable=False)
correction_note: Mapped[str | None] = mapped_column(String(1000), nullable=True)
details: Mapped[dict[str, Any]] = mapped_column(
"metadata", JSON, default=dict, nullable=False
)
class FormAcknowledgement(Base, TimestampMixin):
__tablename__ = "form_acknowledgements"
__table_args__ = (
@@ -335,6 +386,7 @@ class FormAcknowledgement(Base, TimestampMixin):
__all__ = [
"FormAcknowledgement",
"FormAssistedConfirmation",
"FormInstanceEvent",
"FormHandoffEffect",
"FormIntakeProfile",