Skip to content

Move input admission and Environment input reservations into sessions - #441

Merged
SaladDay merged 2 commits into
mainfrom
refactor/sessions-inputs
Oct 6, 2026
Merged

SaladDay merged 2 commits into
mainfrom
refactor/sessions-inputs

Conversation

@SaladDay

@SaladDay SaladDay commented Oct 6, 2026 •

Copy link
Copy Markdown
Collaborator

Part of #1 (dissolve store).

Input validation, admission, steering, cancel requests and Environment input reservations move out of store and into sessions, which owns the pure decisions and procedures, and sessionpg, which loads and applies. sessions.AdmitInputs is now the one batch procedure for:

  • public admission;
  • Environment input promotion;
  • Session creation's initial input.

Authority by operation:

Operation Authority
SubmitInputs, ReserveEnvironmentInput pooled sessions.Service
ExpireEnvironmentInput pooled sessions.Service, for the Worker and the Dispatcher alike. It is idempotent under the Session lock and bounded by a 5 s timeout.
PromoteEnvironmentInput, FailEnvironmentInput, ExpireEnvironmentInputs leased ExecutionOperations (the new InputExecution family)
ListTurnInputs, GetEnvironmentInputReservation, ListEnvironmentInputWork sessions.Reader, each in one snapshot

Deleted:

  • the test-only SubmitMessage, RequestCancel and CancelEnvironmentInput (the fixture seeder now runs the real use case);
  • store/scheduling.go, store.ErrExecutionAuthority and checkExecutionAuthority;
  • the store versions of every moved operation.

Replay receipts, sequence and position assignment, event order, activity tracking, reservation states and expiry, and the error identities that reach the api are unchanged. PostgreSQL tests in sessionpg cover:

  • concurrent same-key admission;
  • steering versus a racing Turn end;
  • promote/expire races;
  • lease loss;
  • rollback.

Checks run:

  • build, go vet ./services/core/...;
  • sessions and sessionpg in full with the database;
  • execution and api -run for inputs;
  • store -run for the input and session_initial* tests;
  • tests/fixtures build, check-names.py.

View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

AdmitInputs admits a validated batch for every admission path, and
admitInput is no longer exported. GetEnvironmentInputReservation reads in
one snapshot through the bound Session transaction, the receipt and
reservation loaders lose their forwarding helpers, FindInputReservation
loads receipts only for a matching batch, and the pooled expiry calls in
execution are bounded. TestTurnInputRetriesAndRestart again checks that
admission leaves the stored Session unchanged and that its latest Turn
survives a restart.
@SaladDay
SaladDay merged commit df2abab into main Oct 6, 2026
19 checks passed
@SaladDay
SaladDay deleted the refactor/sessions-inputs branch October 6, 2026 19:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant