|
1 | 1 | // Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license. |
2 | 2 | // |
3 | 3 | // [#22835 · ADR-0131 D6] The datasource-admin plugin reads ENVIRONMENT rows |
4 | | -// only — over the real showcase composition, across a restart. |
| 4 | +// only, over the real showcase composition across a restart. Its reads of |
| 5 | +// stored `datasource` rows carried no organization predicate, so a row stored |
| 6 | +// in a legacy organization's layer was restored, served by both doors and |
| 7 | +// pooled, while the boot report named it as served by no read. |
5 | 8 | // |
6 | | -// ## What was broken |
7 | | -// |
8 | | -// Every metadata read serves the environment's `sys_metadata` rows only, and |
9 | | -// the boot report `[metadata_org_scoped_unserved]` names a row stored in a |
10 | | -// legacy organization's layer as served by no read and loaded by no boot. The |
11 | | -// datasource-admin plugin's own reads of stored `datasource` rows carried no |
12 | | -// such predicate: its boot restore registered a legacy organization-scoped |
13 | | -// row, and from there both the datasource-admin door and the metadata read |
14 | | -// door served it, and a live pool was opened from it. |
15 | | -// |
16 | | -// ## What each case pins |
17 | | -// |
18 | | -// - after a restart over a legacy organization-scoped row and an environment |
19 | | -// row, neither door serves the legacy row (`404`, absent from both lists) |
20 | | -// and no pool is opened from it; the environment row is served as before; |
21 | | -// - the boot report still names the legacy row, and the row is kept as it |
22 | | -// was — neither deleted nor rewritten; |
23 | | -// - the plugin's by-name reads behind its writes never reach the legacy row: |
24 | | -// an admin create and remove under its name write and remove an |
25 | | -// environment row of their own, and a `/meta` save under its name is what |
26 | | -// the admin door then serves. |
27 | | -// |
28 | | -// The verify harness composes the datasource-admin service but not its REST |
29 | | -// routes, so this file mounts `registerDatasourceAdminRoutes` the way |
30 | | -// `packages/cli/src/commands/serve.ts` does. |
| 9 | +// Pinned: neither door serves the legacy row and no pool opens from it; the |
| 10 | +// environment row is served; the boot report still names the legacy row, and |
| 11 | +// it stays at rest; the by-name reads behind the plugin's writes never reach |
| 12 | +// it. The routes are mounted the way `packages/cli/src/commands/serve.ts` does. |
31 | 13 |
|
32 | 14 | import { describe, it, expect, beforeAll, afterAll, vi } from 'vitest'; |
33 | 15 | import { registerDatasourceAdminRoutes } from '@objectstack/service-datasource'; |
|
0 commit comments