Repository navigation
feat(driver): remote schedule registry via ScheduleStoreService driver protocol (#257) - #404
Merged
Merged
Conversation
…iver protocol (#257) Add the remote schedule-registry seam to the driver protocol so a deployment can run its schedule store in a separate driver process, consistent with SessionStoreService/EventLogService/SessionLeaseService. - contracts/proto/mecatl/driver/v1/schedule_store.proto: the 13-RPC ScheduleStoreService (Save/Load/Delete/List/Due/Claim/ClaimNow/ SetEnabled/RecordFire/RecordFireStart/RecordFireProgress/LoadFire/ ListFires) + the 1-RPC ScheduleOneShotReArmerService (ReArmOneShot). Schedules and fires cross as opaque format-tagged JSON envelopes (schedule-json/1) the driver round-trips verbatim; the atomic Claim/ClaimNow/ReArmOneShot advance is implemented server-side by the driver (the harness client cannot fence over the wire) — the same trusted-peer posture SessionStoreService takes for snapshot opacity. - internal/adapter/grpcdriver/schedulestore.go: the thin client wrapper (port.ScheduleStore + port.ScheduleOneShotReArmer over the wire; NOT_FOUND -> ErrScheduleNotFound, UNIMPLEMENTED -> ErrScheduleUnsupported, mis-keyed-driver and unknown-format guards) + the fail-closed server wrappers (every RPC validates before touching the backend; top-level key vs decoded-payload mismatch is INVALID_ARGUMENT). - Validated by scheduleconformance.Run over bufconn (client -> wire -> server wrapper -> memschedulestore), incl. the Claim/ClaimNow/ReArmOneShot atomicity and RecordFire idempotency subtests, plus 20 wrapper unit tests covering the error-classification and validation arms.
…le registry (#257) Compose the wave-1 driver into the deployment: a dedicated, independent --schedule-store-url flag (the --event-log-url precedent; ADR 0059 decision #5's 'an independent override wins' arm) pointing the durable schedule registry at a remote ScheduleStoreService driver. - internal/app/build.go: resolveScheduleStore is the ONE resolution the scheduler tick loop (buildScheduler), the fire path (startScheduler's fireStore), and the delivery-queue gate (buildDeliveryQueue) all share; the override dials through the shared driverConns cache (equal URLs share one connection, once-guarded close) and fails loud on dial error (an explicitly-configured driver that won't dial is an operator misconfiguration, never a silent no-scheduling degrade). Unset keeps the byte-identical store-accessor discovery. - cmd/mecated: the operator-tier flag + ACP-common-help exclusion (server-boundary surface, never a project-tier knob). - Docs: PRODUCTION-READINESS flips the driver ScheduleStoreService from deferred to shipped; architecture.md/observability.md/usage + user-docs gain the flag and the two-service driver surface.
…stry for tool + tick loop (#257) Close the split-brain the wave-2 override would otherwise open: the in-chat Schedule tool's manager discovered its store ONLY by type-asserting the session store, so --schedule-store-url + an accessor-less session store left the tool absent while the tick loop ran remote (and with an accessor-ful store the two would manage DIFFERENT registries). ScheduleManagerConfig gains an OPTIONAL explicit ScheduleStore that wins over the accessor discovery (composition passes the one resolveScheduleStore result); nil keeps the byte-identical accessor path, and nil-from-both keeps the honest absent-manager semantics. Pinned by the override tests (override shadows an accessor-ful store; byte-identical arms unchanged) and the composition-level TestBuild_ScheduleStoreOverrideWiresScheduleTool / TestBuild_ScheduleStoreOverrideStartsScheduler.
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
Closes #257. Adds a
ScheduleStoreService(+ScheduleOneShotReArmerService) to the driver protocol (contracts/proto/mecatl/driver/v1/) so the scheduled-tasks registry can be remote — consistent with the other driver stores (SessionStoreService,EventLogService,SessionLeaseService). Part of #189 (scheduled tasks); the mechanical mirror deferred out of #256.Built with the dev pipeline: architect plan → 3 implementation waves → panel review (spec + standards + security + architecture + duplication + library-reuse) → QA test-adequacy review → iteration.
What lands
Wave 1 — wire protocol + grpcdriver wrappers
contracts/proto/mecatl/driver/v1/schedule_store.proto: the 13-RPCScheduleStoreService(the issue listed 11;RecordFireStart/RecordFireProgressfrom Scheduled tasks: expose in-flight fire state, progress, and wall-clock timeout #386 are included — the conformance suite exercises them) + the 1-RPCScheduleOneShotReArmerService. Schedules/fires cross as opaque format-tagged JSON envelopes (schedule-json/1, theSessionSnapshotprecedent) the driver round-trips verbatim;Claim/ClaimNow/ReArmOneShotatomicity is implemented server-side by the driver (the harness client can't fence over the wire) — the same trusted-peer postureSessionStoreServicetakes.internal/adapter/grpcdriver/schedulestore.go: thin client (port.ScheduleStore+port.ScheduleOneShotReArmerover the wire;NOT_FOUND → ErrScheduleNotFound,UNIMPLEMENTED → ErrScheduleUnsupported, mis-keyed-driver + unknown-format guards) and fail-closed server wrappers (every RPC validates before touching the backend; top-level key vs decoded-payload mismatch →INVALID_ARGUMENT).Wave 2 — composition + operator flag
--schedule-store-urlon mecated: a dedicated, independent override (the--event-log-urlprecedent; ADR 0059 decision ACP: accept image/audio prompt content blocks #5's "an independent override wins" arm). OneresolveScheduleStoreshared by the scheduler tick loop, the fire path, and the delivery-queue gate; dials through the shareddriverConnscache (equal URLs share one connection, once-guarded close); fails loud on dial error. Unset = byte-identical store-accessor discovery. Operator-tier only (ACP-excluded; no project-tier influence).Wave 3 — no split-brain
server.ScheduleManagerConfig.ScheduleStore: the in-chat Schedule tool's manager takes the same resolved store, so tool + tick loop + fire path share ONE registry (otherwise the tool stayed absent with an accessor-less session store, or managed a different registry than the tick loop fired from).Testing
TestGRPCScheduleStoreConformanceruns the fullscheduleconformancesuite (28 subtests) over the real gRPC wire via bufconn — client → wire → server wrapper →memschedulestore— provingClaim/ClaimNow/ReArmOneShotatomicity,RecordFireidempotency,Duefiltering, and the sentinel mappings hold through the remote path (the same suite the in-process backends pass).LoadScheduleandLoadFire, driver-NOT_FOUND-tolerantDelete, the re-arm happy path and itsUNIMPLEMENTED → ErrScheduleUnsupporteddegrade.Verification
task lint·task test(root + engine + provider modules,-race, engine-standalone) ·task docs(matlatl strict: 0 broken/orphan/unreachable) ·task api:check— all green.go run ./cmd/mecademoprints a full offline session.Review notes
Panel review (spec/standards/security/architecture/duplication/library-reuse) found no ship-blockers: layering holds (no
server ← grpcdriveredge), the driver-conn rides the existingdriverConnsinventory row, the proto/generated/docs conventions hold. A QA test-adequacy pass drove the error-path test additions in wave 1's iteration (fire-envelope validation,LoadFireguards, delete tolerance, blank-scalar table). One pre-existing gap noted for follow-up (NOT this PR's scope): a driver serving onlyScheduleStoreServicemakes the scheduler's re-arm path WARN per tick rather than sticky-disable — the sticky-disable flag only exists on theDuepath (internal/adapter/scheduler/scheduler.go:851); worth its own issue if we care.