GeezerVison is showing github.com — feat(server): sync and write several experimental spaces in one request by kommander · Pull Request #66694 · anomalyco/opencode
Conversation
kommander
commented
Nov 26, 2026
•
edited by opencodejr
Bot
Loading
Uh oh!
There was an error while loading. Please reload this page.
Issue for this PR
None; follow-up to #66668.
Type of change
- Bug fix
- New feature
- Refactor / code improvement
- Documentation
What does this PR do?
One request now syncs or writes several spaces.
POST /api/experimental/space/sync (experimental.space.sync): { spaces: [{ space, cursor? }] } → { pages }. 1–100 distinct spaces, read in request order from one 500-row budget; once it is used up the remaining spaces are not read and get no page. Each page is one SQL statement (head and floor as indexed subqueries), so the separate head read and floor re-check are gone. Snapshot continuation pages are now type: "snapshot", so a client can drop keys absent from a snapshot after its last page.
POST /api/experimental/space/write (experimental.space.write): { changes: [{ space, key, value }] } → { spaces: [{ space, revision, cursor }] }. One transaction, per-space locks taken in sorted order.
- Subscribe/unsubscribe: 1–100 distinct spaces; catch-ups share one 500-row budget, the rest get
resync.
Removes GET /api/experimental/space/:space and POST /api/experimental/space/:space/write. Experimental, no flag.
How did you verify your code works?
Ported and added core/server space tests (shared budget, one statement per space with its query plan, multi-space atomic write, crossing writes, caps → 400); server suite, space tests 10x, bun run check, typecheck:tsc, migration --check, check:generated.
Screenshots / recordings
N/A
Checklist
- I have tested my changes locally
- I have not included unrelated changes in this PR
Added by the opencode bot (AI-generated).
Public API: replaces the experimental space sync/write routes with batched POST /api/experimental/space/sync and /write, and caps subscribe/unsubscribe at 100 distinct spaces (breaking, experimental only)
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. I ran the server and space tests and type-checked server, core (with tests) and client: all clean. I also ran opencode serve from this branch and checked with curl: a multi-space write returns per-space heads; sync returns pages in request order from the shared 500-row budget and leaves later spaces without a page once it is used up; continuation pages are type: "snapshot" and are followed by a delta; a repeated space and an empty list return 400.
Public API (experimental space HTTP API and generated clients). This is not backwards compatible:
- Removed:
GET /api/experimental/space/:space and POST /api/experimental/space/:space/write.
- Added:
POST /api/experimental/space/sync ({ spaces: [{ space, cursor? }] } → { pages }) and POST /api/experimental/space/write ({ changes: [{ space, key, value }] } → { spaces: [{ space, revision, cursor }] }).
- Changed:
Space.Change now requires space. Snapshot continuation pages are type: "snapshot" instead of "delta" with an empty deleted. Sync, subscribe and unsubscribe take 1–100 distinct spaces (400 otherwise). Subscribe catch-ups share one 500-row budget.
Existing callers of these experimental endpoints need updating; nothing else in the repo uses them.
No blocking concerns.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
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.
|