Skip to content

feat(redisstore): isolate bounded follow capacity and migrate to Go 1.27 - #1480

Merged
samuv merged 12 commits into
mainfrom
impl/redis-follow-capacity
Sep 14, 2026
Merged

samuv merged 12 commits into
mainfrom
impl/redis-follow-capacity

Conversation

@samuv

@samuv samuv commented Sep 14, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Isolates Redis durable followers from write-path capacity with one bounded follow client per credential generation and fail-fast process-local admission.
  • Makes follower shutdown store-owned and bounded, including safe follow-only force-close while durability leases remain intact.
  • Exposes mecak8s CLI and Helm sizing controls, adds the stable resumable watch_capacity transport contract, and documents operator sizing.
  • Migrates the repository and published Go modules to Go 1.27 so the implementation can consume ToolHive Core v0.0.46 and redisconn v0.0.2.

Development stage

  • Plan / Interface — Bounded/Architectural behavioral and exact-interface contract; no implementation
  • Implementation — based on an approved, merged Plan / Interface PR
  • Combined — compact one-task Bounded/Architectural exception; no separate plan PR,
    and the in-PR plan declares **Expected tasks:** 1, a non-placeholder
    **Combined rationale:**, and no runtime/public/operator/persistence/trust-boundary
    interface change (None — rationale; workflow-only meta-changes may review process
    docs/skills here)
  • Spike / Routine — acceptance-plan spine exempt; Spike evidence does not ship as-is

Contract linkage

  • Work classification: Architectural
  • Classification rationale: Changes exported Go and TypeScript error contracts, operator CLI and Helm configuration, the Go compatibility floor, and ownership of process-lifetime Redis clients and follower goroutines.
  • Decision record: ADR 0330
  • Human waiver of spine: Yes — after ToolHive's released module metadata required Go 1.27, the directing user approved reviewing that amendment in this implementation PR and closed the separate amendment PR docs: amend Redis follow plan for Go 1.27 #1462.
  • Acceptance plan: Redis follow capacity
  • Human decisions resolved and recorded: Yes
  • Plan / Interface PR: docs: plan isolated Redis follow capacity #1422
  • Approved commit baseline: 3ad4a689bb68db01a21c72995daef1854c295866
  • Combined/exemption rationale: N/A — Split delivery. This is the single Implementation PR for the merged plan; its Go 1.27 amendment and associated docs use the explicit human amendment-review waiver.

Interface conformance

  • Matches the approved contract and the human-approved Go 1.27 amendment; no unapproved material drift.
  • No protobuf schema, Redis wire-data, cursor, snapshot, or session-event change.
  • Adds port.ErrEventFollowCapacity and stable watch_capacity; gRPC reports RESOURCE_EXHAUSTED, while an already-open HTTP watch emits its terminal SSE error frame.
  • TypeScript attachments resume watch_capacity from their last processed cursor and unchanged filter. No-progress replay-to-live boundaries preserve bounded exponential backoff.
  • mecak8s adds --redis-follow-pool-size and --redis-max-followers; Helm adds redis.follow.poolSize and redis.follow.maxFollowers. Both default to 32, with 1 <= maxFollowers <= poolSize validated without clamping.
  • Every committed Go module and go.work declares Go 1.27. The root graph consumes released ToolHive Core v0.0.46 and redisconn v0.0.2 without replacement.
  • Adds no metric, trace, or telemetry surface.

Issue relationship

Closes #876

Type of change

  • Behavioral/interface plan
  • Bug fix
  • New feature
  • Refactoring (no behavior change)
  • Dependency update
  • Documentation/process
  • Other (describe):

Test plan

Baseline checks

  • Acceptance-plan checker
  • Linting (task lint)
  • Offline test suite (task test)
  • Offline demo (go run ./cmd/mecademo)
  • Markdown changed: docs generation/link checks (task docs)
  • User docs/user-facing behavior changed: site build (task site:build)
  • Guarded engine API affected: compatibility check (task api:check)
  • Intentional engine API change: task api:update + engine/CHANGELOG.md
  • Landed plan: strict acceptance trace (go run github.com/stacklok/ac-trace/cmd/[email protected] --strict --plan redis-follow-capacity: 20 ACs, 0 failures)
  • Final implementation review: /panel-review

