Repository navigation
Commit ce965cf
feat(service-datasource): the Studio connection form offers Oracle and SQL Server, federation only (#31632)
<!-- claude-projects-attribution: {"github_login":"os-steve"} -->
_Requested by **Steve** · [project
thread](https://claude.ai/code/project/chan_01FdL1XeUyvVNxLreh3F4Qi9?thread=cmsg_01FdL1XeUyvVNxLreh3F4Qi97vPuFfB4ofnDGXxVYd3NjZ)_
Fixes #31389
Clause-②: yes (widening)
Metadata-protocol: none
## 维护者速读
- **改了什么**:Studio「新建数据源」的驱动下拉新增 Oracle Database 和 SQL Server
两项;选中它们时,「结构模式」只提供「外部」和「仅校验」,不再提供「托管」,并在下方用一句话说明原因。
- **为什么改**:这两个驱动此前已经落地(只做联邦),但只能在代码里声明,管理员无法在界面上连接已有的老库(ERP、财务库)。
- **风险与回滚**:驱动目录接口的每个条目可能多出一个新字段 `federationOnly:
true`(只出现在这两个驱动上),属于加宽;其它驱动条目字节不变。回滚即整体 revert。
- **先看**:①
`packages/services/service-datasource/src/driver-catalog.ts`(新条目与
`federationOnly` 投影)②
`ui/packages/app-shell/src/views/metadata-admin/datasource/DatasourceResourcePage.tsx`
的 `schemaModesFor` 与切换驱动时的模式回落 ③ `driver-catalog-translations.ts`
十种语言的新词。
- **两分钟验证**:`pnpm --filter @objectstack/service-datasource exec vitest
run src/__tests__/driver-catalog.test.ts`,预期 37 条全过。
- **需要你做的**:无,席位落地。
## What changes
- **`@objectstack/service-datasource`**: `DRIVER_CATALOG` (served by
`GET /api/v1/datasources/drivers`) gains `oracle` (label `Oracle
Database`) and `mssql` (label `SQL Server`). Their `configSchema` is the
spec projection (`getDriverConfigJsonSchemaById`), like every other
entry; nothing in the catalog loads `oracledb` or `tedious`. Each
carries a new key, `federationOnly: true`, projected from the spec's
`FEDERATION_ONLY_DRIVER_IDS` and not restated; it is absent (never
`false`) on every other entry, the way the spec column it projects is.
The old module note saying `mssql` is left out is replaced by one saying
why the federation-only drivers are offered.
- **Translations**: `driver-catalog-translations.ts` carries both
drivers' description and every connection field's title and description
in all ten non-English languages on the platform locale table (the same
set every other entry carries). Product names (`Oracle Database`, `SQL
Server`) are not translated, like `PostgreSQL`.
- **`@object-ui/app-shell`**: the New datasource dialog reads the
catalog's `federationOnly`. For a marked driver the Schema mode select
offers External and Validate only (the two federation modes the spec
accepts), never Managed, and one sentence under it says why. A Managed
choice made on another driver moves to External when a marked driver is
chosen. No driver id is written in `ui/`.
- **Missing `tedious` remedy** (seat 1 patch round): `tedious`, the
package knex's `client: 'mssql'` requires, joins
`OPTIONAL_DRIVER_CLIENT_PACKAGES` in `connect-failure-remedy.ts`, so a
SQL Server datasource without it is refused with the install of
`tedious` as its remedy, like `pg`, `mysql2`, `better-sqlite3` and
`oracledb`; before, it was told to run `pnpm install && pnpm build`.
This PR is what puts SQL Server in the form, so it is what makes that
answer reachable.
- **`@object-ui/i18n`**: one new studio key,
`engine.datasource.schemaModeFederationOnly` (en, zh).
- Changeset: `.changeset/31389-federation-only-driver-catalog.md` (patch
on all three packages).
## Tests
- `driver-catalog.test.ts`: the id list now ends `oracle`, `mssql`
(forced edit: the published id list grew); `PRODUCT_NAME_LABELS` gains
both (forced edit: their labels are product names); the icon equality
across languages now also compares `federationOnly` (forced edit). New:
the mark is exactly `FEDERATION_ONLY_DRIVER_IDS` and absent on every
other entry; the spec refuses either driver as `managed` and accepts it
as `external` / `validate-only`; Simplified Chinese words for both and
the mark kept through localisation. The coverage battery walks every
language over both new entries.
- `missing-driver-client-boot-refusal.test.ts`: a `tedious` arm beside
the `oracledb` one (real factory, real `SqlDriver`, knex's genuine
`Cannot find module 'tedious'`): the `mssql` default is refused, ending
on `missingDriverClientRemedy('tedious')`, never the build sentence.
- `DatasourceResourcePage.newDatasourceModes-30327.test.tsx` (the
dialog's existing schema-mode harness, new top-level `describe`; its
served driver list gains the two catalog entries): (h) Oracle and SQL
Server offer exactly External and Validate only, the reason sentence
shows, Create sends `schemaMode: 'external'` with `external: {}`; (i)
Managed chosen on PostgreSQL moves to External on choosing SQL Server;
(j) CONTROL: PostgreSQL offers all three modes and no reason sentence;
zh reads in Chinese.
<details><summary>Ablations (each red, then restored; git diff HEAD
empty after each)</summary>
All four through `scripts/ablation-replace.mjs` (anchor hit 1 → 0, blob
moved, restored to the HEAD blob). The suites import source directly, so
no dist leg.
1. Catalog: `federationOnly` set on every entry (`false` on unmarked
ones) → `marks exactly the spec's federation-only drivers, and no other
entry` red (`memory: expected true to be false`), plus the zh mark test;
2 failed / 35 passed.
2. Form: `schemaModesFor` returns all three modes for a marked driver →
(h) Oracle, (h) SQL Server (`expected [ …(3) ] to deeply equal [ …(2)
]`) and (i) red; 3 failed / 9 passed.
3. Form: reason sentence rendered for any driver → (j) CONTROL red (the
reason paragraph was found where null was expected); 1 failed / 11
passed.
4. Remedy: `tedious` taken back out of `OPTIONAL_DRIVER_CLIENT_PACKAGES`
→ `tedious absent: the mssql default is refused, ending on the install
of that client` red (`expected false to be true`); 1 failed / 6 passed.
</details>
## Acceptance notes
- **Clause-② measured `yes (widening)`, not the claim's `no`**: the form
needs the federation-only fact and the card says it must read it from
the catalog, so the catalog answer gains a key. Measured on base
`6b83ec2d` vs head through `driverCatalogFor(undefined | 'zh-CN')`: base
serves 5 entries, each with keys
`configSchema,description,icon,id,label`; head serves 7, the five
unchanged and `oracle` / `mssql` with
`configSchema,description,federationOnly,icon,id,label`.
- **New public key `federationOnly`**: spelled after the spec column it
projects (`DriverVocabularyEntry.federationOnly`, `true` or absent). The
seat rules the name.
- **Validate only stays offered**: the card says the form offers only
`external`. The spec accepts both federation modes for these drivers
(`federationOnly` doc: `schemaMode: 'external'` / `'validate-only'`),
and the form offers Validate only for every driver, so only Managed is
withheld. Hiding Validate only too would also leave an existing
`validate-only` SQL Server row's edit dialog with a selected value no
option names.
- **Stale QA checklist text**:
`docs/qa/platform-checklist/areas/integration-system.json` lines 1341
and 1353 describe the catalog as `memory/sqlite/postgres/mysql/mongodb`;
it now also lists `oracle` and `mssql`. Outside the claim's file
surface, so not edited here.
- **Seat rulings**: `Clause-②: yes (widening)` as measured and the key
name `federationOnly` stand; Validate only stays offered (the spec, not
the card's wording, decides); the full app-shell suite is left to CI
`Test UI`.
## Verification
At head `0f59ea948`:
- `pnpm --filter @objectstack/service-datasource test`: 74 files, 1295 /
1295 passed; `typecheck` exit 0.
- `@object-ui/i18n`: test 99 files, 1804 passed / 13 skipped;
`type-check` exit 0. `@object-ui/app-shell`: `type-check` exit 0;
`src/views/metadata-admin/datasource/` 9 files, 59 / 59 passed. The full
app-shell suite (2218 files) is left to CI `Test UI` (declared
narrowing).
- Lint: root eslint on `packages/services/service-datasource` exit 0;
`@object-ui/i18n` and `@object-ui/app-shell` `lint` exit 0 (warnings
only, none on changed lines).
- Gates: `node scripts/pm/dispatch-gates.mjs --commands` at `0f59ea948`
derived 68 families (the new one: `check:optional-error-sink`); all 68
ran with exit 0 on the first pass (`--ran`: 68 run, 0 NOT-MEASURED, 0
UNRUN). At `f6295c173` the 67 then derived were likewise all green.
- Dogfood battery (asked for by the dispatch), at `f6295c173`, before
the remedy commit; not re-run on `0f59ea948`: `pnpm --filter
@objectstack/dogfood test` under the lock, VERDICT command-exit 0, 443
files (440 passed, 3 skipped), 3674 tests (3633 passed, 41 skipped).
## Human Minimum
- [x] 1. Schemas start as Zod; `packages/spec` holds no runtime logic.
(no `packages/spec` edit)
- [x] 2. Every name I added uses the casing for its kind.
- [x] 3. No formatter ran; `pnpm lint` passes.
- [x] 4. One issue, one branch off an up-to-date `main`, one pull
request.
- [x] 5. A change that publishes carries a changeset, and both
declaration lines are filled in here and in the changeset.
- [x] 6. `packages/spec` touched: not touched.
- [x] 7. No hand edits to `content/docs/references/`,
`packages/*/CHANGELOG.md` or `content/docs/releases/`.
- [x] 8. Title, body and comments are in English.
- [x] The *Before Submitting* list in CONTRIBUTING.md is done.
---
_Generated by [Claude
Code](https://claude.ai/code/session_01ADHkmNeNnbFawUQhsi5pXU)_
<!-- signed: domain:server#1 · os-steve ·
session_01ADHkmPF1skfu2kx89BEXZi -->
---------
Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: objectstack-fleet[bot] <332303061+objectstack-fleet[bot]@users.noreply.github.com>1 parent b2ce250 commit ce965cf
10 files changed
Lines changed: 384 additions & 15 deletions
File tree
- .changeset
- packages/services/service-datasource/src
- __tests__
- ui/packages
- app-shell/src/views/metadata-admin/datasource
- i18n/src/namespaces/studio
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| 21 | + | |
| 22 | + | |
21 | 23 | | |
22 | 24 | | |
23 | 25 | | |
| |||
54 | 56 | | |
55 | 57 | | |
56 | 58 | | |
57 | | - | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
58 | 93 | | |
59 | 94 | | |
60 | 95 | | |
| |||
97 | 132 | | |
98 | 133 | | |
99 | 134 | | |
100 | | - | |
| 135 | + | |
101 | 136 | | |
102 | 137 | | |
103 | 138 | | |
| |||
125 | 160 | | |
126 | 161 | | |
127 | 162 | | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
128 | 183 | | |
129 | 184 | | |
130 | 185 | | |
| |||
164 | 219 | | |
165 | 220 | | |
166 | 221 | | |
167 | | - | |
| 222 | + | |
| 223 | + | |
168 | 224 | | |
169 | 225 | | |
170 | 226 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
163 | 163 | | |
164 | 164 | | |
165 | 165 | | |
| 166 | + | |
| 167 | + | |
166 | 168 | | |
167 | 169 | | |
168 | 170 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
181 | 181 | | |
182 | 182 | | |
183 | 183 | | |
184 | | - | |
| 184 | + | |
| 185 | + | |
185 | 186 | | |
186 | 187 | | |
187 | 188 | | |
188 | 189 | | |
189 | 190 | | |
190 | 191 | | |
191 | 192 | | |
192 | | - | |
| 193 | + | |
193 | 194 | | |
194 | 195 | | |
195 | 196 | | |
| |||
0 commit comments