Split Session change decisions from their PostgreSQL writes - #316
Merged
Merged
Conversation
The detail type moves to sessions with the Session change vocabulary, while the sanitizing rule uses store's provisioning step labels.
SessionChange, Turn with its status constants, EnvironmentInputActivity, EnvironmentFailure and ProvisioningFailureDetail move verbatim from store to the new sessions package. Every reference was rewritten by rename-sessions-vocab.py; two store test locals named sessions were renamed so they no longer shadow the package. No behaviour changes.
items decides each Item change and builds its ordered events; sessions decides the public changes for Turn and Session transitions, what a Turn that ends settles, measured usage and Session activity. sessionpg loads the facts those decisions read and applies them in the caller's Session transaction: event sequence and IDs, journal rows, Items, usage, Artifact settlement and pruning. It parses IDs with pgunit.ParseID and returns textvalue.ErrUnstorable for text PostgreSQL cannot store. Store scripts call the decisions and apply functions directly; recordTurnChange, recordSessionChange, recordItemChange and settleTurnArtifacts are gone.
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.
Part of #1 (store layering), PR 11. Splits the Session change decisions from their PostgreSQL writes, so later Session PRs build on shared primitives.
Commits
sessions. That coversTurnand its statuses,EnvironmentInputActivity,EnvironmentFailureandProvisioningFailureDetail. Item merging and the ordered Item events move toitems.sessionsowns the Turn and Item change sets,EndTurn, measured usage, the terminal status and the retention bounds. When a Turn ends, unfinished Items become incomplete, artifacts are published or discarded, then the Turn event and the settled activity are written.persistence/postgres/sessionpgloads facts and applies the decisions. It runs as free functions on the caller's transaction queries, allocates sequence numbers, IDs, positions and output indexes, and decides nothing.textvalue.ErrUnstorable.recordTurnChange,recordSessionChange,recordItemChangeandsettleTurnArtifacts.Behaviour
Review and checks
check-names.py, sqlc (no diff), items/sessions/persistence/api tests, and the full store package (541 passed, 13 opt-in skips).go vetinsandbox/providersfails on main itself after Move saved Agents into the agents domain and agentpg adapter #315; a separate fix is coming.Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.