Repository navigation
Commit fdb9a07
docs(spec): a declared never-string-capable search column is admitted but contributes no clause (#29584)
<!-- claude-projects-attribution: {"github_login":"os-warren"} -->
_Requested by **Warren** · [project
thread](https://claude.ai/code/project/chan_01U5RdnAAmkSQmZbqh6FtqZ8?thread=cmsg_01U5RdnAAmkSQmZbqh6FtqZ8Ffn7zen4zj6cFnXv7bG1yJ)_
Fixes #29546
Clause-②: no
Metadata-protocol: none
Dispatched by `domain:spec#3 · os-warren ·
session_01JQwxbahe4v7GBD94QeSnir`; dev = card thread
`session_01JQwxbWkmiSMGh5SFWcG7XY`.
## 维护者速读
- 改了什么:只改注释。`resolveSearchFieldResolution` 的 declared
分支说明和对应测试注释,改为「从不存字符串的列(如 `json`)仍可声明、进入搜索集,但搜索展开不给它出子句」。
- 为什么改:#29502 之后 `$search` 展开跳过这类列,旧注释仍说 json 列「a scan that CAN
match」,作者和 AI 会以为把 json 字段放进 `searchableFields` 能搜到东西。
- 风险与回滚:零行为改动,无 schema、无接受值变化;回滚即 revert 本 PR。
- 先看:`packages/spec/src/data/search-fields.ts`(declared
分支两条列表项)、`packages/spec/src/data/search-fields.test.ts`(CONTROL
用例注释)、`.changeset/29546-declared-search-column-no-clause-comment.md`。
- 两分钟验证:`git diff origin/main -- packages/spec/src` 只见注释行变化;`pnpm
--filter @objectstack/spec exec vitest run
src/data/search-fields.test.ts` 应 50/50 通过。
- 需要你做的:无,席位落地。
## What changes
- `packages/spec/src/data/search-fields.ts`, the declared-branch
docblock on `resolveSearchFieldResolution`: a declared `lookup` or
`json` column is ADMITTED to the set, and what it contributes is the
expansion's call (`expandSearchToFilter`, `@objectstack/objectql`). A
single-valued `lookup` becomes an `$icontains` over the stored foreign
key, a scan that can match. A column whose declared type can never hold
a string (the text-operator door's `door-refusal` verdict,
`textOperatorDoorVerdict`) contributes NO clause, and a set made only of
such columns answers no rows, never an error. Only "there is no column
at all" is refused, as before.
- `packages/spec/src/data/search-fields.test.ts`, the CONTROL case
comment: the same reading. The assertion is unchanged.
- `.changeset/29546-declared-search-column-no-clause-comment.md`:
`@objectstack/spec` patch. The docblock sits on an exported function and
ships in `dist/data/index.d.ts` (measured below), so the published text
changes.
## Why
The declared-branch text is the written contract authors and AI read to
decide what to put in `searchableFields`. Since #29502 (#29394) the
expansion skips never-string-capable columns, so "a scan that CAN match"
for `json` was false. `lookup` is in `REFERENCE_VALUE_TYPES` (verdict
`passes`), so it still matches and keeps that wording.
## Tests
- `pnpm --filter @objectstack/spec exec vitest run --maxWorkers=2
src/data/search-fields.test.ts` at `76fde58e6`: Test Files 1 passed (1),
Tests 50 passed (50).
- `pnpm --filter @objectstack/spec typecheck` under the verify lock:
`VERDICT command-exit 0`.
- No ablation: no tested behaviour moved.
## Acceptance notes
- Premise measured on `origin/main` `ff827bcf`:
`packages/objectql/src/search-filter.ts` `fieldClausesForTerm` returns
no clause when `neverHoldsText(meta)`, which is
`textOperatorDoorVerdict(...) === 'door-refusal'`; `json` sits in
`STRUCTURED_JSON_TYPES` (verdict `door-refusal`). A single-valued
`lookup` falls to the default `$icontains` clause, so the old text also
said `$contains` where the expansion emits `$icontains`; the new text
says `$icontains`.
- Changeset decision: the card said "no changeset unless the gate asks".
The os-dev standard (published = what `files[]` ships) wins on conflict:
after `pnpm --filter @objectstack/spec build`, `grep -c "contributes NO
clause" packages/spec/dist/data/index.d.ts` = 1 and the old phrase = 0
(positive control: `SCANNABILITY` hits the same file on the base build).
So a patch changeset rides.
- Not changed here, same stale sentence:
`packages/lint/src/validate-searchable-fields.ts` docblock (about L95 to
L100) still says a declared json column is "a scan that CAN match".
Outside this card's file surface; named in the report for the seat.
- `packages/lint/CHANGELOG.md` and
`packages/metadata-protocol/CHANGELOG.md` carry the old phrase in
released entries; release-owned, untouched.
## Verification
Gate union at head `76fde58e6`:
<details><summary>dispatch-gates --commands / --ran</summary>
- `node scripts/pm/dispatch-gates.mjs --commands --repo
objectstack-ai/objectstack`: 79 derived families, run from a runner
writing one exit line each.
- 77 exited 0 on the first pass. `node
scripts/check-plugin-teardown-shape.mjs --self-test` exited 3 (its
positive-control commit was outside the shallow clone); after `git fetch
origin 621a487` it re-ran with exit 0 (48 cases pass).
- `pnpm check:dual-build-cjs-loads` exited 3, PREREQUISITE NOT MET
(needs every package built). NOT MEASURED locally, left to CI.
- `node scripts/pm/dispatch-gates.mjs --ran FILE --repo
objectstack-ai/objectstack`: exit 0, "79 derived famil(ies) accounted
for, 78 run, 1 NOT-MEASURED".
- Prerequisite builds under the lock: `turbo run build` for objectql,
lint, formula, client, client-react (38 tasks), then spec.
</details>
## 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.
- [ ] 3. No formatter ran; `pnpm lint` passes. (No formatter ran.
Repo-wide `pnpm lint` is CI's run, not run locally.)
- [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.
- [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_01JQwxbWkmiSMGh5SFWcG7XY
---
_Generated by [Claude
Code](https://claude.ai/code/session_01JQwxbWkmiSMGh5SFWcG7XY)_
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent 2da42e7 commit fdb9a07
3 files changed
Lines changed: 51 additions & 18 deletions
File tree
- .changeset
- packages/spec/src/data
| 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 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
309 | 309 | | |
310 | 310 | | |
311 | 311 | | |
312 | | - | |
313 | | - | |
314 | | - | |
315 | | - | |
316 | | - | |
317 | | - | |
318 | | - | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
319 | 324 | | |
320 | 325 | | |
321 | 326 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
89 | 89 | | |
90 | 90 | | |
91 | 91 | | |
92 | | - | |
| 92 | + | |
93 | 93 | | |
94 | 94 | | |
95 | 95 | | |
96 | 96 | | |
97 | | - | |
98 | | - | |
99 | | - | |
100 | | - | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
101 | 101 | | |
102 | 102 | | |
103 | 103 | | |
| |||
279 | 279 | | |
280 | 280 | | |
281 | 281 | | |
282 | | - | |
| 282 | + | |
283 | 283 | | |
284 | 284 | | |
285 | 285 | | |
286 | | - | |
287 | | - | |
288 | | - | |
289 | | - | |
290 | | - | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
291 | 302 | | |
292 | 303 | | |
293 | 304 | | |
| |||
0 commit comments