Skip to content

feat(storage): BackendSessionStorage — KV-backed SessionStorage#12

Merged
silversurfer562 merged 1 commit into
mainfrom
feat/backend-session-storage
Jun 17, 2026
Merged

feat(storage): BackendSessionStorage — KV-backed SessionStorage#12
silversurfer562 merged 1 commit into
mainfrom
feat/backend-session-storage

Conversation

@silversurfer562

Copy link
Copy Markdown
Member

Implements specs/help-memory-tool Option A (the corrected scope — see that spec's premise-correction note).

What

  • BackendSessionStorage — an optional SessionStorage backed by an injected key/value backend (KVBackend protocol: stash/retrieve). Gives cross-host session continuity without writing the protocol by hand.
  • Schema, 4h TTL, and legacy migration are shared with LocalFileStorage via extracted _serialize / _deserialize helpers (no duplication).
  • Backend errors never propagate into the runtime: reads fall back to defaults, writes log-and-continue (mirrors the file backend).
  • Exports KVBackend + BackendSessionStorage from the package root.
  • Fixes a stale README protocol example (load/saveget_session/set_session).

Dependency stance (ADR-002)

attune-help imports no backend — the integrator injects one — so this adds zero required dependencies. storage.py remains stdlib-only.

Scope note

Task 5's [memory] extra was dropped: attune_redis is bundled inside attune-ai, not a standalone PyPI package, so there's nothing clean to pin. The backend is bring-your-own via injection. (The genuine model-driven Anthropic memory tool is split to a separate follow-on spec.)

Tests

13 new tests (in-memory fake backend) covering protocol parity with LocalFileStorage (round-trip, defaults-on-miss, TTL expiry, legacy migration, malformed payload), keying/isolation, and backend error-safety. 315 passed (5 pre-existing ensurepip SIGABRT env failures in the isolated-venv tests, unrelated). ruff clean.

🤖 Generated with Claude Code

Add an optional SessionStorage backed by an injected key/value backend
(KVBackend protocol: stash/retrieve), for cross-host session continuity
without writing the protocol by hand. Schema, 4h TTL, and legacy
migration are shared with LocalFileStorage via extracted _serialize /
_deserialize helpers. Backend errors never propagate: reads fall back to
defaults, writes log-and-continue.

attune-help imports no backend itself — the integrator injects one — so
this adds no required dependency (ADR-002 intact). Export KVBackend +
BackendSessionStorage from the package root; fix the README protocol
example (get_session/set_session, not load/save).

Implements specs/help-memory-tool (Option A) tasks 1-4, 6, 7. Task 5
([memory] extra) dropped: attune_redis is bundled in attune-ai, not a
standalone PyPI package, so there is nothing clean to pin — the backend
is bring-your-own via injection.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@codecov

codecov Bot commented Jun 14, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 90.69767% with 4 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/attune_help/storage.py 90.47% 3 Missing and 1 partial ⚠️

📢 Thoughts on this report? Let us know!

@silversurfer562 silversurfer562 merged commit b5d6a16 into main Jun 17, 2026
14 checks passed
@silversurfer562 silversurfer562 deleted the feat/backend-session-storage branch June 17, 2026 11:13
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