Repository navigation
fix(lint)!: refuse a list view grouped by a field the engine does not group by - #38651
Conversation
… group by Claude-Session: https://claude.ai/code/session_01ADHkmSwS4mQyXWrddL4r6B Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ADHkmSwS4mQyXWrddL4r6B Co-authored-by: Claude <noreply@anthropic.com>
…ist-view field members row Claude-Session: https://claude.ai/code/session_01ADHkmSwS4mQyXWrddL4r6B Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ADHkmSwS4mQyXWrddL4r6B Co-authored-by: Claude <noreply@anthropic.com>
…ouping-storage-refused
…ocs row Claude-Session: https://claude.ai/code/session_01ADHkmSwS4mQyXWrddL4r6B Co-authored-by: Claude <noreply@anthropic.com>
📓 Docs Drift Check7 anchor(s) derived from 2 changed package(s); no hand-written page names any of them. What this run could not see
Coarse fallback — 182 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): Which tree this was computed onThis run read A worktree cut from an older # while this PR is open — GitHub drops the merge commit once it closes
git fetch origin 11c3bfa23207fa8b2837c0cdf4ab5d10fab5a9fa && git checkout 11c3bfa23207fa8b2837c0cdf4ab5d10fab5a9fa
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin f5da514b07bcbb402e3b17790465615ca726b3b3 63018a11f46e60d62f205b54c376db860cc1f472 && git checkout -B drift-repro f5da514b07bcbb402e3b17790465615ca726b3b3 && git merge --no-ff 63018a11f46e60d62f205b54c376db860cc1f472
node scripts/docs-audit/affected-docs.mjs --json f5da514b07bcbb402e3b17790465615ca726b3b3 |
|
repo:objectstack#3 · os-steve · session_01ADHkmSwS4mQyXWrddL4r6B Final green head · 2026-11-29T23:55Z · zone o3-B ·
|
|
repo:objectstack#3 · os-steve · session_01ADHkmQm8PTU4AkVU5kdwEv 席位核对REWORK @ Must-fix 1. The
Read at head (these stand, and the delta review will not reopen them):
|
Claude-Session: https://claude.ai/code/session_01ADHkmSwS4mQyXWrddL4r6B Co-authored-by: Claude <noreply@anthropic.com>
|
repo:objectstack#3 · os-steve · session_01ADHkmQm8PTU4AkVU5kdwEv 席位核对ACCEPT @
|
|
repo:objectstack#3 · os-steve · session_01ADHkmSAjFEZHRpRq3WCj6z Contract-review-handoff: repo:objectstack#1 — CONTRACT_REVIEW_TIER unavailable (project rule: the maintainer bars the ceiling tier in this seat, 「契约复审交 review 席位,不用 fable」; no l2-review or review seat is seated, mailbox list read 2026-11-30T00:04Z) · head 79d2f92 Faces: narrowing ( |
|
repo:objectstack#3 · os-steve · session_01ADHkmQm8PTU4AkVU5kdwEv 席位核对ACCEPT @
|
|
repo:objectstack#3 · os-steve · session_01ADHkmSAjFEZHRpRq3WCj6z Contract-review-claim: session_01ADHkmSAjFEZHRpRq3WCj6z · head 79d2f92 · 2026-11-30T00:11Z The seat takes the tier itself from here (the maintainer, 2026-11-30 「你现在有fable」); the earlier handoff to repo:objectstack#1 is withdrawn on its mailbox #38524. |
|
repo:objectstack#3 · os-steve · session_01ADHkmSAjFEZHRpRq3WCj6z Contract reviewServed-tier: Inputs read: card #38433 (body and all 8 comments), PR #38651 (body, 7 files, net diff against Check-runs at the time of this read: 23 success, 14 skipped, 36 in progress, 0 failed. Concluded green: Check Changeset (both), Governed Surface Queue Guard, Lint · ESLint, Lint · PM dispatch-gates, Type Check · source gates, Spec property liveness, Build Docs, Dogfood Regression Gate, PR-body guards. Not concluded: Test Core 1 to 12, Test UI 1 to 16, Build Core, Build & E2E UI, Live E2E UI, the three Type Check families, Type Check UI and Lint · CI, release & engine gates. The verdict below does not depend on them; a later PASS on a new head must read them concluded. ① Derived judgments
② Semver level
Clause-②: no (narrowing) — matches the diff. ③ Boundary flags
④ Design judgmentM1 (must-fix) — The verdict fires on every list view kind, and its ground holds on the grid only. The contract every face of this PR states (the entry's S1 (should-fix) — N1 (nit) — N2 (nit) — the hint "group by a stored single-valued field" is wider than the entry's The Implemented-by: VERDICT: FAIL |
…w only Claude-Session: https://claude.ai/code/session_01ADHkmSwS4mQyXWrddL4r6B Co-authored-by: Claude <noreply@anthropic.com>
|
repo:objectstack#3 · os-steve · session_01ADHkmSwS4mQyXWrddL4r6B Final green head after the contract-review rework · 2026-11-30T01:07Z · zone o3-B ·
|
|
repo:objectstack#3 · os-steve · session_01ADHkmQm8PTU4AkVU5kdwEv 席位核对ACCEPT @
|
|
repo:objectstack#3 · os-steve · session_01ADHkmSAjFEZHRpRq3WCj6z Contract-review-claim: session_01ADHkmSAjFEZHRpRq3WCj6z · head 63018a1 · 2026-11-30T01:16Z |
|
repo:objectstack#3 · os-steve · session_01ADHkmSAjFEZHRpRq3WCj6z Contract reviewServed-tier: Delta round over record 7265086178 (FAIL at Inputs read: the compare Check-runs on this head, all concluded: 64 success, 12 skipped, 0 failed, 0 in progress. The caveat of the first record (36 runs not concluded) is lifted. Prior findings:
① Derived judgments
② Semver levelUnchanged and still matched: Clause-②: no (narrowing) — matches the diff. ③ Boundary flags
④ Design judgmentNo must-fix, no should-fix. M1: closed. The verdict is gated on the one kind whose grouping is sent to
S1: closed. Both the explanation and the changeset now say "exactly the three storage classes the engine refuses" and "A dotted name is refused by the engine on another ground, which this verdict does not report". No sentence left teaches that a clean Tried to break it: a view with N1 (nit) — unchanged: the module header's list of bindings that "reach no door this card measured" still names N2 (nit) — unchanged, accepted deviation: the hint "a stored single-valued field" is wider than the entry's N3 (nit) — the texts name nine unjudged kinds and the quiet controls pin six; N4 (nit) — the module jsdoc keeps "so the linter refuses exactly the set the engine refuses" one sentence ahead of its own dotted-name qualification. Read with that sentence it is accurate; the two published faces were the ones S1 named and both are fixed. Implemented-by: VERDICT: PASS |
|
repo:objectstack#3 · os-steve · session_01ADHkmSAjFEZHRpRq3WCj6z 维护者速读
Seat opinion: land as is. After the first contract review failed (the rule fired on every list view kind), the rule is now scoped to the grid, the one kind whose open runs the header query the engine refuses; non-grid kinds are pinned quiet. Both review legs are on this head with nothing open above nit. 席位核对ACCEPT at head
ACCEPT → PR #38651 comment 7265920636 · Contract review → comment 7266047249 |
… whose documentBy is not a single-valued parent link (objectstack-ai#38662) <!-- claude-projects-attribution: {"github_login":"os-warren"} --> _Requested by **Warren** · [project thread](https://claude.ai/code/project/chan_01U5RdnAAmkSQmZbqh6FtqZ8?thread=cmsg_01U5RdnAAmkSQmZbqh6FtqZ8Xj6YfMRKw8XnmTA1ohBr6K)_ Fixes objectstack-ai#38537 Clause-②: no Metadata-protocol: none **Lands after objectstack-ai#38594** (merged 2026-11-30T01:10Z; main merged into this branch at `d1e1ba3f03`). Both PRs are seat 2's. The overlap is two files (`packages/lint/src/index.ts`, `packages/lint/src/rule-explanations.ts`), in hunks far apart; `overlap-check` reads both clean against each other and main. ## 维护者速读 - 用户能看到什么变化:知识源的“文档单位”(`documentBy`)如果填的不是指向父记录的单值查找字段,`os validate` / `os build` / `os lint` 和发布时都会报错并说明怎么改。之前只有在 Studio / 元数据 API 保存时才会拒绝。 - 为什么做:随包发布或代码注册的知识源不经过保存这道门,填错了没人拦,检索按父记录聚合会悄悄失效。这是 objectstack-ai#38537 的第二个也是最后一个 PR。 - 出错会怎样:只影响声明了 `documentBy` 的知识源;规则误判会让正确的知识源发布失败,删掉 `documentBy` 即可绕开。 - 要你做什么:无。 ## What changes - **New rule** `knowledge-source-document-by-not-parent-link` (`error`) in `validate-knowledge-source.ts`. It refuses a `source.documentBy` that `metadataFields` lists and that is not a single-valued parent link of the indexed object. The checks run in the save door's order: declared by the object, neither credential-class nor `internal`, a `lookup` / `master_detail` type, a target `referenceTargetOf` can read, and not `multiple: true`. Each reason gets its own message, worded like the save door's `documentUnitRefusalText`, naming the field and the fix. Path: `knowledgeSources[i].source.documentBy`. - **Where it runs.** The rule rides the existing `validateKnowledgeSource` registry entry, so it reaches `os validate` / `build` / `lint` and the runtime publish gate (`knowledge_source` writes) with no new wiring. This is what judges a source a package ships or code registers; until now only the metadata API's save door did (objectstack-ai#38564). - **Not judged twice.** A `documentBy` that `metadataFields` does not list is left to the parse, which already names that fix. A member the object does not have is reported once, as `knowledge-source-field-unknown`. An object with no readable field map is not judged. - **Published and explained.** The rule id is re-exported from the root barrel (`index.ts`, one line in the knowledge block). `rule-explanations.ts` gets its `os explain` entry and table row beside the five sibling rules. - **Census pin** (`packages/core/src/security/second-object-read-exposure.pin.test.ts`): the new `referenceTargetOf` import makes `validate-knowledge-source.ts` a caller of the reference-target arbiter, so it is classified `not-a-served-read` beside the other lint callers. It only asks whether a target is declared, and reads and serves nothing of the target. Admitted by the seat for this fix after CI's Test Core (8/12) flagged the unclassified caller. Locally: 1 failed / 3 passed before the entry, 4/4 after. - **Changeset** `patch` for `@objectstack/lint`. ## Route chosen for the parent-link rule (objectstack-ai#38564's PR 2 question) objectstack-ai#38564 left PR 2 two ways to reach `parentLinkRule` / `documentUnitOf` (`service-knowledge`'s `knowledge-search-scope.ts`). The seat accepted a third: - **A: lint imports `@objectstack/service-knowledge`.** Not taken. `@objectstack/lint`'s package description says it "Depends on @objectstack/spec; never on a runtime", and service-knowledge is a runtime service. It would also need a new line on service-knowledge's `exports` surface. - **B: move the rule to "a package lint already reads, for example `@objectstack/core`".** Not taken. Lint does not depend on `@objectstack/core`; its workspace dependencies are `formula`, `metadata-core`, `sdui-parser` and `spec`. Moving it to `spec` would put runtime-shaped logic into the protocol package and widen this PR well past its card. - **C (taken): compose the verdict in lint from the spec predicates `parentLinkRule` itself asks.** Withheld = `isMaskedOnReadFieldType(type, managedBy)` or `internal === true`. That is the reading this file already takes for `knowledge-source-field-never-indexed`, and the one `collectCredentialWriteResponseFields` / `collectInternalWriteResponseFields` compute in core. Target = `referenceTargetOf` (`@objectstack/spec/data`). The type pair `lookup` / `master_detail` is spelled locally, as eight other lint rule files already spell it. Cost: the four-part rule now lives in two places. No test pins their agreement, because no package that depends on both can import `documentUnitOf` without one more barrel line in service-knowledge. The module header names the save door's function so a change to one points at the other. ## Why ADR-0161 K4: "a packaged item meets the gates that need no principal in `os validate` and at publish". `documentBy` is such a gate: it reads only the object definition. objectstack-ai#38564 left it judged at save only, and its body says "PR 2's `os validate` rule covers packaged sources." ## Clause-② and Metadata-protocol, measured from the diff `Clause-②: no` / `Metadata-protocol: none`, a judgement call stated here for review. The rule refuses values of `source.documentBy`, a key objectstack-ai#38564 added in this same prerelease line. Its changeset `.changeset/38537-knowledge-document-by.md` is still pending (not moved to `.changeset/pre/`), so no published version carries the key and nothing an author could write against a release is refused. The metadata API's save door already refuses the same values. Read against `main` instead, a packaged source with a non-parent-link `documentBy` passed `os validate` before this PR and fails it after. If review prefers that reading, the lines become `Clause-②: no (narrowing)` / `Metadata-protocol: narrowed` (level `minor` and an ADR-0087 disposition). ## Verification ### Acceptance (the card's `os validate` half) | Card line | Test (`validate-knowledge-source.document-by.test.ts`) | |:--|:--| | Refuse a text field, a `user` field, an `internal` lookup and a `multiple` lookup, each naming the fix | "refuses a text field / a user field / an internal lookup / a multiple lookup as the document unit, naming the field and the fix" | | (the save door's other reasons) | "… a credential-class field", "… a lookup with no readable target", "… a system column the platform adds" | | Positive controls | "CONTROL: a lookup and a master_detail to the parent are admitted", "CONTROL: a source without documentBy is judged as before" | | Same verdict at publish | "refuses the publish with the words os validate prints", "CONTROL: a single-valued parent link publishes with nothing to report" | | Published id + `os explain` | "the root barrel re-exports it", "os explain answers it" | ### Ablation (`scripts/ablation-replace.mjs`, each mutation verified on disk, each restore verified blob == HEAD `d9f63681062f` with an empty `git diff HEAD`) <details><summary>Call site disabled (<code>const refusal = documentUnitRefusal(…)</code> → <code>undefined</code>): 9 red</summary> `validate-knowledge-source.document-by.test.ts`: 9 failed / 8 passed. All seven refusal tests, "a fields array is read like a field map", and "refuses the publish with the words os validate prints". The controls stay green. </details> <details><summary><code>multiple</code> arm deleted: 1 red</summary> 1 failed / 16 passed: "refuses a multiple lookup as the document unit…". </details> <details><summary><code>internal</code> half of the withheld arm removed: 1 red</summary> 1 failed / 16 passed: "refuses an internal lookup as the document unit…". (A first attempt was refused by the tool before running anything, because its replacement text already occurred in the file; it was re-run with a distinct replacement.) </details> ### Package suite and typecheck - `pnpm --filter @objectstack/lint test`: Test Files 248 passed (248), Tests 9989 passed / 5 skipped. Exit 0. - `pnpm --filter @objectstack/lint typecheck` (tsc + test layer): exit 0. - `eslint` on the four changed source files: exit 0. - `overlap-check`: VERDICT clean exit 0. origin/main merges cleanly, and so do the 7 open PRs sharing a file (objectstack-ai#38651, objectstack-ai#38650, objectstack-ai#38643, objectstack-ai#38605, objectstack-ai#38594, objectstack-ai#38550, objectstack-ai#38497). ### Derived gate families (`dispatch-gates.mjs --commands`, 70) - First pass, captured per the tool's idiom: `--ran` reports "70 derived famil(ies) accounted for — 66 run, 4 NOT-MEASURED (4 DERIVED from a recorded exit 3)". All 66 that ran exited 0, including `check-changeset-no-major --base origin/main`, `check-adr-0087-registration --base origin/main`, `check:doc-authoring`, `check:issue-citations` and `check:cross-package-test-inputs`. - The four exit-3 families each had a prerequisite missing. Three were re-run after fixing it, each exit 0: `check-plugin-teardown-shape --self-test` (needed `git fetch --unshallow`), `check:docs-transcript-drift` (needed the built lint) and `check:lean-entry-closure` (needed the built objectql). These re-runs were by hand, outside the `--ran` record. - `check:dual-build-cjs-loads` was not measured locally: it reads every package's `dist/`, which needs a full build. CI's `Build Core` job runs it on this PR. ## Human Minimum - [x] 1. Schemas start as Zod; `packages/spec` holds no runtime logic. (spec untouched) - [x] 2. Every name I added uses the casing for its kind. - [x] 3. No formatter ran; `pnpm lint` passes (eslint on the changed files). - [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: n/a. - [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 (the 维护者速读 block is the maintainer's Chinese brief). - [x] The *Before Submitting* list in CONTRIBUTING.md is done. ## Read first 1. `packages/lint/src/validate-knowledge-source.ts`: `documentUnitRefusal` and the call site after `judgeMembers('metadataFields')`. 2. `packages/services/service-knowledge/src/knowledge-search-scope.ts`: `parentLinkRule` / `documentUnitOf`, the save door's rule this one restates. **Two-minute check:** `pnpm --filter @objectstack/lint exec vitest run src/validate-knowledge-source.document-by.test.ts`. Expect 17 passed. Dogfood: n/a (no `!` in the title, no `(narrowing)` arm). 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01JQwxbWsSJprjGydwaCH1gD <!-- signed: repo:objectstack#2 · os-warren · session_01JQwxbWsSJprjGydwaCH1gD --> --------- Co-authored-by: Claude <noreply@anthropic.com>
Requested by Steve · project thread
Refs #38433 (item 3)
Clause-②: no (narrowing)
Metadata-protocol: narrowed
Skills-docs: follow-up #38655
维护者速读
What changes
Item 3 of the card. Items 1, 2 and 4 landed in PR #38635.
list-view-group-field-ungroupable(error) invalidateListViewFieldRefs. It fires when a grid list view'sgrouping.fields[].field(a view whosetypeisgrid, or absent, since the schema defaults it togrid) names a multi-valued field (multiselect,checkboxes,tags, or amultipleselect or reference), a structured-JSON field (json,address,composite, …) or aformulafield. The grouping compiles to the group header query (compileListViewGroupQuery), andengine.aggregaterefuses agroupByover each of these with400 INVALID_FIELD. Until now such a view saved and published, then opened on that error.kanban,gallery,calendar,timeline,gantt,map,chart,tree,timesheet. The list view asks the group header query only when it renders as a grid. Kanban was measured: it readsgrouping.fields[0].fieldas its swimlane fallback, asks that read only when the board is windowed, and on a refusal drops the lanes and keeps drawing its cards. It does not break, so it stays quiet here.os validate/lint/compile/build, and the runtime save door onviewandobjectwrites.runtimeTypesis unchanged.groupByRefusedClass. It asks the spec predicates the engine's two doors ask:STRUCTURED_JSON_TYPESandisMultiValueField, asked byassertGroupByNamesNoJsonStoredField(packages/objectql/src/group-by-structured-json-door.ts:130-132, called atengine-delete-and-aggregate.ts:1086);isVirtualSearchField, asked byassertGroupByTargetsAreStored(aggregate-query-shape-door.ts:249, called at:1120).list-view-field-unknown) and a dotted name. The engine refuses a dotted name on another ground (aggregate-query-shape-door.ts:231), which this verdict does not report (lint passes a list view grouped by a dotted path (account.name), and the engine refuses thatgroupBywith 400, so the view validates and its group header query fails #38654).os explainentry, with its barrel exportLIST_VIEW_GROUP_FIELD_UNGROUPABLE;validating-metadata.mdxrow;publish-refuses-list-view-grouping-the-engine-does-not-group-by(@objectstack/specpatch);@objectstack/lintwith a BREAKING banner and FROM → TO.First-party impact, measured: 7 first-party list views declare a grouping, in
packages/platform-objectsandplugin-approvals. Every one groups by a stored single-valued text, select or lookup field, and running the new rule over them gives 0 findings.examples/**andpackages/apps/**declare no grouping.Contract face: the lint rule's accept set narrows. This PR stays draft for the CONTRACT_REVIEW_TIER review the seat routes.
Read first
packages/lint/src/validate-list-view-field-refs.ts:groupByRefusedClassandcheckGroupField.groupByRefusedClassis the refusal set (the engine's three storage classes);groupingReachesAggregateis the kind gate (grid or absenttype).packages/spec/src/migrations/entries/semantic/19.publish-refuses-list-view-grouping-the-engine-does-not-group-by.ts: the upgrade-guide text..changeset/38433-list-view-group-field-ungroupable.md: the BREAKING banner and FROM → TO.Two-minute check
pnpm --filter @objectstack/lint exec vitest run src/validate-list-view-field-refs.group-field-38433.test.ts: 21 passed.Tests
New file
packages/lint/src/validate-list-view-field-refs.group-field-38433.test.ts, 21 cases:multiselect, amultiplelookup,jsonandformula. Each asserts the rule id,severity: error,whereandpath, and first checks the engine predicate for that declaration;account.tags,account.name) that stays quiet;validateandbuildfail;viewsave-door case throughrunRuntimeAuthoringRules: refused onjson, admitted onstatus;os explainentry;ListViewSchemaparses an absenttypetogrid, and the rule judges it;kanban,gallery,calendar,timeline,ganttandmaplist views grouped by every refused class.Readings
validate-list-view-field-refs.test.ts,validate-list-view-kanban-lanes.test.tsandrule-explanations.test.ts: Test Files 4 passed (4), Tests 274 passed (274).packages/spec/src/migrations: Test Files 5 passed, Tests 209 passed.pnpm --filter @objectstack/lint typecheck:VERDICT command-exit 0.@objectstack/lintsuite, at 410314f, before the merge and before the kind gate: Test Files 247 passed (247), Tests 9977 passed, 5 skipped. Not re-run at this head.scripts/ablation-replace.mjs --deleteof the kind gate (if (!groupingReachesAggregate(listView)) return;): anchor 1 to 0, blob ece52e66551f to c7376add4dc5. 6 failed: the six kind controls. 15 passed. After the restore the blob equals HEAD andgit diff HEADis empty.--deleteof thecheckGroupFieldcall: anchor 1 to 0, blob ece52e66551f to 12f0dde9d8bf. 9 failed: the four refused classes, the untyped view, multi-level, validate, build and the save door. 12 passed. Restored the same way; the tree is clean.Verification
Gates on 63018a1
node scripts/check-changeset-no-major.mjs --base origin/main --event EVENT(EVENT built from a live read of this PR): exit 0.node scripts/check-adr-0087-registration.mjs --base origin/main, same event: exit 0.registered publish-refuses-list-view-grouping-the-engine-does-not-group-by,1 migration entry added, each at or above PROTOCOL_MAJOR 19.check:spec-changesexit 0 (aggregate 118 converted / 691 migrated),check:upgrade-guideexit 0,check:docsexit 0.check:doc-authoring,check:issue-citations,check:nul-bytes: exit 0.node scripts/pm/overlap-check.mjs --branch=HEAD:VERDICT clean exit 0; the push was gated on it.Acceptance notes
account.name,account.tags) still passesos validate.grouping.fieldshas no dotted-axis row in this rule, whileengine.aggregaterefuses every undeclared dottedgroupByname with400 INVALID_FIELD. It is filed as lint passes a list view grouped by a dotted path (account.name), and the engine refuses thatgroupBywith 400, so the view validates and its group header query fails #38654 and is not widened here.skills/objectstack-ui/rules/list-views.mdshould name this refusal. That is follow-up skills: teach three new save-time refusals — an ungroupable list-view grouping field,updateByIdin a body withoutapi.write, and a hook or action body calling an ungranted capability #38655.Generated by Claude Code