Additional checks:

  • task tidy, with no module-file drift
  • task sdk:lint
  • task sdk:typecheck
  • task sdk:test (43 files, 214 tests)
  • task sdk:api:check
  • go test -race ./internal/adapter/redisstore -run '^TestADR_0330_ForceCloseIsFollowOnly$' -count=20

The repository-wide task ac-trace-strict remains blocked by unrelated legacy plans using proposed; the landed Redis plan passes its strict trace independently.

Changes

Area Change
Redis store Separate durability/follow clients, atomic credential-generation pairs, fail-fast admission, and bounded follower ownership/shutdown
Server and TypeScript SDK Stable watch_capacity classification and cursor-safe reconnect with persistent-capacity backoff
mecak8s and Helm 32/32 defaults, CLI/value/schema/template validation, and decimal-safe values-file rendering
Go modules Go 1.27 floor, ToolHive Core v0.0.46, and redisconn v0.0.2
Documentation Accepted ADR, List 1 lifecycle rows, living architecture/reference/user guidance, API baseline, and changelog

User-facing change

mecak8s operators can reserve and cap Redis follower capacity independently from durability traffic. Saturated watchers receive a typed resumable failure instead of waiting for a shared pool, and SDK attachments reconnect from their checkpoint under bounded backoff.

Special notes for reviewers

  • Focus on admission versus pool-size bounds, the admission/Close linearization, per-cycle generation leases, and follow-only force-close.
  • The plan is docs: plan isolated Redis follow capacity #1422 at approved commit 3ad4a689bb68db01a21c72995daef1854c295866.
  • The Go 1.27 amendment was explicitly approved for this PR; separate amendment PR docs: amend Redis follow plan for Go 1.27 #1462 was closed without merge.
  • The branch includes current main's docs: fix duplicate ADR 0334 numbering #1473 ADR 0336 collision repair through its latest merge; that unrelated plan is not part of this PR diff.
  • Panel findings in test rigor, ADR supersession, Helm integer rendering, and persistent-capacity SDK backoff were repaired and focused rechecks are clean. Spec, security, reuse, and duplication axes had no findings.

PANEL: ship_blockers=0 important=0 advisory=0 reviewer_failures=0

Co-Authored-By: Codex <[email protected]>

Signed-off-by: Samuele Verzi <[email protected]>
Expose Redis follow-capacity exhaustion across gRPC, SSE, and the TypeScript SDK, and resume reconnects from the attachment checkpoint.

Co-Authored-By: Codex <[email protected]>

Signed-off-by: Samuele Verzi <[email protected]>
…acity

# Conflicts:
#	docs/acceptance/draft-aware-session-inventory.md
@samuv samuv changed the title impl/redis follow capacity feat(redisstore): isolate bounded follow capacity and migrate to Go 1.27 Sep 14, 2026
@samuv samuv self-assigned this Sep 14, 2026

@JAORMX JAORMX left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thorough review complete against 209989a9 at head 23a84665.

I think the size is justified: this is one cohesive architectural contract carried through Redis client ownership, transport classification, SDK reconnect behavior, mecak8s/Helm configuration, module compatibility, and the owning documentation. Splitting it would create less-reviewable intermediate states where those layers disagree.

The implementation matches issue #876, the approved acceptance plan, and ADR 0330. I found no merge-blocking correctness, security, architectural, Kubernetes, dependency, or compatibility issues. Admission/close linearization, per-generation leases, follow-only force-close, watch_capacity handling, cursor-preserving SDK retries, sizing validation, API/changelog updates, and lifecycle inventory all look sound. Relevant CI is green.

Two worthwhile but non-blocking test improvements:

  1. internal/adapter/redisstore/follow_capacity_test.go:185 proves starvation freedom with already-separated injected clients, but does not directly exercise physical isolation through the production defaultStoreDependencies -> newPair -> buildClientPair path and real bounded pools.
  2. internal/adapter/redisstore/follow_capacity_test.go:134 performs its setup AppendEvent before installing command spies, so the routing assertion covers Save but not the append/write path explicitly named by AC1.3.

Neither gap indicates a production defect or warrants splitting/blocking this PR. Approved.

PANEL: ship_blockers=0 important=2 advisory=0 reviewer_failures=0

@samuv
samuv merged commit bd7a4d5 into main Sep 14, 2026
60 of 61 checks passed
@samuv
samuv deleted the impl/redis-follow-capacity branch September 14, 2026 15:47
This was referenced Sep 14, 2026
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.

redisstore: isolated bounded follow pool + store-owned follower lifecycle

2 participants