8000 fix: rename the remote read cache to LocalCache and confine it to stdio by ynishi · Pull Request #40 · ynishi/notelet · GitHub
[go: up one dir, main page]

Skip to content

fix: rename the remote read cache to LocalCache and confine it to stdio - #40

Merged
ynishi merged 1 commit into
mainfrom
fix/remote-cache-stdio-only
Oct 21, 2026
Merged

ynishi merged 1 commit into
mainfrom
fix/remote-cache-stdio-only

Conversation

@ynishi
@ynishi ynishi commented Oct 21, 2026
Copy link
Copy Markdown
Owner

Follow-up to #39 (refs #38). PR #39 built the read cache wider than it was meant to be.

What changes

  • Rename. The read cache is now LocalCache:
    • the switch is NOTELET_LOCAL_CACHE, a bool (true / false);
    • the module is local_cache;
    • log lines start with local cache:;
    • the README section is "Local cache".
  • stdio only. Only notelet-mcp stdio with a remote builds the cache and reads the switch. This is the local client. serve and the database paths behave as they did before feat: cache reads in remote mode behind NOTELET_REMOTE_CACHE #39, and they never read the switch.
  • Removed:
    • the hand-written value check;
    • the refusal to start when the switch is set together with a database backend.
  • Core reverted. notelet-core is back to its state before feat: cache reads in remote mode behind NOTELET_REMOTE_CACHE #39: MemoryNoteRepo::mirror and forget are gone. The cache owns its note store (local_cache/store.rs). answers_match_the_memory_adapter checks that list, search and dump give the same pages as the memory adapter.
  • Docs. README and the module doc no longer present the cache as reached through serve, a hook or loopback.
  • Tests. New tests pin that a read passed through during the first fill does not wait for the fill.

Verify

  • just check: pass.
  • just test: notelet-core 39, notelet-mcp 186 and notelet 1, all pass.
  • The script that opens this PR runs just check, just test and just test-pg-local first.

Smoke

A release build ran stdio against the dev remote with NOTELET_LOCAL_CACHE=true.

check result
Cold start, no snapshot: initialize 0.002 s
Cold start: first note_get (passed through) 0.186 s
note_get once filled 0.001 s
note_put, then note_get read back at once
Start from snapshot: initialize / note_get 0.026 s / 0.000 s
note_delete, then note_get NotFound at once
serve with NOTELET_LOCAL_CACHE=1 starts; no cache is built

An earlier measurement on #39's build gave 3.4 s for initialize and 8.6 s for the first note_get. That did not reproduce here, and the code holds no wait on the fill in the pass-through path.

Release note

The switch name and its values change from #39. #39 has not been released, so no released version is affected.

The remote read cache is renamed to LocalCache, and its switch is now
NOTELET_LOCAL_CACHE, a bool: true or false. Unset or empty is false.

It is built only by `stdio` with a remote, and only that path reads
the switch. `serve` and the database paths behave as they did before
the cache existed. The value check at config load and the refusal when
a database is configured are removed, so a stray value of the variable
can no longer stop a command that never uses the cache. Under `stdio`
with a remote, a value other than true or false still stops the start,
and the message does not echo the value.

notelet-core is reverted: MemoryNoteRepo has no `mirror` or `forget`
again, and the port's docs read as before. The cache owns its own note
store (local_cache/store.rs), which places notes exactly as the remote
has them and answers list, search and dump with the same ordering,
filters, paging and snippets as the memory adapter. A test runs both on
the same notes and fails if they drift apart.

The README, the config doc and the crate docs no longer present the
cache as something reached through `serve`; they say it belongs to
`stdio` with a remote.

Tests pin that a pass-through read during the first fill does not wait
for the fill: while the fill is held in a body fetch or in a listing,
and on a cold start where only the connect is waited for. Another test
pins that `stdio` starts without waiting for an unresponsive remote.

Refs #38
@ynishi
ynishi merged commit 64c1f35 into main Oct 21, 2026
7 checks passed
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

0