Repository navigation
Move Environments and devices into sessions and sessionpg - #336
Merged
Merged
Conversation
Environment and device reads, the initialization list and the frozen setup and initial files join sessions.Reader on the pooled sessionpg.Store, which sessionpg.New(units, cipher) builds with the credential key. Frozen data that does not open or validate is an internal error, and a missing key is credentialcrypto.ErrUnavailable. Device creation, revocation, heartbeats and Runtime enrollment are sessions.Service use cases; the device registration rule and RuntimeTypeAgentDaemon move to sessions and runtimedevice. The EnvironmentExecution family joins sessions.ExecutionOperations on sessionpg.NewExecution(lease): initialization claim, completion and failure, connection replacement, observation and reconciliation, and Session device binding each run a Load, Decide and Apply transaction under the Session lock. sessionpg.LoadEnvironment, LoadSessionEnvironment and CreateSessionEnvironment are participants of other Session transactions. The Worker, runtime manager and lifecycle receive the Session operations and reader explicitly. The daemon gateway takes its credential, heartbeat and archived cancellation dependencies separately, so draining a receipt no longer depends on a type assertion on the heartbeat store, and MarkRuntimeOffline is deleted. api gains the required EnvironmentsReader, and cmd/device provisions devices through sessions.Service. The store Environment, initialization, connection recovery, local device and enrollment files are deleted.
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.
Environment initialization, connections, enrollment and devices, plus the reads of frozen Session data, move out of
storeintosessionsandsessionpg.What changes
Execution use cases:
sessionsgains the lease-boundEnvironmentExecutionfamily onsessionpg.Execution:Each is Load → pure Decide → Apply, and the rules have table tests. Environment failure and termination reuse the 11c procedures.
Reads: Environments, Session Environments, devices, the frozen setup, the initial files, the skill references and executor credential authentication go through the
sessionsreader, implemented bysessionpg.Store. api and the runtime enrollment handler take the reader directly.Frozen data:
sessionpg.Storeopens the frozen setup, the initial files and the skill references with the credential cipher and the Session binding. The bindings and ciphertext are unchanged.Runtime gateway:
runtime.NewGatewaytakes the archived-cancellation dependency explicitly. The type-assertion discovery is gone.Device registration:
CreateDevice,RevokeDeviceand device registration validation move with the devices.Removed from
store: the moved Environment, connection, enrollment and device files, the Worker forwarding file, and the no-opMarkRuntimeOffline.Test fixtures: they build the Session adapter from the pool and cipher, not from
*store.Store.Docs:
IMPLEMENTATION.mdnames the new owners.Behavior
credentialcrypto.ErrUnavailable(503). PostgreSQL tests cover both.BindSessionDevicerejects a malformed or nil device ID before any storage call, as before.Checks
go build ./...,go vet ./services/core/...,make openapi(no diff) andscripts/check-names.py.sessionsandsessionpgin full.-runon the 194 tests in the store test files this PR touches: 187 pass, and 7 are gated on the environment. Five of those seven also passed with the official Python SDK and the environment key binary. The other two need a native daemon binary.-run(14 tests), execution-run(20 tests),cmd/serverandruntimeenrollmentin full.A blind review found no blockers or majors. Three minor findings are fixed in this commit: the test fixtures reached into store internals, the device ID was checked in the wrong order, and a line of
IMPLEMENTATION.mdwas missing. The fourth, an adapter export, is handled in the follow-up PR.Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.