Require Parent Confirmation Before Preparing a School RSVP
Create a school calendar event, show a parent the proposed attendance reply,
and prepare that reply only after the parent confirms its exact contents.
This example runs application service functions against a generated TeaQL
Python library and a disposable SQLite database. Its final state is QUEUED;
it does not send an email or submit a school form.
The scenario comes from Oraki's public question on X. All names, addresses and school details in the executable are synthetic.
Evidence status: The generated Python/SQLite application passes ten scenarios on TeaQL Python 0.7.0. The receipt records the model and source hashes. The verified endpoint is command preparation; external delivery and a production authentication UI are separate.
Run the example
Use a checkout of the TeaQL site repository, Python with venv and pip, and
cargo-teaql 2.0.14. The recorded run uses Python 3.15.0. Generation and
dependency installation require network access. The site's npm dependencies
are unnecessary for this command.
git clone https://github.com/teaql/teaql-io-site.git
cd teaql-io-site
cargo install cargo-teaql --version 2.0.14 --locked
python3 scripts/verify-parent-confirmed-rsvp.py \
--report artifacts/parent-confirmed-rsvp/verification.json
The runner submits the model to
https://api.teaql.io/latest/, requires zero evaluation errors, warnings and
suggestions, and generates the python-web-fastapi workspace. It installs the
workspace against the example's dependency constraints,
compiles the application, and executes the SQLite scenarios. The constraints
pin TeaQL Python 0.7.0; a future generator that requires another runtime
needs a new verification rather than a silent dependency substitution.
The generated FastAPI workspace supplies the domain library and application guide. The example calls its own service functions directly; it does not add HTTP routes or an authentication system. Its application code and scenario driver are separate from the generated files. The runner verifies those generated files remain unchanged.
Temporary generated code, the virtual environment and test databases are
removed on exit. Only the requested compact JSON receipt remains. Agents using
the TeaQL Agent Kit can set
TEAQL_SKILL_DIR to their installed build-teaql-app directory so the runner
stamps current caller provenance before evaluation and generation.
Choose another database or language
The same confirmation design can use PostgreSQL (PG) or MySQL through TeaQL's corresponding server-side providers. Besides Python, TeaQL can generate APIs from the same KSML domain model for six other languages: Java, Rust, TypeScript, Go, C# / .NET, and Swift. The language support overview lists their database providers.
Generate the selected language's APIs, configure its database provider, and implement the confirmation service with those native APIs. Swift's local SQL provider is SQLite; a Swift application can use a backend service backed by PostgreSQL or MySQL. The runner and receipt here verify Python with SQLite. Run equivalent confirmation, replay and transaction checks for the language and database combination you choose.
Separate the event from the reply
The model has one household root and four related entity types:
| Entity | Purpose |
|---|---|
family_member | Identify the child and the authenticated member allowed to confirm. |
school_event | Keep the extracted date, title, location, source reference and consent revision. |
rsvp_request | Bind one child and event to a response, recipient, confirmation and command key. |
rsvp_status | Name the PENDING, APPROVED and QUEUED states. |
The fixture creates the calendar event before creating a pending RSVP.
Nothing in calendar creation approves attendance. can_confirm is a
server-managed household permission in this small fixture. A product with
different guardians for different children must model and check that
child-specific authority as well.
Show the exact action before confirming it
The application-owned preview function returns the summary displayed to the
parent and its SHA-256 digest:
action, digest = await preview(parent_context, request_id)
The summary includes the household, child, event, date, location, source, consent revision, response, recipient and command key. The interface should display recognizable child and event names alongside their identities, and make the recipient and attendance response visible.
After the parent confirms, the trusted endpoint calls:
await confirm(parent_context, request_id, digest)
confirm resolves the member from the context's authenticated subject. It
checks household ownership and current confirmation authority, recomputes the
summary, and rejects a digest from an older preview. It then saves the
approver, digest and APPROVED state together through one audited save.
The digest identifies the reviewed action; authority comes from the
authenticated context and the application check, not from possession of a hash.
The fixture constructs these trusted contexts in code. Production endpoints must derive the subject, authorized household and service permissions from server-side authentication and authorization. Keep those resources and approval fields out of agent-supplied request bodies, and expose the application actions instead of a generic entity-write endpoint.
Recheck before preparing delivery
The trusted delivery service calls:
result = await prepare_delivery(worker_context, request_id)
The service reloads the RSVP, event, child and approving parent, verifies
current ownership and authority, and compares the stored approved digest with
the current action. A changed trip, recipient or response requires a new
preview and confirmation. The old APPROVED record remains a historical
approval; its status alone cannot establish that the current action is approved.
Validation and the transition to QUEUED run inside context.transaction.
With the selected SQLite provider, this covers the read, decision and write
interval. Repeating preparation for the same unchanged request returns
ALREADY_QUEUED without another write. An injected failure after the queue
write rolls back both state and version, checked through an independent
read-only SQLite connection.
Read the recorded result
The verification receipt records the exact model and source hashes, resolved runtime, commands and test result. The observed native test output ends with:
Ran 10 tests in 3.381s
OK
The scenarios cover a calendar-only import, unconfirmed preparation, authorized confirmation and replay, a child account, another household, an outdated preview, changed trip details, a changed recipient, revoked authority, an unprivileged delivery caller and rollback after a write. Some tests exercise more than one of these checks.
The generated default mutation policy emits MUTATION-POLICY-001 warnings;
the confirmation rules tested here are application service checks. This is
a Python/SQLite application example, not a seven-runtime approval feature.
Connect an external delivery system
QUEUED means the example authorized preparation of one command. A production
sender needs an immutable command payload, durable delivery tracking and an
idempotency strategy supported by the destination. Decide whether a queued
command can be cancelled or must be reviewed again when event details change,
and enforce that decision at the dispatch boundary.
The demonstrated replay result prevents a repeated state transition for one RSVP. It does not establish exactly-once email delivery or global command-key uniqueness. Database rollback cannot recall an email already accepted by a school. Keep sending and delivery acknowledgement separate from the database confirmation transaction.