Skip to content

Commit c5f8165

Browse files
committed
docs(skills): with no searchableFields declared, a field marked searchable: true joins the auto-default search set
The data, query and list-views skills taught the record-search auto-default as type-only. Since the field-level opt-in is honoured (ruling record 6573569376, letter A; `packages/spec/src/data/search-fields.ts`), the set `$search` scans with no `searchableFields` declared — and the `$searchFields` allow-list, which is the same set — is the type-based default plus every field marked `searchable: true`, of any type except `secret`, `password` and `vector`. Each sentence now says so, and adds what does not change: `searchable: false`, the default, never removes a field the type default scans; declaring `searchableFields` chooses the set. The enum half of the type default is spelled `select` alone, as `SEARCHABLE_ENUM_TYPES` is. Paid in place within each ratchet ceiling: objectstack-data drops the duplicate Field Groups pointer stub (the `fieldGroups` row links the same anchor) and tightens three phrases; list-views merges the two rows each diagnostic had in the refusal table. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01J8VVAjjRmCZgXRP1FNQS2n
1 parent c76c0e0 commit c5f8165

3 files changed

Lines changed: 22 additions & 20 deletions

File tree

‎skills/objectstack-data/SKILL.md‎

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ metadata:
3535

3636
## Quick Reference — Detailed Rules
3737

38-
For comprehensive documentation with incorrect/correct examples:
38+
Detailed rules, with incorrect/correct examples:
3939

4040
- **[Naming Conventions](./rules/naming.md)** — snake_case rules, option values, config properties
4141
- **[Field Types](./rules/field-types.md)** — All field types and configs
@@ -85,7 +85,7 @@ the publish door rejects it before that:
8585
| `highlightFields` | derived | Ordered field keys used as a record's compact face: the columns a **related list** renders on the parent's detail page, and what a lookup picker shows. Declare it on the CHILD object (see [Relationships](./rules/relationships.md)) |
8686
| `namespace` | — | **Not a schema key** — `ObjectSchema.create()` rejects unknown keys, so authoring it is a build error. Embed the prefix directly in `name` instead (e.g. `name: 'crm_account'`) |
8787
| `datasource` | `'default'` | Target datasource ID for virtualized data |
88-
| `nameField` | derived (e.g. `'name'`/`'title'`) | **Canonical** record-title field — the stored field used as the record's display name. Use a single text/email field; a composite title to import, sort or search by is a stored computed field (a non-`formula` field with an `expression`, computed and stored on write); a text formula is display-only |
88+
| `nameField` | derived (e.g. `'name'`/`'title'`) | **Canonical** record-title field — the stored field used as the record's display name. Use a single text/email field; a composite title to import, sort or search by is a stored computed field (a non-`formula` field with an `expression`); a text formula is display-only |
8989
| `displayNameField` | — | **Deprecated** alias for `nameField` (still honored as a fallback) |
9090
| `titleFormat` | — | **Deprecated, not removed (ADR-0079)** — render-only: the server can't return or query it. Use `nameField` (it wins); a composite title follows the `nameField` row |
9191
| `enable` | — | Capability flags (trackHistory, searchable, apiEnabled, etc.) |
@@ -114,8 +114,10 @@ Toggle system behaviours per object:
114114
`searchableFields` on the object is the canonical set `$search` scans (ADR-0061).
115115
Leave it unset and search auto-defaults to the `nameField` plus the object's
116116
short-text and enum columns (`text` / `email` / `phone` / `url` / `autonumber` /
117-
`textarea` / `markdown` / `select` / `status`); declare it to pin the set
118-
explicitly. Views may narrow it, never widen it.
117+
`textarea` / `markdown` / `select`) plus every field marked `searchable: true`,
118+
of any type except `secret` / `password` / `vector`. `searchable: false`, the
119+
default, never removes a field the type default scans; declare
120+
`searchableFields` to choose the set. Views may narrow it, never widen it.
119121

120122
### ⛔ Searching by a related record's title — mirror the value, always
121123

@@ -154,15 +156,11 @@ a `formula` entry in any `searchableFields` is refused — `os validate`
154156
**Mirror maintenance is the trade-off** — a mirror is only as fresh as whatever
155157
writes it. Cover both paths: a `beforeInsert` / `beforeUpdate` hook on `task`
156158
stamps `project_name` from the incoming `project_id`'s parent; an `afterUpdate`
157-
hook on `project` re-stamps its tasks when it is renamed. Rows written by a path that bypasses hooks (bulk import, direct SQL) need a
159+
hook on `project` re-stamps its tasks when it is renamed. Rows written past the hooks (bulk import, direct SQL) need a
158160
one-off backfill. See [Lifecycle Hooks](./references/data-hooks.md).
159161

