feat(fs): make session persistence authority explicit#662
Open
TZZheng wants to merge 1 commit into
Open
Conversation
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
SessionCacheto declare an explicit persistence role, with zero-safeNoPersistandMainAggregateWriteras the sole shared-aggregate writerWhy
Issue #645 needs detached/direct/cold cache views that can ingest session history without competing for the human-owned derived
logs/session.jsonlaggregate. Completeness alone must never grant write authority; the Main aggregate owner must be explicit.Test-first evidence
TestDetachedSessionCacheSteadyRefreshRemainsMemoryOnlywas added and run against the exact original current-main base before production changes. It failed because a detached cache's steadyRefreshupdated memory and created the sharedsession.jsonl. After the role gate was implemented,NoPersiststays memory-only across full rebuild, explicitPersist, and steady refresh, whileMainAggregateWriterretains the prior write-through behavior.Validation
go test ./internal/fs -count=1go test . -count=1go test ./internal/tui -run '^$' -count=1go vet ./internal/fs156f729d69a03f7b1b034eb252e0755f47855d4be8eba00587c7659bdbe7bca82834f3c29c926fb45c84e9bbee7aa608da6633aa4f4eaedc1cb19a82The publication rebase followed unrelated MCP migrate/preset changes in #661. The patch remained byte-identical, the changed path sets are disjoint, and both reviewers reran new-base compatibility checks.
Scope
This PR intentionally does not add direct-mail identity, durable unread state, or TUI switching behavior. Those remain separate changes in the #645 dependency chain.
Part of #645.