Repository navigation
Commit 430a311
test(knowledge-pgvector): the live PostgreSQL pin reads the runtime-composed mark beside the deployment store (#38523)
<!-- claude-projects-attribution: {"github_login":"os-project-manager"}
-->
_Requested by **Leehom** · [project
thread](https://claude.ai/code/project/chan_01TenzsRopZj4jMbvjX8uz1X?thread=cmsg_01TenzsRopZj4jMbvjX8uz1XDXvJPPtrTGfdDYhWWpihq5)_
Fixes #38514
Clause-②: no
Metadata-protocol: none
## 维护者速读
- 用户无感:主干上必过的"真实 PostgreSQL 时间一致性"检查从上一次知识服务改动起一直是红的,本单把它修回绿。
-
原因是上一单让运行时自动挂载的知识服务多带一个"由运行时组装"的标记(按知识库检索线的既定决定),而一条只在真实数据库任务里跑的测试还按旧的单一参数断言。
- 修法只改这一条测试的期望值并写明原因,产品代码不动;出错也只影响测试本身,可直接撤回。
- 没有跳过、删除或放宽任何用例;要你做的:无。
## What changes
`packages/plugins/knowledge-pgvector/src/__tests__/capability-mount.live-postgres.test.ts`,
one assertion: the knowledge service argument that
`resolveCapabilityArgument('knowledge', …)` builds is now pinned as `{
deploymentAdapter: 'pgvector', runtimeComposed: { declared: false } }`,
with a comment saying why the argument carries the runtime-composed mark
(ADR-0161 K8, the dated note on item 12) and why `declared` is `false`
(this stack writes no `requires: ['knowledge']`).
No product code changes. Nothing in the package's shipped `files[]`
changes, so this PR carries `skip-changeset` and no changeset (measured:
after `pnpm --filter @objectstack/knowledge-pgvector build`, a test-only
symbol has 0 hits across `dist`, `README.md` and `CHANGELOG.md`; the
positive control `KnowledgePgvectorPlugin` hits 4 files in `dist`).
## The reading
- The extra key is the intended mark, not a leak.
`packages/core/src/capability-composition.ts` returns `runtimeComposed:
{ declared: stackDeclaredCapabilities(input.stack).includes('knowledge')
}` beside `deploymentAdapter`, and its doc comment names it as the
"enabled by configuration" mark of ADR-0161 K8. The service reads it:
`KnowledgeServicePlugin`
(`packages/services/service-knowledge/src/knowledge-service-plugin.ts`)
declares `runtimeComposed?: { declared: boolean }` and uses it for the
reap-guard switch, `enabledByConfiguration`, the `kernel:bootstrapped`
hold and the boot-line level. The core unit test
`packages/core/src/capability-composition.test.ts` already pins the
two-key shape.
- With the mark, the service serves only when an embedder and the
deployment's store are present. This test registers a fake embedder and
mounts the pgvector store, so the two later cases of the block (the
source bound to the marked store; passages land in the pgvector tables
and `search_knowledge` returns them) still hold at the new shape, and
they now actually run instead of being skipped behind the failed
`beforeAll`.
- Other pins of the one-key argument: none. Every other test that names
`resolveCapabilityArgument('knowledge', …)` is in
`capability-composition.test.ts`, already at the new shape; the
remaining `deploymentAdapter: '…'` hits in tests are constructor
options, not pins of the resolver's answer.
## Tests
<details><summary>Live PostgreSQL (pgvector 0.6.0, a private cluster),
whole live suite — 7 files / 91 tests passed</summary>
`OS_TEST_POSTGRES_URL=… OS_EXPECT_LIVE_DIALECT_MATRIX=1 pnpm --filter
@objectstack/knowledge-pgvector exec vitest run --maxWorkers=2
live-postgres` at 4055713:
```
Test Files 7 passed (7)
Tests 91 passed (91)
os-verify-lock: VERDICT command-exit 0
```
</details>
<details><summary>The red, reproduced at the base, and green at the head
— capability-mount file alone</summary>
Head (4055713): `Test Files 1 passed (1)`, `Tests 4 passed (4)`.
Base file restored (dccf836), same live database:
```
FAIL src/__tests__/capability-mount.live-postgres.test.ts > a knowledge_source with no adapter and no requires — mounted by the item, bound to the marked store
AssertionError: expected { deploymentAdapter: 'pgvector', …(1) } to deeply equal { deploymentAdapter: 'pgvector' }
Test Files 1 failed (1)
Tests 2 passed | 2 skipped (4)
```
That is the exact signature on the failing `main` runs.
</details>
<details><summary>Non-live suite and typecheck</summary>
`pnpm --filter @objectstack/knowledge-pgvector test`: `Test Files 4
passed | 7 skipped (11)`, `Tests 19 passed | 91 skipped (110)` (the
skipped are the live files, no URL set).
`pnpm --filter @objectstack/knowledge-pgvector typecheck`: exit 0,
`check:test-typecheck: OK`.
</details>
## Verification
Two-minute check: with a pgvector PostgreSQL at `OS_TEST_POSTGRES_URL`,
run `pnpm --filter @objectstack/knowledge-pgvector exec vitest run
capability-mount`; expect 4 passed.
CI evidence line: the `Temporal Conformance (live PG + MySQL)` job is
`never on pull_request` (its `if:` in `.github/workflows/ci.yml`
excludes `pull_request`), so this PR's own checks publish it as skipped.
It runs in the merge queue, because this path matches the
`temporal_live` filter (`packages/plugins/knowledge-pgvector/**`), and
on the `main` push after landing; the card closes on a green `main` push
that runs the job.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
https://claude.ai/code/session_01FEkQ5oQLfL8thb6wtUHnTb
Co-authored-by: Claude <noreply@anthropic.com>1 parent 63acc6c commit 430a311
1 file changed
Lines changed: 6 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
115 | 115 | | |
116 | 116 | | |
117 | 117 | | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
118 | 123 | | |
119 | | - | |
| 124 | + | |
120 | 125 | | |
121 | 126 | | |
122 | 127 | | |
| |||
0 commit comments