Skip to content

fix(lint)!: refuse a list view grouped by a field the engine does not group by - #38651

Merged
os-zhuang merged 8 commits into
mainfrom
claude/issue-38433-grouping-storage-refused
Nov 30, 2026
Merged

os-zhuang merged 8 commits into
mainfrom
claude/issue-38433-grouping-storage-refused

Conversation

@objectstack-fleet

@objectstack-fleet objectstack-fleet Bot commented Nov 29, 2026 •

Copy link
Copy Markdown
Contributor

Requested by Steve · project thread
Refs #38433 (item 3)
Clause-②: no (narrowing)
Metadata-protocol: narrowed
Skills-docs: follow-up #38655

维护者速读

  • 作者在命令行校验或在设计器保存表格列表视图时,若按多值字段、JSON 字段或公式字段分组,会被直接拒绝并给出改法;看板、日历等其它视图不受影响,运行中的用户无感。
  • 属于「发布时拦下保存成功却用不了的元数据」这一组检查,补上看板分组提示修复之后剩下的一项,替作者在发布前发现一打开就报错的列表。
  • 碰到的是已经这样分组的表格视图作者,下次保存会被拒(这样的视图本来一打开就报错,平台自带的视图无一受影响);撤回本合并即可恢复原状。
  • 无

What changes

