Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions .changeset/searchable-enum-types-dead-status-entry.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
---
'@objectstack/spec': patch
---

fix(spec): drop the dead `'status'` member from `SEARCHABLE_ENUM_TYPES` (#13695)

`SEARCHABLE_ENUM_TYPES` in `packages/spec/src/data/search-fields.ts` declared
`new Set(['select', 'status'])`, but `'status'` is not — and has never been —
a member of the 49-value `FieldType` enum. The entry could never match a real
field's `type`, so it changed no accept/reject behaviour and matched no field
in any object: dead vocabulary that invited the next reader to believe a
`status` field type exists.

Verified before removal (not read): `FieldType.options` has 49 members,
`'status'` is absent, `'select'` is present; no in-flight plan for a `status`
field type exists anywhere in the tree.

Grade: `patch`, argued rather than defaulted. Not `skip-changeset` — this
touches published package source, not just docs/tests — and not a no-op
either: this closes a real probe gap. The existing `[#6934]` pins in
`search-fields.test.ts` check the four search vocabularies against **each
other** (pairwise disjointness) but never against `FieldType` itself, so a
pure ghost member — matching nothing, rather than overlapping something —
passed every existing pin silently. This PR adds a `[#13695]` pin asserting
`SEARCHABLE_ENUM_TYPES ⊆ FieldType`, scoped to that one set; a parallel ghost
finding in `SEARCH_AUTO_EXCLUDED_TYPES` (`'object'`, `'grid'`, `'geometry'`,
`'encrypted'` are also not `FieldType` members) is filed separately and left
untouched here.
24 changes: 24 additions & 0 deletions packages/spec/src/data/search-fields.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
SEARCHABLE_ENUM_TYPES,
SEARCHABLE_TEXTUAL_TYPES,
} from './search-fields';
import { FieldType } from './field.zod';

// ---------------------------------------------------------------------------
// [#4483] The auto-default's "lead" field ORDERS the set; it must not ADMIT one.
Expand Down Expand Up @@ -142,6 +143,29 @@ describe('[#4483] $search auto field set — lead orders, never admits', () => {
// two resolution assertions below go red on an overlap independently of them,
// and in opposite directions, so no single relaxation can make this pin vacuous.
// ---------------------------------------------------------------------------
// ---------------------------------------------------------------------------
// [#13695] `SEARCHABLE_ENUM_TYPES` members must be real `FieldType`s.
//
// The #6934 disjointness pins above check the vocabularies against EACH OTHER
// but never against `FieldType` itself, so a member that matches no real field
// type at all — a pure ghost, distinct from an overlap — passed every existing
// pin silently: `'status'` sat in this set matching nothing, for as long as it
// took a docs sweep to notice by hand. This pin closes that probe gap for the
// enum vocabulary specifically (the one the finding hit); it is deliberately
// NOT extended to `SEARCH_AUTO_EXCLUDED_TYPES`, which is a separate, larger
// finding of its own (`object`/`grid`/`geometry`/`encrypted` are ghosts there
// too) filed out of scope for this fix.
// ---------------------------------------------------------------------------
describe('[#13695] SEARCHABLE_ENUM_TYPES ⊆ FieldType', () => {
const validTypes: ReadonlySet<string> = new Set(FieldType.options);

it('every member is a real FieldType — no ghost vocabulary entries', () => {
for (const t of SEARCHABLE_ENUM_TYPES) {
expect(validTypes.has(t), `'${t}' is in SEARCHABLE_ENUM_TYPES but not a FieldType member`).toBe(true);
}
});
});

describe('[#6934] search type vocabularies are pairwise disjoint', () => {
const overlap = (a: ReadonlySet<string>, b: ReadonlySet<string>) =>
[...a].filter((t) => b.has(t)).sort();
Expand Down
2 changes: 1 addition & 1 deletion packages/spec/src/data/search-fields.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export const SEARCHABLE_TEXTUAL_TYPES: ReadonlySet<string> = new Set([
'text', 'email', 'phone', 'url', 'autonumber', 'textarea', 'markdown',
]);
/** Enumerated types searched by mapping the query to option values via labels. */
export const SEARCHABLE_ENUM_TYPES: ReadonlySet<string> = new Set(['select', 'status']);
export const SEARCHABLE_ENUM_TYPES: ReadonlySet<string> = new Set(['select']);
/** System / audit / heavy fields never auto-included. */
export const SEARCH_AUTO_EXCLUDED_FIELDS: ReadonlySet<string> = new Set([
'id', '_id', 'created', 'modified', 'created_at', 'updated_at',
Expand Down
Loading