Skip to content

feat(adapters): publish production persistence implementations - #2005

Merged
JAORMX merged 7 commits into
mainfrom
feat/public-persistence-adapters
Sep 30, 2026
Merged

JAORMX merged 7 commits into
mainfrom
feat/public-persistence-adapters

Conversation

@JAORMX

@JAORMX JAORMX commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Expose the existing JSONL, Redis, and gRPC driver implementations to external Go applications without copying the stores, changing persistence formats/semantics, or adding transport dependencies to the engine.

  • Public imports: github.com/stacklok/mecatl/adapters/{jsonlstore,redisstore,grpcdriver}.
  • Generated driver contracts have a small independent module; the existing /driver/v1 package path stays unchanged. Shared watcher and soul validation have one implementation in a private support module.
  • Mecatl's composition and tests use the public adapters. Existing pagination, lineage, cursor replay/follow, lifecycle behavior, and conformance suites remain.
  • Public dependency revisions resolve through the Go proxy and checksum database. Real adapters/go.sum is committed; ordinary builds/tidy do not depend on unpublished tags or consumer replacements.

The existing user-facing owner, user-docs/building/extension-points/session-store.md, documents construction, capabilities, cleanup, read-only limitations, and snapshots versus logs. adapters/COMPATIBILITY.md defines compatibility and independent nested-module releases. ADR 0372 records the promotion without rewriting frozen decisions.

Simpler CI and workspace hygiene

Following the operator's explicit request to prioritize maintainability over low-value CI self-tests:

  • One CI test job calls task test:race for ready PRs/main, or task test for drafts. Task runs independent modules concurrently, with CI concurrency capped at three. The normal required-check name remains Test (race).
  • Delete package partitions, shard completeness/aggregate/count assertions, timing wrappers and experimental flags. No replacement orchestration framework.
  • Restore fix(test): isolate microVM integration dependencies and stabilize workspace metadata #1999's root tidy → go work sync → standalone module tidies. Tests use GOWORK=off and read-only manifests. Preserve microVM's test-only integration-module boundary.
  • Keep one ordinary metadata-freshness check, not repeated build/download/tidy cycles on every CI run. Local repeated-cycle validation was byte-stable across all 27 metadata files.
  • Keep one offline external-consumer proof in Build after dependency setup. Remove special release wrappers and the candidate proxy's synthetic dependency rewrites.

The follow-up cleanup removes approximately 1,000 net lines relative to the initial implementation. The tradeoff is shared-runner execution instead of cross-runner sharding, not a new package-registration burden.

External-consumer proof

task test:persistence-standalone packages current adapter source and runs an unrelated external module with GOWORK=off, no replace, an isolated cache, and file-only dependency resolution. Real dependency versions remain unchanged. Filesystem fixtures, miniredis, and bufconn exercise:

  • Independent production writer/reader construction, discovery/pagination, saved usage, and exact parent/child relationships and incarnations.
  • Replay/resume, gaps, malformed/cross-session/expired cursors, pruning and lineage tombstones.
  • Actual live follow delivery, early exit, cancellation, and cleanup.
  • Initialized Redis reads with unexpected writes rejected by the fixture.

The proof rejects host-module leakage and checks the engine-only graph. A real app composition test also verifies persisted production-writer output through the public JSONL reader.

Preserved limitations and release status

JSONL construction and some reads write initialization/lock/catalog state: this is not a general read-only-mount API. Redis needs initialized markers and suitable read/scripting permissions; miniredis is not real ACL/replica certification. gRPC wrappers add no authorization, and a read-only Go interface is not an authorization boundary.

Snapshots and event logs are independent, not an atomic reconstruction contract. Empty zero-cursor history cannot distinguish absent from pruned data; arbitrary external Redis trimming without a generation change remains undetected. Existing transport error-classification limits are documented.

No tags were published. Support and driver are pinned to publicly verified immutable revisions; human-owned adapters/v* releases can use normal standalone Go checks without waiting for dependency tags.

Verification

Final assembled contents, committed through 7c8647ac0:

  • task --concurrency 3 test
  • task lint
  • task --concurrency 3 test:race
  • task test:persistence-standalone RACE=-race
  • task build, task docs, task site:build, task ac-trace-strict
  • Offline demo: tool call, permission ask/approval, and result observed.
  • Actionlint, impacted remaining shell checks, real standalone modules, Task parallel failure-propagation smoke test, metadata byte-stability checks, and git diff --check.

Verification uncovered two existing issues: an offline test omitted its metadata-discovery HTTP fixture, and concurrent session factories mutated captured configuration. Both received minimal fixes; the failing scheduler test then passed 20 repetitions under -race, as did the app race suite. The proposed larger factory refactor is explicitly not included.

GPT-6 Astra reviewed the simplification; its remaining download-error-handling finding was fixed by removing the custom retry wrapper. Earlier independent adapter reviews were completed and their findings addressed. GitHub CI still independently validates the updated head.

Work was performed in a dedicated worktree; unrelated main-worktree files are untouched. The operator waived the separate acceptance-plan PR for the extraction and subsequently authorized this CI cleanup. No merge is performed by this change.

JAORMX and others added 4 commits September 30, 2026 11:14
Move JSONL, Redis, and gRPC drivers into an opt-in public module. Isolate generated contracts and shared support, preserve production wiring and conformance, and prove external consumption without workspace replacements. Document read-only limits and dependency-first releases.

Co-authored-by: Mecatl <[email protected]>
Copy the captured configuration for each session factory invocation so concurrent session creation cannot overwrite another session's child permission resolver. Keep the default-policy test's model discovery on its existing offline HTTP fixture.

Co-authored-by: Mecatl <[email protected]>
Replace race shards, workflow-shape assertions, and timing experiments with one CI job using Task's parallel module dependencies. Remove redundant release wrappers and repeated CI normalization cycles. Pin public dependencies to resolvable revisions, commit standalone adapter checksums, and preserve PR #1999's tidy/sync ordering. Retain the external consumer proof once after dependency setup.

Co-authored-by: Mecatl <[email protected]>
JAORMX and others added 3 commits September 30, 2026 11:37
Run the disposable consumer with -mod=mod instead of go mod tidy, which also loads dependency-owned tests and required uncached OpenTelemetry versions in CI. Preserve the file-only proxy, isolated cache, GOWORK=off, and module graph checks. Verified with the exact missing archives from the failing Build job and race-enabled consumer tests.

Co-authored-by: Mecatl <[email protected]>
Run cross-adapter behavior tests in the existing adapters module suite. Remove the candidate module proxy, offline cache proof, standalone fixture module, and CI-only dependency prewarming.

Wait for startup recovery test RPC handlers before deleting their stores.

Co-authored-by: Mecatl <[email protected]>
Classify golang.org/x/mod as indirect now that the proxy helper is gone. Verified task tidy is stable, task build succeeds, and the remaining Build closure guard passes.

Co-authored-by: Mecatl <[email protected]>
@JAORMX
JAORMX merged commit d540607 into main Sep 30, 2026
40 checks passed
@JAORMX
JAORMX deleted the feat/public-persistence-adapters branch September 30, 2026 10:35
@toolhive-release-app toolhive-release-app Bot mentioned this pull request Sep 30, 2026
2 tasks
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