feat(states): add TaskStateORM and task_states table migration - #391
Draft
vineetvora-scale wants to merge 3 commits into
Draft
feat(states): add TaskStateORM and task_states table migration#391vineetvora-scale wants to merge 3 commits into
vineetvora-scale wants to merge 3 commits into
Conversation
Empty, inert table: nothing reads or writes it until the Postgres task-state repository lands. The (task_id, agent_id) index is deferred to the write-semantics decision.
MongoDB has no cascades, so state deletion is application-driven on both backends; a Postgres-only cascade would diverge silently on a future task hard-delete. The FK alone prevents orphaned rows.
DELETE /tasks issues a real row delete today and already fails on the sibling child tables' bare FKs; the earlier comment implied no hard-delete path exists. Also warn that explicitly-None timestamps bypass the server default and violate NOT NULL.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Second PR in the task-state storage series (follows #380). Adds
TaskStateORMand a migration creating thetask_statestable: the PostgreSQL home for task state once the Postgres repository lands in the next PR.The table is created empty and inert. Nothing reads or writes it until the repository PR wires the
postgresphase, so deploying this changes no behavior. The migration is schema-only on a brand-new table (instant, no locks against live traffic) anddowngradecleanly drops it.Deliberately deferred (needs design sign-off)
Two decisions from the design review are still open, so this PR ships without them and stays in draft until they close:
(task_id, agent_id)index/constraint is absent. Its shape is the open write-semantics decision: a unique constraint backing an atomic upsert, or a plain compound index mirroring MongoDB's non-unique one. It ships alongside the repository that implements whichever contract is chosen.Verification
downgraderemoves it cleanly, re-upgrade succeeds.What's next
The final M1 PR:
TaskStatePostgresRepositoryimplementing the repository contract from #380, the selector'spostgresbranch going live, and the parity test suite running against both backends.