Repository navigation
fix(lint)!: os build and the object_extension publish door refuse a formula cycle an object extension adds - #33442
Conversation
… and the object_extension door A formula field an objectExtensions entry adds that reads itself, or two that read each other, now get the formula-cycle refusal the object's own formulas get, located at the entry. A cycle closing through a declared formula keeps the declared member's location at the object. Claude-Session: https://claude.ai/code/session_01FEkQ5mAXtyZgMs9QwfQzXE Co-Authored-By: Claude <noreply@anthropic.com>
…he check in the object extension paragraph Claude-Session: https://claude.ai/code/session_01FEkQ5mAXtyZgMs9QwfQzXE Co-Authored-By: Claude <noreply@anthropic.com>
…refusal through saveMetaItem and publishMetaItem Claude-Session: https://claude.ai/code/session_01FEkQ5mAXtyZgMs9QwfQzXE Co-Authored-By: Claude <noreply@anthropic.com>
📓 Docs Drift Check5 anchor(s) derived from 2 changed package(s); no hand-written page names any of them, so this run has nothing to list — not a clean bill of health. This check sees only pages that NAME a derived anchor: one that documents this change in prose, or enumerates it in an authoring dialect, names none and stays invisible to it on every run. What this run could not see
Coarse fallback — 172 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 5812b4d84a93fb7087a836a397f73afe5d87bd04 && git checkout 5812b4d84a93fb7087a836a397f73afe5d87bd04
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 8fdf25a43707b03f2120941acd6acefbdd0b034a bfa139bac599ca65a062b0486364ea25d7e57ce8 && git checkout -B drift-repro 8fdf25a43707b03f2120941acd6acefbdd0b034a && git merge --no-ff bfa139bac599ca65a062b0486364ea25d7e57ce8
node scripts/docs-audit/affected-docs.mjs --json 8fdf25a43707b03f2120941acd6acefbdd0b034a |
|
domain:spec#1 · os-project-manager · session_01FEkQ5mswnWm181XgYcCUag Contract reviewServed-tier: Inputs read: card #33153 (body, comments 6865769873, 6883476966, 6884342925), PR #33442 (body, 7 files, net diff against Check-runs on the head when this record was written: 21 success, 10 skipped, 33 in progress, 0 failed. Concluded green among them: Check Changeset, Governed Surface Queue Guard, Spec property liveness, Lint · PM dispatch-gates, PR-body guards, Dogfood Regression Gate. Not concluded: Test Core 1-8, Test UI 1-16, Build Core, Type Check (workspace, debt ledger, consumer gates, UI), three Lint groups, Live E2E UI, Build & E2E UI. This record judges the contract and its implementing code; it does not answer for a check-run that had not concluded. ① Derived judgments
② Semver level
Clause-②: no (narrowing) — matches the diff. ③ Boundary flags
④ Design judgment
Attempts to break the implementing code.
Findings.
No must-fix. Finding 1 earns a delta review of its fix or of its carrier. Implemented-by: VERDICT: PASS |
…ber under a name the target already serves On the door's one pass the written entry is folded over the target as served before the write, so every name it adds is served from its own record: none is left out of the cycle report there. The build keeps leaving the authored target's declared names to the object walk. Claude-Session: https://claude.ai/code/session_01FEkQ5mAXtyZgMs9QwfQzXE Co-Authored-By: Claude <noreply@anthropic.com>
…eck and the door's reading of a served name Claude-Session: https://claude.ai/code/session_01FEkQ5mAXtyZgMs9QwfQzXE Co-Authored-By: Claude <noreply@anthropic.com>
|
domain:spec#1 · os-project-manager · session_01FEkQ5mswnWm181XgYcCUag Contract reviewServed-tier: Round 2. The round-1 record is comment 6884435411 on PR #33442, at head Inputs read: card #33153 (body, comments 6865769873, 6883476966, 6884342925, 6885198948), PR #33442 (body, 7 files, comments, net diff against Check-runs on the head: 72 runs, 60 success, 12 skipped, 0 failed, 0 pending. Concluded green: Test Core 1-8, Test UI 1-16, Build Core, TypeScript Type Check and the four Type Check groups, every Lint group, Check Changeset, Governed Surface Queue Guard, Spec property liveness, Lint · PM dispatch-gates, PR-body guards, Dogfood Regression Gate, Build Docs, Live E2E UI, Build & E2E UI. ① Derived judgments
② Semver level
Clause-②: no (narrowing) — matches the diff. ③ Boundary flags
④ Design judgmentThe key attack: no name is left out of the report on the door's write.
Findings.
Observation, not charged to this PR: the same door snapshot gives a false negative when a higher-priority sibling's definition of a name the entry also adds closes a cycle through another field of the entry (the door folds the entry's definition over the sibling's and sees no cycle; the build reports the entry's member). That is a property of the #33072 snapshot, present at Round-1 findings (6884435411).
No must-fix. Finding 1 earns a delta review of its fix or of its carrier. Implemented-by: VERDICT: PASS |
…anked name, and state it beside the build's tie exception Claude-Session: https://claude.ai/code/session_01FEkQ5mAXtyZgMs9QwfQzXE Co-Authored-By: Claude <noreply@anthropic.com>
|
domain:spec#1 · os-project-manager · session_01FEkQ5mswnWm181XgYcCUag Contract reviewServed-tier: Round 3. Round 1 is comment 6884435411 (head Inputs read: card #33153 (body, comments 6865769873, 6883476966, 6884342925, 6885198948, 6885969777), PR #33442 (body, 7 files, comments, net diff against Check-runs on the head: 72 runs, 60 success, 12 skipped, 0 failed, 0 pending. Concluded green: Test Core 1-8, Test UI 1-16, Build Core, TypeScript Type Check and the four Type Check groups, every Lint group, Check Changeset (both runs on this head, 132613268973 and the rerun 132628462605 after the PR body was rewritten), Governed Surface Queue Guard, Spec property liveness, Lint · PM dispatch-gates, PR-body guards (both runs), Dogfood Regression Gate, Build Docs, Live E2E UI, Build & E2E UI. ① Derived judgments
② Semver level
Clause-②: no (narrowing) — matches the diff. ③ Boundary flags
④ Design judgmentEvery sentence the round added, against the code, for the build and for the door. What the code does, read at the head: the walk's
The new pin against the texts. Attempts to break the texts.
Findings.
No must-fix and no should-fix. Nits alone: the round ends here. Round-2 findings (6885259034).
Implemented-by: VERDICT: PASS |
|
domain:spec#1 · os-project-manager · session_01FEkQ5mswnWm181XgYcCUag ACCEPT · PR #33442 (#33153) · head
|
⛔ merge queue 构建失败 — 先分诊,再决定要不要重排队列构建 43664839229 红了。队列跑的是全量套件(PR 侧 CI 只跑 affected 子集), 分类: 失败的 job(日志抽取,best effort):
跨 PR 相同签名(24h,按失败测试文件聚合):
历史信号:
分诊清单:
Generated by Claude Code · merge-queue-triage workflow (#4859) |
…s the written entry among other packages' extensions by priority, as os build does (objectstack-ai#33702) <!-- claude-projects-attribution: {"github_login":"os-project-manager"} --> _Requested by **Leehom** · [project thread](https://claude.ai/code/project/chan_01TenzsRopZj4jMbvjX8uz1X?thread=cmsg_01TenzsRopZj4jMbvjX8uz1X5DTB6H6vWGj3p1JFrKB58W)_ Fixes objectstack-ai#33494 Clause-②: no (narrowing) — at the runtime `object_extension` publish door (Studio, `PUT /api/v1/meta/object_extension/TARGET`, the MCP and AI authoring doors) the expression rule now reads each field of the target as `os build` serves it when another package's published extension adds the same field. One shape it accepted is now refused (shape 3: a higher-priority package's formula for a field the written entry also adds closes a cycle through another field of the entry), and two it refused now publish (shape 1, a tie at the priority that decides the field; shape 2, the written entry outranked there). `os build`, `os validate` and `os lint` are unchanged. The new gate input (`storedObjectExtensions` on `runRuntimeAuthoringRules` and `evaluateRuntimeAuthoringGate`, the `StoredObjectExtension` type from `@objectstack/lint/runtime`) is optional and additive. Measured first-party exposure: no two first-party packages extend the same object (`examples/app-showcase` one entry on `showcase_account`; `packages/plugins/plugin-auth` one on `sys_sso_provider`; HotCRM `origin/main` 2492ac6 one module, o2c, extending `crm_contract` and `crm_account`), so no first-party write changes verdict. Metadata-protocol: narrowed Skills-docs: none owed — this PR edits `content/docs/deployment/validating-metadata.mdx` (the object extension paragraph states the door's fold); the skills teach `defineObjectExtension({ extend, fields, priority })` and formula fields and say nothing of how the door read a field two packages add. ## 维护者速读 - **改了什么**:运行时 `object_extension` 发布口在判断扩展字段(如公式循环)时,现在把其他软件包已发布的同目标扩展连同其优先级一起折叠,用的是 `os build` 的同一个折叠函数,所以发布口看到的字段定义与 build 一致:同优先级冲突的字段两边都不判,被更高优先级覆盖的字段按覆盖者的定义判。 - **为什么改**:此前发布口拿到的目标对象里,其他包加的字段是没有优先级的普通字段,写入条目总是盖在上面。结果有两种情况发布口拒绝而 build 放行(同优先级、被更高优先级覆盖),一种情况发布口放行而 build 拒绝(更高优先级的兄弟公式经由本条目的另一个字段构成循环)。 - **风险与回滚**:发布口一处收窄、两处放宽,build 不变。需要两个软件包扩展同一对象的同名字段并带公式循环才会触发;第一方实测没有两个包扩展同一对象。新输入是可选的,宿主不提供时行为与之前相同。回滚即 revert。 - **先看**:`packages/lint/src/validate-expressions.ts`(扩展遍历:stored 条目只折叠不判定、回填跳过 stored 名称)、`packages/lint/src/object-graph.ts`(`objectExtensionsByTarget` / `objectsAsServed` 的 `stored` 参数)、`packages/metadata-protocol/src/protocol-authoring-gate.ts`(`otherPackagesExtensionsOf`)。 - **两分钟验证**:`pnpm --filter @objectstack/lint exec vitest run src/runtime-gate.object-formula-cycle.test.ts`,预期 20 条全过,其中 `objectstack-ai#33494` 一组 5 条:同优先级与被覆盖两种情形发布口与 build 都放行,更高优先级兄弟公式构成的循环在发布口按本条目的字段拒绝。 - **需要你做的**:无,席位落地。 ## What changes **`packages/lint/src/object-graph.ts`.** `objectExtensionsByTarget(stack, stored = [])` and `objectsAsServed(stack, stored = [])` take an optional list of `StoredObjectExtension` (an extension the host's registry already holds for another package: `extend`, `priority`, `fields`, `packageId`). Each is collected by the fold's own `collect`, one carrier per entry below 0 (registered before the stack's own entries), marked `stored: true` on its `VisibleObjectExtension`. They sort and fold exactly as any entry: ascending priority, a later writer replacing the whole field, a name whose deciding writers share a priority put in `tied`. The build never passes the list, so every build verdict is what it was. **`packages/lint/src/validate-expressions.ts`.** `StackExpressionOptions.storedObjectExtensions`, read on an `object_extension` write only (`storedExtensions`). It reaches the top-of-pass fold (`objectsAsServed(stack, storedExtensions)`, so the field, type and nullable indexes see the build's winner and leave a tie out) and the extension walk (`objectExtensionsByTarget(stack, storedExtensions)`). In the walk a stored entry is folded in and never judged or located; the fill-back from `base` (the target as served before the write, which carries the stored entries' fields as plain fields) skips the names they add, so a tied name is not served again as one sibling's definition. The call-site comment is rewritten to this reading. Neither edit touches the gate-setup region PR objectstack-ai#33434 edits (its hunks at ~:2374-2380 and after ~:2396; this PR changes the one fold call between them, as the seat's surface amendment allows). **`packages/lint/src/formula-cycle-issues.ts`.** `extensionFormulaLoci` reads `stored`: a stored entry locates nothing, and a name it adds later in fold order than the written entry removes the written entry's locus (the sibling's definition is the one served). So a cycle a higher sibling closes through another field of the written entry is named on that field alone, and the sibling's member is never charged to the write. **`packages/lint/src/runtime-gate.ts`, `authoring-rules.ts`, `runtime.ts`.** `runRuntimeAuthoringRules({ storedObjectExtensions })` (optional) hands the list to `AuthoringRuleContext.storedObjectExtensions` on an `object_extension` write only, the same value in every pass; the expression rule passes it to `runStackExpressionPasses`. `@objectstack/lint/runtime` exports the `StoredObjectExtension` type. **`packages/metadata-protocol/src/protocol-authoring-gate.ts`, `runtime-authoring-gate.ts`.** New `otherPackagesExtensionsOf(registry, target, writtenPackage)`: each `extend` contributor of the target (`getObjectContributors`) of a package other than the written one, with its priority and fields, in the registry's order; a disabled package's left out (`isPackageDisabled`, as every served fold withholds it); `[]` for a registry that cannot answer. `judgeRuntimeAuthoringRules` states it on an `object_extension` write (the target and package `objectExtensionWriteFold` already names) and `evaluateRuntimeAuthoringGate` passes it through (optional `storedObjectExtensions`). No `packages/spec` schema moves: the registry already held each sibling's package and priority. **`packages/spec/src/migrations/entries/semantic/18.object-extension-formula-cycle-refused.ts`** (PR objectstack-ai#33442's entry, not yet released): `reason` and `acceptanceCriteria` now state the door's fold, "at the priority that decides it" in place of "at the same priority", and the tie exception for both the build and the door on a declared object. **`content/docs/deployment/validating-metadata.mdx`**: the object extension paragraph's last sentence states the door's fold and "at the priority that decides it". **`.changeset/33494-extension-door-priority-fold.md`**: `@objectstack/lint`, `@objectstack/metadata-protocol` and `@objectstack/spec` minor, both declaration lines, the `Skills-docs:` line, a BREAKING banner (Before / Now / Unchanged / Fix) and `adr-0087: not-required (already-registered object-extension-formula-cycle-refused)` (this PR updates that unreleased entry rather than registering a new one). Its **Now** paragraph corrects, by quotation, the pending `.changeset/33153-extension-formula-cycle.md` Now clause and Unchanged sentence the carry note 6886038545 names, and "at the same priority" there. That changeset is not edited (it is another PR's). ## Why Card objectstack-ai#33494 (from PR objectstack-ai#33442's contract review, record 6885259034 finding 1 and its observation): the door's snapshot (objectstack-ai#33072) carried every other package's extension field on the target as a plain field with no priority, so the gate folded the written entry over all of them. `os build` folds every package's entry by priority and serves the winner. The door refused a tie and an outranked entry the build accepts, and accepted a higher sibling's cycle through another field of the entry that the build refuses. ## Tests 1. **`packages/lint/src/runtime-gate.object-formula-cycle.test.ts`**: the objectstack-ai#33153 pin "the door judges the written entry's own definition whatever a sibling's priority" is replaced by a `objectstack-ai#33494` describe (5 cases) at the real gate (`runRuntimeAuthoringRules`, `type: 'object_extension'`, with `storedObjectExtensions`) and the build (`runAuthoringRules('build', …)` over both packages): - ⭐ shapes 1 and 2: a tie (200/200) and an outranked entry (sibling 300, written 200), the written `s__c` reading itself: no cycle finding at the door, none in the build. - ⭐ LIT shape 3: the sibling (300) serves `s__c = record.a__c + 1`, the written entry (200) adds `s__c` (number) and `a__c = record.s__c * 2`: refused at the door on `a__c` only, in the engine's sentence (`formulaCycleMessage('a__c', ['a__c', 's__c'])`); the build names the sibling's `s__c` at the sibling's entry and `a__c` at the written entry. - the entry that outranks the sibling (300 over 200) is still refused at the door at the entry, and by the build at the same entry. - a tied name the sibling stored as a self-reading formula is not served back from the target and not charged to the write (door and build both clean). - a host that states no extensions leaves the door as it was (the written entry folded over the served target). 2. **`packages/runtime/src/domains/meta-object-extension-item.test.ts`**, new describe `[objectstack-ai#33494]` (4 cases) through the real `saveMetaItem` + `publishMetaItem`, with a third package registered as an extender of the account (`registerObjectExtension`, priority 200 or 300): ⭐ the tie and the outranked self-reading formula publish (the row goes active), as `os build` accepts each; ⭐ shape 3 gets 422 `INVALID_METADATA` with `expression-invalid` at `object 'crm_account' · objectExtensions[0] · field 'a__c' expression` and the row stays a draft; CONTROL: an entry outranking the sibling with a self-reading formula is still refused. 3. **`packages/metadata-protocol/src/protocol-authoring-gate.extension-write-fold.test.ts`**, new describe `[objectstack-ai#33494]` (2 cases): `otherPackagesExtensionsOf` lists every other package's `extend` contributor in the registry's order with its priority and fields, leaving out the owner, the written package and a disabled package; a registry with no contributors member, or one that throws, states none. 4. **Meta-tests** (`validate-expressions.test.ts`, `validate-security-posture.test.ts`, objectstack-ai#5017 receiver scans): `storedNames` (a Set of names) and `stored` (the fold's list parameter) tabled as plumbing receivers, each with its reason. **Red at base:** the head's lint test file over the base lint sources (`git restore --source=41b64bb0` of the six lint source files): 2 of 20 red, the shapes 1/2 case and the shape 3 LIT; restored with `git checkout HEAD --`, `git diff HEAD` empty. **Ablations** (one-shot through `node scripts/ablation-replace.mjs` on committed head `e681d49f`; each restore verdict "blob == HEAD and `git diff HEAD` is empty"; lint tests read `src/`): - A1, the fill-back skip (`&& !storedNames.has(n)` dropped): 1 of 20 red, the tied-name case. - A2, stored entries locating (`if (entry.stored) loci.delete(name)` made unreachable behind a `globalThis` marker): 1 of 20 red, the shape 3 LIT (the sibling's `s__c` charged to the write). A first attempt was a no-op (its replacement kept the anchor text; the tool refused and restored), so it was rerun with the marker. - A3, the top fold without the stored list (`objectsAsServed(stack)`): 2 of 20 red, shapes 1/2 and shape 3. - R1, the host carry, for the runtime pins that read metadata-protocol through `dist/`: the registry handed as `globalThis.__ablationR1` (undefined) in `judgeRuntimeAuthoringRules`, `pnpm --filter @objectstack/metadata-protocol run build`, `ablation-dist-preflight` found the marker in `dist/`, runtime `-t 33494`: 3 red (both publish LITs and the shape 3 LIT), the CONTROL green. Restore leg: rebuilt, `--absent` found no marker, 4/4 green. (A first R1 attempt was also a no-op for the same reason and is not counted.) ## Acceptance notes - **Where the snapshot is built** (measured): `packages/metadata-protocol/src/protocol-authoring-gate.ts` (`judgeRuntimeAuthoringRules`), not `packages/runtime/src/domains/`; the seat amended the claim's surface (6888588670). - **No second fold.** The door's fold is `objectsAsServed` / `objectExtensionsByTarget` with the host's entries added to their input; the tie set and the ordering are the build's. - **A tied name the target's owner also declares**: in the build the tied name is filled back from the authored object (the object walk's); at the door the target's base layer is not carried (only the served target), so the walk leaves every name a stored entry adds to the fold, and such a name is absent there. It needs an owner field re-declared by two packages at the priority that decides it, plus a formula cycle through it; the verdict charged to the write can only differ by a member under that name. Noted, not filed. - **A disabled package's extension** is left out (`isPackageDisabled`), as the served fold leaves it out; an enable door's `asEnabled` reading is not this write's. - **The legacy `NS__NAME` filing** (`extensionTargetKey`, objectstack-ai#28858) is not mirrored: the host reads the contributors under the target the body names, as the gate folds it. - **Other as-served checks on this door** read the same fold now (the field-formula and validation-rule passes' field, type and nullable indexes), so a type or null-guard verdict on a field another package outranks is the build's too. - **Not changed, by the order's fence:** `packages/spec` schemas; the door roster and its pins; PR objectstack-ai#33434's hunks. ## Verification Head `763105ec`: the fix `e681d49f`, the meta-test tabling `78ad84f3`, the ADR-0087 marker `dd37779e`, and a merge of `origin/main` `e9884e19` (base `41b64bb0`). PR objectstack-ai#33434 landed before the merge; it merged clean, and both its stamped-column index and this PR's `objectsAsServed(stack, storedExtensions)` are on the merged line. <details><summary>Package tests</summary> Run on head `763105ec` (the merge of `origin/main` `e9884e19`, which brought PR objectstack-ai#33434) after a whole-repo `pnpm -r run build` (`VERDICT command-exit 0`): - `@objectstack/lint` `pnpm test`: 210/210 files, 8998/8998 tests; `pnpm --filter @objectstack/lint typecheck` (tsc + test typecheck) exit 0. - `@objectstack/metadata-protocol` `pnpm test`: 340 files passed and 9 skipped, 22883 tests passed and 43 skipped; `typecheck` exit 0. - `@objectstack/runtime` `src/domains/meta-object-extension-item.test.ts`: 50/50; `pnpm --filter @objectstack/runtime typecheck` exit 0. - `@objectstack/spec` `src/migrations`: 198/198 (round 0, on `e681d49f`; the entry's text has not moved since). </details> <details><summary>Gates (dispatch-gates --commands)</summary> The derivation at `763105ec` is 114 lines. Every line ran after the whole-repo build of `763105ec`, its exit code captured before any pipe, and all 114 exited 0. `dispatch-gates --ran`: `114 derived, 114 run, 0 NOT-MEASURED, 0 UNRUN`. The record is `pm-orders/spec/33494-gates-ran.txt` in the project share. Round 0 (head `78ad84f3`, before the merge): the same 114 lines, 112 exit 0 and 2 red, each fixed and rerun green: `check-adr-0087-registration` (the changeset said `registered` for an entry that already existed; now `not-required (already-registered …)`, commit `dd37779e`) and `check-plugin-teardown-shape --self-test` exit 3 (the shallow clone lacked the pinned fixture commit; `git fetch --depth=1 origin 621a487…`). Record: `pm-orders/spec/33494-gates-ran-r0.txt`. </details> Dogfood (`Clause-②:` carries the `(narrowing)` arm and the title `!`): full battery, the CI command (`pnpm --filter @objectstack/dogfood test` under the verify lock), no shard, on head `763105ec` after a whole-repo build. Result: `VERDICT command-exit 0`, Test Files 467 passed and 3 skipped (470), Tests 3958 passed and 42 skipped (4000), no failures. (Round 0 on `dd37779e`, before the merge: 467/3 files, 3953 passed and 42 skipped, no failures.) ## Human Minimum - [x] 1. Schemas start as Zod; `packages/spec` holds no runtime logic. - [x] 2. Every name I added uses the casing for its kind. - [x] 3. No formatter ran; `pnpm lint` passes. - [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: its generated artifacts are regenerated and committed. - [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. - [x] The *Before Submitting* list in CONTRIBUTING.md is done. --- _Generated by [Claude Code](https://claude.ai/code/session_01FEkQ5pZiFTTaXqbY34YRcV)_ --------- Co-authored-by: Claude <noreply@anthropic.com>
Requested by Leehom · project thread
Fixes #33153
Clause-②: no (narrowing) —
os build,os validate,os lintand the runtimeobject_extensionpublish door (Studio,PUT /api/v1/meta/object_extension/TARGET, the MCP and AI authoring doors) now refuse one shape an object extension could carry before: aformulafield an extension adds that sits on a cycle of formulas (it reads itself, two added formulas read each other, or the cycle closes through a formula the target declares). No exported type or signature changes. Measured first-party exposure: 0objectExtensionsentries add aformulafield (examples/app-showcaseone entry, aselect, aurland anumberfield;packages/plugins/plugin-authone, asecretfield; HotCRMorigin/mainac4dd3d has noobjectExtensionsin code), so nothing first-party is newly refused.Metadata-protocol: narrowed
Skills-docs: none owed — this PR edits
content/docs/deployment/validating-metadata.mdx(the object extension paragraph names the cycle check);skills/objectstack-formulaandskills/objectstack-datateach formula fields anddefineObjectExtension({ extend, fields })without saying an extension is exempt from the cycle check, so the build and the door now give the verdict the object's own formulas already get.Precedent followed: #33216/#33217 (PR #33398), which widened the same extension walk and declared the same
no (narrowing)/narrowedpair.维护者速读
objectExtensions/ Studio 发布的object_extension)新增的公式字段,如果引用自己,或两个互相引用,或经由对象自身声明的公式绕回来,现在在os build和运行时发布口都会被拒(规则 idexpression-invalid,和对象自身公式循环同一句提示),位置为object '对象' · objectExtensions[0] · field '字段' expression。packages/lint/src/validate-expressions.ts(扩展遍历末尾新增的一次formulaCycleIssues调用)、packages/lint/src/formula-cycle-issues.ts(extensionFormulaLoci与 map 形式的report)、packages/lint/src/runtime-gate.object-formula-cycle.test.ts。pnpm --filter @objectstack/lint exec vitest run src/runtime-gate.object-formula-cycle.test.ts,预期 16 条全过:扩展自引用、互相引用、经声明公式绕回的循环在 build 与发布口都被拒且位置一致,链式公式和读对象公式的扩展公式通过;发布口按写入条目自身的定义判定同名字段(含与其他包同优先级或被更高优先级覆盖的情形,build 此时放行,后续卡 object_extension door: the gate's served snapshot carries a sibling package's extension field with no priority, so the door's formula-cycle verdict differs from os build on ties and outranked entries #33494)。What changes
packages/lint/src/validate-expressions.ts(the extension walk only; the gate-setup region #33246 edits is untouched). After each target's entries are judged, the walk runs the formula-cycle pass (#33100'sformulaCycleIssues) over thefieldDefsit already builds for that target: the target as served (its declared fields with every kept entry's fields folded in throughobjectsAsServed, a tie between two packages left out), its declared fields and injected columns behind it; for a target the stack does not declare, the entries' own fields. No second fold. Each cycle member an entry adds gets a finding located at that entry, and in the build a member the authored target declares is left to the object walk, so a cycle closing through a declared formula keeps that member's location at the object and names it once. On the door's one pass the object walk does not run and the written entry is folded over the target as served before the write, so every name the entry adds is served from the entry's own record and none is left out, a name the target already serves included (review round 1).packages/lint/src/formula-cycle-issues.ts.formulaCycleIssues'reportalso takes a map from field name to location. The newextensionFormulaLoci(target, entries, left)builds it: each name an entry adds, locatedobject 'T' · objectExtensions[i] · field 'F' expression(the location the field-formula pass gives the same field), a name two entries add located at the later entry in fold order (the definition the registry serves), the caller'sleftnames left out (the authored target's declared names in the build, none at the door). Kept in this module so the walk gains no new receiver for the #5017 key scan.Door.
validateStackExpressionsis already on theobject_extensiondoor (#33072), so the roster and its pins do not move. The door's one pass reads only the written entry, and only names the entry adds are reported members there, so a cycle the target or a sibling package already carries, and a formula that only reads a cycle, are not charged to the extension write.packages/spec/src/migrations/entries/semantic/18.object-extension-formula-cycle-refused.ts: the ADR-0087 D3 entry, its one exception stated (inos buildon a declared target, a field two packages add at the priority that decides it is not judged; the door judges the written entry's own definition, see #33494). No D2 conversion: which read breaks the cycle is a fact only the author holds.content/docs/deployment/validating-metadata.mdx: the object extension paragraph names the cycle check, its location in the build, and the door's reading of a name the target already serves..changeset/33153-extension-formula-cycle.md:@objectstack/lintminor and@objectstack/specminor, both declaration lines, a BREAKING banner (Before / Now / Unchanged / Fix) andadr-0087: registered object-extension-formula-cycle-refused.Why
The engine computes an object's formulas, an extension's included, in dependency order; a formula on a cycle has no order, is never evaluated and reads null on every row. The cycle check named the object's declared formulas only, so the card's probe (an extension adding
a__c = record.a__c, ora__candb__creading each other) got 0 findings at both the build and the door.Tests
packages/lint/src/runtime-gate.object-formula-cycle.test.ts, new top-level describe#33153(11 cases) in the validate_expression and the object publish gate accept a formula that reads another formula field, and that formula reads null on every row #33100 harness file, at the real gate (runRuntimeAuthoringRuleswithtype: 'object_extension') and the build (runAuthoringRules('build', …)):formulaCycleMessage); the build's finding equals the door's (where and message).packages[j].manifest.objectExtensions[0]).packages/runtime/src/domains/meta-object-extension-item.test.ts, new describe[#33153](3 cases) through the realsaveMetaItem+publishMetaItem: a self-reading formula and a two-formula cycle each get 422INVALID_METADATAwith the build's rule id,whereandpathon each member, the field is not served and the row stays a draft; a chain publishes and is served.Red at base: the round-0 head tests over the base sources (
git restore --source=fc283d6dof the two lint files): 5 of 12 red (the file then held 12 cases), every LIT plus the sibling and undeclared-target cases; controls and the differential green. Restored withgit checkout HEAD --,git status --porcelainempty.Ablations (one-shot, through
node scripts/ablation-replace.mjson the committed head; the tool's restore verdict each time: blob equals HEAD,git diff HEADempty):formulaCycleIssues(!report.has(field)dropped, so every served member is reported): 5 of 12 red (round 0), including the differential case (the target's own cycle charged to the extension write) and the declared-member case (named twice). Lint tests readsrc/.base && !extensionWriteback tobase, the round-0 reading): 2 of 15 red, exactly shapes a and b; and the build-side exclusion (ownNamesemptied in the build too, behind an opaqueglobalThismarker): 1 red, shape a's build assertion (the member named twice). Both restored by the tool's verdict.bfa139ba: 3 of 16 red, shapes a and b and the tie/outranked pin; restored by the tool's verdict.globalThismarker), for the runtime pins that read lint throughdist/:pnpm --filter @objectstack/lint build,ablation-dist-preflightfound the marker in 4 built files, runtime-t 33153: 2 red (both LITs), the control green. Restore leg: lint rebuilt,--absentfound the marker in 0 of 20 built files, tree clean, 3/3 green.Acceptance notes
git grepofobjectExtensions/defineObjectExtensionoverexamples/,packages/(non-test) and HotCRMorigin/main: two entries, neither adds aformulafield.protocol-extension-redeclared-owner-field.tsdoes not judge an extension of an object its own package owns, so nothing else refused that shape).os buildon a declared target, is left out of the served body (objectsWithoutTiedFields) and so out of the cycle pass, as fix(lint)!: os build and the object_extension publish door judge the one-hop leaf through an extension-added lookup, and the regex and JSON-schema checks of an extension's validation rules #33398 leaves its hops unjudged: which definition is served is registration order. On an undeclared target the build takes the later entry's definition of a shared name and judges it.validate-expressions.ts(A flow or hook condition ordering record.created_at with no guard is refused at the publish door while os build accepts it #33246's),authoring-rules.tsand the door roster pins (the rule already runs on the door).Verification
Head
bfa139ba(basefc283d6d; review round 1 adds88b22a14and7c2eeb88over67ff848e, round 2 addsbfa139ba).origin/mainhas moved to811b976a;git diff --stat fc283d6d 811b976aover every file this PR touches is empty, so no merge was needed. #33246 (PR #33434) had not merged.Package tests
@objectstack/lint: 210/210 files, 8982/8982 tests;pnpm --filter @objectstack/lint typecheck(tsc + test typecheck) exit 0.@objectstack/runtimesrc/domains/meta-object-extension-item.test.ts: 46/46;pnpm --filter @objectstack/runtime typecheckexit 0.@objectstack/specsrc/migrations: 5 files, 198/198.Gates (dispatch-gates --commands, 109 lines)
The derivation at
bfa139bais 109 lines, the same list as at67ff848eand7c2eeb88. Every line ran after a whole-repopnpm buildofbfa139ba, its exit code captured before any pipe, and all 109 exited 0.dispatch-gates --ran:109 derived, 109 run, 0 NOT-MEASURED. The record ispm-orders/spec/33153-gates-ran-r2.txtin the project share (earlier rounds:33153-gates-ran.txt,33153-gates-ran-r1.txt).Dogfood (
Clause-②:carries the(narrowing)arm and the title!): full battery, the CI command (pnpm --filter @objectstack/dogfood testunder the verify lock), no shard, on headbfa139baafter a whole-repo build. Result:VERDICT command-exit 0, Test Files 465 passed and 3 skipped (468), Tests 3932 passed and 42 skipped (3974), no failures (the same counts as on67ff848eand7c2eeb88).Human Minimum
packages/specholds no runtime logic.pnpm lintpasses.main, one pull request.packages/spectouched: its generated artifacts are regenerated and committed.content/docs/references/,packages/*/CHANGELOG.mdorcontent/docs/releases/.Generated by Claude Code