Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
refactor(frontend): drop monaco-languageclient, inline the language client subclass (#20792)
Danny Xu8e81a732f920
diff --git a/.claude/skills/verify/SKILL.md b/.claude/skills/verify/SKILL.mdnew file mode 100644index 0000000000..744f7abca8--- /dev/null+++ b/.claude/skills/verify/SKILL.md@@ -0,0 +1,58 @@+---+name: verify+description: Build, launch, and drive Bytebase end-to-end to verify a change against the running app (backend + production frontend bundle + Playwright).+---++# Verifying Bytebase changes against the running app++## Build the app (production bundle, embedded)++```bash+pnpm --dir frontend release # vite build → backend/server/dist+go build -tags embed_frontend -ldflags "-w -s" -p=16 -o ./bytebase-build/bytebase ./backend/bin/server/main.go+```++The `embed_frontend` tag is required — without it the binary serves no UI.++## Drive it with the e2e harness++The harness (`frontend/tests/e2e/`) boots a fresh instance per run: embedded+Postgres, first-signup admin (`[email protected]` / `12345678`), and sample+instances via `POST /v1/actuator:setupSample` (hr_prod / hr_test with the+employee schema).++```bash+cd frontend+export BYTEBASE_E2E_LICENSE=$(grep BB_DEV_ENTERPRISE_LICENSE .env.dev-local | cut -d= -f2)+pnpm exec playwright test sql-editor/<spec>.spec.ts --reporter=list+```++- License is mandatory (suite is enterprise-only); the dev enterprise JWT in+ `frontend/.env.dev-local` works.+- If the Playwright browser download hangs (it has here — 40min stall), use+ the locally installed Chrome instead: `export BYTEBASE_BROWSER_CHANNEL=chrome`+ (wired through `playwright.config.ts` `use.channel`).+- Server boot takes 3–6 min (embedded PG + migrations + sample instances);+ it is spent in globalSetup, not test time.++## Iterating without a 6-min reboot per attempt++For debugging, boot a standalone server once and drive it with a plain+Playwright script; a reusable pair of scripts exists in session scratchpads+under `lsp-debug/` (boot-server.mjs / drive.mjs pattern): spawn+`bytebase-build/bytebase --port <p> --data <tmp>` with `PG_URL=""`, poll+`/healthz`, signup/login via `/v1/auth/*`, `POST /v1/actuator:setupSample`,+poll `/v1/instances` until the sample databases appear.++## Gotchas observed++- `ControlOrMeta+a` select-all in Monaco is unreliable on macOS headless+ Chrome — clear buffers by backspacing the measured content length+ (see `setBuffer` in `sql-editor/sql-editor-lsp.spec.ts`).+- Clicking a suggest-widget row to accept is flaky; assert on the row's+ visibility and dismiss with Escape.+- The LSP connection indicator text ("connected") lives in a hover tooltip —+ don't locate it; assert on websocket frames instead (see the+ `page.on("websocket")` frame capture in the LSP spec).+- Backend LSP capabilities: completion (trigger chars `.` and space) and+ executeCommand only — no hover.diff --git a/frontend/package.json b/frontend/package.jsonindex 3ad2e6d7da..63821ebc41 100644--- a/frontend/package.json+++ b/frontend/package.json@@ -68,7 +68,6 @@"lucide-static": "^1.14.0","markdown-it": "^14.1.0","monaco-editor": "npm:@codingame/[email protected]",- "monaco-languageclient": "10.7.0","normalize-wheel": "^1.0.1","pev2": "1.21.0","pouchdb": "^9.0.0",diff --git a/frontend/playwright.config.ts b/frontend/playwright.config.tsindex 4fcf9cdf94..6fbce3d1b3 100644--- a/frontend/playwright.config.ts+++ b/frontend/playwright.config.ts@@ -14,6 +14,10 @@ export default defineConfig({globalTeardown: path.resolve(__dirname, "tests/e2e/framework/global-teardown.ts"),use: {headless: !headed,+ // Set BYTEBASE_BROWSER_CHANNEL=chrome to drive the locally installed+ // Chrome instead of the downloaded Playwright Chromium (useful when+ // the browser download is unavailable).+ channel: process.env.BYTEBASE_BROWSER_CHANNEL || undefined,trace: "on-first-retry",screenshot: "only-on-failure",},diff --git a/frontend/pnpm-lock.yaml b/frontend/pnpm-lock.yamlindex f1ade00ff5..3565c2de89 100644--- a/frontend/pnpm-lock.yaml+++ b/frontend/pnpm-lock.yaml@@ -142,9 +142,6 @@ importers:monaco-editor:specifier: npm:@codingame/[email protected]version: '@codingame/[email protected]'- monaco-languageclient:- specifier: 10.7.0- version: 10.7.0normalize-wheel:specifier: ^1.0.1version: 1.0.1@@ -1024,180 +1021,54 @@ packages:'@code-inspector/[email protected]':resolution: {integrity: sha512-8i3QI/bSirORDF/0P16T6NhNy1RxO7soip8sWeV/2btLbYCwyiaDnqT4Bw3JaM8MNz0N8NaA2qItUrrKE7TtCg==}- '@codingame/[email protected]':- resolution: {integrity: sha512-K04QcQA+Zb0KXucBAK/BGCT5dldiwIqdUbBQq7yuLvBLbof3cP1WSUuxasMHGYwM0MWyzIAsDtyAYMS7is8ZuA==}-'@codingame/[email protected]':resolution: {integrity: sha512-ZvNruAV3e594knX+Q9ugoP5SnrwrFLKnvLSzZGuoRxrBWpnMn5AhWHWVFWlgfsVoATf87fFUZGLyS32xIsbhHw==}- '@codingame/[email protected]':- resolution: {integrity: sha512-OwYs6h1ATUAeMmX+Q1c8esTG7GLMqniBs+fLEr1/9b/ciY485ArKo5UvrUxVPDtRNy/7F06vRW9IUCq9iKP14w==}-'@codingame/[email protected]':resolution: {integrity: sha512-ypFJzuTwhP2x/+BAeMe33GlCtwDRSMv6QRfC/+7vHYaPwv2AfHZY6ExZABLtyHImB7OTSWJeCK81ocjtH0vR6A==}- '@codingame/[email protected]':- resolution: {integrity: sha512-+EfSzjiFakCf0IIJKPZrHVGioq5N8GBsp51bXuKBR5J/B58cUaJY0Dc12PNTSpgAusAGOppUIOSBqUk4F/7IaQ==}-- '@codingame/[email protected]':- resolution: {integrity: sha512-oeoZ3WtM42zHA1IWHrx9UGEfE+TixE+G8Bl9M9bjgFj1EROnkB5yOfELwRYPo4WOEtcK1C5nvIvWIj/hL9MaLg==}-- '@codingame/[email protected]':- resolution: {integrity: sha512-dVXoBLRN8vyFHsLY6iYISaNetZ3ispXLut0qL+jvN0e0CEFkUv1F/3EAE7myptrJSS/N1AptrRIxATT3lwFP+Q==}-'@codingame/[email protected]':resolution: {integrity: sha512-fM8fMfIdKXNNDN4mJ5JodFn0GqU+yGZn2dpNy+4UXg/kgoXuxse91iEAF6LN9cXq1DVYX/JZxBqM+BlknPV0Cg==}- '@codingame/[email protected]':- resolution: {integrity: sha512-EadvDCyWdgxOPmaIvbcVVDNjTUYuKdjYWwKbPbbcTs9t4z1/DjdE7mV3ZdT6aGh5m6zkEEUOi143l27Y5eRt+Q==}-- '@codingame/[email protected]':- resolution: {integrity: sha512-8GoD3lk0CN0dIMZOrZNS/i8RCaF1YSQ6nmrf+rqneOSHG9S382EnsZZD69d4+i7JnoeyttO7Kr9KH8WOhRV6OA==}-'@codingame/[email protected]':resolution: {integrity: sha512-E5Hpg8kIxG9TmbZM3e3qqxUorzcTZJWtbp9FU7ezKuxeUr5lmeRhrFIjjpBcS0HDM4Gr7cY/Wc6h8Y32NIo7HQ==}- '@codingame/[email protected]':- resolution: {integrity: sha512-SJW/YOhjo+9MXEyzMwQMUWdJVR3Llc6pTq5JQqs6Y30v73gTrpLqtzbd9FNdCuQR8S6bUk5ScH8GL4QrVuL5FA==}-'@codingame/[email protected]':resolution: {integrity: sha512-4xvN1p1VvyfOW9bmU2fkd76ex7vgU+ySjBdP2QS+prkgWmDiJnErVmh2uZke0cwkdOrcD+AxXsLUYBpiibzXDQ==}- '@codingame/[email protected]':- resolution: {integrity: sha512-rTTZW2biPxcg+JumhVf2L+38C5ptvNNxiJlwz39VfXFEh6qOHtAsIMy7vIXa0uGg5/y8DNp0SnOQJP/RKhLYZA==}-'@codingame/[email protected]':resolution: {integrity: sha512-tIOhsT2mr6UIfqzyDGU5w0nXubQKa5g96LxYdZnFkAjLRkRg8jU349Wst2fVTRe7UHzM7nTddoFJm5jvB2zd6g==}- '@codingame/[email protected]':- resolution: {integrity: sha512-TenLLAFIwY7keZFF8e3beUn7OVfnNINR5Noi4PVrjeeTcy6FuNH6Jghdul2JwpRAkvyJLdFMvomE2jlT6F03jQ==}-'@codingame/[email protected]':resolution: {integrity: sha512-scRcbTQg/riMEI7gHG1t/fosLRwFhP7uEpdijqv7fX2Ib0dzfCwWTeo+0KlrQu3yEoC4asXHazm5FDJytcH3Xw==}- '@codingame/[email protected]':- resolution: {integrity: sha512-lgaalpA9CUQW7i0bBwgBOK0DQNDvOo3QO3p6Rz6yVsHpgA4iMqq2d11dBDUKvuQSwIHPRu8CMHCqhQk/BQN/YA==}-'@codingame/[email protected]':resolution: {integrity: sha512-jM+T/k4wemPDOaoyBSln+pkwhjGiuR/ov1KhVBUjOntrnU/fqq6CuaDd9LWqf8Aq2/9rn1iEjlAsGp9C3acLoA==}'@codingame/[email protected]':resolution: {integrity: sha512-9ZX6A+QNolqb5rmiR9H0rB4m10zZe0ptubCOlN08kSCM/OqC1tsGUZTG8PgCOb8XccbYqZQQiiL67sDR7RKNRA==}- '@codingame/[email protected]':- resolution: {integrity: sha512-cp/gGyTvCTAzCYnQm0HJykXJRB0Huz8Lvq60lj5LutgWcb8S3w6dOB2Houm8dHoeUm/jOko8SQNIP8hzWN92Zw==}-- '@codingame/[email protected]':- resolution: {integrity: sha512-v0cB2uAOCwj135aGIf0arGV+DNW32lbWh04bv8ctTxcWRt1Pr2kTQ1pjfE8ynKgxabPfAk8E25/CerKSYOmZ+A==}-- '@codingame/[email protected]':- resolution: {integrity: sha512-xA3WOt1w5jlAOnyx4PBwx+qV3vx8C8/zie29qjYbgJMxGKDkb0HfpuKUwywDA2uUMI2wJZS+PnNG00zPDoLIrw==}-- '@codingame/[email protected]':- resolution: {integrity: sha512-1/upuO9lRJilZ3sRr0QLTpz55KYRaBWDe8wtPvghOFYOHyWgW8A4VhUQxa6L9SJgY1JkypUAm0U8WcMX2G4LnQ==}-- '@codingame/[email protected]':- resolution: {integrity: sha512-iq+xx+tv1QIMmFD0eBhFRMF4xMAsVf/HyA1WogqBofteCWeAvRE9HUjZ5JzHz7jXBPe3dLP1LOM0r0GrJZs4fQ==}-- '@codingame/[email protected]':- resolution: {integrity: sha512-FajWCML9OR8ppLnJ0mcg+sFHEhYJl8zhb3/DHnd+pNysw8dLfetXoSWjaPnwPPpwiQgkNN1UsToZHOU9czVifQ==}-- '@codingame/[email protected]':- resolution: {integrity: sha512-NwKh0BnPgUrJkxsm0X6vY4ftnd9DjxkcnQqK+bohta6UOzm09J1EjZ6QD42fjWngxrp/xiegtrYQ9NA2q6VpoA==}-- '@codingame/[email protected]':- resolution: {integrity: sha512-fvaisgfcg8YaAwnyPcGmQDLwkwqzamLQUyx9HmnwDpXw0YANzd058Kwn6bz+Vfn9MjwuMNT0nllD0qQMnpdyew==}-- '@codingame/[email protected]':- resolution: {integrity: sha512-9hDRyzFJkDia5rO9QE262JgxwP/cnalFisLFo7FQcw57ZhqzqXIdQIuwcKaHuAgzeQ6W2+A3KOLfTr3m7VZrXw==}-- '@codingame/[email protected]':- resolution: {integrity: sha512-7fFnqOTAJGb5RuJ4uwh9sh0JmXALuHPGOl7iL9rZkcgIuVP5y6wVDUDXq5qjiRTNSFDs7Bzh463Ir5m5D6mJbA==}-- '@codingame/[email protected]':- resolution: {integrity: sha512-IFjoqrSuPtIFWb+KlPT6PFWKszzNX+TCD9drgCV6AigvBO/xfGL3QwHB68l/DLbmDbohOz4Xdkutv20wuENAeA==}-- '@codingame/[email protected]':- resolution: {integrity: sha512-0uDAeXO+GllKUPhJzP893rlDhlFV1IwCu/515rBdcyegt48iGm/xAgj26V90hNz8hmB6EuM/7d8MFeklbiIpYA==}-- '@codingame/[email protected]':- resolution: {integrity: sha512-MJhHxDyJEiuVLQ9+jb8MnnN9lsbJOjJjMswVCeJ7v/Q/msAhq25QYUfn0DbOIzESJE1f7crffRb5e38XP8sYWA==}-- '@codingame/[email protected]':- resolution: {integrity: sha512-c7MMrhnSLb59NxpAa8nVy9aIbxy4gVYrCpDMq8W380LOaXTYb7nueTrw8QJ5QbJBNi2P2KZoGkn2BlONuBtJJg==}-- '@codingame/[email protected]':- resolution: {integrity: sha512-ARedFTM6JCluoPLJqkBcTJaQFdJNcN86OX6B8/NMApIPrnSIAfanMndpyilt8XjzUG6IH22cypR+DAlEjf48cA==}-- '@codingame/[email protected]':- resolution: {integrity: sha512-ipuS1V3NgXDkNrj0vBcgMBFnqo+19HVsZjjFGfPFH3x0uptP9aiWWK42wtDK3Qbu4teSjHL7WnSLrmw94rplWw==}-'@codingame/[email protected]':resolution: {integrity: sha512-zGtJz+J/4xgkMTNoZY+jc6rSl23KFx2cYU808UmcOsJyVnTsLAMxigcE+0oK4C56d3lKL8j4s27Io+dtizMwhQ==}- '@codingame/[email protected]':- resolution: {integrity: sha512-SxBGcMK3RgkGtUn7ZDl7dCoyNW0CWFQ/bfSRYUY06A0IA4JNS5jq1lhof57d0WXewm+5l8w1Spr/vMsfx1c9ig==}-'@codingame/[email protected]':resolution: {integrity: sha512-fbio+xRryvaambNaWuy89OUl6hj5YJxPUL/pMNd+NdLhmy+buWsKIazG3Afe607QroNOPu9S1HM85RQM1W0h1A==}- '@codingame/[email protected]':- resolution: {integrity: sha512-QLj62A8XDOIQW3KjsZlNxs+sfsNNHYxWMjQMwZu/y2Vw3IIHGly2Lpn4t4SFbeaBHJQJy4i5s7NpzlbF9MbEzQ==}-- '@codingame/[email protected]':- resolution: {integrity: sha512-OoileAUtPAJ0j3RW31DFSxtOipy0EcFq+iIXEdGvoRlsQPZJ3o9ayjf1JvCXpxUjJ3QkmvQVhXsWNUFREjEFLg==}-- '@codingame/[email protected]':- resolution: {integrity: sha512-MGz/eV1CxibLvnl6WzK6idUHJCXJOVepJvKM6Trkv5050vRe+f/o1TjCiG8PaznAypYqZvnwkTG0B7/OTizCpQ==}-- '@codingame/[email protected]':- resolution: {integrity: sha512-akyNHOJQRS7YHyk6kf0Encnkt+shlR+bIB84UJRUHFgSeF8s5gkDkQuFJph0YeUDWJWat+yBLUSZx2nHomdbHQ==}-- '@codingame/[email protected]':- resolution: {integrity: sha512-7IIrXnwHiF3w9d9p9kspEUz/LCibMLUztmRpGdZQfFtWBJw043q7rk8V1O42KdXr1hVg9IR5vfffwjy9nbiiUg==}-'@codingame/[email protected]':resolution: {integrity: sha512-muU05JyiVTW6M6fQhxCtfED989BojAtYLToQu1LXCghFPjkoUaX2fmT5w1wcz7CBUZaTH8GTMuqaxV0fn752aA==}'@codingame/[email protected]':resolution: {integrity: sha512-fUj9gmmpz+jShDqt/VAq9/wwc5s20uxSlZdAzDXCx+cxrLSTSjUcWNZkO39DdWRamS0blix576wW9vMh1CXt7g==}- '@codingame/[email protected]':- resolution: {integrity: sha512-AL0FtSQBW+1vtoXYQvUqB2hfWojpK73Kq/n6KuNXxjLF/XBJ5FpeeZDfrBfwhWPPoHuBTsaFUCQy4L8xQgbVlA==}-'@codingame/[email protected]':resolution: {integrity: sha512-mEifjtkqJggKLNTvM09NgXPqnHwL72OlO0NcveVZHzwL0MD7JasNaitsIQyorNkbX+cI8y1UJVAHcCjNkqXVDA==}- '@codingame/[email protected]':- resolution: {integrity: sha512-0vTMFiC89YSDSmjFckuQBUKwRuFNtsILNO3k0PBiSLN/MW+VDItjJpiVLXC42+rUWlGgY2lYxOneGVa5slCV1w==}-'@codingame/[email protected]':resolution: {integrity: sha512-AzNtspCshfRnJ7Pg8K/NbAPFTQT2MBXhWvlBWFdWidDPJGOXrfyjNZegFOx/FceRzsyg7dVP95F7Sp9Vsfy5/w==}- '@codingame/[email protected]':- resolution: {integrity: sha512-hsTwl6YYTiheFuQMmCmiEGLIdIdgYaf8Z85XWyxe6YgPtDaYGnp0fGSOXKA9/bf0JtuynzoLKtUUfDupK/A7Tw==}-'@codingame/[email protected]':resolution: {integrity: sha512-uB9EL/OAKhL6MtzI2LqxkGRwvRpB9znnlN7yTm3Z3HmxmRPzTA1PuChjLM5tiwU+PFk8ECmi6Ug6YN08wI39hA==}- '@codingame/[email protected]':- resolution: {integrity: sha512-zhujHd1PQ6rRXsC2OQGrx/282G2v3lpPFl9heDFGKzpdj5119SgcW+B9p/MwJ1qF3LJpuRRgefNiQtqC/KT1eA==}-- '@codingame/[email protected]':- resolution: {integrity: sha512-4Po/YaHUvVf4VmhVCZmM2lc/flOptiWSM140bIRNpMcfH0VwihYg15CcDeu1Oc+6DaauzsG3u59GtEvlMmJ9Zw==}-- '@codingame/[email protected]':- resolution: {integrity: sha512-Jp9ytLaWZ6evabTPtG3Mu3dFx+7WTIPz69BsGpl9PnU0kiSWUqQhPSob0Jz7E2qmMj0ZcNv2Wqvm6bMBu5OyrA==}-- '@codingame/[email protected]':- resolution: {integrity: sha512-NVYtTAFR35NV/Fx7tSlbASicvpAjK5A14fmxF7/LJJN8ZmzhA/P3Y+UzhqOQl6/VcPV4pAMU0Z7Sicgwbn37dw==}-- '@codingame/[email protected]':- resolution: {integrity: sha512-LfzlztsvobdP5L5EvJ/rqSEgy5fEVmrkMqRteuhEtNGd4hnmdBoX8W7BNMBPff6d4NfCK74pGHJF57RyT4Iixg==}-- '@codingame/[email protected]':- resolution: {integrity: sha512-2LMHr+na03FhOAaXpIGmamq9hf7e4wt2kULn8NqNZRd3i+0v1tx/TSSjGhsA5EkrNrFD7CMSoXayBq8tgpCq/A==}-'@connectrpc/[email protected]':resolution: {integrity: sha512-J8317Q2MaFRCT1jzVR1o06bZhDIBmU0UAzWx6xOIXzOq8+k71/+k7MUF7AwcBUX+34WIvbm5syRgC5HXQA8fOg==}peerDependencies:@@ -2662,9 +2533,6 @@ packages:resolution: {integrity: sha512-7ZgogeTnjuHbo+ct10G9Ffp0mif17idi0IyWNVA/wcwcm7NPOD/WEHVP3n7n3MhXqxoIYm8d6MuZohYWIZ4T3w==}- resolution: {integrity: sha512-qkdCKzLNtrgPFP1Vo+98FRzJnBRGe4ffyCea9IwHB1fyxPOeNTHpLKYGd4Uk9xvNoH0ZoOjwZxNptyMwqrId1Q==}-resolution: {integrity: sha512-JahakDAIg1gyOm7dlgWSDjV4n7Ip2PKR55NIT6jrMfIgLFgWo81vdr1/QGqWtFNRqXP9UV71oVePtjqS2ebnPw==}@@ -3410,10 +3278,6 @@ packages:resolution: {integrity: sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g==}engines: {node: '>=10'}- resolution: {integrity: sha512-oA5cOFixkF4bspVL2zMSn48LvlNR/Cu3vJ8MCVam3PdjobSULGgHtOASuZIi3FgWK42X1z8/6hrG0LCjvNu1Hw==}- engines: {node: '>=20.10.0', npm: '>=10.2.3'}-resolution: {integrity: sha512-iSAJLHYKnX41mKcJKjqvnAN9sf0LMDTXDEvFv+ffuRR9a1MIuXLjMNL6EsnDHSkKLTWNqQQ5uo61P4EbU4NU+Q==}@@ -5204,20 +5068,6 @@ snapshots:transitivePeerDependencies:- supports-color- '@codingame/[email protected]':- dependencies:- '@codingame/monaco-vscode-base-service-override': 25.1.2- '@codingame/monaco-vscode-environment-service-override': 25.1.2- '@codingame/monaco-vscode-extensions-service-override': 25.1.2- '@codingame/monaco-vscode-files-service-override': 25.1.2- '@codingame/monaco-vscode-host-service-override': 25.1.2- '@codingame/monaco-vscode-layout-service-override': 25.1.2- '@codingame/monaco-vscode-quickaccess-service-override': 25.1.2- '@vscode/iconv-lite-umd': 0.7.1- dompurify: 3.3.1- jschardet: 3.1.4- marked: 14.0.0-'@codingame/[email protected]':dependencies:'@codingame/monaco-vscode-base-service-override': 31.0.1@@ -5232,75 +5082,32 @@ snapshots:jschardet: 3.1.4marked: 14.0.0- '@codingame/[email protected]':- dependencies:- '@codingame/monaco-vscode-api': 25.1.2-'@codingame/[email protected]':dependencies:'@codingame/monaco-vscode-api': 31.0.1- '@codingame/[email protected]':- dependencies:- '@codingame/monaco-vscode-api': 25.1.2-- '@codingame/[email protected]':- dependencies:- '@codingame/monaco-vscode-api': 25.1.2- '@codingame/monaco-vscode-files-service-override': 25.1.2-- '@codingame/[email protected]':- dependencies:- '@codingame/monaco-vscode-api': 25.1.2-'@codingame/[email protected]':dependencies:'@codingame/monaco-vscode-api': 31.0.1- '@codingame/[email protected]':- dependencies:- '@codingame/monaco-vscode-api': 25.1.2-- '@codingame/[email protected]':- dependencies:- '@codingame/monaco-vscode-api': 25.1.2-'@codingame/[email protected]':dependencies:'@codingame/monaco-vscode-api': 31.0.1- '@codingame/[email protected]':- dependencies:- '@codingame/monaco-vscode-api': 25.1.2- '@codingame/monaco-vscode-extensions-service-override': 25.1.2-'@codingame/[email protected]':dependencies:'@codingame/monaco-vscode-api': 31.0.1'@codingame/monaco-vscode-extensions-service-override': 31.0.1- '@codingame/[email protected]':- dependencies:- '@codingame/monaco-vscode-api': 25.1.2- '@codingame/monaco-vscode-files-service-override': 25.1.2-'@codingame/[email protected]':dependencies:'@codingame/monaco-vscode-api': 31.0.1'@codingame/monaco-vscode-files-service-override': 31.0.1- '@codingame/[email protected]':- dependencies:- '@codingame/monaco-vscode-api': 25.1.2-'@codingame/[email protected]':dependencies:'@codingame/monaco-vscode-api': 31.0.1- '@codingame/[email protected]':- dependencies:- '@codingame/monaco-vscode-api': 25.1.2-'@codingame/[email protected]':dependencies:'@codingame/monaco-vscode-api': 31.0.1@@ -5309,106 +5116,15 @@ snapshots:dependencies:'@codingame/monaco-vscode-api': 31.0.1- '@codingame/[email protected]':- dependencies:- '@codingame/monaco-vscode-api': 25.1.2- '@codingame/monaco-vscode-files-service-override': 25.1.2-- '@codingame/[email protected]':- dependencies:- '@codingame/monaco-vscode-api': 25.1.2-- '@codingame/[email protected]':- dependencies:- '@codingame/monaco-vscode-api': 25.1.2-- '@codingame/[email protected]':- dependencies:- '@codingame/monaco-vscode-api': 25.1.2-- '@codingame/[email protected]':- dependencies:- '@codingame/monaco-vscode-api': 25.1.2-- '@codingame/[email protected]':- dependencies:- '@codingame/monaco-vscode-api': 25.1.2-- '@codingame/[email protected]':- dependencies:- '@codingame/monaco-vscode-api': 25.1.2-- '@codingame/[email protected]':- dependencies:- '@codingame/monaco-vscode-api': 25.1.2-- '@codingame/[email protected]':- dependencies:- '@codingame/monaco-vscode-api': 25.1.2-- '@codingame/[email protected]':- dependencies:- '@codingame/monaco-vscode-api': 25.1.2-- '@codingame/[email protected]':- dependencies:- '@codingame/monaco-vscode-api': 25.1.2-- '@codingame/[email protected]':- dependencies:- '@codingame/monaco-vscode-api': 25.1.2-- '@codingame/[email protected]':- dependencies:- '@codingame/monaco-vscode-api': 25.1.2-- '@codingame/[email protected]':- dependencies:- '@codingame/monaco-vscode-api': 25.1.2-- '@codingame/[email protected]':- dependencies:- '@codingame/monaco-vscode-api': 25.1.2-- '@codingame/[email protected]':- dependencies:- '@codingame/monaco-vscode-api': 25.1.2- '@codingame/monaco-vscode-files-service-override': 25.1.2-'@codingame/[email protected]':dependencies:'@codingame/monaco-vscode-api': 31.0.1'@codingame/monaco-vscode-files-service-override': 31.0.1- '@codingame/[email protected]':- dependencies:- '@codingame/monaco-vscode-api': 25.1.2-'@codingame/[email protected]':dependencies:'@codingame/monaco-vscode-api': 31.0.1- '@codingame/[email protected]':- dependencies:- '@codingame/monaco-vscode-api': 25.1.2-- '@codingame/[email protected]':- dependencies:- '@codingame/monaco-vscode-api': 25.1.2- '@codingame/monaco-vscode-environment-service-override': 25.1.2-- '@codingame/[email protected]':- dependencies:- '@codingame/monaco-vscode-api': 25.1.2-- '@codingame/[email protected]':- dependencies:- '@codingame/monaco-vscode-api': 25.1.2-- '@codingame/[email protected]':- dependencies:- '@codingame/monaco-vscode-api': 25.1.2-'@codingame/[email protected]':dependencies:'@codingame/monaco-vscode-api': 31.0.1@@ -5417,69 +5133,20 @@ snapshots:dependencies:'@codingame/monaco-vscode-api': 31.0.1- '@codingame/[email protected]':- dependencies:- '@codingame/monaco-vscode-api': 25.1.2- '@codingame/monaco-vscode-files-service-override': 25.1.2-'@codingame/[email protected]':dependencies:'@codingame/monaco-vscode-api': 31.0.1'@codingame/monaco-vscode-files-service-override': 31.0.1- '@codingame/[email protected]':- dependencies:- '@codingame/monaco-vscode-api': 25.1.2-'@codingame/[email protected]':dependencies:'@codingame/monaco-vscode-api': 31.0.1- '@codingame/[email protected]':- dependencies:- '@codingame/monaco-vscode-api': 25.1.2- '@codingame/monaco-vscode-files-service-override': 25.1.2-'@codingame/[email protected]':dependencies:'@codingame/monaco-vscode-api': 31.0.1'@codingame/monaco-vscode-files-service-override': 31.0.1- '@codingame/[email protected]':- dependencies:- '@codingame/monaco-vscode-api': 25.1.2-- '@codingame/[email protected]':- dependencies:- '@codingame/monaco-vscode-api': 25.1.2- '@codingame/monaco-vscode-bulk-edit-service-override': 25.1.2-- '@codingame/[email protected]':- dependencies:- '@codingame/monaco-vscode-api': 25.1.2-- '@codingame/[email protected]':- dependencies:- '@codingame/monaco-vscode-api': 25.1.2-- '@codingame/[email protected]':- dependencies:- '@codingame/monaco-vscode-api': 25.1.2- '@codingame/monaco-vscode-keybindings-service-override': 25.1.2- '@codingame/monaco-vscode-layout-service-override': 25.1.2- '@codingame/monaco-vscode-quickaccess-service-override': 25.1.2- '@codingame/monaco-vscode-view-common-service-override': 25.1.2-- '@codingame/[email protected]':- dependencies:- '@codingame/monaco-vscode-api': 25.1.2- '@codingame/monaco-vscode-keybindings-service-override': 25.1.2- '@codingame/monaco-vscode-quickaccess-service-override': 25.1.2- '@codingame/monaco-vscode-view-banner-service-override': 25.1.2- '@codingame/monaco-vscode-view-common-service-override': 25.1.2- '@codingame/monaco-vscode-view-status-bar-service-override': 25.1.2- '@codingame/monaco-vscode-view-title-bar-service-override': 25.1.2-'@connectrpc/[email protected](@bufbuild/[email protected])(@connectrpc/[email protected](@bufbuild/[email protected]))':dependencies:'@bufbuild/protobuf': 2.12.0@@ -6828,10 +6495,6 @@ snapshots:- optionalDependencies:- '@types/trusted-types': 2.0.7-optionalDependencies:'@types/trusted-types': 2.0.7@@ -7743,43 +7406,6 @@ snapshots:dependencies:brace-expansion: 2.0.2- dependencies:- '@codingame/monaco-vscode-api': 25.1.2- '@codingame/monaco-vscode-configuration-service-override': 25.1.2- '@codingame/monaco-vscode-editor-api': 25.1.2- '@codingame/monaco-vscode-editor-service-override': 25.1.2- '@codingame/monaco-vscode-extension-api': 25.1.2- '@codingame/monaco-vscode-extensions-service-override': 25.1.2- '@codingame/monaco-vscode-language-pack-cs': 25.1.2- '@codingame/monaco-vscode-language-pack-de': 25.1.2- '@codingame/monaco-vscode-language-pack-es': 25.1.2- '@codingame/monaco-vscode-language-pack-fr': 25.1.2- '@codingame/monaco-vscode-language-pack-it': 25.1.2- '@codingame/monaco-vscode-language-pack-ja': 25.1.2- '@codingame/monaco-vscode-language-pack-ko': 25.1.2- '@codingame/monaco-vscode-language-pack-pl': 25.1.2- '@codingame/monaco-vscode-language-pack-pt-br': 25.1.2- '@codingame/monaco-vscode-language-pack-qps-ploc': 25.1.2- '@codingame/monaco-vscode-language-pack-ru': 25.1.2- '@codingame/monaco-vscode-language-pack-tr': 25.1.2- '@codingame/monaco-vscode-language-pack-zh-hans': 25.1.2- '@codingame/monaco-vscode-language-pack-zh-hant': 25.1.2- '@codingame/monaco-vscode-languages-service-override': 25.1.2- '@codingame/monaco-vscode-localization-service-override': 25.1.2- '@codingame/monaco-vscode-log-service-override': 25.1.2- '@codingame/monaco-vscode-model-service-override': 25.1.2- '@codingame/monaco-vscode-monarch-service-override': 25.1.2- '@codingame/monaco-vscode-textmate-service-override': 25.1.2- '@codingame/monaco-vscode-theme-defaults-default-extension': 25.1.2- '@codingame/monaco-vscode-theme-service-override': 25.1.2- '@codingame/monaco-vscode-views-service-override': 25.1.2- '@codingame/monaco-vscode-workbench-service-override': 25.1.2- vscode: '@codingame/[email protected]'- vscode-languageclient: 9.0.1- vscode-languageserver-protocol: 3.17.5- vscode-ws-jsonrpc: 3.5.0-diff --git a/frontend/src/react/components/monaco/lsp-client.ts b/frontend/src/react/components/monaco/lsp-client.tsindex 03d2cf4b76..ef810da007 100644--- a/frontend/src/react/components/monaco/lsp-client.ts+++ b/frontend/src/react/components/monaco/lsp-client.ts@@ -1,7 +1,15 @@import { omit, throttle } from "lodash-es";-import { MonacoLanguageClient } from "monaco-languageclient";-import type { ExecuteCommandParams } from "vscode-languageclient";-import { CloseAction, ErrorAction, State } from "vscode-languageclient";+import type {+ ExecuteCommandParams,+ LanguageClientOptions,+ MessageTransports,+} from "vscode-languageclient";+import {+ BaseLanguageClient,+ CloseAction,+ ErrorAction,+ State,+} from "vscode-languageclient";import {toSocket,WebSocketMessageReader,@@ -33,6 +41,36 @@ export type ConnectionState = {ws: Promise<WebSocket> | undefined;};+// Inline replacement for `monaco-languageclient`'s `MonacoLanguageClient`,+// which was a ~15-line subclass and the only thing we consumed from that+// package. All the LSP machinery lives in `vscode-languageclient`, whose+// undeclared `import "vscode"` resolves to the top-level `vscode` alias+// (`@codingame/monaco-vscode-extension-api`) in package.json — that alias+// must stay for language features to register against the same API+// instance that `initializeMonacoServices` initializes.+class MonacoLanguageClient extends BaseLanguageClient {+ private readonly messageTransports: MessageTransports;++ constructor({+ name,+ clientOptions,+ messageTransports,+ }: {+ name: string;+ clientOptions: LanguageClientOptions;+ messageTransports: MessageTransports;+ }) {+ super(name.toLowerCase(), name, clientOptions);+ this.messageTransports = messageTransports;+ }++ protected createMessageTransports(+ _encoding: string+ ): Promise<MessageTransports> {+ return Promise.resolve(this.messageTransports);+ }+}+const listeners = new Set<() => void>();const emit = () => {@@ -215,8 +253,9 @@ const reconnect = async () => {};const createLanguageClient = async (): Promise<MonacoLanguageClient> => {- // `monaco-languageclient` v9+ requires `@codingame/monaco-vscode-api`'s- // `initialize()` to have completed before `new MonacoLanguageClient(...)`,+ // `vscode-languageclient` touches the `vscode` API at construction time,+ // which requires `@codingame/monaco-vscode-api`'s `initialize()` to have+ // completed before `new MonacoLanguageClient(...)`,// otherwise the constructor throws "Default api is not ready yet, do not// forget to import 'vscode/localExtensionHost' and wait for services// initialization". `MonacoEditor.tsx` kicks off `initializeLSPClient()`diff --git a/frontend/tests/e2e/sql-editor/sql-editor-lsp.spec.ts b/frontend/tests/e2e/sql-editor/sql-editor-lsp.spec.tsnew file mode 100644index 0000000000..f0738c2bb8--- /dev/null+++ b/frontend/tests/e2e/sql-editor/sql-editor-lsp.spec.ts@@ -0,0 +1,195 @@+// SQL Editor — LSP smoke test (completion over the /lsp websocket).+//+// Locks the language-client wiring in+// frontend/src/react/components/monaco/lsp-client.ts: the inline+// BaseLanguageClient subclass must start against the websocket transports,+// complete the LSP initialize handshake, deliver `setMetadata` via+// workspace/executeCommand, and surface schema-aware completions in+// Monaco's suggest widget. The completions are asserted against a test-owned+// fixture table (created in beforeAll, synced into Bytebase's catalog+// metadata): its name never appears in the editor buffer or the sample+// schema, so word-based (document-local) suggestions can't produce it —+// a fixture-table completion proves the full LSP round trip.+//+// The backend LSP (backend/api/lsp/handler.go) advertises only+// completionProvider (trigger chars "." and " ") and+// executeCommandProvider — no hoverProvider — so hover is intentionally+// not asserted here.+//+// Single linear test on purpose: the assertions build on each other+// (handshake → metadata → completion → query), and a shared-page cascade+// after a mid-suite failure would only blur the signal.++import { test, expect, type BrowserContext, type Page } from "@playwright/test";+import type { BytebaseApiClient } from "../framework/api-client";+import { loadTestEnv, type TestEnv } from "../framework/env";+import { execSql, getInstancePgPort } from "../framework/psql";+import { SqlEditorPage } from "./sql-editor.page";++test.setTimeout(180_000);++// Test-owned fixture (validated constant identifiers, safe to interpolate).+// Lives in `public` so it is on the search path: the bare-prefix+// quick-suggest path can complete it without a schema qualifier.+const LSP_FIXTURE_TABLE = "lsp_probe_fixture_e2e";++let env: TestEnv & { api: BytebaseApiClient };+let pgPort: string;+let sharedContext: BrowserContext;+let page: Page;+let sqlEditor: SqlEditorPage;++type SocketStats = {+ url: string;+ sentFrames: string[];+ receivedFrames: string[];+ closed: boolean;+};+const lspSockets: SocketStats[] = [];++const frameText = (payload: string | Buffer): string =>+ typeof payload === "string" ? payload : payload.toString("utf-8");++test.beforeAll(async ({ browser }) => {+ env = loadTestEnv();+ await env.api.login(env.adminEmail, env.adminPassword);++ // Own fixture: drop leftovers, create the probe table, and sync so the+ // LSP's catalog metadata (the source of schema completions) knows it.+ pgPort = await getInstancePgPort(env);+ execSql(env.databaseId, pgPort, `DROP TABLE IF EXISTS public.${LSP_FIXTURE_TABLE}`);+ execSql(env.databaseId, pgPort, `CREATE TABLE public.${LSP_FIXTURE_TABLE} (id INTEGER PRIMARY KEY)`);+ await env.api.syncDatabase(env.database);++ sharedContext = await browser.newContext({ storageState: ".auth/state.json" });+ page = await sharedContext.newPage();+ sqlEditor = new SqlEditorPage(page, env.baseURL);++ page.on("websocket", (ws) => {+ if (!new URL(ws.url()).pathname.endsWith("/lsp")) return;+ const stats: SocketStats = {+ url: ws.url(),+ sentFrames: [],+ receivedFrames: [],+ closed: false,+ };+ lspSockets.push(stats);+ ws.on("framesent", (frame) => stats.sentFrames.push(frameText(frame.payload)));+ ws.on("framereceived", (frame) =>+ stats.receivedFrames.push(frameText(frame.payload))+ );+ ws.on("close", () => (stats.closed = true));+ });+});++test.afterAll(async () => {+ await sharedContext?.close();+ if (pgPort) {+ execSql(env.databaseId, pgPort, `DROP TABLE IF EXISTS public.${LSP_FIXTURE_TABLE}`);+ // Re-sync so the shared server's catalog metadata drops the fixture too;+ // otherwise later spec files see a phantom table.+ await env.api.syncDatabase(env.database);+ }+});++test("LSP language client: handshake, schema completions, and query flow", async () => {+ const projectId = env.project.split("/").pop()!;+ await sqlEditor.gotoWithDb(projectId, env.instanceId, env.databaseId);+ await expect(sqlEditor.codeEditor).toBeVisible({ timeout: 30_000 });++ // --- 1. Websocket + LSP initialize handshake ---------------------------+ await expect+ .poll(() => lspSockets.length, { timeout: 30_000 })+ .toBeGreaterThan(0);+ // Scan ALL captured sockets, not just [0]: the client's connect retry and+ // its reconnect path each open a fresh websocket, so the handshake can+ // land on a later socket than the first attempt.+ const anySocketFrame = (+ dir: "sentFrames" | "receivedFrames",+ marker: string+ ) => lspSockets.some((s) => s[dir].some((f) => f.includes(marker)));+ // Client sent the LSP initialize request…+ await expect+ .poll(() => anySocketFrame("sentFrames", '"method":"initialize"'), {+ timeout: 30_000,+ })+ .toBe(true);+ // …and the server answered with its capabilities.+ await expect+ .poll(() => anySocketFrame("receivedFrames", '"capabilities"'), {+ timeout: 30_000,+ })+ .toBe(true);+ // The editor pushes connection metadata (instance/database scope for+ // completions) via workspace/executeCommand setMetadata.+ await expect+ .poll(() => anySocketFrame("sentFrames", '"setMetadata"'), {+ timeout: 30_000,+ })+ .toBe(true);++ // No "WebSocket connection failed" CRITICAL notification (the+ // errorHandler path in lsp-client.ts).+ await expect(page.getByText("WebSocket connection failed")).not.toBeVisible();++ // Clear-and-type with verification. ControlOrMeta+a select-all is+ // unreliable on macOS headless Chrome (observed dropping the selection,+ // which concatenates buffers), so clear by backspacing the measured+ // content length instead.+ const setBuffer = async (sql: string) => {+ await sqlEditor.codeEditor.click();+ await page.waitForTimeout(200);+ await page.keyboard.press("Escape"); // dismiss any open suggest widget+ for (let round = 0; round < 5; round++) {+ const len = (await sqlEditor.readEditorContent()).length;+ if (len === 0) break;+ await page.keyboard.press("ControlOrMeta+ArrowDown").catch(() => {});+ await page.keyboard.press("End");+ for (let j = 0; j < len + 5; j++) {+ await page.keyboard.press("Backspace", { delay: 5 });+ }+ }+ await page.keyboard.type(sql, { delay: 50 });+ };++ const fixtureRow = page+ .locator(".suggest-widget .monaco-list-row")+ .filter({ hasText: LSP_FIXTURE_TABLE })+ .first();++ // --- 2. Schema-aware completion --------------------------------------+ // The fixture table name never appears in the buffer, so only the LSP+ // (fed by the synced catalog metadata) can suggest it. Instead of an+ // arbitrary settle sleep, poll the concrete readiness condition: retry+ // type + invoke until the LSP serves the fixture completion (bounded).+ let visible = false;+ for (let attempt = 0; attempt < 6 && !visible; attempt++) {+ await setBuffer("SELECT * FROM lsp_probe_");+ await page.keyboard.press("ControlOrMeta+Space");+ visible = await fixtureRow+ .waitFor({ state: "visible", timeout: 5_000 })+ .then(() => true)+ .catch(() => false);+ if (!visible) {+ await page.keyboard.press("Escape");+ }+ }+ expect(visible).toBe(true);+ // The row itself is the LSP proof; accepting it via click/keyboard is+ // flaky under headless Chrome and adds nothing, so just dismiss.+ await page.keyboard.press("Escape");++ // --- 3. Trigger-character path ("." is a server trigger char) ----------+ await setBuffer("SELECT * FROM public.");+ await expect(fixtureRow).toBeVisible({ timeout: 10_000 });+ await page.keyboard.press("Escape");++ // --- 4. Editor still executes queries after the whole LSP flow ---------+ await setBuffer("SELECT 1");+ await sqlEditor.runButton.click();+ await expect(page.getByText(/^\d+\s+rows?$/i).first()).toBeVisible({+ timeout: 15_000,+ });+ // The LSP socket must still be alive at the end.+ expect(lspSockets.some((s) => !s.closed)).toBe(true);+});