160162
---
161163

162-
→ Moved verbatim to [references/examples-objects.md](./references/examples-objects.md) § Field Groups (MVP).
163-
164-
---
165-
166164
## Conditional Field Rules
167165

168166
Put conditional UI/data-entry rules on the **field definition** when the rule

‎skills/objectstack-query/SKILL.md‎

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -316,11 +316,15 @@ to stored values.
316316
protocol normalizes `$searchFields` onto it, and the object form
317317
`search: { query, fields }` spells the same narrowing `fields`.
318318

319-
Omit it to search the object's declared `searchableFields` (or an auto-default
320-
of name/title + short-text fields), resolved server-side. It can only **narrow**
321-
that set, never widen it: over the REST/protocol ingress a name outside it is
322-
`400 INVALID_FIELD`, not a silent fall-back to a full scan. The object form
323-
`search: { query, fields }` stays available for the Tier-2 knobs below.
319+
Omit it to search the object's declared `searchableFields` (or, with none
320+
declared, an auto-default: name/title + short-text fields, plus every field
321+
marked `searchable: true` of any type except `secret` / `password` / `vector`),
322+
resolved server-side. It can only **narrow** that set, never widen it: over the
323+
REST/protocol ingress a name outside it is `400 INVALID_FIELD`, not a silent
324+
fall-back to a full scan. `searchable: false`, the default, never removes a
325+
field the type default already scans; declare `searchableFields` to choose the
326+
set. The object form `search: { query, fields }` stays available for the Tier-2
327+
knobs below.
324328

325329
> ⚠️ **Validates, then silently ignored — never emit these.** `fuzzy`, `boost`,
326330
> `operator`, `minScore`, `language` and `highlight` are the whole set; their

‎skills/objectstack-ui/rules/list-views.md‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,9 @@ export const CaseViews = defineView({
186186
| The object … | The allowed set is |
187187
|:-------------|:-------------------|
188188
| declares `searchableFields` | **that list, verbatim** — whatever the field types are |
189-
| declares nothing | the auto-default: the name field + the text-like columns (`text` / `email` / `phone` / `url` / `autonumber` / `textarea` / `markdown` / `select` / `status`) |
189+
| declares nothing | the auto-default: the name field + the text-like columns (`text` / `email` / `phone` / `url` / `autonumber` / `textarea` / `markdown` / `select`) + every field marked `searchable: true`, of any type except `secret` / `password` / `vector` |
190+
191+
`searchable: false`, the default, removes nothing the type default scans; declare `searchableFields` to choose the set.
190192

191193
Modelling side: **objectstack-data → Search Fields**. Query side
192194
(`search.fields` over the API): **objectstack-query → Full-Text Search**.
@@ -201,11 +203,9 @@ the whole search box, for every user and every term: no result at all.
201203
|:---------------------------|:--------------|:--------------------------|
202204
| a subset of the allowed set | clean | scans exactly those columns |
203205
| key omitted | clean | scans the object's full allowed set |
204-
| `searchableFields: []` | clean | **identical to omitting it** — empty is *absent* at all three layers, so it scans MORE than `["subject"]` would |
205-
| a renamed / mistyped column | `searchable-field-unknown` | `400 INVALID_FIELD` |
206-
| a dotted path (`account_id.name`) | `searchable-field-unknown` | `400 INVALID_FIELD` |
207-
| a real column outside the allowed set | `searchable-field-unsearchable` | `400 INVALID_FIELD` |
208-
| a virtual `formula` column — nothing stored to scan | `searchable-field-unsearchable` | `400 INVALID_FIELD` |
206+
| `searchableFields: []` | clean | **identical to omitting it** — empty is *absent*, so it scans MORE than `["subject"]` would |
207+
| a renamed / mistyped column, or a dotted path (`account_id.name`) | `searchable-field-unknown` | `400 INVALID_FIELD` |
208+
| a real column outside the allowed set, or a virtual `formula` column (nothing stored to scan) | `searchable-field-unsearchable` | `400 INVALID_FIELD` |
209209

210210
Both diagnostics are **errors**, not warnings — `os validate` fails the build.
211211

0 commit comments

Comments
 (0)