Skip to content

feat: Server Beam — sql.on across two Destinations - #158

Merged
huyplb merged 6 commits into
mainfrom
cursor/link-servers-plan-7e48
Aug 2, 2026
Merged

feat: Server Beam — sql.on across two Destinations#158
huyplb merged 6 commits into
mainfrom
cursor/link-servers-plan-7e48

Conversation

@huyplb

@huyplb huyplb commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

Summary

Server Beam lets a -- @node cell move data between databases with sql.on('source') / sql.on('target') (async / Promises).

Behavior

  • Check up to 2 Destinations (order = source, then target) — MAX_SERVERS
  • Up to 20 sql.on() calls per editor Execute — MAX_SQL
  • Beam cells run once (no per-credential fan-out)
  • Passwords stay server-side via existing resolveRef
  • Code-cell returns accept single objects and scalars (grid no longer breaks)

Examples (Bookmarks → Add samples)

  • ★ Sample · Server Beam ping (source + target)
  • ★ Sample · Server Beam copy rows source → target
  • ★ Sample · Server Beam chunked pull → push

Docs

docs/plans/server-beam.md

How to try

  1. Save two credentials; check both as Destinations (source first)
  2. Install samples → open a Server Beam sample
  3. Turn Safe mode off for write samples; Run
Open in Web Open in Cursor 

cursoragent and others added 2 commits August 2, 2026 23:02
Cross-DB data move via Node cells: up to 2 link servers and 10 sql.on()
calls per editor Execute. Explicitly omit commercial/edition metering.

Co-authored-by: huy.phan9 <huyplb@users.noreply.github.com>
Replace Link Servers plan with docs/plans/server-beam.md; same caps
(2 endpoints, 10 sql.on per Execute), no paid-tier metering notes.

Co-authored-by: huy.phan9 <huyplb@users.noreply.github.com>
@cursor cursor Bot changed the title docs: Link Servers plan (sql.on, execute caps) docs: Server Beam plan (sql.on, execute caps) Aug 2, 2026
Node cells can call sql.on('source'|'target') with up to 2 checked
Destinations (order = source, then target) and at most 10 sql.on() calls
per Execute. Adds ping / copy / chunked samples and bridge tests.

Co-authored-by: huy.phan9 <huyplb@users.noreply.github.com>
@cursor cursor Bot changed the title docs: Server Beam plan (sql.on, execute caps) feat: Server Beam — sql.on across two Destinations Aug 2, 2026
cursoragent and others added 3 commits August 2, 2026 23:17
Single objects and primitive/Date values become a one-row grid instead of
failing normalization (which left the result grid unusable). Explicit
{ columns, rows } shape is unchanged.

Co-authored-by: huy.phan9 <huyplb@users.noreply.github.com>
Co-authored-by: huy.phan9 <huyplb@users.noreply.github.com>
Update cap constant, error copy, tests, plan, and sample comments.

Co-authored-by: huy.phan9 <huyplb@users.noreply.github.com>
@cursor
cursor Bot marked this pull request as ready for review August 2, 2026 23:25
@cursor

cursor Bot commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: serverGenReqId_1971e07b-9f32-4ae4-98be-eb4199aa2965)

@huyplb
huyplb merged commit a2cdf49 into main Aug 2, 2026
9 checks passed
@huyplb
huyplb deleted the cursor/link-servers-plan-7e48 branch August 2, 2026 23:29
huyplb added a commit that referenced this pull request Aug 3, 2026
…ible (#159)

Review of #158 found main shipped red: `tsc --noEmit` failed with two errors
and two unit tests were failing. 
Fixed those, plus the defects behind them.
**main was broken.**
- `SqlBinding = ReturnType<typeof makeSqlBinding>` on a function annotated
  `: SqlBinding` is circular; TS2456 + TS2577. Dropped the annotation and let
  it infer — the alias still serves consumers.
- `server-beam.test.ts` expected /at most 2/ while the message said "cant
  handle more than 2". Aligned the message (and its missing apostrophe).
- `codeCellExec.test.ts` still asserted the OLD contract: #158 deliberately
  widened normalizeCodeCellReturn so `return 1` / `return [1,2,3]` / a bare
  object become grids. Updated the assertions to the new behaviour rather than
  narrowing the feature — only a missing return is rejected now.

**Alias lookup accepted inherited keys.** `!beamDialects[key]` let `toString`,
`constructor`, `valueOf` and `__proto__` past the unknown-alias check, then
used the inherited *function* as the dialect — surfacing as "dialect
.toLowerCase is not a function" instead of "Unknown Server Beam alias". Now
`Object.hasOwn`. Not exploitable (the parent routes through a Map and fails
closed) but a confusing dead end. Third time this class has appeared in this
codebase — a shared hasOwn helper or lint rule would be cheaper than a fourth.

**Which server is `target` was invisible.** Aliases come from list order, not
click order, and `sql.on('target')` is what writes — so a wrong assumption
writes to the wrong database. Two changes: a third checked Destination is now
an error instead of a silent `slice(0, 2)`, and every beam run prints the
resolved mapping ("Server Beam → source = A, target = B") before results.

**Samples for both editor cases**, each executed against real SQLite before
committing:
- general, one server, no alias — plain sql`…`, no beam.
- migration, source → target — read, reshape, chunked write, read back.
  Verified across two separate database files: rows landed in target, and
  the source was confirmed untouched.

Writing the migration sample caught a bug in the sample itself: `domain` was
split from the pre-lowercased email, yielding "Example.COM" beside
"o'brien@example.com". Normalize once, then derive.

801 tests pass, tsc and eslint clean.
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.

2 participants