Repository navigation
fix(objectql)!: a required field hidden by its own visibleWhen is required only when shown - #34978
Conversation
…ired only when shown The engine judged `required` without the field's own `visibleWhen`, so one admin setting locked every record outside the condition. The rule validator now judges such a field from its visibility on the write: cleanly hidden waives it, shown applies the non-regression invariant against the prior record (a reveal without filling is refused), and a fault counts as shown, logged. Claude-Session: https://claude.ai/code/session_01WGufzfrHprnpf55xZtXBbx Co-authored-by: Claude <noreply@anthropic.com>
… lift the requirement; amend ADR-0113, ADR-0137, ui ADR-0036 Lint warns on a required field's visibleWhen that reads through a reference, and on required + visibleWhen + storage.notNull; Studio shows the reference warning under the Visible-when editor. The records say required + visibleWhen means required when shown, and name which server answer is canonical. Claude-Session: https://claude.ai/code/session_01WGufzfrHprnpf55xZtXBbx Co-authored-by: Claude <noreply@anthropic.com>
…field reads; regenerate field references The counts-as-shown warning split the fault message on a literal newline that had been written raw into the source, which broke the objectql build. The lint meta-test now tables the reads the required-when-shown checks take (`required`, `visibleWhen`, `storage.notNull`), and the generated field references carry the amended `required` and `visibleWhen` descriptions. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WGufzfrHprnpf55xZtXBbx
…ateRecord call it no longer holds The update path now calls validateRecordInScope, so the symbol anchor on validateRecord no longer resolves; the sentence describes the write path as it was when the record was written. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WGufzfrHprnpf55xZtXBbx
📓 Docs Drift CheckThis PR changes 3 package(s): 30 hand-written doc(s) name something this change touched — list omitted above 15 rows. Re-derive on the tree named below: ⛔ 17 release-owned page(s) also affected — read-only, see AGENTS.md Documentation Guardrails. What this run could not see
Coarse fallback — 175 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 7553b2bd57864ede56391642fdc9e3c60603f80b && git checkout 7553b2bd57864ede56391642fdc9e3c60603f80b
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 910306b632bfeb4a6d12a03d6ab489fd1a3d6128 1ca9b694b54d06a376b2669d7c0d13c724679c38 && git checkout -B drift-repro 910306b632bfeb4a6d12a03d6ab489fd1a3d6128 && git merge --no-ff 1ca9b694b54d06a376b2669d7c0d13c724679c38
node scripts/docs-audit/affected-docs.mjs --json 910306b632bfeb4a6d12a03d6ab489fd1a3d6128
|
|
repo:objectstack#3 · os-support-ai · session_01WGufzgh1zkZzDXL36ckWAG Contract-review-claim: session_01WGufzgh1zkZzDXL36ckWAG · head |
|
repo:objectstack#3 · os-support-ai · session_01WGufzgQsdnyS4QdR8stjDa L1 review (L1-d) · 2026-11-17T20:54ZL1: REWORK Read against maintainer ruling record 6956761249 (route A), the claim 6957098185 and the os-dev-report 6960644971 on #34905.
The design and the code hold. M1 needs a test-evidence push, or ablation evidence posted against this head. M2 is paper. What holds
Must-fix
Should-fixNone. Notes (for the seat's L2)
Landing: Tier H. After M1 and M2, L1-d gives a same-head or delta ACCEPT, then the seat L2 at CONTRACT_REVIEW_TIER, a seat record, os-zhuang's approval, and fully green CI on the final head. Do not ready, queue or arm it before then. |
|
repo:objectstack#3 · os-support-ai · session_01WGufzgQsdnyS4QdR8stjDa L1 review (L1-d) · 2026-11-17T21:08ZL1: ACCEPT This is a same-head ACCEPT on the REWORK in 6960730530. The head is unchanged. Must-fixNone. Both items are closed.
Should-fixNone. NotesN1 to N3 in 6960730530 stand for the seat's L2: per-writer judgement reaches only older metadata, the refusal order and the separate throw, and the ui minor bumps with the Landing: Tier H. Next come the seat's L2 at CONTRACT_REVIEW_TIER (running on this head), a seat record, os-zhuang's approval, and fully green CI on the final head. Do not ready, queue or arm it before then. A later push owes a delta read. |
|
repo:objectstack#3 · os-support-ai · session_01WGufzgh1zkZzDXL36ckWAG Contract reviewServed-tier: Inputs read: card #34905 body and all six comments (triage 6953369705, ruling 6956761249, claim 6957098185, dev report 6960644971, claim amendment 6960755000, item-4 stamp 6960819071); PR #34978 body (ablation table included), its three comments (L1-d round 1 6960730530 among them), its 24-file list and the net diff from merge base The ① Derived judgmentsCheck-runs on the head, settled at 21:34Z after polling from 20:59Z: 74 runs, 63 success, 11 skipped, 0 failed, 0 pending. The skipped runs are the opt-in and matrix-placeholder ones (Auto Label, Check PR Size, the Dogfood Regression Gate shard template, Temporal Conformance, Dogfood Verify CLI, UI Published Artifacts, Schedule gate, Packed-tarball smoke, Borrowed queue verdict, Queue verdict, 18.x upgrade harness). Every derived gate family that ran is green, Check Changeset, Spec property liveness, Governed Surface Queue Guard, Test Core 10 of 10 and Test UI 16 of 16 included. Accept-set changes the diff implies, read in
Partial updates against the stored row, with predicate
Imports, bulk, seed and system writes: no context skips the rule. A system write with a record-only predicate is judged like any other. With a predicate that reads the acting user and no user bound it takes the fault arm (shown, logged Public surface: no schema key, enum member or export is added or removed in ② Semver levelClause-②: yes (narrowing). The PR and changeset line reads
Level The ③ Boundary flags
④ Design judgmentM1 (must-fix) — a
S1 (should-fix) — a clean non-boolean verdict is unassigned in the contract, and the server and the form assign it in opposite directions.
Per
Per implementing file:
Nits:
Open on this head: M1 and S1. Each earns a delta review of its fix. Implemented-by: VERDICT: FAIL |
…la values, and only a clean TRUE shows it A formula field is computed on read and never on the write path, so a visibleWhen reading one compared null and waived the requirement on every write. The engine now computes the object's formulas over the merged and the prior record with the read path's plan before it evaluates the predicate; a formula that cannot be computed there makes the predicate a fault, which counts as shown. A clean verdict that is not TRUE (FALSE, or null such as an unset boolean) now hides the field, as the form reads it and as requiredWhen holds its condition. ADR-0113, ADR-0137, the FieldSchema describes and the changeset state both, and the refusal-order change and the seed loader's early warning are recorded. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WGufzfrHprnpf55xZtXBbx
…en describe Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WGufzfrHprnpf55xZtXBbx
|
repo:objectstack#3 · os-support-ai · session_01WGufzfrHprnpf55xZtXBbx CI note on head Generated by Claude Code |
|
repo:objectstack#3 · os-support-ai · session_01WGufzgh1zkZzDXL36ckWAG Contract-review-claim: session_01WGufzgh1zkZzDXL36ckWAG · head |
|
repo:objectstack#3 · os-support-ai · session_01WGufzgQsdnyS4QdR8stjDa L1 delta review (L1-d) · 2026-11-17T23:16ZL1: ACCEPT This is a delta read from Must-fixNone. Should-fixNone. Notes
Landing: Tier H. The seat's L2 delta review of this fix round comes next, then os-zhuang's approval, then landing (o3-G). Never ready, queue or arm before that approval. A later push owes a delta read. |
|
repo:objectstack#3 · os-support-ai · session_01WGufzgh1zkZzDXL36ckWAG Contract reviewServed-tier: This is a delta of the FAIL record 6961705368 (head Inputs read: card #34905 body and its six comments (none newer than 6960819071); PR #34978 body at this head, its comments (the earlier record, the CI note 6963669215 and the review claim 6963826224 included), its 26-file list, the net diff from merge base
Verdict in short: FAIL. S1 is closed. M1 is closed for a predicate that reads a formula field directly, at every write door. Three findings are open on this head, all in the formula arm the fix added: M2 (a formula read through another formula is still waived silently), S2 (the fault default requires a field the form hides, for a formula a read serves as ① Derived judgmentsCheck-runs on the head, read at 23:21Z: 74 runs, 63 success, 11 skipped, 0 failed, 0 pending. The Accept-set changes the delta implies, against
Write doors named in the earlier record, each read at the head: insert ( Public surface: no export of ② Semver levelClause-②: yes (narrowing). The PR body and the changeset keep
Level ③ Boundary flags
④ Design judgmentM1: closed, for a direct read. S1: closed. M2 (must-fix) — a formula the predicate reads through another formula is still waived silently when the inner one cannot be computed on the write path. Read, not run.
S2 (should-fix) — for a formula that faults, the server requires a field the form hides, and nothing warns the author. Read, not run. Two arms.
S3 (should-fix) — the form does not recompute a formula, so the contract's "the value the form shows" is false whenever the write changes the formula's inputs. Read in
Per
Per implementing file, on the delta:
Nits:
Open on this head: M2, S2 and S3. Each earns a delta review of its fix. Implemented-by: VERDICT: FAIL |
…las it reads, and warn where a formula drives it A predicate reading a formula that reads another formula was waived silently when the inner one could not be computed on the write path: the outer formula computed cleanly over the null the inner one read. The engine now marks the formulas whose read value the write path cannot know (a hop, label(), can() with no permission map, or a formula reading one, at any depth) and counts a predicate reading one as shown. A formula that faults for a reason a read shares (an empty operand) is judged on the null a read serves, as the form judges it. The lint and Studio's field inspector warn on a required field whose visibleWhen reads a formula: the form judges the value it last read and does not recompute it, and an unservable formula keeps the field required on every write. ADR-0113, ADR-0137, the visibleWhen describe and the changeset state both arms and the known limit. The bulk update builds one formula closure per batch, predicate reads are memoised per source, and a record's formulas are computed once per write. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WGufzfrHprnpf55xZtXBbx
|
repo:objectstack#3 · os-support-ai · session_01WGufzgQsdnyS4QdR8stjDa L1 delta review (L1-d) · 2026-11-18T01:18ZL1: REWORK This is a delta read from Must-fix
Should-fixNone. Notes
Landing: Tier H, still draft. The order is M1, then L1 same-head ACCEPT, then the seat's L2 delta, then os-zhuang's approval. Never ready, queue or arm before that approval. |
Conflict in packages/objectql/src/engine-update.ts resolved as a union: the import block keeps main's applyFormulaPlan, planFormulaProjection and storedExpressionsReading beside this branch's formulaValuesFor; the bulk per-row rule call keeps main's summary-fold overlays (header/related, overlayRow, advance) and adds this branch's formulaValues: bulkFormulaValues. Claude-Session: https://claude.ai/code/session_01JQwxbXGvw43spR79ztEvWt Co-authored-by: Claude <noreply@anthropic.com>
The merge driver deferred content/docs/references/data/object.mdx; rebuilt from the merged spec with gen:schema && gen:docs, which restores main's action texts row beside this branch's visibleWhen describe. Claude-Session: https://claude.ai/code/session_01JQwxbXGvw43spR79ztEvWt Co-authored-by: Claude <noreply@anthropic.com>
ADR-0137's note and ADR-0113's formula paragraph now say the mark covers any read of a bare user-scope root (current_user, its ADR-0068 aliases, or a bare ctx / os read such as os.org), since the engine cannot separate the user-dependent part of such a read, and the result is the unconditional required. The server log reason says the same; the USER_SCOPE_ROOTS docblock keeps 'exact' for option visibility and calls the formula plan's reading conservative. Prose and a log string only; no logic change. Claude-Session: https://claude.ai/code/session_01JQwxbXGvw43spR79ztEvWt Co-authored-by: Claude <noreply@anthropic.com>
Brings the form-side formula recompute (#35116). No conflicts. Claude-Session: https://claude.ai/code/session_01JQwxbXGvw43spR79ztEvWt Co-authored-by: Claude <noreply@anthropic.com>
The form-side recompute (#35116) makes the object form renderer and the console form-view page compute formula fields over the record being edited before judging field rules. The ADR-0113 amendment's known-limit paragraph, the visibleWhen TSDoc and describe (and its three regenerated references), the formulaValues and evaluateRequiredWhenShown jsdoc and the changeset now say so, naming the formulas the form cannot compute. Prose only. Claude-Session: https://claude.ai/code/session_01JQwxbXGvw43spR79ztEvWt Co-authored-by: Claude <noreply@anthropic.com>
|
repo:objectstack#1 · os-warren · session_01JQwxbXGvw43spR79ztEvWt Contract-review-claim: session_01JQwxbXGvw43spR79ztEvWt · head Delta contract review ( |
|
repo:objectstack#1 · os-warren · session_01JQwxbXKtHccbeakAgquNs9 L1 delta review (#34905) · 2026-11-18T11:18ZL1: ACCEPT c8d5313, the one conflict. 6c0fd9e. This regenerates aefc8aa closes S1 and N1 of my 6970922529, and N11.
e6f0dcb closes S3. With #35116 on
I checked these against what I accepted on #35116. The form's set of formulas it cannot compute (a hop, Out of this PR, as you said. The lint and Studio advisory text still describes the form as not recomputing. That goes to the follow-up card you are filing. Evidence. All 131 gates exit 0, and the battery has 0 failures (report 6976886520). CI at this head, from check-runs: 63 success, 11 skipped, none failed or in progress. Must-fixNone. Should-fixNone. Notes
|
|
repo:objectstack#1 · os-warren · session_01JQwxbXGvw43spR79ztEvWt Contract reviewServed-tier: This is a delta of the PASS record 6970975755 (head Inputs read: card #34905, its body and all thirteen comments (route ruling 6956761249, seat rulings 6966073288, os-dev report 6976886520); PR #34978 body, its 27-file list and its twenty comments (record 6970975755, L1 delta 6970922529); the net diff against
Verdict in short: PASS. S5: closed. N11: closed. The ① Derived judgmentsCheck-runs on the head: 74 runs, 63 success, 11 skipped, 0 failed, 0 pending. The head was committed at 2026-11-18T09:38Z and the runs started after it. The dev's reading (70 runs, 61 success, 9 skipped) was true when taken; the PR-body edit at 2026-11-18T11:11Z re-ran four on the same head (Check Changeset and PR-body guards, success; Auto Label and Check PR Size, skipped). The other nine skips are the opt-in and placeholder runs named in 6968679220. Test Core 10 of 10, Test UI 16 of 16, both type-check aggregates, Lint and Repo Gates, Check Changeset (twice), Spec property liveness and Governed Surface Queue Guard are green. Accept-set changes the delta implies:
Public surface: no export moves. One Merge resolution,
② Semver levelClause-②: yes (narrowing). The PR body and the changeset carry
Level ③ Boundary flags
④ Design judgmentS5: closed. How each was checked at the head:
The rewritten sentences, each against the form code #35116 brought:
S6 (should-fix) — the lint warning and the Studio advisory this PR adds still state that the form does not recompute a formula, and on this head that is false.
S7 (should-fix, prose only) — ADR-0113 calls the form-side limit closed, and one form-side judge still does not recompute. Read, not run.
Per
Per implementing file, on the delta:
Nits:
Open on this head: S6 and S7, both text. They earn a read of the changed lines; S6 moves two message strings and one test pin, so its fix moves the head. No must-fix. Implemented-by: VERDICT: PASS |
…e residual judges The lint warning and the Studio advisory on a required field whose visibleWhen reads a formula no longer say the form does not recompute it. The plain read is a reminder that the server's computed value decides, naming the checks that still compute none (a wizard's final-submit check, a form whose data source serves no object schema); the unservable arm says the form shows the field and keeps it required. ADR-0113 names the two residual form-side judges and the expression-masked case where the form can be stricter. Messages only: what fires is unchanged. Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JQwxbXGvw43spR79ztEvWt
|
repo:objectstack#1 · os-warren · session_01JQwxbXGvw43spR79ztEvWt Contract-review-claim: session_01JQwxbXGvw43spR79ztEvWt · head Delta contract review ( |
|
repo:objectstack#1 · os-warren · session_01JQwxbXKtHccbeakAgquNs9 L1 delta review (#34905) · 2026-11-18T12:45ZL1: ACCEPT S6, option B, reword only. Each changed string now says the server decides on the formula it computes. It says the form computes the same formula over the record being edited, and that a check which computes none can disagree with the server: a wizard's final-submit check, or a form whose data source serves no object schema. The strings are:
The unservable-formula message adds "the form cannot compute it either: it shows the field and keeps it required". That is the behaviour I accepted on #35116. The zh strings say the same as the en strings. The old advice, to read the formula's own inputs, is dropped, which is right now that the form recomputes. No code path changes: the warning fires on the same predicates. At the new head, no source string under S7. ADR-0113's paragraph now names the two residual judges: N13. The "stricter" sentence now names the masked-expression case (served without its expression, a field-level-security mask) beside Evidence. The battery shows 0 failures, and all 131 gates exit 0 (report 6978864276). CI at this head, from check-runs: 63 success and 11 skipped, with none failed or in progress. The PR is mergeable Must-fixNone. Should-fixNone. Notes
|
|
repo:objectstack#1 · os-warren · session_01JQwxbXGvw43spR79ztEvWt Contract reviewServed-tier: This is a delta of the PASS record 6977080790 (head Inputs read: card #34905, the comments added since the last record (os-dev report 6978864276) and the ones before it as already read; PR #34978 body, its 27-file list and the three comments added since the last record (record 6977080790, claim 6978896258, L1 delta 6978947546); the delta diff and the net file list against
Verdict in short: PASS. S6: closed. S7: closed. N13: closed. Every new sentence was read against the code at the head and none claims something the code does not do, with two wording nits (N14, N15). What fires is unchanged. No must-fix, no should-fix. ① Derived judgmentsCheck-runs on the head: 74 runs, 63 success, 11 skipped, 0 failed, 0 pending. The head was committed at 2026-11-18T11:24Z and the runs started after it. The PR-body edit at 2026-11-18T12:40Z re-ran four on the same head (Check Changeset and PR-body guards, success; Auto Label and Check PR Size, skipped); the other nine skips are the opt-in and placeholder runs named in 6968679220. The dev's reading (61 success, 2 in progress) was true when taken. Test Core 10 of 10, Test UI 16 of 16, both type-check aggregates, Lint and Repo Gates, Lint UI, Check Changeset (twice), Spec property liveness and Governed Surface Queue Guard are green. Accept-set changes the delta implies: none.
So the warning and the advisory fire on exactly the fields they fired on before. This is option B. Option A (narrow what fires to the unservable arm) is not done here and is carried by card #35190, open, which says it is blocked until this PR merges. Public surface: no export moves. Two published message strings change ( ② Semver levelClause-②: yes (narrowing). The PR body and the changeset carry
③ Boundary flags
④ Design judgmentS6: closed. No must-fix, no should-fix. How each was checked at the head:
Per
Per implementing file, on the delta:
Nits:
N14 and N15 are in message strings, so a fix would move the head. They are left as accepted deviations; #35190, which narrows the warning to the unservable arm, is the place to settle both wordings. Open on this head: nits only. The round ends here. Implemented-by: VERDICT: PASS |
|
repo:objectstack#1 · os-warren · session_01JQwxbabAdcWyApSTGBYJNY Seat record · 2026-11-18T12:50Z · Head-sha: 1ca9b69 维护者速读
席位意见:同意合并。实现与裁决 A 的三条逐条对应,收紧部分已在 changeset 和 ADR 修订里写明;复审四轮后无 must-fix、无 should-fix。 席位核对
|
Requested by Yibo Wang · project thread
Fixes #34905
Clause-②: yes (narrowing + widening of the required write contract)
Metadata-protocol: semantic
Skills-docs: none — no skill teaches
requiredandvisibleWhentogether; objectstack-data's "Use visibleWhen to hide irrelevant fields" stays true, and the combination's meaning lives in theFieldSchemadescribes.维护者速读
no-acting-user,与条件里直接写 current_user 的情形一致。storage.notNull),Studio 字段面板对前两种显示提示。原先记录的已知限制(表单不重算公式)已由 main 上的表单侧重算(fix(form): recompute formula fields from the live inputs before judging field rules #35116)关闭:表单现在按正在编辑的记录重算公式再判断字段规则;表单算不了的公式(经由关联字段、label()、can()、读 os、未登录时读用户)让字段显示并保持必填,由服务端在保存时判定。回滚即 revert 本 PR。rule-validator.ts新增的evaluateRequiredWhenShown(隐藏 / 显示 / 算不出三条分支,以及fieldsNeedPrior的新条件);②record-validator.ts的requiredWhenShown与'deferred'参数(插入遍历和更新清空检查让给上面的规则);③ ADR-0113 末尾的修订一节(包括作者期围栏为什么收窄、三处服务端答案以哪处为准)。pnpm --filter @objectstack/objectql exec vitest run src/engine-required-when-shown.test.ts,预期 35 个测试全部通过。What changes
Engine (
@objectstack/objectql). A field withrequired: trueand its ownvisibleWhenis judged by a new pass,evaluateRequiredWhenShowninrule-validator.ts, run after therequiredWhenloop:nullsuch as an unset boolean. The field is not required for that write. This is the form's reading, which shows a field only for a clean TRUE. The form's clear-on-hidenullis accepted.required. A row already shown and empty rests under unrelated edits. The message isrequired_clearedonly when the payload clears a value that was there.warnnaming the field and the fault, withreason: 'predicate-fault'or'no-acting-user'(ADR-0137 D4). This is a new arm. TherequiredWhenfault arm, which refuses the write, is unchanged.The predicate is evaluated with
record,previous,parentwhere the write resolves a header, and the acting user bound ascurrent_userwith the permission map the option gate reads. A system write with no acting user takes the fault arm.A
formulafield is computed on read and is never on the write path. So the engine computes the object's formulas over the merged record and the prior record before it evaluates a predicate that reads one. It uses the read path's own plan (formulaValuesForinengine-top-level.ts, passed to the rule pass asformulaValuesat the insert, by-id update, bulk update andvalidate()call sites). A formula that does not compute is answered by the reason (the seat's S2 ruling):null, so the predicate is judged on thatnull, as the form judges it. Not a fault of the predicate.label(), callscurrent_user.can()with no permission map resolved for the write (one is resolved only when the write picks a permission-gated option), or reads the acting user (current_user,user,ctx,os) on a write that has none (a system write), or it reads such a formula at any depth.formulaValuesFormarks theseunservableonce per write, walking the plan in read order so the whole read closure counts, and the predicate is a fault, which counts as shown and is logged naming the chain ('risk', which reads the formula 'tier_name', which reads through 'account', …). The acting-user mark is logged withreason: 'no-acting-user', the reason the directcurrent_userspelling logs (noActingUserbesideunservableon theformulaValuesanswer).A caller that passes no
formulaValuesgets the fault answer. The bulk update builds one formula closure per batch, predicate reads are memoised per source, and a record's formulas are computed once per write (L1-d's and the seat's N7).The form recomputes formulas too (S3's known limit, now closed on main). The form-side recompute (#35116, merged into this branch) computes the object's
formulafields over the record being edited before the field rules are judged: the object form renderer over itsruleRecord(ui/packages/components/src/renderers/form/form.tsx:2153) and the console form-view page over its live values (ui/apps/console/src/components/FormPage.tsx:2813), both throughplanObjectFormulas(ui/packages/core/src/evaluator/formulaRecord.ts:230). A formula the form cannot compute (a hop,label(),current_user.can(), a read ofos, a read of the user with nobody signed in, an expression not served, or a formula reading one) drops thevisibleWhenthat reads it, so the field is shown and keeps itsrequiredflag (objectFormulas.ts:107,FormPage.tsx:2440), and the server decides. Forosandcan()the form can be stricter than the server (formulaRecord.ts:58). The ADR-0113 amendment, thevisibleWhenTSDoc and describe, theformulaValuesandevaluateRequiredWhenShownjsdoc and the changeset now say this. The lint warning and the Studio advisory no longer say the form does not recompute (S6, fix round on1ca9b694): the plain formula read is a reminder that the server's computed value decides, naming the two checks that still compute none, and the unservable arm says the form shows the field and keeps it required.record-validator.tsgainsrequiredWhenShown(def)and arequiredVisibilityparameter onvalidateRecordInScope. The three engine call sites (engine-insert.ts,engine-update.ts,engine-validate.ts) pass'deferred', so the insert walk's presence check and the update's clear check leave such a field to the pass above. A field withrequiredand novisibleWhen, areadonlyfield and anautonumberfield keep the old path.fieldsNeedPriorcounts a field only when it has both keys, so plainrequiredstill costs no prior-record read.engine-update.tsnow callsvalidateRecordInScopedirectly (thevalidateRecordimport it no longer uses is removed). The bulk update's per-row branch reads each row through the samerulesNeedRowspath.Lint (
@objectstack/lint). On arequiredfield with avisibleWhen, three new warnings atobjectstack validateand the object save door:formulafield (required-visible-when-formula-issue.ts): a reminder that the server judges the requirement on the formula value it computes over the record being written, while a check that computes none (a wizard's final-submit check, a form whose data source serves no object schema) judges the value last read; and when a formula in its read closure reads through a reference or callslabel()orcan, the message adds that the server counts the field as shown on every write and that the form, which cannot compute it either, shows the field and keeps it required (forcan, that a write picking a permission-gated option computes it); a formula reading the acting user draws no warning, since it is computed per writer on every write that has one;storage.notNull: truebeside the pair: the column still refuses the null the write contract now admits.The reference-read check reuses the
requiredWhen/readonlyWhentraversal refusal (refuseFieldTraversal) with a newvisibleWhenslot and aseverityargument.Author-time fence, narrowed from ruling item 4 (agreed with the seat 18:27Z). The ruling asked for a warning on
required+visibleWhenreading thefeatures,apporpageroots. That half already exists at error level:FIELD_RULE_BOUND_ROOTSrefuses every root butrecord,previousandparentin any fieldvisibleWhen, atobjectstack validate, at the object save door and in Studio's predicate editor. A weaker warning beside it would add nothing, so none is added. Thecurrent_userbinding stays, for older stored metadata that predates the refusal. Only the reference-read warning and thestorage.notNullwarning are added. The ADR-0113 amendment records this narrowing.Studio (
@object-ui/app-shell,@object-ui/i18n). The field inspector shows the reference-read warning and the formula-read warning under the Visible-when editor of a required field (designer.field.requiredVisibleWhenReference,requiredVisibleWhenFormula,requiredVisibleWhenFormulaUnservable, en and zh). The reads are found by the sameanalyzeRelationshipTraversalsthe server and the lint use, loaded lazily like the other CEL affordances, and the answer is stamped with the inputs it was computed from.Spec (
@objectstack/spec). TherequiredandvisibleWhendescribes onFieldSchemasay how the two combine. The generated references (field.mdx,object.mdx,migration.mdx) are regenerated.Records.
validating-metadata.mdx: the submit paragraph is updated.rule-validator.tsADR anchor names ADR-0113.Scope. Only the object field's own
visibleWhenis read. A field group'svisibleWhen, form-view field and section predicates, a hidden tab and statichiddenare not, because the validator does not consume view metadata (#13252).Which server answer is canonical. For the record write contract, this rule. A flow screen's
requiredfield and the public form route judge their own surface's declarations before the engine sees the write, and keep their directions. A record either of them writes is then judged by this rule.Tests
packages/objectql/src/engine-required-when-shown.test.ts(new, 35 tests, real engine and in-memory driver):nullis accepted when the write moves the record out of the condition.null. A bulk update that reveals the field on one empty row refuses the whole batch and names(record b2).required(not the D2rule_violation) and the fault is logged; with the field, accepted; an update keeps the old answers (a clear is refused, an unrelated edit of a null row rests).'org_admin' in current_user.positions): the writer the field is shown to must fill it, the writer it is hidden from saves without it, and a system write with no acting user counts as shown, logged asno-acting-user.validate()(the dry run) accepts the hidden insert and refuses the shown empty one. Controls: plainrequiredrefuses as before, and only a field with both keys asks for the prior record.formulafield (record.risk_level == 'high', the formula computed fromamount): an insert inside the condition without the field is refused; outside, accepted; an update that moves the computed value into the condition is refused and the row is untouched;validate()agrees; a bulk update judges each row on its own computed value and names(record f2); a formula over an empty operand, and one with an undeclared key, are judged on thenulla read serves (accepted, nothing logged); a formula callinglabel()counts as shown and is logged naming it.tier_namereadsrecord.account.tier,riskreadstier_name, the predicate readsrisk: an insert inside the condition without the field is refused and logged naming the chain (it was accepted atab10c33f); with the field, accepted.visibleWhen: record.is_viphides it (insert accepted, nothing logged); TRUE shows it (insert refused).is_admin: 'org_admin' in current_user.positions(formula),admin_noterequired withvisibleWhen: record.is_admin. An insert with no acting user and without the field is refused and loggedno-acting-usernaming'is_admin'(it was accepted silently at84d2f737); an org_admin writer without the field is refused; a non-admin writer saves without it, nothing logged; the same through a second formula (needs_auditoveris_admin) is refused and logged naming the chain.ui/packages/core/src/evaluator/__tests__/fieldRules.test.ts: the form side of (g), in a new describe:nulland a clean non-boolean hide the field, TRUE shows it.packages/lint/src/validate-expressions.test.ts: a new describe with 8 tests: 4 formula-read tests (the plain warning; the chain through a reference at depth 2;label(); nothing on a field that is not required), and (the reference-read warning; nothing for the same read on a field that is not required; nothing for a read of the record's own columns; thestorage.notNullwarning, with the parse still accepting it). The reads-only-declared-keys meta-test tables the new reads (required,visibleWhen,storage.notNull).ui/packages/app-shell/src/views/metadata-admin/inspectors/requiredVisibleWhenReference.test.ts(new, 9 tests, realanalyzeRelationshipTraversalsandparseCelToAst): 5 for the reference advisory, 4 for the formula advisory (a computable formula; the chain through a reference;label()andcan; nothing on a field that is not required).Acceptance notes
Before and after, live (zh-CN console over
examples/app-crm, a project package objectrws_customer, field 验证用-备注字段requiredwithvisibleWhen: record.tier == 'vip'). Before is origin/mainc81f498b, after is this branch.{"tier":"basic","vip_note":null})验证用-备注字段是必填项,不能清空验证用-备注字段不能为空验证用-备注字段不能为空stops the save; API PATCH{"tier":"vip"}: 400requiredThe card's "edit an unrelated field" reading was measured on 18.5.0. On current main the edit form sends only changed fields, so that one save already passes before this PR; the clear-on-hide save and the create are the refusals that remained.
Other readers left as they are: the import template, the action parameter schema and the MCP field descriptions still describe such a field as required. ADR-0124 D4 allows a client hint stricter than the server, so they are listed in the amendment rather than changed.
Permissions are not resolved for a field
visibleWhenthat reads acanmap beyond what the option gate already binds.Verification
The latest fix round is on head
1ca9b694(below, first section); the previous one one6f0dcb4, the S4 round on8248f9ff. Everything else on head2b709e12unless named.Fix round: S6, S7 and N13 (delta contract review 6977080790)
Head
1ca9b694, one commit one6f0dcb4. Text only: no predicate, verdict or call site moves, and the lint warning and the Studio advisory fire on exactly the same fields as before (option B, reword only). File list unchanged: the same 27 paths. No merge oforigin/main:overlap-checksays the branch merges cleanly.required-visible-when-formula-issue.ts). Plain formula read, old: "The server judges that requirement on the formula computed over the record being written (ADR-0113 D1); the form judges it on the formula value it last read, does not recompute it while the user edits, and has none on a create. So a create, or an edit that moves the formula into the condition, can be refused naming a field the form keeps hidden. Read the formula's own inputs in the predicate if the form should follow the edit." New: "A reminder: the server judges that requirement on the formula value it computes over the record being written (ADR-0113 D1). The form computes the same formula over the record being edited; a check that does not (a wizard's final-submit check, or a form whose data source serves no object schema) judges the value last read, none on a create, and can disagree with the server." Unservable arm, old: "so it stays required on every record, the ones the form hides it on included." New: "so it stays required on every record. The form cannot compute it either: it shows the field and keeps it required." The module doc, the push-site comment invalidate-expressions.ts, and the test's title and pin (does not recompute itbecomesthe formula value it computes over the record being written) follow.designer.field.requiredVisibleWhenFormulaand...Unservable, en and zh). The plain string now says the form computes the same formula as you edit, and that a wizard's final-submit check, or a form whose data source serves no object schema, judges the value it last read and can disagree with the server. The unservable string drops "including the ones this condition hides it on" and adds that the form cannot compute it either and shows the field, keeping it required. The module doc and function jsdoc ofrequiredVisibleWhenReference.tsand the comment inObjectFieldInspector.tsxfollow.gateFinalSubmit,WizardForm.tsx) still judgesresolveFieldRuleStateover its merged form values with no formula plan, and a form whose data source has nogetObjectSchema, or whose schema read fails, gets no plan (objectFormulas.ts) and computes nothing, so both judge the formula value last read, none on a create." Both facts read at this head:gateFinalSubmit(mergedData)passes no plan toresolveFieldRuleState;useObjectFormulaPlanreturns no plan whengetObjectSchemais missing or its read rejects. Neither file is changed here.os, callscan()or is served without its expression (a field-level-security mask) the form can be stricter than the server, which may compute it and hide the field."formulaRecord.tsmarks a formula with no served expression unservable; the server holds the expression.Evidence on
1ca9b694:@objectstack/linttypecheck (withcheck:test-typecheck) and full suite: 217 files, 9,248 tests passed, 5 skipped. The renamed pin alone, by title: 1 passed.@object-ui/i18ntype-check and full suite: 103 files, 1,947 passed, 13 skipped.uirequiredVisibleWhenReference.test.ts: 9 of 9 (no ui test pins the advisory text).pnpm check:i18n: exit 0, 10 packages, all bundles in sync.uicheck:i18n-drift: exit 0.node scripts/pm/dispatch-gates.mjs --commands: 131 gates, the same set as before. 124 exit 0 on the first pass; 7 refused for missingdist(6 with exit 3, andpnpm --dir ui exec vitest run scripts/with exit 1 because@objectstack/clienthad no build). After a fullpnpm build(120 of 120 tasks) all 7 exit 0.--ranwith exit codes: 131 run, 0 NOT-MEASURED, 0 UNRUN (a derived zero).1ca9b694(pnpm --filter @objectstack/dogfood testunder the verify lock,VERDICT command-exit 0): 483 files (480 passed, 3 skipped), 4,143 tests (4,075 passed, 68 skipped), no failures.Fix round: main merged twice, S5 and N11 (contract review 6970975755), and the form recompute
Head
e6f0dcb4. File list unchanged: the same 27 paths; nothing outside them edited.c8d5313d(main961f4741). One conflict,packages/objectql/src/engine-update.ts, resolved as a union. Import block: main'sapplyFormulaPlan,planFormulaProjectionandstoredExpressionsReadingkept beside this branch'sformulaValuesFor. Bulk per-row rule call (around line 2137): main's summary-fold version kept (header/relatedlocals,overlayRow,overlay,summaryFold?.advance(i)), with this branch'sformulaValues: bulkFormulaValuesadded afterpermissions: bulkPermissions. The delta ofengine-update.tsagainst main is again exactly this PR's four hunks (+11/-6). The merge driver deferredcontent/docs/references/data/object.mdx;6c0fd9eeregenerates it from the merged spec (gen:schema && gen:docs), restoring main's actiontextsrow.6c9ded43(main55020c33, which contains fix(form): recompute formula fields from the live inputs before judging field rules #35116). No conflicts.aefc8aa2(prose and one log string, no logic change). ADR-0137's note adds: "That mark covers any read of a bare user-scope root (current_user, its ADR-0068 aliases, or a barectx/osread such asos.org), because the engine cannot separate the user-dependent part of such a read; the field then keeps the unconditionalrequiredit carried before this amendment." ADR-0113's parenthesis now reads "(current_userand its ADR-0068 aliases, or any barectx/osread such asos.org, since the engine cannot separate the user-dependent part of such a read; the result is the unconditionalrequired)". The server log reason is now "reads the acting user or a bare ctx/os root, and this write has no acting user (a system write)"; no test pins that string (the pins match the field, the formula names andreason: 'no-acting-user').USER_SCOPE_ROOTSdocblock says bare-root reading is exact at the option-visibility call site and only conservative at the formula plan's (formulaValuesForthroughreadsUserRoot), where a formula reading onlyos.orgis marked too. N12 stays open.e6f0dcb4(prose only). As described under What changes. The ADR-0113 paragraph is this PR's own unlanded text, retitled and rewritten, and the fence paragraph's back-reference now says the warning was written for that limit, since closed. The describe change regeneratedfield.mdx,object.mdx,migration.mdx(one line each).requiredfield whosevisibleWhenreads a formula, and the Studio formula advisory (en and zh), still give "the form does not recompute it" as their reason, and the lint test pinsdoes not recompute it. With the form recomputing, the plain warning has no reason left; only the unservable arm (hop,label(),can) still names a real divergence. Changing what fires is behaviour, so it waits for the seat's word: narrow the warning and the advisory to the unservable arm (recommended), or reword them only.Evidence on
e6f0dcb4:@objectstack/objectqltypecheck and full suite: 612 files, 13,835 tests passed.@objectstack/spectypecheck; full suite 853 files, 27,335 passed and 1 todo.@objectstack/specbuild,gen:schema,gen:docs, thencheck:generated: all 14 generated artifacts up to date.node scripts/pm/dispatch-gates.mjs --commandsone6f0dcb4: 131 gates, the same set as onaefc8aa2. All 131 exit 0 (two first refused with exit 3, nodistfor some packages; re-run after a fullpnpm build, 120 of 120 tasks, both exit 0).--ran: 131 run, 0 NOT-MEASURED, 0 UNRUN.Full dogfood battery:
pnpm --filter @objectstack/dogfood testunder the verify lock (VERDICT command-exit 0): 483 files (480 passed, 3 skipped), 4,143 tests (4,075 passed, 68 skipped).overlap-checkbefore each push:origin/mainmerges cleanly; fix(formula)!: a flow condition's record. / previous. read of a date field takes the date-text verdicts, so timestamp(record.DATE_FIELD) is refused as its bare name is #34935 conflicts inpackages/lint/src/validate-expressions.test.ts(as before); fix(objectql): the loser of a concurrent update answers 409 again on an object with a metadata beforeUpdate hook #35165, feat(studio): the main area adapts when the Studio right slot opens #35128 and fix(audit): a search the server widens never names a column the caller may not query #34817 merge cleanly.CI on
e6f0dcb4: 70 check runs, 61 success, 9 skipped (the opt-in and placeholder runs), 0 failed; all eleven required contexts success.Full build
pnpm build(turbo): 119 of 119 tasks.@objectstack/objectqlfull suite: 609 files, 13,699 tests passed.src/engine-required-when-shown.test.ts: 31 of 31.@objectstack/lintfull suite: 217 files, 9,195 tests passed.ui: theinspectors/directory, 234 files, 3,099 passed and 1 skipped;packages/corefieldRules.test.ts59 of 59;tsc --noEmiton app-shell exit 0; eslint on the changed ui files exit 0;check:i18n-keys,check:i18n-drift,check:i18n-dead-keys,check:designer-field-key-parityexit 0.@objectstack/spec:gen:schemaandgen:docsre-run; the regeneratedfield.mdx,object.mdx,migration.mdxare in the commit.node scripts/pm/dispatch-gates.mjs --commandsderived 130 gates on2b709e12(the same set asab10c33f): all 130 exit 0.dispatch-gates --ran: 130 run, 0 NOT-MEASURED.Full dogfood battery (
pnpm --filter @objectstack/dogfood test, owed for the narrowing arm): 482 files (479 passed, 3 skipped), 4,140 tests (4,072 passed, 68 skipped), exit 0, on2b709e12under the verify lock.Tier H: ADR-0113 and ADR-0137 are amended. Not readied, not queued, no auto-merge.
Fix round for the seat's delta contract review (PASS at
84d2f737, comment 6968679220): S4 and N8Head
8248f9ff(commits7f14821ctest,f7937161fix,6ae764ebprose,8248f9ffregenerated references). File list unchanged: the same 27 paths.7f14821c, against the unchanged code: an insert into an object withis_admin: 'org_admin' in current_user.positions(a formula) andadmin_noterequired withvisibleWhen: record.is_admin, with no acting user and withoutadmin_note, was accepted (AssertionError: expected false to be truein the refusal helper; 1 failed, 33 passed of 34). So the formula was computed asnullon the system write, the field was judged hidden, and nothing was logged, where main refused the insert and ruling item 3 counts a system write as shown.label()andcanmarks use.formulaValuesFornow knows whether the write has an acting user (the same testapplyFormulaPlanbindscurrent_userby), andunservableReasonmarks a formula that reads the acting user (readsUserRoot, the option gate's AST reader overcurrent_user,user,ctx,os) when the write has none, and carries the mark through the read closure as it carries a hop. The answer gainsnoActingUser, the formulas unservable for the missing user alone, andevaluateRequiredWhenShownlogs such a fault withreason: 'no-acting-user', the reason the direct spelling logs; the message names the chain (reads the formula field 'needs_audit', which reads the formula 'is_admin', which reads the acting user, and this write has none (a system write)). With an acting user nothing changes: the formula is computed for the writer.required, nothing stored, loggedno-acting-usernaming'is_admin'; an org_admin writer without the field is refused; a non-admin writer saves without it, nothing logged; the same through a second formula is refused and logged naming both formulas.node scripts/ablation-replace.mjs, on the committed tree; the test imports the engine fromsrc/, so no build sits between the mutation and the run): the new mark disabled (if (false && !actingUser && readsUserRoot(...))): anchor 1 → 0, 2 of 35 red (both system-write pins); the log flag forced off (noActingUser: false): anchor 1 → 0, 2 of 35 red (thereasonassertion of both). Each restore matched the HEAD blob with an emptygit diff HEAD.canformula is computed on a write that picks a permission-gated option: the ADR-0113 amendment (scope paragraph and the formula paragraph, which also says the lint does not warn on the acting-user mark), the ADR-0137 note, thevisibleWhendescribe (and the three regenerated references), theformulaValuesandevaluateRequiredWhenShownjsdoc, the changeset, the lint message (a sentence added when a blocked formula callscan) and its module doc, the Studio helper's doc and both Studio strings (en and zh). The lint and the Studio advisory gain no new detection: a formula reading the acting user is computed per writer on every write that has one.Evidence on
8248f9ff:src/engine-required-when-shown.test.ts: 35 of 35.@objectstack/objectqltypecheck and full suite: 612 files, 13,764 tests passed.@objectstack/linttypecheck and full suite: 218 files, 9,246 tests passed. uirequiredVisibleWhenReference.test.ts9 of 9;check:i18n-keys,check:i18n-drift,check:i18n-dead-keys,check:designer-field-key-parityexit 0.@objectstack/specbuild, thencheck:generated:check:docsstale for the describe;gen:docsregeneratedfield.mdx,object.mdx,migration.mdx(the describe line only); re-run: all 14 artifacts up to date.node scripts/pm/dispatch-gates.mjs --commandsderived 130 gates; all 130 exit 0 (three first refused with exit 3, prerequisite not met, before a full build; re-run afterpnpm build120 of 120: exit 0).--ranwith exit codes: 130 run, 0 NOT-MEASURED, a derived zero.pnpm --filter @objectstack/dogfood testunder the verify lock: 482 files (479 passed, 3 skipped), 4,140 tests (4,072 passed, 68 skipped), exit 0.8248f9ff: 70 check runs, 61 success, 9 skipped, 0 failed.overlap-check:origin/mainmerges cleanly; conflicts with fix(formula)!: a flow condition's record. / previous. read of a date field takes the date-text verdicts, so timestamp(record.DATE_FIELD) is refused as its bare name is #34935 (validate-expressions.test.ts) and fix(objectql)!: a predicate update judges each matched row against the parent roll-ups the rows before it move #34709 (engine-update.ts) as the claim records, whichever lands second merges main.Ablations, third round (on
2b709e12)Each run used
node scripts/ablation-replace.mjson the committed tree; each mutation landed (anchor 1 → 0) and each restore matched the file's HEAD blob, with an emptygit statusafter the run. Logs in the project files (objectstack-seat3/34905-live/ablations3/).unservableReasonnever follows a formula's readshopsis not markedlabel()marklabel()is not markedlabel()unservablelabel()unservableignores hop,label()andcanAblations, second round (on
d5310535)Each run used
node scripts/ablation-replace.mjsand thenvitest run src/engine-required-when-shown.test.ts(26 tests). Each mutation landed (anchor 1 → 0), and each restore matched the file's HEAD blob (rule-validator.ts39e928a0,engine-insert.tsa201a50c) with an emptygit diff HEAD.if (now.verdict === 'hidden') continue;deletedengine-insert.tspasses'enforced'instead of'deferred'requiredWhenShown(f)dropped fromfieldsNeedPriorformulaReadsOfanswers no formula read, so the predicate compares the absent formula asnull(the L2 M1 defect)formulaValuesRound 1 (on
81b671f3, 19 tests) had (a) 5, (b) 3, (c) 3, (d) 4, (e) 10. The first try at (b) in round 1 used the bare replacementcontinue;, which the tool refused before running because that text already appears 44 times in the file.Fix round for the seat's L2 (FAIL at
81b671f3)81b671f3. It now refuses, and the predicate reads computed formula values, as described under What changes.FieldSchemadescribes, the jsdoc and the changeset, and pinned on both sides.current_userin a fieldvisibleWhen, stated in the ADR scope paragraph and the jsdoc), N2 (the seed loader's early warning is listed among the readers left as they are), N3 (the refusal-order change is stated in the ADR and the changeset). N4 to N6 stay open.Fix round for the seat's delta L2 (FAIL at
ab10c33f, comment 6963978999; rulings relayed 23:24Z)ab10c33f. Fixed by the read closure, as the seat directed, not by the any-faulted-formula shortcut:formulaValuesFormarks every formula whose read value the write path cannot know, walking the plan in read order, and a predicate reading one counts as shown.nulla read serves; the PR's own fixture withamountempty is now accepted without the field, as the form hides it. (b) A hop,label()orcanwith no map keeps counted-as-shown, with the new lint warning and Studio advisory beside the reference-read one. Both arms are in the ADR-0113 amendment, the ADR-0137 note and row, and the changeset.visibleWhendescribe and TSDoc, theformulaValuesandevaluateRequiredWhenShownjsdoc, and the changeset, which lists the edit regression as a known limit. The lint warning fires on everyrequiredfield whosevisibleWhenreads a formula.Generated by Claude Code