Repository navigation
Paging cursor for find and typed walks (#247 item 4) - #259
Merged
Merged
Conversation
Merged
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.
Closes #247
Last piece of #247 (item 4): cursor paging for
findand typed walks, across CLI, serve and the MCP tools (find,typed_walk).Cursor design
c_+ base32 ofversion | verb | position | store.change_count | query fingerprintplus a 12-byte HMAC-SHA256 keyed by the session id (memnet/paging.py). The position is a row count into this result, never an id or an id's order; no nickname or hid is in the token. Stateless on the server.bad_cursor(not a token, forged, another session's, or the other verb's),cursor_mismatch(a query parameter changed;limitis not part of the fingerprint, so page size may change),stale_cursor(change_countdiffers: any write since the page; reads never bump it).typed_walkskip counted after WHERE/min-hops; find:bounded_match_find(offset=)). A walk page cut by the reply-byte cap returns a cursor at the first dropped row; a page cut by the 20,000 edge-read budget returns none (a re-run would hit the same budget).walk_cursorstat (andstats.cursorin--json-handles); find ends with@STAT: find_cursor|<token>|-; MCPtyped_walkaddsnext_cursor(null when no more) and takeslimit/cursor; MCPfindtakescursor/paged. Row numbers continue across walk pages.Back-compat
Paging is opt-in:
--cursor,--pagedon find, an explicit--limiton typed-walk (CLI default is now "not asked", still 50),limitorcursoron MCPtyped_walk(its default is nowNone, still 50). A request that asks for none of these gets the same bytes as before; pinned bytest_backcompat_*andtest_mcp_typed_walk_without_limit_or_cursor_is_unchanged(golden strings taken from master before the change).Tests
tests/test_paging_cursor.py(written red first, commit 0495d87, then made green) andtests/test_sysml_paging_cursor.py. Full suite, ruff check and ruff format --check pass locally; a realmemnet serve --ipcdemo is in the proof notes.Model
New
MN-REQ-14.13+MN-VER-14-S13,PagedReadaction andPagingCursorpart (requirements/verify/behaviour/implementation).MN-REQ-14.2(general read past the 50-row cap) stays PARKED; see open decisions.Open decisions for the owner
--paged(it always has a limit, so "limit asked" cannot be the switch), walk uses an explicit limit. Say if you would rather have a cursor on every limit-truncated reply.stale_cursor(restart), not a best-effort resume. A serve restart that restores a session also invalidates cursors.query walkandpin_map(shaped by cue and depth, not a row list).