Item 3 of the card. Items 1, 2 and 4 landed in PR #38635.

  • New lint finding list-view-group-field-ungroupable (error) in validateListViewFieldRefs. It fires when a grid list view's grouping.fields[].field (a view whose type is grid, or absent, since the schema defaults it to grid) names a multi-valued field (multiselect, checkboxes, tags, or a multiple select or reference), a structured-JSON field (json, address, composite, …) or a formula field. The grouping compiles to the group header query (compileListViewGroupQuery), and engine.aggregate refuses a groupBy over each of these with 400 INVALID_FIELD. Until now such a view saved and published, then opened on that error.
  • Other list-view kinds are not judged: 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 reads grouping.fields[0].field as 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.
  • The finding runs wherever this rule function already runs: os validate / lint / compile / build, and the runtime save door on view and object writes. runtimeTypes is unchanged.
  • The refused set comes from one helper, groupByRefusedClass. It asks the spec predicates the engine's two doors ask:
    • STRUCTURED_JSON_TYPES and isMultiValueField, asked by assertGroupByNamesNoJsonStoredField (packages/objectql/src/group-by-structured-json-door.ts:130-132, called at engine-delete-and-aggregate.ts:1086);
    • isVirtualSearchField, asked by assertGroupByTargetsAreStored (aggregate-query-shape-door.ts:249, called at :1120).
  • The kanban hint from PR fix(lint): kanban group-field hint offers a grid grouping only where the engine accepts it #38635 now calls the same helper, so there is no second type list.
  • The hint prescribes a fix the engine accepts: show the field as a grid column, or group by a stored single-valued field.
  • The rule refuses exactly the three storage classes the engine refuses. Not judged by this finding: an unknown name (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 that groupBy with 400, so the view validates and its group header query fails #38654).
  • Also in this PR:
    • an os explain entry, with its barrel export LIST_VIEW_GROUP_FIELD_UNGROUPABLE;
    • the validating-metadata.mdx row;
    • the ADR-0087 semantic entry publish-refuses-list-view-grouping-the-engine-does-not-group-by (@objectstack/spec patch);
    • a minor changeset for @objectstack/lint with a BREAKING banner and FROM → TO.

First-party impact, measured: 7 first-party list views declare a grouping, in packages/platform-objects and plugin-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/** and packages/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

  1. packages/lint/src/validate-list-view-field-refs.ts: groupByRefusedClass and checkGroupField. groupByRefusedClass is the refusal set (the engine's three storage classes); groupingReachesAggregate is the kind gate (grid or absent type).
  2. packages/spec/src/migrations/entries/semantic/19.publish-refuses-list-view-grouping-the-engine-does-not-group-by.ts: the upgrade-guide text.
  3. .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:

  • one refused case per engine-refused class: multiselect, a multiple lookup, json and formula. Each asserts the rule id, severity: error, where and path, and first checks the engine predicate for that declaration;
  • controls that stay quiet: a single-valued select, a text field and a single-valued lookup;
  • a dotted case (account.tags, account.name) that stays quiet;
  • an unknown name and a multi-level grouping;
  • validate and build fail;
  • a runtime view save-door case through runRuntimeAuthoringRules: refused on json, admitted on status;
  • the os explain entry;
  • an untyped list view: ListViewSchema parses an absent type to grid, and the rule judges it;
  • quiet controls for kanban, gallery, calendar, timeline, gantt and map list views grouped by every refused class.
Readings
  • Head 63018a1 (origin/main f5da514 is its merge base).
  • New file plus the sibling suites validate-list-view-field-refs.test.ts, validate-list-view-kanban-lanes.test.ts and rule-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.
  • Whole @objectstack/lint suite, 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.
  • Ablation 1, scripts/ablation-replace.mjs --delete of 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 and git diff HEAD is empty.
  • Ablation 2, --delete of the checkGroupField call: 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.
  • After a spec build under the lock: check:spec-changes exit 0 (aggregate 118 converted / 691 migrated), check:upgrade-guide exit 0, check:docs exit 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.
  • The rest of the derived family set is left to CI. At db3d5ec, before the merge, 64 of 70 derived families exited 0 locally; the other 6 were NOT MEASURED (a prerequisite not met, or my per-gate timeout).
  • Full dogfood battery: run at b7e76b2 (Test Files 495 passed, 3 skipped; Tests 4187 passed, 68 skipped). NOT MEASURED at 63018a1, reason: not re-run for this round.

Acceptance notes


Generated by Claude Code

@github-actions github-actions Bot added size/m 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 Nov 29, 2026
@github-actions

github-actions Bot commented Nov 29, 2026 •

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

7 anchor(s) derived from 2 changed package(s); no hand-written page names any of them. ⚠️ 1 changed file(s) yielded no anchor (packages/lint/src/index.ts), so the pages documenting them are NOT COVERED by this run — this is not a clean bill of health for those files.

What this run could not see
  • 1 changed file(s) yielded no anchor (packages/lint/src/index.ts) — pages documenting those are invisible to this run
  • 6 name(s) were too generic to anchor anything (single lowercase words)
  • the SDK route bridge reached 69 of 252 client-bound route-ledger rows — the other 183 have no registrar path: tail to select them, so pages documenting THEIR client methods cannot appear above, on this or any run. Of those 183: 0 are remediable by widening that discovery convention (an in-repo file declares the path; the convention did not scan it); 59 are structural — on a ledger where NOT ONE row is declared in-repo, so no discovery change reaches them at any price; 124 are undecided (no in-repo declaration, on a ledger that has other in-repo registrars — absence and an unreadable spelling are not distinguishable here). The rows themselves: node scripts/docs-audit/affected-docs.mjs --bridge-coverage
  • a page that states a rule by its inputs shares no identifier with the emitter that implements the rule, so an emitter-only diff cannot list it — not on this run and not on any run. Measured on fix(driver-sql): emit varchar(maxLength) for a text field a declared index keys on #11430: content/docs/protocol/objectql/types.mdx documents the text-family column mapping by the ObjectQL type names it maps FROM (text / textarea / html) while the diff changed createColumn; it went unlisted, and it was the page that diff falsified, in four places. No shared token exists to detect this on, so a rule your change carries has to be re-read by hand in the pages that restate it.
  • a key NAME is not a key, so the hand re-read the line above prescribes can land on the wrong schema. The same spelling is authorable on one governed type and a [REMOVED] tombstone on another for each of active, aria, joins, objects, template, tools and version (censused on [finding] tools is a key on BOTH AgentSchema (tombstoned, dead) and SkillSchema (live, cloud-attested), so a name-based search attributes skill examples to the agent key — it produced a false stop-the-line alarm on PR #19059 #19093 over the liveness ledger's governed types, top-level keys); nothing in a search result distinguishes the two, so a grep hit on a LIVE example reads as evidence about the DEAD key. Measured on fix(spec): the agent.tools liveness row says dead — it claimed live on a key the schema tombstoned #19059: content/docs/ai/agents.mdx was reported as contradicting the agent.tools tombstone over its tools: example at :161, which is inside the defineSkill({ block opened at :155 — the page was already correct. Settle ownership by PARSING the value against both schemas, never by the name: that literal PASSES SkillSchema, and as an AgentSchema it FAILS at tools with the tombstone prescription. ⛔ These names are not the whole class — a key retired through a .strict() guidance map leaves no tombstone in the walked shape and none of them here (tool.category, live as AIToolDefinition.category).

Coarse fallback — 182 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): node scripts/docs-audit/affected-docs.mjs --json f5da514b07bcbb402e3b17790465615ca726b3b3 → packageMentionDocs.

Which tree this was computed on

This run read content/docs from 11c3bfa23207fa8b2837c0cdf4ab5d10fab5a9fa — the merge of head 63018a11f46e60d62f205b54c376db860cc1f472 into base f5da514b07bcbb402e3b17790465615ca726b3b3, which is what actions/checkout gives a pull_request run. Not the PR head.

A worktree cut from an older main holds a different content/docs, so re-deriving there can legitimately return a different list — that is a different tree, not a wrong row. To answer on the same tree:

# 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

⚠️ That checkout carried uncommitted changes, so the commit above does not fully identify what was read.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#3 · os-steve · session_01ADHkmSwS4mQyXWrddL4r6B

Final green head · 2026-11-29T23:55Z · zone o3-B · b7e76b28b5 · check-runs: 62 success, 10 expected skips, 0 failed, 0 pending · mergeable_state clean · not governed, +292 / -7.
l1-face flags two items:

  • dogfood: the full battery ran on this head (495 files passed, 3 skipped; 4187 tests passed), as the dev's report 7264818744 records.
  • skills-docs: follow-up owed — skills/objectstack-ui/rules/list-views.md. The seat files the skills card, and the line is rewritten to #N before ACCEPT.
    Route A is per claim amendment 7263999512: the new rule list-view-group-field-ungroupable (error), the new v19 entry publish-refuses-list-view-grouping-the-engine-does-not-group-by (registered; the ADR-0087 gate exits 0), and the docs row.
    Sent to L1-a for the first review. Owed reads, sentence by sentence: the changeset and content/docs/deployment/validating-metadata.mdx. One CONTRACT_REVIEW_TIER review is owed and the seat routes it. The PR stays draft. Refs #38433 (item 3): the seat decides whether the card closes.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#3 · os-steve · session_01ADHkmQm8PTU4AkVU5kdwEv
L1-a, the seat's L1 thread · 2026-11-30T00:01Z · first review

席位核对

REWORK @ b7e76b28b5c99b12d306d25c97f68e4729b449c1 (card #38433 item 3, Refs, zone o3-B). There is one must-fix, and it is bookkeeping. The code, tests, docs and dogfood all check out, as read below. The narrowing owes L2 at CONTRACT_REVIEW_TIER; the seat routes it and lands at Tier H.

Must-fix 1. The Skills-docs: line still reads follow-up owed — skills/objectstack-ui/rules/list-views.md. It appears in the PR body (line 6) and in the changeset.

  • The L1 rule for a narrowing: an owed follow-up is filed as a card, and the line becomes #N before ACCEPT.
  • The seat is filing that card. When it is filed, rewrite the line in both places.
  • The changeset edit makes a new head. The delta review will re-read only the changeset and the body line.

Read at head (these stand, and the delta review will not reopen them):

  • The rule. validate-list-view-field-refs.ts adds checkGroupField, called once per grouping.fields[] entry. It skips a dotted name and one that does not resolve to ok, and it reports error list-view-group-field-ungroupable when groupByRefusedClass answers.
    • groupByRefusedClass asks the spec's own predicates and no type list of its own: STRUCTURED_JSON_TYPES, then isMultiValueField, then isVirtualSearchField.
    • The two sets never overlap. STRUCTURED_JSON_TYPES is json, composite, repeater, record, location, address, vector. isMultiValueField is the multi-option types, or a capable type with multiple: true.
    • So moving the JSON test ahead of the multi test changes no class.
  • The fix(lint): kanban group-field hint offers a grid grouping only where the engine accepts it #38635 kanban hint now reads the same helper. At base it computed isMultiValueField({ type, multiple }) itself, and the helper passes multiple: meta?.multiple === true. Its multi gate above the remedy is unchanged.
  • Doors. The suite member validateListViewFieldRefs declares runtimeTypes: ['flow', 'view', 'object']. So the refusal reaches the publish gate on a view write and an object write, as the changeset says, and page (sort member only) does not run it.
  • My own runs, in a clean worktree at this head, after building the @objectstack/lint^... closure:
    • The two validate-list-view-field-refs* files: 224 passed (224).
    • The kanban-hint and explanation-census files: 3 passed, 56 passed (56).
  • My ablation. I removed the formula arm of groupByRefusedClass. That gives 2 failed | 12 passed in the new file: "refuses a formula field" and "judges every level of a multi-level grouping". Restored, tree clean.
  • Declarations. The title has !. The body and changeset have Clause-②: no (narrowing) and Metadata-protocol: narrowed, and the changeset has a BREAKING banner with FROM → TO. lint is minor, the package that moves the door. spec is patch, adding only an upgrade-guide entry, which is the repo's precedent (for example 35143-views-dashboards-checks).
    • The ADR-0087 disposition is registered publish-refuses-list-view-grouping-the-engine-does-not-group-by. The new v19 entry carries the surface, replacement, reason and acceptanceCriteria, each true against the rule and the doors above.
  • Changeset, read sentence by sentence. It is true against the code:
    • the three refused classes and their examples;
    • 400 INVALID_FIELD from the engine's two doors;
    • "asks the same spec predicates";
    • not judged: an unknown name and a dotted name;
    • publish on view / object and the CLI commands;
    • no boot refusal;
    • FROM → TO;
    • the LIST_VIEW_GROUP_FIELD_UNGROUPABLE export (index.ts), with an os explain entry in rule-explanations.ts.
      The explanation adds "a field whose type is not readable" to what is not judged, which matches the helper's typeof type !== 'string' return.
  • validating-metadata.mdx, read sentence by sentence. The "List-view field members" row gains the new code with its three classes. Its cell ✓ᶠᵛᵒᵖ and the "page door runs the sort member only" clause stay true.
  • Dogfood (l1-face flags it as owed). The full battery is recorded at this head in the dev report 7264818744: b7e76b28b5, under the verify lock, 495 passed | 3 skipped, 4187 passed | 68 skipped, no failures. The first attempt, which used a wrong flag, was stopped and redone, as recorded. The changeset-only delta will not move it.
  • First-party impact. The PR body reports 7 grouped list views (in platform-objects and plugin-approvals) and 0 findings. That is the dev's reading, and the battery agrees.
  • Mechanical face. The flags are skills-docs (the must-fix) and dogfood (covered above). Checks at this head: 62 success, 10 expected skip, 0 failed. mergeable_state is clean. Refs is right: this is item 3 of review follow-ups of PR #38430: the kanban group-field hint offers a grid grouping the engine refuses for multi-value, JSON and formula fields #38433.
  • The dev's deviation. The new test file is named for the dispatch and does not follow the shared-harness rule (6583487846). It is test-only and carries every pin of this rule, so it does not block.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#3 · os-steve · session_01ADHkmQm8PTU4AkVU5kdwEv
L1-a, the seat's L1 thread · 2026-11-30T00:03Z · delta review

席位核对

ACCEPT @ b7e76b28b5c99b12d306d25c97f68e4729b449c1 (card #38433 item 3, Refs, zone o3-B). This is the delta from REWORK 7264912836, at the same head: only the PR body moved. The narrowing owes L2 at CONTRACT_REVIEW_TIER; the seat routes it and lands at Tier H.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

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 (Clause-②: no (narrowing), title !: list-view-group-field-ungroupable refuses a multi-valued, JSON-stored or formula grouping field at validate, build and the runtime view and object save doors) and published schema (one new v19 ADR-0087 semantic entry). L1 ACCEPT 7264935846. The PR takes needs:contract-review in this stroke.

@objectstack-fleet objectstack-fleet Bot added the needs:contract-review Marker only — PR awaits its at-tier Contract review PASS; no check reads it, the record decides label Nov 30, 2026
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#3 · os-steve · session_01ADHkmQm8PTU4AkVU5kdwEv
L1-a, the seat's L1 thread · 2026-11-30T00:05Z · delta review

席位核对

ACCEPT @ 79d2f923810a7c5f739ba659deebf44ebc7e8317 (card #38433 item 3, Refs, zone o3-B). ACCEPT 7264935846 carries over to this head. L2 is still owed at CONTRACT_REVIEW_TIER; the seat routes it.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

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.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#3 · os-steve · session_01ADHkmSAjFEZHRpRq3WCj6z

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: 79d2f923810a7c5f739ba659deebf44ebc7e8317
Local-runs: none
Scope: packages/spec/src/migrations/entries/semantic/19.publish-refuses-list-view-grouping-the-engine-does-not-group-by.ts + packages/lint/src/validate-list-view-field-refs.ts, packages/lint/src/rule-explanations.ts, packages/lint/src/index.ts, packages/lint/src/validate-list-view-field-refs.group-field-38433.test.ts
Security-touching: no
Rule-change-verified: none

Inputs read: card #38433 (body and all 8 comments), PR #38651 (body, 7 files, net diff against main f5da514, which is the merge base), and the check-runs on this head. Read, not reviewed: packages/objectql/src/group-by-structured-json-door.ts, aggregate-query-shape-door.ts, engine-delete-and-aggregate.ts, packages/spec/src/data/field-value.zod.ts, search-fields.ts, packages/spec/src/ui/view.zod.ts, view-grouping-query.ts, and the consumer in ui/packages/plugin-list/src/ListView.tsx, ObjectGallery.tsx, ui/packages/plugin-grid/src/objectGridGroupingDecisions.ts, ui/packages/plugin-kanban/src/ObjectKanban.tsx.

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

  • Accept set of validateListViewFieldRefs: narrows. A list view whose grouping.fields[].field is an undotted name resolving to a declared multi-value, structured-JSON or formula field now draws list-view-group-field-ungroupable (error) in os validate / lint / compile / build and at the runtime view and object save doors. Right for a grid list view. Wrong as scoped: the verdict has no view-kind gate, see M1.
  • Agreement with the engine's refusal set, class by class: right. groupByRefusedClass asks STRUCTURED_JSON_TYPES.has(type), then isMultiValueField({ type, multiple: meta.multiple === true }), then isVirtualSearchField({ type }). assertGroupByNamesNoJsonStoredField (group-by-structured-json-door.ts, jsonStoredGroupTargets) asks the first two in the same order with the same multiple === true read, and assertGroupByTargetsAreStored asks the third; isVirtualSearchField reads type alone, so the trimmed argument loses nothing. An unreadable type is quiet on both sides.
  • Kanban hint (checkKanbanGroupField): behaviour-preserving refactor. The earlier inline chain tested multi first and the helper tests structured-JSON first; the two classes are disjoint by type, so the words chosen do not change. Right.
  • Public surface of @objectstack/lint: one added export, LIST_VIEW_GROUP_FIELD_UNGROUPABLE, and one added os explain entry. Additive. Right.
  • @objectstack/spec: one added semantic migration entry at major 19; no schema, no key, no conversion. Right, and its shape and five fields match the v19 sibling 19.publish-refuses-views-and-dashboards-that-save-and-do-not-work.ts.
  • runtimeTypes unchanged: right, the verdict rides the already registered rule function. The validating-metadata.mdx row keeps its door marks, which is correct for that reason.
  • Dotted grouping names stay unjudged: right as a scoping choice and stated in the jsdoc; the engine refuses them on the aggregate_records with a 4-hop dotted groupBy (purchase_order.requisition.requester.department.name) answers 500 DATABASE_ERROR instead of a 4xx #34886 branch, not by storage class.

② Semver level

@objectstack/lint minor with a BREAKING banner and FROM → TO, @objectstack/spec patch, title with !. Clause-②: no (narrowing) and Metadata-protocol: narrowed read the same on the PR body and the changeset, and the changeset carries the registered ADR-0087 marker naming the entry this PR adds. This matches what the diff publishes: a narrowed accept set on the lint package and a notice-only entry on spec. Both Check Changeset runs concluded success on this head.

Clause-②: no (narrowing) — matches the diff.

③ Boundary flags

  • open_questions: empty on the final two reports. The earlier one (how the ADR-0087 entry lands) was answered by claim amendment 7263999512, route A, and the diff follows it.
  • Dev flag, test file placement (new file named for the card against AGENTS.md ruling record 6583487846, which puts a pin in the shared harness file): not a contract matter. The claim's file surface ordered the new file. Escalated to the lane seat to rule in its ACCEPT; no finding here.
  • Dev flag, index.ts export outside the first surface: covered by the amendment. Answered.
  • Dev flag, upgrade guide output is gitignored and check:upgrade-guide compares no copy on disk: read as stated; no tracked file is owed. Answered.
  • Out-of-scope finding, dotted grouping name passes os validate while the engine refuses it (carrier: seat): confirmed against aggregate-query-shape-door.ts. No card number is on the thread. Escalated to the seat to file; see also N1.
  • Skills-docs follow-up: named as skills: teach three new save-time refusals — an ungroupable list-view grouping field, updateById in a body without api.write, and a hook or action body calling an ungranted capability #38655 on the PR body and the changeset. Answered.
  • SQL push-down: the diff adds no query, no id materialisation and no in-app join. Nothing to judge.
  • Security: no skills/** path in hits; no changed hunk teaches permission, sharing, credential, token or authentication behaviour.

④ Design judgment

M1 (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 reason: "The grouping parses and publishes, then shows nothing ... the view opens on that error and renders no group"; the finding message: "the header query answers 400 INVALID_FIELD and no group renders"; the changeset and the explanation alike) is that a grouping compiles to the group header query. In the consumer on this tree that query is sent for a grid alone: ListView.tsx sets gridOwnsGroupedFetch and groupingNeedsHeaderQuery only under currentView === 'grid'. For type: 'gallery' the same grouping is handed to object-gallery, and ObjectGallery.tsx (groupedItems) buckets the fetched cards in the browser by String(item[field]); no aggregate is asked. A formula value arrives on the find rows, so a gallery grouped by a formula field draws its groups today and opens on no error. GroupingConfigSchema itself names the kind ("Supports multi-level grouping for grid/gallery views"). checkGroupField reads no listView.type, so after this PR that view is refused at publish and by os validate with an error whose message is false for it, and the upgrade guide tells its author it "shows nothing". That takes a capability the consumer serves away, on a kind the dev did not measure (the first-party count covers 7 views, all type: 'grid', and every test fixture is type: 'grid'). It also breaks the rule this module states for itself ("the linter cannot refuse at author time what the door serves at run time"; "likely wrong is not the verdict a gate may invent", ADR-0072 D1). The kinds where grouping is not read at all (calendar, timeline, gantt, map) are refused the same way for an inert key. Kanban is partly different: grouping.fields[0] is the swimlane fallback and the windowed swimlane read does group by it (ObjectKanban.tsx, swimlaneReadField), but what the board draws when that read is refused was not measured by anyone. Fix, one of: gate checkGroupField on the kinds whose grouping is measured to reach engine.aggregate (grid, and kanban only if measured), with a pinned quiet control per other kind and the entry, message, explanation and changeset words scoped to match; or bring a maintainer ruling that grouping is refused on every kind because the server-side contract of GroupingConfigSchema governs the gallery too, and then word the entry and the message for what such a view actually does today. The second route changes what an author may publish beyond the card's premise, so it is not the dev's or the seat's to choose silently.

S1 (should-fix) — rule-explanations.ts, second paragraph, and the same sentence in the changeset: "it refuses exactly what the engine refuses", followed by "Not judged: ... a dotted name". The engine refuses a dotted groupBy name too (assertGroupByTargetsAreStored, the #34886 branch), and a credential or internal column ahead of both doors. Read together, the two sentences teach that a clean os validate means the engine accepts the grouping and that a dotted name is not refused. The module jsdoc already says it correctly ("the engine refuses every dotted groupBy name on its own ground ... so this verdict does not speak for it"). Fix: say the verdict refuses exactly the three storage classes the engine refuses, and that a dotted name is refused by the engine on another ground this verdict does not report.

N1 (nit) — validate-list-view-field-refs.ts, module header, the list of renderer bindings that "reach no door this card measured" still names grouping.fields, while the new section of the same header says the grouping field is a groupBy column of the header query. Stale since the grouping order section, not introduced here. Belongs with the dotted-grouping follow-up card.

N2 (nit) — the hint "group by a stored single-valued field" is wider than the entry's replacement, which lists the kinds that hold; a password or secret field is stored and single-valued and the engine refuses it. No realistic producer. Accepted deviation.

The hits file otherwise holds: id equals the file name and the changeset marker, the surface names the one rule id and both doors, acceptanceCriteria is checkable with os validate, and "Stored metadata is not rewritten or refused at boot" agrees with a rule that runs at author time and on writes only. Its reason sentence is the part M1 makes untrue for a non-grid view.

Implemented-by: claude/issue-38433-grouping-storage-refused
Reviewed-by: session_01ADHkmSAjFEZHRpRq3WCj6z

VERDICT: FAIL

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#3 · os-steve · session_01ADHkmSwS4mQyXWrddL4r6B

Final green head after the contract-review rework · 2026-11-30T01:07Z · zone o3-B · 63018a11f4 · check-runs: 64 success, 12 expected skips, 0 failed, 0 pending · mergeable_state clean · not governed, +351 / -7 over 7 files.
This round takes contract review 7265086178 (FAIL @ 79d2f923) under claim amendment 2 (7265115216); the dev's delta report is 7265468891.

  • M1: the rule judges only a grid list view, or one with no type, which ListViewSchema parses to grid. Kanban was measured read-only and is out: on a refused swimlane read the board drops the lanes and keeps drawing its cards. Quiet controls cover kanban, gallery, calendar, timeline, gantt and map. Ablation 1 (the kind gate) turns 6 red, exactly those controls. Ablation 2 (the call) turns 9 red. The tree is clean after each restore.
  • S1: the explanation and the changeset say the rule refuses exactly the engine's three storage classes, and that a dotted name is refused by the engine on another ground (lint passes a list view grouped by a dotted path (account.name), and the engine refuses that groupBy with 400, so the view validates and its group header query fails #38654).
  • The PR body was rewritten from the dev's draft (zone issue_patch, read back identical).
    l1-face flags dogfood: the full battery ran at b7e76b28b5 and was NOT re-run at this head. This round only narrows when a lint error fires, so it can remove findings but not add them. Whether that still covers this head is L1-a's call.
    Sent to L1-a for a delta. The L2 delta at CONTRACT_REVIEW_TIER is the seat's. The PR stays draft, Refs #38433 (item 3).

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#3 · os-steve · session_01ADHkmQm8PTU4AkVU5kdwEv
L1-a, the seat's L1 thread · 2026-11-30T01:10Z · delta review

席位核对

ACCEPT @ 63018a11f46e60d62f205b54c376db860cc1f472 (card #38433 item 3, Refs, zone o3-B). This is the delta 79d2f923..63018a11, one commit. It answers the seat's L2 FAIL 7265086178 under claim amendment 2 (7265115216). The L2 re-review is the seat's.

  • M1: the rule now judges a grid only. groupingReachesAggregate(listView) is true for type absent or 'grid'. It is checked first in checkGroupField, and the call now passes the list view.
    • listView at the call site is the list-view body for every shape checkListView is handed: objects[].listViews.*, views[].list, views[].config (a ViewItem's ListViewSchema), views[].listViews.* and the flattened viewKind: 'list' overlay, which carries type at its top level. So the gate reads the list kind in each.
    • An absent type is a grid because ListViewSchema's type defaults to 'grid'. The new test "an absent type is a grid … and is judged" pins that.
    • The exclusion of kanban and the other kinds rests on the dev's reading of objectui: ListView.tsx sends the header query only under currentView === 'grid', and a board keeps drawing its cards when its count read is refused. The zone reports the ablations as the type gate removed (exactly the 6 silent controls go red) and the call removed (9 red).
  • S1: the wording. "Exactly the three storage classes the engine refuses" replaces "exactly what the engine refuses". The dotted name is now stated as refused by the engine on another ground and left to lint passes a list view grouped by a dotted path (account.name), and the engine refuses that groupBy with 400, so the view validates and its group header query fails #38654.
  • Read sentence by sentence; all true against the code above.
    • The changeset's BREAKING banner, the rule bullet and FROM now scope to a grid (or a list view with no type). They list the unjudged kinds as kanban, gallery, calendar, timeline, gantt, map, chart, tree and timesheet, which is the same list as the module note.
    • The explanation (rule-explanations.ts) says the same, plus the gallery and kanban reasons from the helper's docblock.
    • validating-metadata.mdx adds "a grid list view's" to the row. Its cell and the page clause still hold.
    • The v19 entry's surface and reason scope to a grid and add "Other list-view kinds are not judged".
  • Dogfood: the battery at b7e76b28 (7264818744) covers this head, in my judgement. That run judged the wider rule (every kind) and passed. This delta only removes findings, and no file under packages/qa names the rule id (grep, 0 hits). So no dogfood case can newly fail. The seat makes the landing call.
  • Checks. At this head: 64 success, 12 expected skip, 0 failed, 0 pending (final-green 7265874014). mergeable_state read unknown on the first read, so re-read it before landing.
  • Not re-run by me this round. I did not rebuild for this delta. The test evidence is CI's lint suite at this head plus the dev's ablations in 7265468891, and the gate logic is the four lines read above.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#3 · os-steve · session_01ADHkmSAjFEZHRpRq3WCj6z

Contract-review-claim: session_01ADHkmSAjFEZHRpRq3WCj6z · head 63018a1 · 2026-11-30T01:16Z

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#3 · os-steve · session_01ADHkmSAjFEZHRpRq3WCj6z

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: 63018a11f46e60d62f205b54c376db860cc1f472
Local-runs: none
Scope: packages/spec/src/migrations/entries/semantic/19.publish-refuses-list-view-grouping-the-engine-does-not-group-by.ts + packages/lint/src/validate-list-view-field-refs.ts, packages/lint/src/rule-explanations.ts, packages/lint/src/index.ts, packages/lint/src/validate-list-view-field-refs.group-field-38433.test.ts
Security-touching: no
Rule-change-verified: none

Delta round over record 7265086178 (FAIL at 79d2f923810a7c5f739ba659deebf44ebc7e8317). The delta is one commit, 63018a11f4, 6 files, +95 / -36; the whole PR stays 7 files against merge base f5da514. Judged in full, not only against the prior findings.

Inputs read: the compare 79d2f923...63018a11 and the six files at the new head; the PR body as it stands now; card #38433 comments since the last round (claim amendment 2, 7265115216; delta report 7265468891); the PR thread since the last round (final-green 7265874014, L1-a delta ACCEPT 7265920636); the check-runs on this head. Read, not reviewed: ui/packages/plugin-list/src/ListView.tsx (byte-identical to the previous head), ui/packages/plugin-kanban/src/ObjectKanban.tsx, packages/spec/src/ui/view.zod.ts. The delta touches nothing under ui/**, packages/objectql/** or the spec predicates.

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. main has moved since the merge base in packages/lint/src/index.ts and rule-explanations.ts; mergeable_state reads clean.

Prior findings:

① Derived judgments

  • Accept set of validateListViewFieldRefs: narrows for a list view whose type is grid or absent, and for no other kind. groupingReachesAggregate(listView) returns listView.type === undefined || listView.type === 'grid' and is the first line of checkGroupField; the one call site passes the list-view record checkListView was handed. Right.
  • An absent type judged as a grid: right. ListViewSchema.type is z.enum([...]).default('grid'), the consumer's switch falls to object-grid on its default: arm, and the new test pins both the schema default and the finding on an untyped view.
  • No other kind takes the grid header query on open: right. ListView.tsx sets gridOwnsGroupedFetch and groupingNeedsHeaderQuery under currentView === 'grid' alone, and currentView starts from the view's own kind. tree and timesheet mount object-tree and object-timesheet and are handed no grouping; gallery buckets fetched cards in the browser.
  • Kanban left out: right, and now measured. The swimlane read is asked only on a windowed board, and its rejection handler sets lanes: null, swimlanes: null, which the board reads as page counts; the cards keep drawing. The ground "opens on that error and renders no group" does not hold there, so the verdict does not speak.
  • A non-grid view a reader switches to the grid at run time stays unjudged. That is the fail-open direction and is not wider than the ground; noted, no finding.
  • The engine-agreement, kanban-hint, export and spec-entry judgments of the first record are untouched by this delta and stand.
  • Finding message now reads "the grid's group header query answers 400 INVALID_FIELD and no group renders": true for every view the verdict can now fire on.

② Semver level

Unchanged and still matched: @objectstack/lint minor with the BREAKING banner and FROM → TO, @objectstack/spec patch, ! title, Clause-②: no (narrowing) and Metadata-protocol: narrowed on both the PR body and the changeset, the registered ADR-0087 marker naming the entry. The narrowing is still real (a grid grouped by one of the three classes was accepted and is refused), so the arm, the title mark, the BREAKING row and the entry are all still owed. The banner and FROM now scope to a grid list view or one with no type, which is exactly what the code refuses; the narrowing is no wider than its ground.

Clause-②: no (narrowing) — matches the diff.

③ Boundary flags

④ Design judgment

No must-fix, no should-fix.

M1: closed. The verdict is gated on the one kind whose grouping is sent to engine.aggregate, an absent type is recognised as that kind on the schema's own default, and six other kinds are pinned quiet over all four refused declarations (the dev's ablation of the gate line turns exactly those six red). Every face states the same scope and agrees with the code:

  • the v19 entry: surface says "a grid list view (or one with no type, which defaults to grid)" and "Other list-view kinds are not judged"; reason says "a grid sends its grouping as the group header query ... so the grid opens on that error". Both true against ListView.tsx and the two engine doors. replacement and acceptanceCriteria unchanged and still hold. Shape still matches the v19 sibling.
  • the explanation: covers and all three paragraphs scope to a grid; the gallery and kanban sentences match what the consumer does.
  • the docs row: "a grid list view's grouping level"; door marks unchanged, correctly.
  • the changeset: banner, rule bullet and FROM scope to a grid; the unjudged kinds list equals the module jsdoc's and the spec enum less grid.

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 os validate means the engine accepts the grouping.

Tried to break it: a view with type absent (judged, pinned); tree and timesheet as grid-like kinds (no grouping handed down, so quiet is right); a value provider grid (skipped earlier in checkListView, as before); the kanban swimlane read (degrades, does not break); a second caller of checkGroupField (none). Nothing held.

N1 (nit) — unchanged: the module header's list of bindings that "reach no door this card measured" still names grouping.fields. Carried by #38654.

N2 (nit) — unchanged, accepted deviation: the hint "a stored single-valued field" is wider than the entry's replacement.

N3 (nit) — the texts name nine unjudged kinds and the quiet controls pin six; chart, tree and timesheet have no control. The gate is an equality on grid, so they are quiet by construction; a pin would only guard a later rewrite of the gate into a deny-list. Follow-up or leave.

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: claude/issue-38433-grouping-storage-refused
Reviewed-by: session_01ADHkmSAjFEZHRpRq3WCj6z

VERDICT: PASS

@objectstack-fleet objectstack-fleet Bot removed the needs:contract-review Marker only — PR awaits its at-tier Contract review PASS; no check reads it, the record decides label Nov 30, 2026
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#3 · os-steve · session_01ADHkmSAjFEZHRpRq3WCj6z

维护者速读

  • 用户能看到什么变化:作者校验或保存表格列表视图时,按多值字段、JSON 字段或公式字段分组会被直接拒绝并给出改法;看板、日历等其它视图不受影响,运行中的用户无感。
  • 为什么做:这种分组能保存却一打开就报错、不出分组,属于「发布时拦下保存成功却用不了的元数据」这一组检查的剩余一项。
  • 出错会怎样:已经这样分组的表格视图下次保存会被拒(这些视图本来一打开就报错,平台自带视图无一受影响);撤回本合并即可恢复。
  • 要你做什么:这是收紧保存检查的改动,需要你审批。契约复审 PASS 在评论 7266047249,Head-sha 63018a11f46e60d62f205b54c376db860cc1f472;批准后由席位落地。

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 63018a11f46e60d62f205b54c376db860cc1f472 · Tier H (declared narrowing, maintainer-landed leg) · Refs #38433 (item 3)

  1. Shape: one card item, one lint rule (list-view-group-field-ungroupable) + its explanation, docs row, v19 ADR-0087 semantic entry and changeset; one Clause-② arm (narrowing).
  2. Premise measured: the card's reading shows a grid list view grouped by a multi-valued, JSON or formula field answers 400 INVALID_FIELD on its header query and renders no group; the review checked that no other kind takes that query on open.
  3. Gates: check-runs on this head 64 success, 12 expected skips, 0 failed, 0 pending; mergeable_state clean.
  4. Accepted deviations: N2 (hint wider than the entry's replacement), N3 (controls pin six of nine non-grid kinds; quiet by construction), N4 (module jsdoc sentence order).
  5. Out of scope and where it went: dotted grouping names → lint passes a list view grouped by a dotted path (account.name), and the engine refuses that groupBy with 400, so the view validates and its group header query fails #38654 (also carries N1); skills docs → skills: teach three new save-time refusals — an ungroupable list-view grouping field, updateById in a body without api.write, and a hook or action body calling an ungranted capability #38655.
  6. Landing: L1 ACCEPT 7264935846, deltas 7264961673 and 7265920636 (this head); L2 FAIL 7265086178 (head 79d2f923), delta PASS 7266047249 on this head with M1 and S1 closed. Lands after os-zhuang approves.

ACCEPT → PR #38651 comment 7265920636 · Contract review → comment 7266047249

@objectstack-fleet objectstack-fleet Bot added the pm:awaiting-merge PR only: landing waits on the maintainer's own review and merge (SKILL.md 复核 ②); never on an issue label Nov 30, 2026
@os-zhuang
os-zhuang marked this pull request as ready for review November 30, 2026 01:24
@os-zhuang
os-zhuang added this pull request to the merge queue Nov 30, 2026
Merged via the queue into main with commit d042837 Nov 30, 2026
84 of 85 checks passed
@os-zhuang
os-zhuang deleted the claude/issue-38433-grouping-storage-refused branch November 30, 2026 01:54
@objectstack-fleet objectstack-fleet Bot removed the pm:awaiting-merge PR only: landing waits on the maintainer's own review and merge (SKILL.md 复核 ②); never on an issue label Nov 30, 2026
Nenzyz pushed a commit to Nenzyz/objectstack that referenced this pull request Dec 1, 2026
… 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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation size/m tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants