Repository navigation
fix(metadata-admin): the page-block and hook condition editors lint in the scope their runtime binds (objectui#8167) - #9643
Conversation
…visibleWhen` (objectui#8167)
The objectui#8167 ruling settled the RULE — a mount's lint scope is decided by
what the evaluator binds at runtime — and deliberately did not settle this
mount, because the director did not read the objectui renderer side. It asked
for the reading to be the first commit, with the mount following it.
This is that reading, and it FALSIFIES the "node tier, therefore flattened"
default the ruling carried as a placeholder:
* a page block is a SDUI node — `previews/PageBlockCanvas.tsx` hands each one
to `SchemaRenderer`, and the page preview uses the same runtime renderer;
* `visibleWhen` is enforced once, generically, inside `SchemaRenderer`, whose
`shouldHide` short-circuits on it ahead of every other visibility leg;
* the evaluator it is answered by binds the row as the `record` ROOT ONLY —
the file says so in as many words ("NOT as bare fields"), and
`SchemaRenderer.visibleWhenRecordBinding.test.tsx` already pins it: a bare
`status == 'in_review'` renders the block on BOTH polarities of the row.
So the node tier IS a row surface here. No behaviour changes in this commit —
only the measurement the next one acts on.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012EpHzwH4wTy5sd7ibkD2yq
…following the renderer (objectui#8167) The mount follows the reading in the previous commit. `SchemaRenderer` binds the row as the `record` root only, so a bare `status == 'done'` typed into a page block's visibility gate resolves against nothing — and because that surface is fail-soft, it resolves to SHOWN on every row, forever, with no signal. The editor was handing out a success receipt for a predicate the renderer never matches. The value is written EXPLICITLY at the mount, which the ruling asked for either way it came out. It came out `record`, which falsifies the "node tier, therefore flattened" default the ruling carried as a placeholder. Pins are a pair, not a prop-arrival probe: the bare shorthand is REJECTED with the `record.<field>` fix named, and the canonical spelling is still ACCEPTED. Both run against the real `@objectstack/formula`. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012EpHzwH4wTy5sd7ibkD2yq
…what the server binds (objectui#8167)
`@objectstack/objectql`'s `wrapDeclarativeHook` compiles the condition once and
evaluates it as `ExpressionEngine.evaluate<boolean>(expr, { record: record ?? {},
previous })` — `record` and `previous`, and nothing else. This editor linted
`flattened`, so a bare `status == 'done'` came back clean and then met a scope
with no top-level `status`.
On this surface the consequence is worse than a gate that never fires: an
unevaluable condition does not resolve false, it throws `HookConditionError`,
deliberately (the objectstack#4775 fail-LOUD ruling). The author's write pays for
the editor's success receipt.
`previous` needed no change, and that was measured rather than assumed: at
`scope: 'record'` the installed engine draws no finding for a `previous.*`
reference and already advertises `previous` among its roots. A case now pins
that, so a later narrowing of the root list cannot take the transition idiom
away in silence.
The hook mount's old CONTROL case is re-homed, not weakened. It asserted "no
claim is made here"; a claim is made now, and the same mount appears as a
rejecting case instead. The one mount still passing nothing is the
schema-driven `ConditionWidget`, whose arm is unshipped — see the PR body.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012EpHzwH4wTy5sd7ibkD2yq
…objectui#8167) Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012EpHzwH4wTy5sd7ibkD2yq
✅ Console Performance Budget
The eager closure is every chunk the entry reaches through static imports — what the browser fetches and parses before the app renders. The entry chunk on its own is a small fraction of it. 📦 Bundle Size Report
Size Limits
|
Contract reviewServed-tier: 98/98 Provenance, measured rather than passed: the tier reading is the harness-written ① Derived judgmentsDiff at head: 4 files, +225/-14. Production wiring is exactly two added props,
② Semver level
③ Boundary flagsDev report
The seat's review comment What has to change for a pass, concretely: drop the Implemented-by: VERDICT: FAIL Generated by Claude Code |
… refuses a contract-bound root (objectui#8167)
Contract review returned FAIL on the page-block arm, and it is right. The
renderer reading was correct as far as it went — `SchemaRenderer` binds the row
as the `record` root — but the SAME evaluator construction also binds
`page: pageVariables`, which the reading quoted and did not act on.
At `scope: 'record'` the validator runs a strict environment declaring exactly
the engine's `SCOPE_ROOTS`, and `page` is not in it. Measured on the installed
`@objectstack/formula`:
scope 'record' · "page.selectedProjectId != ''"
-> error: "bare reference `page` … Write `record.page`."
That is `@objectstack/spec`'s OWN worked example for this key — `page.zod.ts`
documents the contract-bound roots as `record`, `current_user` and page state as
`page.<var>`. So the narrowing turned a predicate the spec prescribes into a
hard error with a nonsense remedy, and because this inspector reports blocking
issues upward it would have disabled Save and auto-save while the block was
selected. The objectui#8155 shape exactly (`app` refused although bound).
So neither lint scope fits that mount: `flattened` accepts the bare-field defect
the card is about, `record` refuses a contract-bound root. The mount goes back
to passing nothing, `flattened` being the less-wrong of two wrong answers — an
editor that over-accepts rather than one that refuses what the spec documents.
⭐ The reading is KEPT, corrected to name all three bound roots and to say that
neither scope expresses that set, so the next reader does not re-derive it and
reach the same wrong conclusion. The two page-block pins are replaced by one
that asserts the spec's own `page.selectedProjectId != ''` still lints CLEAN
there — it reddens the moment anyone "settles" the mount with `'record'`.
The changeset is re-scoped to the hook arm, which is what still narrows.
The hook arm is unchanged and stands.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012EpHzwH4wTy5sd7ibkD2yq
✅ Console Performance Budget
The eager closure is every chunk the entry reaches through static imports — what the browser fetches and parses before the app renders. The entry chunk on its own is a small fraction of it. 📦 Bundle Size Report
Size Limits
|
Contract reviewServed-tier: 95/95 Provenance and method. The tier reading is the harness-written ① Derived judgmentsDiff at head: 4 files, +256/−14. Production wiring is exactly ONE added JSX attribute,
② Semver level
③ Boundary flagsNewest dev report
Implemented-by: VERDICT: PASS Generated by Claude Code |
Provenance — clause-② carriers cleared on a PASS at tier
⭐ The reviewer ran the engine rather than reading it — it located an installed Two non-blocking notes the review raised, carried rather than dropped
Also recorded by the review: the first slice's changeset (
Generated by Claude Code |
Part of #8167
Part of, notFixes. Only ONE of the ruling's three arms ships here. A closing keyword would shut the card over the two that do not.What ships: the hook arm
@objectstack/objectql'swrapDeclarativeHookcompiles a hookconditiononce and evaluates it asrecordandprevious, and nothing else; the next lines throwHookConditionErrorrather than resolving false ("Fail LOUD. Notfalse", objectstack#4775). The editor lintedflattened, so a barestatus == 'done'came back clean — and on this surface the consequence is worse than a dead gate: the author's write pays for the editor's success receipt. The mount now passesscope="record".previousneeded no work, and that is a measurement. The ruling wrote 「previousadded to the lint scope's known roots」 as though it were a line of work. It is already there:A new case pins the transition idiom so a later narrowing cannot take it away in silence.
⛔ What was withdrawn: the page-block arm, and why it cannot be fixed at the mount
The renderer reading was correct as far as it went —
SchemaRendererbinds the row as therecordroot, so a barestatus == 'done'never matches on a page block. What it missed is in the very expression it quoted: the same evaluator construction also bindspage: pageVariables.At
scope: 'record'the validator runs a strict environment declaring exactly the engine'sSCOPE_ROOTS, andpageis not in it. Measured on the installed@objectstack/formula, all four corners:flattenedstatus == 'done'flattenedpage.selectedProjectId != ''recordstatus == 'done'record.status— rightrecordpage.selectedProjectId != ''page… Writerecord.page."That last row is
@objectstack/spec's own worked example:page.zod.tsdescribesvisibleWhenas "Contract-bound roots:record,current_user… and page state aspage.<var>" and ends withe.g. "page.selectedProjectId != ''". And because this inspector reports blocking CEL issues upward, where the host counts them, that error disables Save and auto-save while the block is selected.⇒ neither lint scope fits this mount.
flattenedaccepts the bare-field defect;recordrefuses a contract-bound root with a nonsense remedy. This is the objectui#8155 shape (apprefused although bound). The mount goes back to passing nothing —flattenedbeing the less-wrong of two wrong answers, an editor that over-accepts rather than one that refuses what the spec documents.The reading is kept, corrected. The comment at the mount now names all three bound roots and says in as many words that neither scope expresses that set, so the next reader does not re-derive the measurement and reach the same wrong conclusion.
Blocked on the engine, not on this PR. Making that mount lintable needs either
pageamong@objectstack/formula's scope roots — its own docblock says the list errs toward declaring more, and that a missing root is a false positive — or a per-surface root allowlist onvalidateExpression. That is an objectstack spec-seat change carrying its own clause-② review. ⛔ Not opened from here; carried back to the card for the seat.⛔ Still not shipped: the
ConditionWidgetarmUnchanged from the first round and upheld by the review.
ConditionWidgethas zero mount sites — it is resolved from a registry by field-name convention behindWidgetRenderer = (props: WidgetProps) => React.ReactElement, sosatisfies Record<string, WidgetRenderer>makes a widget-specific required prop a compile error at the registry.FormFieldSpec.scopewould be born declared-and-unenforced (zero in-tree form specs declare a condition field);WidgetContext.conditionScopehard-codes one scope inside the genericResourceEditPageunless derived per metadata type; a required prop on the publishedSchemaFormis a break across ~70 call sites. The choice is the director's — costed in the report on the card.widgets.tsxis untouched.The fence, verified
conditionrecordvisibleWhenwidgets.tsx(ConditionWidget)PermissionAdvancedFacets(RLS)FlowNodeConfigField(flow node)ConditionBuilder's own defaultundefined→hint.scope ?? 'flattened'No component API changes. Production wiring in this branch is exactly one line.
Verification — re-run on
d519436Every heavy run through
scripts/pm/os-verify-lock.sh(OS_VERIFY_LOCK_SLOT=objectui-8167-dev); verdicts read from the lock's ownVERDICT command-exitline, exit codes redirected to a file and read back, never through a pipe.Pins —
ConditionBuilder.mountScope.test.tsx, real@objectstack/formula, no stub:Test Files 1 passed (1)/Tests 11 passed (11), exit 0.Ablation, two legs, both directions predicted before running.
trap … EXIT INT TERMwithREPO_ROOT-absolute restore; HEAD blob hashes resolved non-empty first (2b4b1183…,7c26cca5…).Leg B is the point of the replacement pin: the withdrawal is now falsifiable, not asserted. Anyone who "settles" that mount with
'record'gets a red test carrying the nonsense remedy, instead of a designer with a disabled Save button.Affected tests — the 32 files naming
PageBlockInspector,HookDefaultInspectororConditionBuilder(git grep -lw):Test Files 32 passed (32)/Tests 347 passed (347), exit 0.Type-check —
pnpm --filter @object-ui/app-shell type-check, exit 0, zeroerror TSlines; the script echoedtsc --noEmit && tsc -p tsconfig.test.json. Prerequisite built first:turbo run build --filter='@object-ui/app-shell^...' --concurrency=2→28 successful, 28 total.Lint — NARROWING DECLARED, three pieces of evidence: ①
pnpm lintisturbo run lintacross every package; what ran is app-shell's own complete CI unit, the only package this diff touches. ② 1168 files, 0 errors, 3026 warnings — counts read from--format json. ③ Invariance:eslint.config.jsconfigures noprojectServiceand noproject:, so no type-aware linting exists and a change inside app-shell cannot move another package's verdict.Derived gates (hand-derived from
package.json+.github/workflows/; objectui has noscripts/pm/dispatch-gates.mjs) — all exit 0:check:control-bytes(scanned 7762 tracked text file(s)),check:new-line-citations(0 new citation(s)),check:test-path-roots,check:vi-mock-specifiers,check:vi-mock-inherit,check:vi-mock-override-shape,check:changeset-claims,check:unreferenced-sources,check:i18n-keys,check:i18n-drift,check:governed-queue-guard,changeset:check,check-changeset-presence.mjs(3 source file(s) of 1 released package(s) changed, and this change declares 1 changeset(s)),check-governed-queue-guard.mjs --testover all four paths → NOT GOVERNED. Out-of-band control-byte scan of the diff → no hits.Changeset re-scoped to the hook arm. The withdrawn sentence the review flagged ("Nothing already saved changes meaning") is gone as a blanket claim; the text now describes one mount, and states that the page-block mount is unchanged and why.
NOT MEASURED: remote CI on this head — reported at local-verification close; no waiting, no polling.
Carriers: both were stripped by the seat after the FAIL. ⛔ Not re-hung from here — a fresh clause-② review is the seat's to commission on this head.
🤖 Generated with Claude Code
https://claude.ai/code/session_012EpHzwH4wTy5sd7ibkD2yq
Generated by Claude Code