fix(editor): avoid duplicating schemas in table completions - #715
fix(editor): avoid duplicating schemas in table completions#715mikevillari wants to merge 2 commits into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
|
Thanks, the diagnosis is right and the tests assert the applied edit rather than the range, which is the correct shape for this bug. I reproduced both original failures on main before reading the fix. One blocking finding. Table labels are not always schema qualified: postgres.ts:1478 emits bare names for the public schema, and mysql.ts:1040, oracle.ts:863, druid, sqlite, libsql and duckdb emit bare names for every table. Filtering on qualifier + prefix drops those. Measured on your branch: SELECT * FROM public.dem with label demo produced a suggestion on main and produces none here, same for mydb.dem. The reported case is fixed, but a case that worked has stopped working. A four line fallback covers both, and your 33 tests still pass with it: Keep the dot branch guard on the effective qualifier: switching it to typedQualifier makes unknown. offer every table and breaks the existing empty-suggestions test. Please add a bare-label case to the new test block so this cannot regress again. No live engines needed: the provider only ever sees tableItems, so a parameterised label shape covers all seventeen. |
WARNING CORE_CAPABILITIES
Description
Accepting a qualified table suggestion can produce
sample.sample.demo, because Monaco replaces only the current word while the provider inserts the complete qualified name. Longer prefixes such assample.demalso lose the suggestion because table filtering ignores the typed qualifier.Filter table suggestions using the qualifier plus current word and replace that entire span. After a dot, offer matching schema tables when direct table/alias column lookup yields no columns.
Type of Change
Related Issue
Closes #705
Changes Made
Testing
sample.dinsertssample.sample.demo;sample.,sample.de, andsample.demhave no matching suggestion.bun run test: 14,721 passes, zero failures, all 34 component groups.bun run test:coverageand threshold check: 46,329/46,329 lines (100%).build:lib, and diff checks pass.SELECT * FROM sample.demousing the real editor model.sample.demofrom the popup produces the correct query without duplication.Test Environment
macOS arm64; Node 26.5.0; Bun 1.4.2; GNU Bash 5.2.37; Helm 4.1.3; 7-Zip 26.03.
Checklist
Additional Notes
AI-assisted implementation and validation. Browser verification used an isolated local fixture with the installed Monaco distribution and the actual bundled provider, not a full application deployment or a database query. The automation attempt to accept with Tab failed, so keyboard acceptance is not claimed; popup mouse acceptance and real-model edit application were verified.
Production
bun run buildremains for CI: the same base/dependency set hit a local Turbopack worker-port permission error in #706 even after a broader-permission retry. That environment-limited production build was not repeated here. Lint reports existing warnings without errors.