Skip to content

refactor(ui-types): one source for the filter-builder field-type list; close the three K4 review should-fixes - #27400

Merged
os-zhuang merged 4 commits into
mainfrom
claude/project-thread-jq1yxo
Oct 29, 2026
Merged

os-zhuang merged 4 commits into
mainfrom
claude/project-thread-jq1yxo

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Requested by Tesla · project thread

Fixes #27369

Clause-②: no
Metadata-protocol: none

维护者速读

  • 改了什么:filter-builder 的 14 种字段类型现在只在 @object-ui/types 的 filter-field-types.ts 声明一次,校验 schema、TS 接口、渲染器三处都从这里取;顺带处理 K4 评审的三条建议改项。
  • 为什么改:以前三处手抄列表互相漂移(objectui#6939、fix(rest): stop DELETE /reports/:id revealing whether a report id exists (#7523) #7562、test(service-job): schedule exact-count cases on an inert cron fixture #8774 修的都是这个),K4 之后还多了一份冻结列表。
  • 风险与回滚:可接受的类型集合不变(仍 14 个,type 可选,缺省 text);渲染行为不变。回滚即 revert 本 PR。
  • 先看:ui/packages/types/src/filter-field-types.ts、ui/packages/components/src/custom/filter-builder.tsx 的分组导入、ui/scripts/check-doc-links.mjs 新增的 skills 扫描行。
  • 两分钟验证:pnpm --dir ui exec vitest run packages/types/src/__tests__/filter-builder-mirror-6939.test.ts examples/schema-catalog/test/filter-builder-mirror-6939.test.tsx,预期全绿。
  • 需要你做的:本 PR 触及 .github/workflows/ci.yml(Tier H),待分诊合约复审后由你合并。

What changes

One source for the field-type list (card items 1–2).

  • New ui/packages/types/src/filter-field-types.ts declares the renderer's four behaviour buckets (FILTER_NUMBER_LIKE_TYPES, FILTER_DATE_LIKE_TYPES, FILTER_SELECT_LIKE_TYPES, FILTER_LOOKUP_LIKE_TYPES) and FILTER_FIELD_TYPES (text, the buckets, boolean, in the order the retired doc used), plus the member type FilterFieldType. All are exported from @object-ui/types.
  • FilterFieldSchema.type is z.enum(FILTER_FIELD_TYPES).optional(). Its .describe() no longer cites "the published doc", and its docblock says where the authority lives now.
  • FilterField['type'] is FilterFieldType, not a restated union.
  • filter-builder.tsx imports the four buckets and declares no list of its own. They are rebound as readonly string[] locals so the existing .includes(authoredType) call sites compile unchanged.
  • The validator half of filter-builder-mirror-6939 drops LAST_PUBLISHED_TYPES and its doc-reader leftovers. It now pins: the enum equals FILTER_FIELD_TYPES member for member; every member is a spec FieldType (packages/spec/src/data/field.zod.ts) except SPEC_FIELD_TYPE_EXEMPTIONS, which names status with its one-line reason; every exemption is still live (in the list, still outside the spec); and the seven bucketed members are each carried by their shared bucket, which the renderer imports. The header's objectstack#27145 section is rewritten to say the authority is FILTER_FIELD_TYPES.
  • The render half (examples/schema-catalog/test/filter-builder-mirror-6939.test.tsx) replaces the stale hand-kept seven ("…and the mirror refuses it") with one case per member of FILTER_FIELD_TYPES except text. Each case uses the existing oneRow measurement and asserts that the member draws a control signature (inputs plus trigger count) different from a nonsense spelling. text is the fallthrough target by construction; its by-name branch stays pinned in the validator half.

K4 should-fix (1): the skill doc URLs are now gated. This took both halves. check-skills-paths.mjs judges only backtick paths, and it resolves content/ against ui/, so it could not reach a site URL. I chose check-doc-links.mjs instead:

  • SCAN_ROOTS gains { path: '../skills/objectui', rule: 'disk', diskRoot: '../skills/objectui' }. The bundle is read on GitHub and by agents, so its relative hrefs are disk paths. It ships to customer projects as one directory, so the new per-row diskRoot makes the bundle itself the boundary a relative href must stay inside. The default boundary, this tree's root, sits below the bundle and would have rejected all 34 intra-bundle links.
  • The two prose URLs (app-composition.md:62, styling.md:318) become markdown links. The gate already judges objectstack.ai links as site routes against apps/docs.
  • The new row also surfaced one gate gap: guides/schema-expressions.md has a heading inside a blockquote (> ### …). Both renderers anchor that heading, but the gate's ATX scan did not see it, and the corpus test went red. The heading scan now strips blockquote markers first. A unit pin covers this, and the setext-count test counts blockquoted ATX headings.
  • check-skills-token-ratchet: the Theming link cost styling.md 2 tokens. I paid them by deleting text in the same line ("the token list" became "tokens"). app-composition.md is 1 token lighter.

K4 should-fix (2). .github/workflows/ci.yml: the ui paths-filter comment said "four roots outside ui/" above a list of five globs. It now says "five paths outside ui/". This is a comment-only change.

K4 should-fix (3). ui/AGENTS.md rule #2 pointed at the retired content/docs/guide/*.md. It now names the matching page under content/docs/frontend/.

Changeset: .changeset/27369-filter-builder-field-types.md, @object-ui/types patch and @object-ui/components patch, with both declaration lines.

Skill bundle readings (skills/** touched)

before after
skills/objectui/guides/app-composition.md 63 lines · 1079 tokens 63 lines · 1078 tokens
skills/objectui/rules/styling.md 320 lines · 2699 tokens 320 lines · 2699 tokens
all SKILL.md in skills/ 4614 lines 4614 lines
skills/objectui/**/*.md 4825 lines 4825 lines

Tests

All runs are on head 796bf3a3 or on its parent 7dc5d3f6, which differs only in styling.md.

  • Card acceptance: pnpm --dir ui exec vitest run packages/types examples/schema-catalog passed, with Test Files 429/429 and Tests 12850/12850.
  • pnpm --dir ui exec vitest run scripts/__tests__/check-doc-links.test.ts: 123/123. The whole scripts/ suite also ran as part of the derived gates (exit 0).
  • Type-check UI: @object-ui/types type-check (src, examples and tests programs), @object-ui/components type-check and @object-ui/example-schema-catalog type-check all exit 0, built against a fresh build of their dependency closure.
  • The four components-complex-filter-builder/* catalog entries and the nested search-interface builder still validate (the catalog entries the mirror refused describe, green).
  • git grep -n "LAST_PUBLISHED_TYPES\|published doc's fourteen" prints nothing.
One-time ablations (each restored from HEAD; git status clean after each)

ui vitest resolves @object-ui/types to src through its alias, so these needed no dist rebuild.

  1. A fifteenth member with no renderer branch. I added 'email' to FILTER_FIELD_TYPES only. The render half went red on `email` draws a branch of its own, not the fallthrough (1 failed, 99 passed). The spec check stayed green, as it should, because email is a spec FieldType.
  2. A fifteenth member outside the spec. I added 'zz_not_spec' to FILTER_SELECT_LIKE_TYPES. The validator half went red on every member is a spec FieldType, or a named exemption (1 failed, 48 passed).
  3. Removing a member from a bucket narrows all three faces together. I dropped rating from FILTER_NUMBER_LIKE_TYPES:
    • Schema: accepts rating, and the renderer draws it from the shared bucket FILTER_NUMBER_LIKE_TYPES went red.
    • Interface: a scratch const f: FilterField = { …, type: 'rating' } failed tsc -p tsconfig.test.json with TS2322. The control, run before the mutation, showed 0 errors.
    • Renderer: with rating forced into the render probe, `rating` draws a branch of its own went red. A rating column now draws the fallthrough.

Acceptance notes

  • status is the one member that is not a spec FieldType. It is exempted by name, not dropped, so the accepted set does not narrow.
  • check-doc-links gained a row field (diskRoot) and a heading-scan fix. Both are inside the claim's "only if item 3 needs them" surface: the row is what gates the URLs, and the heading fix is what the row needed to land green.

Verification

Derived gates: 88 derived, 87 run, 1 NOT MEASURED

node scripts/pm/dispatch-gates.mjs --repo objectstack-ai/objectstack --commands derived 88 commands. I ran all of them on 7dc5d3f6 and reran the one red family after the fix:

  • node scripts/check-skills-token-ratchet.mjs: exit 1 on 7dc5d3f6 (styling.md 2701/2699), then exit 0 on 796bf3a3.
  • pnpm --filter @objectstack/spec run check:skill-examples: exit 3 until client-react was built, then exit 0 (270 prose examples type-check).
  • pnpm check:dual-build-cjs-loads: exit 3, PREREQUISITE NOT MET because it needs every published package's dist. NOT MEASURED locally. The diff touches no package it loads, and CI runs it.
  • The other 85 exited 0.

Reconciliation: dispatch-gates --ran printed 88 derived famil(ies) accounted for — 87 run, 1 NOT-MEASURED. Lint UI: pnpm --dir ui run lint:root reported 0 errors, and turbo run lint over the three touched ui packages reported 0 errors. Neither reported a warning on a changed line.

Tier H by path (.github/workflows/ci.yml). It stays a draft until green, then the triage seat writes the contract review and the maintainer merges.


Generated by Claude Code

FILTER_FIELD_TYPES and its four behaviour buckets move into
@object-ui/types (filter-field-types.ts). FilterFieldSchema.type builds
its enum from the list, FilterField['type'] is typed from it, and
filter-builder.tsx takes its buckets from it. The mirror test drops the
frozen LAST_PUBLISHED_TYPES copy and instead pins that every member is a
spec FieldType (status exempted by name) and, in the render half, that
every member but text draws a branch of its own.

Claude-Session: https://claude.ai/code/session_01L9qibxvBS38kVpxSqdV8T4
Co-authored-by: Claude <noreply@anthropic.com>
- check-doc-links scans the objectui skill bundle (skills/objectui) as a
  disk surface whose relative hrefs must stay inside the bundle, and the
  two prose doc URLs in it become markdown links the gate judges as site
  routes. Its heading scan now reads blockquoted ATX headings, which the
  bundle writes.
- ci.yml: the ui paths-filter comment counts five paths, not four roots.
- ui/AGENTS.md #2 points at content/docs/frontend/ instead of the
  retired content/docs/guide/.

Claude-Session: https://claude.ai/code/session_01L9qibxvBS38kVpxSqdV8T4
Co-authored-by: Claude <noreply@anthropic.com>
@os-zhuang
os-zhuang marked this pull request as ready for review October 29, 2026 05:05
@github-actions github-actions Bot added ci/cd documentation Improvements or additions to documentation tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface labels Oct 29, 2026
@os-zhuang
os-zhuang enabled auto-merge October 29, 2026 05:05
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

Contract-review-handoff: triage — CONTRACT_REVIEW_TIER unavailable (maintainer rule 「契约复审都要等分诊」, the dispatching seat does not review, 2026-10-29T05:07Z) · head 796bf3a

This PR is the follow-up card #27369 (claim 6487462737) and is Tier H by path: it changes one comment line in .github/workflows/ci.yml. The maintainer account os-zhuang marked it ready, approved it (review 5693101571) and armed auto-merge at 05:05:53Z, before CI finished, so there is no contract record yet. The seat leaves the maintainer's auto-merge alone. Please render the record on this head before the queue lands it if you can. If it lands first, a post-merge record still closes the gap.

Focus: one source for the filter-builder field-type list. The accepted set must stay at 14 members, with type optional, text as the default, and status exempted from the spec FieldType subset pin. The three K4 should-fixes (6486708135) also fold in here.


Generated by Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci/cd documentation Improvements or additions to documentation needs:contract-review Marker only — PR awaits its at-tier Contract review PASS; no check reads it, the record decides size/l tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

3 participants