Repository navigation
Commit 07585bf
fix(service-datasource)!: reconnect requires
<!-- claude-projects-attribution: {"github_login":"marchtian"} -->
_Requested by **田騏** · [project
thread](https://claude.ai/code/project/chan_01VmuUhXU9SSUzqJYyXSmYSi?thread=cmsg_01VmuUhXU9SSUzqJYyXSmYSiEe1mThB51wBSHAzPk8xmuG)_
**Fable review owed.** This PR was built on Opus while the Fable quota
was out (maintainer order: finish on Opus, then wait for the contract
review). It touches `packages/spec/src/**`, so it does not land until a
`CONTRACT_REVIEW_TIER` contract review record PASS is on its current
head.
Fixes #27727 (epic #27261). The four should-fixes and the prose note
from the contract review of PR #27715 (6508089206, ④ and ③). Claim
6509213861.
## What changes
- `IDataEngine.registerDatasourceDef?` member doc
(`packages/spec/src/contracts/data-engine.ts`): "last write wins, except
an absent `driver` keeps the id stored before it", so the member doc and
the `EngineDatasourceDef.driver` key doc no longer disagree. The
engine's own `registerDatasourceDef` doc says the same. The key doc now
also says the read-back answers the stored id.
- `ObjectQL.listDatasourceDefs` answers each definition's stored
`driver` id when it has one (chosen over documenting the omission: the
id is what decides the floor, so a sweep asking which datasources name a
plugin driver can now be written against the contract). A definition
that never named a driver is listed without the key, as before; the
existing `toEqual` pins carry no driver and are unchanged.
- `DatasourceConnectionService.reconnect`: `opts.previous` is required
(type level), and a call without `previous.driver` (absent or empty) is
refused at runtime BEFORE anything is evicted or rebuilt, so the live
pool keeps serving. Before this, a host calling `reconnect` without
`previous` got a kept pool restored under a definition naming no driver,
which serves a plugin driver unfloored, silently. Both in-repo callers
(the admin plugin's `reregisterPool` and two test seams) already pass
it.
- `external-driver-floor.test.ts`: the #27277 keep test now names the
caller class it models (a registration of the write-gate facts only) and
says the connection service is not that caller.
- `content/docs/data-modeling/virtual-objects.mdx`: the "ADR-0015 ...
Tier A" line is gone (Tier A is epic #27261's term, not ADR-0015's); the
ADR-0015 reference stays, describing what the ADR does govern on that
page.
## Why
Contract review 6508089206 ④ on #27666: no must-fix, and none of these
opens a path today, but each leaves the next caller a way to write a
datasource the floor does not protect, or a contract that says two
things about one member.
## Verification
Local, on `a5f0c8b5` (branch merged with `origin/main` at `34dc09b6`):
- New pins, each red with the fix reverted and green with it
(reverse-verified from a committed state):
- objectql `external-driver-floor.test.ts`, `[#27727]` block:
`listDatasourceDefs` answers the named id, the kept id, and the
manifest-declared id (2 of 3 red without the engine change; the third is
the control that a def with no driver is listed without the key).
- service-datasource `datasource-connection-service.test.ts`, `[#27727]`
block: a `reconnect` without `previous` (and with an empty `driver`)
rejects, the live driver and the def list are untouched, and the factory
built nothing (red without the guard); a failed rebuild restores the
kept pool under the OLD driver id. A `@ts-expect-error` pins `previous`
as required in a file the package's `tsc` compiles.
- `pnpm --filter @objectstack/objectql test`: 9247/9247. `pnpm --filter
@objectstack/service-datasource test`: 1013/1013. cli
`secret-reference-union` and `absent-table-reads`: 49/49.
- `typecheck` clean for objectql, service-datasource and spec; `pnpm
lint` exit 0; spec `check:generated` exit 0 (all 14 artifacts current).
- `dispatch-gates --ran`: 109 derived families, 109 run, 0 not measured,
all exit 0 (after a full `pnpm build`).
Clause-②: yes (narrowing)
Metadata-protocol: none
The claim declared `Clause-②: no (narrowing)` for the required
`previous`; the diff also widens `listDatasourceDefs`'s answer by the
stored `driver` key, so this PR and its changeset say `yes (narrowing)`,
as the epic PM asked. The changeset carries the BREAKING banner (a host
calling `reconnect` without `previous`; none in-repo) and the ADR-0087
marker `not-required (no-migration-prescription)`.
## Human Minimum
- [x] 1. Schemas start as Zod; `packages/spec` holds no runtime logic.
- [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: its generated artifacts are
regenerated and committed (doc-only change to a contract interface;
`pnpm --filter @objectstack/spec check:generated` exits 0 against the
freshly built dist, nothing to regenerate).
- [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 with [Claude Code](https://claude.com/claude-code)
https://claude.ai/code/session_017ihL2fhwqSBmy1XBXfcoU1
---
_Generated by [Claude
Code](https://claude.ai/code/session_017ihL2fhwqSBmy1XBXfcoU1)_
---------
Co-authored-by: Claude <noreply@anthropic.com>previous, and the engine read-back answers the stored driver id (#27788)1 parent 04141a6 commit 07585bf
7 files changed
Lines changed: 144 additions & 14 deletions
File tree
- .changeset
- content/docs/data-modeling
- packages
- objectql/src
- services/service-datasource/src
- __tests__
- spec/src/contracts
| 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 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
631 | 631 | | |
632 | 632 | | |
633 | 633 | | |
634 | | - | |
635 | | - | |
| 634 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9244 | 9244 | | |
9245 | 9245 | | |
9246 | 9246 | | |
9247 | | - | |
| 9247 | + | |
| 9248 | + | |
9248 | 9249 | | |
9249 | 9250 | | |
9250 | 9251 | | |
| |||
9311 | 9312 | | |
9312 | 9313 | | |
9313 | 9314 | | |
| 9315 | + | |
| 9316 | + | |
| 9317 | + | |
| 9318 | + | |
9314 | 9319 | | |
9315 | 9320 | | |
9316 | 9321 | | |
9317 | 9322 | | |
| 9323 | + | |
9318 | 9324 | | |
9319 | 9325 | | |
9320 | 9326 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
460 | 460 | | |
461 | 461 | | |
462 | 462 | | |
463 | | - | |
| 463 | + | |
464 | 464 | | |
465 | 465 | | |
466 | 466 | | |
467 | 467 | | |
468 | | - | |
469 | | - | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
470 | 472 | | |
471 | 473 | | |
472 | 474 | | |
| |||
584 | 586 | | |
585 | 587 | | |
586 | 588 | | |
| 589 | + | |
| 590 | + | |
| 591 | + | |
| 592 | + | |
| 593 | + | |
| 594 | + | |
| 595 | + | |
| 596 | + | |
| 597 | + | |
| 598 | + | |
| 599 | + | |
| 600 | + | |
| 601 | + | |
| 602 | + | |
| 603 | + | |
| 604 | + | |
| 605 | + | |
| 606 | + | |
| 607 | + | |
| 608 | + | |
| 609 | + | |
| 610 | + | |
| 611 | + | |
| 612 | + | |
| 613 | + | |
| 614 | + | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1362 | 1362 | | |
1363 | 1363 | | |
1364 | 1364 | | |
| 1365 | + | |
| 1366 | + | |
| 1367 | + | |
| 1368 | + | |
| 1369 | + | |
| 1370 | + | |
| 1371 | + | |
| 1372 | + | |
| 1373 | + | |
| 1374 | + | |
| 1375 | + | |
| 1376 | + | |
| 1377 | + | |
| 1378 | + | |
| 1379 | + | |
| 1380 | + | |
| 1381 | + | |
| 1382 | + | |
| 1383 | + | |
| 1384 | + | |
| 1385 | + | |
| 1386 | + | |
| 1387 | + | |
| 1388 | + | |
| 1389 | + | |
| 1390 | + | |
| 1391 | + | |
| 1392 | + | |
| 1393 | + | |
| 1394 | + | |
| 1395 | + | |
| 1396 | + | |
| 1397 | + | |
| 1398 | + | |
| 1399 | + | |
| 1400 | + | |
| 1401 | + | |
| 1402 | + | |
| 1403 | + | |
| 1404 | + | |
| 1405 | + | |
| 1406 | + | |
| 1407 | + | |
| 1408 | + | |
| 1409 | + | |
| 1410 | + | |
| 1411 | + | |
| 1412 | + | |
| 1413 | + | |
| 1414 | + | |
| 1415 | + | |
| 1416 | + | |
| 1417 | + | |
| 1418 | + | |
| 1419 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
825 | 825 | | |
826 | 826 | | |
827 | 827 | | |
828 | | - | |
| 828 | + | |
| 829 | + | |
| 830 | + | |
| 831 | + | |
| 832 | + | |
829 | 833 | | |
830 | 834 | | |
831 | 835 | | |
| |||
835 | 839 | | |
836 | 840 | | |
837 | 841 | | |
838 | | - | |
839 | | - | |
| 842 | + | |
| 843 | + | |
840 | 844 | | |
841 | 845 | | |
| 846 | + | |
| 847 | + | |
| 848 | + | |
| 849 | + | |
| 850 | + | |
| 851 | + | |
| 852 | + | |
| 853 | + | |
842 | 854 | | |
843 | 855 | | |
844 | 856 | | |
| |||
859 | 871 | | |
860 | 872 | | |
861 | 873 | | |
862 | | - | |
863 | | - | |
864 | | - | |
| 874 | + | |
| 875 | + | |
| 876 | + | |
865 | 877 | | |
866 | 878 | | |
867 | 879 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
253 | 253 | | |
254 | 254 | | |
255 | 255 | | |
256 | | - | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
257 | 259 | | |
258 | 260 | | |
259 | 261 | | |
| |||
468 | 470 | | |
469 | 471 | | |
470 | 472 | | |
471 | | - | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
472 | 476 | | |
473 | 477 | | |
474 | 478 | | |
| |||
0 commit comments