Skip to content

Fix review findings: FK correctness, OOM caches, and scale#112

Merged
huyplb merged 8 commits into
mainfrom
cursor/cloud-agent-1785109452769-k0unh
Jul 27, 2026
Merged

Fix review findings: FK correctness, OOM caches, and scale#112
huyplb merged 8 commits into
mainfrom
cursor/cloud-agent-1785109452769-k0unh

Conversation

@huyplb

@huyplb huyplb commented Jul 26, 2026

Copy link
Copy Markdown
Contributor

Summary

Implements the review-fix plan across correctness, OOM bounds, CLI/provider parity, and algorithmic scale improvements — plus expanded cloud e2e coverage.

Phase 1 — Correctness / security

  • Blueprint moveFkLocal permutes referencedColumns in lockstep (or resyncs)
  • SQL generator emits -- review: instead of REFERENCES t () for mismatched FKs
  • schemaApi cache keys never embed password/connectionString; LRU-capped TTL cache
  • MySQL FK loader pairs local/ref columns and drops incomplete groups

Phase 2 — OOM / execution

  • Bound pageCache (5 pages/statement) and keep only current page on runs.results
  • schemaCache TTL + max entries; clear on connection remove
  • SQL execute fails closed when page wrap fails (no unbounded raw fallback)
  • Adapter pools use BoundedPoolCache (max + idle TTL + dispose)
  • Persist caps for tab/bookmark SQL size and bookmark count

Phase 3 — CLI / providers

  • CLI loadScopedTables (+ migrate snapshots) run normalizeTableSchemas
  • SQLite PRAGMA loads batched with concurrency limit

Phase 4 — Algorithms

  • Kahn topological FK create order with cycle -- review: notices
  • Central dialectSupportsFk bitmatrix (exported from @foxschema/core and browser entry)
  • Dependency scan tokenizes SQL bodies once
  • Autocomplete prefix tries reused per schema revision
  • Result grid already virtualized; documented vs pageCache LRU

E2E (cloud)

  • New sql-editor-blueprint.test.ts: composite-FK explorer, blueprint modal, create+Insert SQL, Next/Prev paging
  • SQLite dialect compare keeps connect/compare; migration skipped (SELECT-only adapter)
  • Ran in cloud against local Postgres/MySQL + seeded SQLite files

Test plan

  • Unit tests for FK lockstep, generator hardening, cache keys, pools, dialect matrix, tries, CLI normalize, page wrap fail-closed, dependency tokenize
  • cd apps/web && npx tsc --noEmit
  • E2E: SQL Editor + Postgres + MySQL + SQLite compare (+ auto-error-catch, compare-flow) — all green
  • Remaining dialects need Docker (overlayfs blocked in this VM): MariaDB, SQL Server, Oracle, DB2, etc.
Open in Web Open in Cursor 

huyplb and others added 8 commits July 25, 2026 22:40
Require user cloud credentials on multi-user hosts, allowlist Azure
vault URLs, and fix DataGrid/CodeQL quality issues from the scan.

Co-authored-by: Cursor <cursoragent@cursor.com>
Open tables from the schema explorer to add/edit/drop columns, set PK and dialect identity, create/drop tables, and insert or apply ALTER SQL. Includes dialect type dropdowns, length/precision editors, and SQL badges on the statement strip.

Co-authored-by: Cursor <cursoragent@cursor.com>
Replace unbounded Map-based pool caches with BoundedPoolCache and
disposePoolEndOrClose across postgres, mysql, sqlserver, azuresql,
db2, oracle, and redshift adapters; export the helpers from core.

Co-authored-by: huy.phan9 <huyplb@users.noreply.github.com>
Harden composite FK reorder/DDL, secret-safe schemaApi keys, MySQL FK
pairing, OOM-safe page/schema caches and pool eviction, fail-closed SQL
paging, CLI normalizeTableSchemas, SQLite PRAGMA batching, Kahn FK order,
dialect FK matrix, dependency tokenize, and completion tries.

Co-authored-by: huy.phan9 <huyplb@users.noreply.github.com>
Satisfy ColumnInfo required fields so apps/web tsc --noEmit passes.

Co-authored-by: huy.phan9 <huyplb@users.noreply.github.com>
Export dialectSupportsFk from the browser core entry so the web app boots.
Add SQL Editor e2e for table blueprint + result paging, tokenize dependency
scan unit tests, and skip SQLite dialect migration (SELECT-only adapter).

Co-authored-by: huy.phan9 <huyplb@users.noreply.github.com>
Include schema and a non-secret password fingerprint in cacheKeyForRef so
saved connections with different schemas or session passwords do not share
inflight/TTL entries. Fingerprint connectionString for ad-hoc paths too.
Rebuild autocomplete tries when table/column names change, not only counts.

Co-authored-by: huy.phan9 <huyplb@users.noreply.github.com>
@huyplb
huyplb marked this pull request as ready for review July 27, 2026 00:40
@tedious-code tedious-code deleted a comment from cursor Bot Jul 27, 2026
@huyplb
huyplb merged commit 25eba3d into main Jul 27, 2026
6 of 7 checks passed
@huyplb
huyplb deleted the cursor/cloud-agent-1785109452769-k0unh branch July 27, 2026 00:42
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