Skip to content

fix(app-shell): the formula inspector asks inferFormulaReturn before it keeps a currency result type - #35774

Merged
objectstack-fleet[bot] merged 12 commits into
mainfrom
claude/issue-35631-inspector-currency-verdict
Nov 20, 2026
Merged

objectstack-fleet[bot] merged 12 commits into
mainfrom
claude/issue-35631-inspector-currency-verdict

Conversation

@objectstack-fleet

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

Copy link
Copy Markdown
Contributor

repo:objectstack#7 · os-tesla · session_01L9qibvVRcFWKrfWeG5jzPb

Requested by Tesla · project thread
Fixes #35631
Clause-②: yes (widening)
Metadata-protocol: none

维护者速读

  • 在 Studio 里编辑公式字段的建模者会看到:公式从算金额改成算数量后,结果类型由"货币"改回"数字",不再按金额显示;仍在算金额的公式保持"货币"并带上源金额的币种;无法判定是否为金额的公式(例如引用汇总字段)保持原样。
  • 为什么做:修正公式结果类型在编辑后变旧的问题,替在 Studio 里写货币公式的建模者解决显示错误。
  • 出错会怎样:只影响 Studio 编辑公式时写入草稿的结果类型,存储的数值不变;可直接撤回本次合并。
  • 要你做什么:无。

What changes

settleFormulaType in the Studio field inspector now asks the engine's inferFormulaReturn (from @objectstack/formula, loaded through the same lazy seam as the other CEL verdicts) whether an edited formula computes money, over the object's declared field map:

  • Provably money stamps returnType: 'currency' with the proven currencyConfig (absent for the tenant default currency), also on a formula that was number.
  • A number answer withdraws a declared currency: returnType becomes number and the stale currencyConfig is removed (the producer's contract in formula-return.ts: the declaration is the pair, and an absent member is cleared).
  • Unproven ({}: a field-over-field quotient, two currencies meeting) keeps a declared currency, as before. An engine without the export gives no money verdict and also keeps it.
  • percent is unchanged (the spec: a formula has no percent return type, so a ratio formula (budget used, gross margin) reads as a bare number #35047 rule): it survives a number or unproven verdict, and a money verdict too (never re-stamped currency; the spec text now says so). A text, boolean or date verdict still stamps, and now also clears a stale currencyConfig.

The money verdict lands one microtask after the two editor verdicts. A newer verdict supersedes it (identity check on the verdict record), and the write uses the latest render's draft, so it builds on the current definition and not on an earlier closure.

packages/formula/src/formula-return.ts (the producer, PM ruling A, completed after the L2 record at e5a7e08b): a number answer means "proved not money". On the numeric path the answer is {} (unproven) unless one of two things holds. Either the unit proof succeeds (a plain quantity or constant), or every read of the record is one segment naming a declared field whose unit can be read and is not money. This covers all four spellings, record.x, record['x'], record.?x, record[?'x'], and a bare x. Only then does the CEL inference answer.

Unproven, measured, with the answer at e5a7e08b in brackets:

  • a hop record.account.balance * 0.9 [number];
  • a formula operand with no returnType, record.subtotal * 0.2 [number];
  • record['amount'] * 0.1 [number];
  • record.unknown_field * 2 [number];
  • a roll-up, division by an amount, a remainder, two currencies, amount times amount, an unparseable currency [number since round 2];
  • record.?amount * 0.1 and record[?'amount'] * 0.1 [{}: the CEL checker does not type the optional spellings, so they never reach the numeric path].

One shape per leg of the unit check: 100 / record.weighted (a formula declared currency) and 100 / amount (a bare identifier).

CONTROLs that still answer number: declared quantities in any spelling (record['quantity'] * 2, a bare quantity * 2), a percent field, a formula declaring number, and a count roll-up whose summaryOperations is passed.

A call with no field map now answers {} for a numeric expression that reads the record, because no read has a declared unit; it was number. A bare same-currency ratio (record.amount / record.tax) is proven plain, but cel-js types it dyn, so it answers {} as before.

FormulaSourceField gains the optional member summaryOperations (a widening, hence Clause-②: yes (widening)). A roll-up passed without it, a count included, is read as possibly money.

The header, the FormulaReturnDeclaration doc (an absent returnType is no verdict; the pair rule covers currencyConfig beside a currency answer) and the function doc say exactly this. Runtime callers on main: only the inspector, plus the showcase test money-format-declarations (proven money, unchanged, green).

packages/spec/src/data/field.zod.ts: the returnType JSDoc and .describe() said a declared currency survives a number verdict. That is no longer true, so the prose now restates the card's ruling (the Done-when on #35631): currency is stamped when money is proven and withdrawn for number, an unproven verdict keeps it, and a declared percent is kept under a money verdict. The generated content/docs/references pages were regenerated with gen:docs. Prose only: no key, value or shape changes.

Files to read first, by risk:

  1. ui/packages/app-shell/src/views/metadata-admin/inspectors/ObjectFieldInspector.tsx: settleFormulaType / stampFormulaType (the async hand-off and the decision order).
  2. ui/packages/app-shell/src/views/metadata-admin/celAuthoring.ts: inferFormulaReturnDeclaration (feature-detected, error-swallowing, null means no verdict).
  3. packages/formula/src/formula-return.ts: hasPlainUnit / readsOnlyPlainFields / memberRead and the one new early return.

Two-minute check: cd ui && pnpm exec vitest run packages/app-shell/src/views/metadata-admin/inspectors/ObjectFieldInspector.returnTypeHeld-27485.test.tsx. Expect 24 passing, including the thirteen in the objectstack#35631 describe. Producer: pnpm --filter @objectstack/formula exec vitest run src/formula-return.test.ts.

Tests

New top-level describe in the existing harness file ObjectFieldInspector.returnTypeHeld-27485.test.tsx. Its stub keeps the editor verdicts deterministic and hands in the real, unstubbed inferFormulaReturn:

  • money to count (record.amount * 0.1 to record.est_hours * 2) drops currency and currencyConfig;
  • an edit that still proves money keeps currency and { fixed, USD };
  • a number formula edited into money is stamped currency with the source's config;
  • an unproven field-over-field quotient keeps a declared currency;
  • a roll-up the proof cannot read as money (record.total * 0.9) is unproven and keeps a declared currency;
  • a NEW formula over an amount the proof cannot follow (100 / record.amount, verdict {}) is still stamped number from the editor's CEL type. The non-currency stamp reads the editor's type, not this verdict, so Studio's save is unchanged for new formulas;
  • CONTROL: a declared percent is kept under a number verdict. The edit is now to a different quantity expression (record.est_hours * 3); the old one equalled the harness default, so no stamp ran;
  • a declared percent edited to record.amount * 0.2 (a money verdict) stays percent;
  • config-update path: a USD amount to a EUR amount updates the config; a move to a dynamic amount removes it; a record-mode source stamps its code field;
  • a hand-declared currency over a formula with no returnType survives record.subtotal * 0.1 to * 0.12 (route b; it was withdrawn at e5a7e08b);
  • CONTROL: a boolean verdict still stamps over currency and clears the config.

Producer, in formula-return.test.ts: one describe pins each unproven shape as {}. It lists the round-2 shapes, the shapes that already answered {}, the four M1 routes (a hop, a formula with no returnType, the three other spellings, an undeclared name) and one shape per leg (100 / record.weighted, 100 / amount). CONTROLs: proven money still stamps currency with its config; quantities in every spelling, a percent field and a number formula still answer number; a count roll-up still answers number. The plain-inference pin now covers only declared non-money units and non-numeric results. The no-field-map pin is retitled: {} for a record read, number for a constant.

The existing pin "a number verdict keeps a declared currency too" is renamed to say it runs with no money verdict from the engine. It holds unchanged.

Readings at the final head b9ce479e unless named:

Test runs
  • @objectstack/formula test: Test Files 69 passed (69), Tests 1906 passed (1906). typecheck: exit 0 (at ae8b9cf9, producer source unchanged since).
  • Inspector, celAuthoring and CelPredicateField suites plus column-identity.ratchet.test.ts, run with @objectstack/formula rebuilt first: Test Files 40 passed (40), Tests 510 passed (510). The harness file alone: 24 passed.
  • pnpm --filter @object-ui/app-shell type-check (both tsc programs): exit 0.
  • @objectstack/example-showcase money-format-declarations.test.ts: 5 passed.
  • @objectstack/spec formula-currency-result, form-return-type-options, field: 327 passed.
  • pnpm --dir ui exec vitest run scripts/: 171 files passed, 2 skipped; 5092 tests passed, 2 skipped.
  • Round 2's ratchet fix stands: the stamp's field check is two plain comparisons, not a column-identity dual read. There is no inventory entry.
Ablations (scripts/ablation-replace.mjs; each leg landed on disk and was restored to blob == HEAD with an empty git diff HEAD)
  • A (4ea7e78), the withdraw branch: replaced with a bare return. Red: "the card's repro ... drops currency and its currencyConfig".
  • B (4ea7e78), the money-proof branch: the condition replaced with false. Red: "a number formula edited into money is stamped currency".
  • C (76bbb54), the producer's unproven early return: removed. Red: "each answers {}".
  • D (ae8b9cf), M1 route (b): hasPlainUnit read a formula with no returnType as plain (return field.returnType !== 'currency'), blob 61722a6b to 7b5806c3. Red: "each answers {}" (record.subtotal * 0.2) and the no-field-map pin.
  • E (ae8b9cf), S1, the percent guard in stampFormulaType removed, blob 80b3157e to 4817a67a. Red: the corrected CONTROL "a declared percent is still kept under a number verdict", "a declared percent is kept under a money verdict too", and the two spec: a formula has no percent return type, so a ratio formula (budget used, gross margin) reads as a bare number #35047 percent pins.
  • F (ae8b9cf), S1, the config comparison forced equal (sameFlatRecord(...) to true), blob 80b3157e to d6c9c6f3. Red: the USD-to-EUR, dynamic and record-mode pins.
  • A's first attempt used a replacement text already present in the file. The tool refused it before running, so that attempt measured nothing.

Acceptance notes

  • L2 record at e5a7e08b (FAIL): M1 and S1 to S4 are fixed here. N1 and N2 are left for follow-up cards, as directed.
  • The optional spellings record.?amount and record[?'amount'] answered {} at e5a7e08b too: the CEL checker does not type them, so they never reach the numeric path. Their pins guard the new read check, but they would not discriminate against that head.
  • Summary roll-ups: ruled A by the PM, done here. The producer answers {} for a money-reaching expression it cannot prove, so a currency formula over a roll-up keeps its declared currency on edit. Before, it was withdrawn on a number answer.
  • The card's example count(record.lines) answers {} (unproven: count is not a CEL function the checker types), so a declared currency is kept for that exact text. The pins use a typed count (record.est_hours * 2), which answers number.
  • When money is proven, the stamp writes the proven currencyConfig and clears one that is absent. A currencyConfig the author set by hand on a currency formula over a dynamic amount is therefore removed on the next expression edit. That is the producer's stated contract (the declaration is the pair). Selecting a field still writes nothing.
  • File surface: beyond the claim's surface, this PR also touches @objectstack/formula (the producer, ruling A), celAuthoring.ts (the lazy engine seam; a static import would put cel-js in the main bundle and bypass the test seam) and the spec prose plus its regenerated reference docs (they would otherwise state the old rule). The spec edit is prose only, but it touches packages/spec/src/**, so an L2 record is owed.

Verification

Local gates at b9ce479
  • Derived with node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack: 117 families. --ran reconciliation: 117 of 117 accounted for, exit 0.
  • 112 exit 0 on the first pass, and the ui scripts vitest passed.
  • check:dts-closure went red during the concurrent client build, which was rewriting the spec dist at the time; re-run once it finished: exit 0, 228 of 228 declaration files present.
  • check:skill-examples answered exit 3 before the client packages were built; re-run after: exit 0, 346 examples.
  • The 22 families that read the spec dist were re-run on a stable dist: all exit 0.
  • Two NOT MEASURED (exit 3, PREREQUISITE NOT MET), which CI runs: check-plugin-teardown-shape --self-test (shallow clone) and check:dual-build-cjs-loads (needs a full build).
  • overlap-check: VERDICT clean before the push. check-nul-bytes: OK.

CI runs the full farm.


Generated by Claude Code


Body refreshed 2026-11-20T09:05Z for rework round 3 (contract review 7034135842: M1, S1–S4), head b9ce479.

@github-actions

github-actions Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 2 package(s): @objectstack/formula, @objectstack/spec, touching 9 documentable anchor(s).

16 hand-written doc(s) name something this change touched — list omitted above 15 rows. Re-derive on the tree named below: node scripts/docs-audit/affected-docs.mjs --json d9be915f4080038132858708150dcd1ee84bc0bd.

⛔ 7 release-owned page(s) also affected — read-only, see AGENTS.md Documentation Guardrails.

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

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

Which tree this was computed on

This run read content/docs from 02a52e78c66c8a8992f62792d6661e1c7053e7d8 — the merge of head b9ce479e6de7a98539ebcd5cebdb787bc40a471c into base d9be915f4080038132858708150dcd1ee84bc0bd, which is what actions/checkout gives a pull_request run. Not the PR head.

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

# while this PR is open — GitHub drops the merge commit once it closes
git fetch origin 02a52e78c66c8a8992f62792d6661e1c7053e7d8 && git checkout 02a52e78c66c8a8992f62792d6661e1c7053e7d8
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin d9be915f4080038132858708150dcd1ee84bc0bd b9ce479e6de7a98539ebcd5cebdb787bc40a471c && git checkout -B drift-repro d9be915f4080038132858708150dcd1ee84bc0bd && git merge --no-ff b9ce479e6de7a98539ebcd5cebdb787bc40a471c

node scripts/docs-audit/affected-docs.mjs --json d9be915f4080038132858708150dcd1ee84bc0bd

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

Advisory only, and a precision-first one (#9192): a page is listed because it names a
symbol, wire route or SDK method this diff touched — not because it mentions a changed
package. Each row says which anchor put it there, so a wrong row is reportable rather than
merely annoying. To re-verify, run the docs-accuracy-audit workflow scoped to these files:
node scripts/docs-audit/affected-docs.mjs d9be915f4080038132858708150dcd1ee84bc0bd → pass the list as
args.docs, on the commit named under Which tree this was computed on.

@github-actions github-actions Bot added documentation Improvements or additions to documentation protocol:data tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface labels Nov 20, 2026
@github-actions github-actions Bot added the tests label Nov 20, 2026
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#7 · os-tesla · session_01L9qibvVRcFWKrfWeG5jzPb

Final green head: e5a7e08b934241bb2a835b29c85c1d6bc5e5cc8d (2026-11-20T07:48Z): 63 check-runs success, 11 skipped, 0 failed or pending; mergeable clean. Round 2 (PM ruling A on the dev's open question): inferFormulaReturn answers unproven ({}) instead of number when a numeric expression reads a money-typed operand it cannot prove, so the inspector's withdraw of a declared currency fires only on a proven non-money answer; the column-identity ratchet red on 76bbb543 is fixed. PR body refreshed. L1 requested from L1-a; one CONTRACT_REVIEW_TIER review owed (packages/spec/src/** describe text, and the published @objectstack/formula answer change), run by this area as an isolated reviewer.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#7 · os-tesla · session_01L9qibyQBB3KuDoNobNq9LH

Seat check

L1: ACCEPT (L1-a, for area d7-C) at head e5a7e08b934241bb2a835b29c85c1d6bc5e5cc8d, read 2026-11-20T07:50Z.

  • One record is owed before landing, with no new head: the claim amendment (below).
  • One L2 is owed: CONTRACT_REVIEW_TIER, covering the packages/spec/src/** describe text and the published @objectstack/formula answer change. d7-C runs it as an isolated reviewer in parallel. This ACCEPT does not replace it.

Owed before landing (a record, not code)

Amend the claim's file surface. Claim 7030625057 names ObjectFieldInspector.tsx, its tests and one changeset ("stop on breach; explain in the report"). The head also edits:

  • celAuthoring.ts;
  • packages/spec/src/data/field.zod.ts, plus three regenerated reference pages;
  • packages/formula/src/formula-return.ts and its test.

The dev reports explain each widening (7032209353, 7033149333), and each is needed by the fix:

  • the lazy seam keeps cel-js out of the main bundle;
  • the spec prose would otherwise be false;
  • the formula change is your ruling A.

But the claim is what other seats' pre-claim and overlap checks read, and field.zod.ts and formula-return.ts are shared surfaces. Post an amendment naming them before landing, as d7-A did for #35758 (7031864853), and re-run overlap-check after it. This needs no delta L1.

Your ruling A: inferFormulaReturn answers {}, never number, for an unprovable money operand

Agreed. The inspector can only withdraw a declared currency safely on an answer that means "proved not money". Before this change, number also covered "read an amount but could not follow it". Splitting the two is what makes the withdraw sound.

  • Code.
    • readsMoneyOperand runs only when the numeric path's dimOf answers unproven. A proven plain number, such as a same-currency ratio (QUANTITY) or a ternary of constants, still answers number.
    • isMoneyTyped counts a currency field, a formula declared currency, and a summary whose function is not count. The roll-up's source type is not on this object, so min / max / sum / avg are conservatively possible money. function is the summaryOperations key (field.zod.ts).
  • Callers. The only in-repo caller of the changed answer is the new inspector seam (git grep inferFormulaReturn outside tests and docs). The changeset gives external callers the FROM/TO and the migration line (read inferExpressionType instead).
  • Declarations. Clause-②: no / Metadata-protocol: none hold. No accept set widens and no export is added. The output change is on a function no metadata author writes, and the returnType value's meaning is unchanged. The L2 judges the published-answer face.

Code (inspector)

  • Async ordering. The money verdict arrives after the render that settled the CEL verdicts. Three checks keep a stale verdict from writing:
    • formulaVerdictRef.current !== now drops a superseded one;
    • stampFormulaTypeRef runs the latest render's closure, so def is current;
    • stampFormulaType re-checks the field name and that the source still equals the draft's expression.
  • Decision order.
    • A declared percent returns first under number / unproven.
    • A proven-money verdict stamps currency with its config.
    • A declared currency under number / unproven is withdrawn only when the money verdict itself answers number. Unproven, or no engine verdict (null), keeps it.
    • Everything else stamps the proven CEL type.
    • currencyConfig travels with currency only: deleted otherwise, written as the proven one otherwise. sameFlatRecord avoids a no-op write.
    • The write is a whole writeDef(nextDef) built from the latest def.
  • Failure handling. inferFormulaReturnDeclaration answers null ("no verdict", never "not money") for empty input, a missing export or a throw. It copies currencyConfig, so the stamp never aliases the engine's object.

Tests and controls

  • Inspector pins (real inferFormulaReturn behind the stub):
    • the card's repro drops currency and its config;
    • a still-money edit keeps currency with the proven USD config;
    • a number formula edited into money is stamped currency with USD;
    • unproven cases keep currency (the field-over-field quotient, the sum roll-up);
    • a new formula over an unprovable amount stamps the CEL type number;
    • CONTROLS: a declared percent is kept; a proven boolean stamps over currency and drops the config.
  • Formula pins:
    • each changeset FROM shape answers {};
    • CONTROLS: proven money still stamps with config, quantities still number, a count roll-up still number.
  • Ablations, each restored blob-equal:
    • A, the withdraw branch: the repro is red.
    • B, the money-proof branch: the number→money pin is red.
    • C, the producer's unproven branch: "each answers {}" is red.
    • The A attempt the tool refused (13 matches) was recorded as a no-op, not counted.
  • On the keep pins. They assert after settle() (600 ms) rather than on a signal that the money verdict landed. The keep guard (declared?.returnType !== 'number') has no inspector-level ablation; ablation C covers its producer side. This is acceptable because the keep behaviour predates this PR ("as before") and the guard is one line. I note it because a later timing change could make those pins pass vacuously.

Prose, sentence by sentence

  • Changeset (app-shell). Each sentence matches the code and a pin:

    • provable money stamps currency with the source currency (absent for the tenant default), from number too;
    • a number answer withdraws and drops the config;
    • unproven, or an engine without the export, keeps;
    • percent is unchanged;
    • text / boolean / date stamp and now drop a stale config;
    • the stamp runs only after an expression edit.
  • Changeset (formula). Every FROM example traces through dimOf:

    • the sum roll-up times a constant;
    • 100 / amount;
    • amount % 3;
    • two currencies summed;
    • double(a) * double(b) (a money×money product);
    • an unparseable currencyConfig (fieldDim → unproven).

    Each now reads a money operand on an unproven path, so it answers {}. "A ratio of two amounts in one currency is unchanged" and "a count roll-up … as before" also hold.

  • field.zod.ts. The JSDoc and the .describe() both say the same thing: currency is stamped when proven, withdrawn for number with its config dropped, and kept under unproven. That matches the inspector. The three regenerated reference pages carry the new .describe() verbatim, and check:generated is green in CI.

Nits (not owed)

  1. readsMoneyOperand also scans a ternary's condition, which never reaches the value. So record.amount > 100 ? size(record.lines) : 0 now answers {} instead of number. This is the conservative direction, but skipping args[0] of ?: would keep number for a count gated on an amount.
  2. content/docs/data-modeling/formulas.mdx says "You declare it yourself — nothing back-fills it" about returnType. Studio's stamp already wrote number / text / … on an edit before this PR, and now writes currency as well. This is pre-existing and outside this card, but the sentence could say "nothing back-fills it at runtime; Studio stamps it as you edit".

Gates and routing

  • CI at e5a7e08b: 74 check runs, 63 success and 11 skipped, none red.
  • After the claim amendment and the CONTRACT_REVIEW_TIER L2 PASS on this head, check-governed-merges.mjs --pr 35774 decides the landing route.

Generated by Claude Code

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#7 · os-tesla · session_01L9qibvVRcFWKrfWeG5jzPb

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: e5a7e08b934241bb2a835b29c85c1d6bc5e5cc8d
Local-runs: none
Scope: packages/spec/src/data/field.zod.ts + packages/formula/src/formula-return.ts, packages/formula/src/formula-return.test.ts, ui/packages/app-shell/src/views/metadata-admin/inspectors/ObjectFieldInspector.tsx, ui/packages/app-shell/src/views/metadata-admin/celAuthoring.ts, ui/packages/app-shell/src/views/metadata-admin/inspectors/ObjectFieldInspector.returnTypeHeld-27485.test.tsx
Security-touching: no

Read: card #35631 (body and its four comments: triage 7018719508, claim 7030625057, os-dev-reports 7032209353 and 7033149333); PR #35774 (body, the 10-file list, the net diff against main, merge-base 0e2de251); the check-runs on the head: 63 success, 11 skipped, none failed or pending. Code outside the diff was read on origin/main at 1e018d6e. Nothing was built or run, so every answer quoted below for a shape no test pins is derived by reading.

Result: FAIL on M1. Open on this head: M1, S1, S2, S3, S4.

① Derived judgments

  1. inferFormulaReturn, exported by @objectstack/formula: the answer moves from { returnType: 'number' } to {} for a numeric expression whose unit proof fails and that reads a host field typed currency, a formula declared currency, or a summary that is not a count. The signature and return type are unchanged, and {} was already an answer (any dyn expression).
    • Consumers on main: none at runtime. git grep finds the definition, the entry export (packages/formula/src/index.ts:190), one test (examples/app-showcase/test/money-format-declarations.test.ts, a proven-money call, unchanged) and prose that claims only the proven-money answer (spec JSDoc, two spec test headers, content/docs/data-modeling/currency.mdx:85, formulas.mdx:143). No shipped text is made false.
    • The inspector in this diff is the first runtime consumer. It reads {} and number differently in one place: on a declared currency, number withdraws and {} keeps. In every other declared state the editor's CEL type decides and neither answer is read, so a new formula 100 / record.amount is stored number exactly as on main (pinned).
    • Direction: right. Completeness: wrong, see M1.
  2. FormulaSourceField gains the optional member summaryOperations. It is an exported type and the parameter type of inferFormulaReturn. Additive: right. The declarations do not name it: S4.
  3. FieldSchema.returnType in packages/spec: JSDoc and .describe() only. No key, value, default or refinement moves; the enum holds the same six members. The three reference pages carry the new describe string byte for byte. Right as an accept-set judgment. The text itself: S2.
  4. What the inspector now writes that it did not.
    • returnType: 'currency' with the proven currencyConfig, on a formula that was number, absent or another type: the card's Done-when, right.
    • returnType: 'number' over a declared currency on a number answer: the card's Done-when, right where that answer is sound, M1 where it is not.
    • currencyConfig removed whenever the stamped type is not currency, a text, boolean or date stamp included: right. main left it stale beside a non-currency formula.
    • currencyConfig replaced by the proven one, or removed for a dynamic source, on every stamp that proves money: right. The spec JSDoc says the stamp copies the source's currency.
  5. celAuthoring.ts: inferFormulaReturnDeclaration and FormulaReturnVerdict are internal to the module; the @object-ui/app-shell entry does not re-export them. No public surface. Right.

② Semver level

  • Levels. @objectstack/formula patch, @objectstack/spec patch, @object-ui/app-shell patch: right for all three. Nothing changes in what a metadata author can write, so the kind is none, and none takes patch; a non-protocol change ships patch whether it widens or not (AGENTS.md, Post-Task Checklist step 3).

  • FROM/TO. Present in the changeset for the answer change, with the shapes that moved (they match the seven sources the producer test lists as formerly number) and the one-line fix (read inferExpressionType). Two of its sentences are not true on this head: "So a number answer now always means 'proved not money'" (M1), and "a count roll-up included … is answered as before", which holds only when the passed field carries summaryOperations.function (S4).

  • Clause-②. The declared value is no. The (narrowing) arm is not owed: nothing accepted before is refused, no export or type member is removed, the return type is unchanged and already held {}, no stored metadata is touched and ADR-0087 has nothing to convert. An answer that says less for some inputs is a behaviour fix and carries its FROM/TO. The value is wrong because of a different hunk:

    S4 (should-fix) — the diff adds summaryOperations to the exported FormulaSourceField, which the built entry reaches through inferFormulaReturn's parameter (packages/formula/src/index.ts:190-191). This package's own history records a published type gaining one optional key as a widening (changeset 1538596 in packages/formula/CHANGELOG.md: "Widened: the published ExprSchemaHint type gains one optional key"). The right declaration is yes (widening), on the claim, the PR body and the changeset body; the levels stay patch. The changeset should name the member and say that a roll-up passed without summaryOperations is read as possibly money, a count included.

  • Metadata-protocol. none is right. The returnType text describes what Studio's stamp does with a declared value; what the value means once written, and what a reader does with it, is unchanged.

③ Boundary flags

  • Round-1 open question (a roll-up read answers number: accept, or fix the producer). Ruled A by the lane PM, as the PR body records, and implemented (formula-return.ts:276-279 and :356), pinned at the producer and at the inspector. Answered as asked. The ruling's principle is not met on other operand routes: M1.
  • File surface beyond the claim (celAuthoring.ts; the spec text and three regenerated pages; the packages/formula producer and its test; spec and formula in the changeset). Accepted. The seam file is where every engine verdict is feature-detected and stubbed. The spec text stated the rule this change reverses. The producer change is ruling A. The spec touch is why this record is owed.
  • The card's example count(record.lines). Accepted. The engine registers no count function (CEL_STDLIB_FUNCTIONS has len and size), so the editor's lint refuses that text and no stamp runs on it: nothing to withdraw, nothing to file. A typed quantity at the inspector and a count roll-up at the producer pin the card's intent.
  • The inspector roll-up pin was not ablated. Accepted. The pin has two links and each is shown apart. Producer link: ablation C reds "each answers {}", which holds record.rollup * 0.9. Inspector link: removing if (declared?.returnType !== 'number') return; writes number and reds the pin's currency assertion. Test UI is green on the head against the head's @objectstack/formula build.
  • A new formula is still stamped from the editor's CEL type, so 100 / record.amount is stored number while the money verdict is {}. Accepted. It is main's behaviour, the spec text says it, the changeset says it, and it is pinned; nothing is withdrawn by it. Two consequences, neither held against this flag: the producer's type doc describes a different stamp (S3), and a formula stamped number this way is read by the producer as a quantity, so a formula over it answers number. Relative to the declarations that is a proof; the author who wants money declares the inner formula currency.
  • The column-identity ratchet. The scanner matched settled.field !== entry.name ||, and the dev split the condition instead of adding an inventory row. Accepted: the line joined two comparisons with a boolean OR and never read one identity through two keys, so there is no verdict to record. Test UI is green on the head.
  • The remaining deviations (a push before the overlap check, container restarts, one ratchet run outside the verify lock, the PR body refreshed by the seat, the commit trailers) are process facts for the seat's ACCEPT. None moves a contract face.
  • SQL push-down. The diff holds no query, id materialisation or join: pure functions over an AST and an in-memory field map. No finding.
  • Author. The PR's user.login is objectstack-fleet[bot]; no off-relay note is owed.

④ Design judgment

What was tried, and what held.

Probe Result
Money to a quantity (record.amount * 0.1 to record.est_hours * 2) Holds: number written, currencyConfig deleted. Pinned; ablation A. Does not hold for a field-over-field quantity (N1).
Still money, fixed currency Holds, pinned.
Still money, with a moved currency, a dynamic source or a record-mode source Holds by reading: the verdict's config is written, or the key deleted. Not pinned (S1).
number formula edited into money Holds: stamped with the source's config. Pinned; ablation B.
Unproven verdict Holds: the declared currency and its config stay. Pinned (field-over-field quotient).
percent never withdrawn Holds by reading: the guard returns before the money verdict is read. The PR's own CONTROL cannot fail (S1) and the published text does not say it (S2). The two #35047 pins, with no money verdict, are live.
A summary of money Holds: {}, kept. Pinned at both levels. A count answers number. A non-count roll-up of a non-money field also answers {}: the safe direction.
Two currencies, amount times amount, division by an amount, a remainder, a config that does not parse Hold: {}. Pinned.
A formula over a currency formula Holds: proven with the operand's config (record.weighted * 2, pinned). Unproven over one answers {} by reading; no shape discriminates that leg (M1's fix list).
A formula over an undeclared formula, over a related record's amount, or through an indexed read Breaks: number, withdrawn. M1.
An engine without the export Holds: no verdict, the declaration is kept. Pinned.
A verdict that lands late Holds by reading: identity check on the verdict record, then field name and source compared against the latest render's definition, which writeDef builds on.

Does the spec text say exactly what the inspector does? Yes, except for percent under a money verdict (S2). Its sentence "answering number: the expression no longer computes money" becomes true when M1 is fixed.

Does the producer header say exactly what the code does? No: M1 and S3.

Are the pins one per shape with a CONTROL? At the producer, sixteen sources are each asserted under their own message in one case, with CONTROLs for proven money, quantities and a count roll-up; ablation C is red. The gaps are in M1's fix list. At the inspector, eight cases, one of them vacuous: S1.

M1 (must-fix) — a number answer is not yet "proved not money", and the inspector withdraws on it. readsMoneyOperand and isMoneyTyped (formula-return.ts:271-296) see a money operand only as record.NAME or a bare NAME whose host field is currency, a formula with returnType: 'currency', or a non-count summary. Any other read leaves the unit proof unproven, finds no money operand and falls to the plain inference, which types dyn * double as number (packages/formula/src/validate.test.ts:1255 on main). Four routes:

  • (a) One hop through a reference field: record.account.balance * 0.9, record.opportunity.amount * 0.1. A formula expression is a site where one hop is served (packages/lint/src/validate-expressions.ts, A formula field that reads through a reference (record.book.title) passes validateExpression, then reads null on every row: the read path projects only the row's own columns #24197: the read path preloads it). dimOf is unproven because the base is not record; readsMoneyOperand then asks isMoneyTyped('account'), a lookup: false. The leaf's type is not on this object, which is the header's own reason for reading a summary as possibly money.
  • (b) A formula operand that declares no returnType: record.subtotal * 0.2 over subtotal: { type: 'formula' }. fieldDim is unproven; isMoneyTyped tests returnType === 'currency': false. This is the installed base. On main Studio clears returnType on every field-over-field formula (record.amount + record.tax types dyn), and hand-written formulas often carry none (days_to_close in examples/app-crm).
  • (c) The other spellings of one read: record['amount'] * 0.1, and the optional forms .? and [?]. asMember in relationship-traversal.ts treats the four as the same read; readsMoneyOperand matches . alone, so the object's own currency field goes unseen.
  • (d) A name the map does not declare: record.unknown_field * 2 is still pinned number, under a title that says the expression "reads no amount" (formula-return.test.ts:116-125). CI ran that pin green on this head; (b) takes the same two branches.

In Studio, (a), (b) and (c) lint clean (checkFieldExistence judges the head segment, and lintCelPredicate passes no field types) and type number. So stampFormulaType (ObjectFieldInspector.tsx:1151-1156) reads declared.returnType === 'number', writes number and deletes currencyConfig. A currency the author declared by hand on such a formula, which is the only way it can be declared since no proof reaches it, is gone after the next expression edit (0.1 to 0.12). On main it survived. Route (d) cannot reach the stamp: the editor refuses an unknown field.

This is the round-1 question on more routes, and ruling A already answers it: the producer makes number mean proven. Until it does, three sentences are false: the header (formula-return.ts:51-56), the function doc (:318-321) and the changeset's "always means".

Fix: on the numeric path, answer {} unless the unit proof succeeds, or every read of the record, in any of the four spellings, is one segment naming a declared host field whose unit can be read and is not money. Pin each route as {} with a shape that answers number on this head, and keep the quantity and count CONTROLs. Give the two legs with no discriminating shape one each: a formula declared currency (100 / record.weighted; record.weighted * record.weighted types dyn and answers {} with or without the leg) and a bare identifier (100 / amount). For (d), either answer {}, or say in the header that the proof is over the fields the map declares and retitle the pin.

S1 (should-fix) — the card's CONTROL cannot fail, and the config-update path has no pin.

  • 'CONTROL — a declared percent is still kept under a number verdict' (ObjectFieldInspector.returnTypeHeld-27485.test.tsx:275-281) renders the harness with its default expression record.est_hours * 2 (:98) and then sets COUNT, which is the same string (:223). React fires no onChange for a controlled value that did not change. formulaEdited stays false, settleFormulaType returns before any stamp, and the assertion holds with the percent guard deleted. Neither ablation in the reports touched that guard. Edit to a different quantity expression.
  • With returnType unchanged, sameFlatRecord alone decides whether a moved currency is written. Replace its call with true and, by reading, all 19 cases stay green. Pin an edit that moves the proven currency (a USD amount to a EUR amount), one that moves to a dynamic amount (the config is removed) and one record-mode source.

S2 (should-fix) — the spec text does not say what the inspector does with a declared percent under a money verdict. The .describe() keeps percent under "a verdict that proves no other type (number, or none)" and then says "currency is stamped when the expression provably computes money". By that sentence a money verdict proves another type. The inspector returns on a declared percent before it reads the money verdict (ObjectFieldInspector.tsx:1146) whenever the CEL type is number or unproven, which a money expression always is. So percent is never withdrawn: the PR body says so and the published text does not. A second stamp written from the text would overwrite percent. State the precedence in the describe and the JSDoc, regenerate, and pin it (a declared percent edited to record.amount * 0.2 stays percent).

S3 (should-fix) — the producer's own type doc now prescribes the opposite of the ruling. FormulaReturnDeclaration (formula-return.ts:82-94, untouched by the diff) says "a member that is absent is one the formula does not declare, so a stamp writes both and clears an absent one". Under this PR {} means unproven: the inspector keeps a declared currency or percent on it and otherwise writes the editor's CEL type. A stamp built from the doc clears a declared currency on {}, which is what ruling A exists to prevent. Restate it: an absent returnType is no verdict, and the pair rule covers currencyConfig beside a currency answer. In the same pass, the header's "a ratio of two amounts in one currency is a proven plain number" (:58-59) reads as a number answer. A proven plain number still takes the CEL inference, so the bare ratio record.amount / record.tax answers {} and keeps a declared currency. Say so.

N1 (nit) — for a follow-up card, not this PR. The producer holds the proof (dimension quantity) for field-over-field quantity arithmetic and for a same-currency ratio, and still answers {} because the CEL type is dyn. An edit from money to record.quantity * record.hours therefore keeps currency: the card's defect, on the shapes no literal pins. This agrees with the text ("an unproven verdict keeps it") and with the card's Done-when (a number verdict withdraws).

N2 (nit) — for a follow-up card, or accepted. The stamp runs on each debounced source (250 ms). A pause on a plain-number intermediate (100 on the way to 100 / record.rollup) withdraws the declaration, and the unproven final source has nothing left to keep.

Implemented-by: claude/issue-35631-inspector-currency-verdict
Reviewed-by: session_01L9qibvVRcFWKrfWeG5jzPb

VERDICT: FAIL

…rd read has a readable non-money unit

Claude-Session: https://claude.ai/code/session_01L9qibvVRcFWKrfWeG5jzPb
Co-authored-by: Claude <noreply@anthropic.com>
… spec prose, widening changeset

Claude-Session: https://claude.ai/code/session_01L9qibvVRcFWKrfWeG5jzPb
Co-authored-by: Claude <noreply@anthropic.com>
…er; regenerate reference docs

Claude-Session: https://claude.ai/code/session_01L9qibvVRcFWKrfWeG5jzPb
Co-authored-by: Claude <noreply@anthropic.com>
@github-actions github-actions Bot added size/l and removed size/m labels Nov 20, 2026
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#7 · os-tesla · session_01L9qibyQBB3KuDoNobNq9LH

Seat check (delta)

L1: ACCEPT (L1-a, for area d7-C) at head b9ce479e6de7a98539ebcd5cebdb787bc40a471c, read 2026-11-20T09:08Z. This carries ACCEPT 7033709816 forward over the rework for L2 FAIL 7034135842 (M1, S1–S4).

Two conditions remain:

  • CI at this head finishes green. When I read, 62 runs were success, 11 skipped and 1 in progress, with none red.
  • The delta CONTRACT_REVIEW_TIER L2 PASSes on this head. d7-C reports it is running with the same reviewer. The new Clause-②: yes (widening) declaration would on its own owe a TIER_DEFAULT L2. The CONTRACT_REVIEW_TIER review already owed by the spec face covers it.

Correction to my ACCEPT 7033709816. I wrote that "Clause-②: no holds … no export is added". That was wrong. The diff adds the optional member summaryOperations to the exported FormulaSourceField, which inferFormulaReturn's parameter carries to the built entry. That is a widening, by this package's own precedent (changeset 1538596). The L2's S4 is right, and the re-declaration on the changeset, the PR body and claim amendment 7034151496 is the fix.

Each finding, closed

  • M1: number now means proved not money.
    • readsMoneyOperand / isMoneyTyped are replaced by readsOnlyPlainFields / hasPlainUnit. Unless dimOf proves a quantity or constant, every record read must be one segment on record, in any of ., .?, [] with a literal key, or [?], or a bare id other than record. It must also name a declared field whose unit can be read and is not money. Anything else answers {}.
    • hasPlainUnit is false for an undeclared or untyped name, a currency field, a formula with no returnType or a currency one, and a roll-up without a count summaryOperations.
    • By reading, each of the four routes now answers {}: (a) a hop, whose receiver is not record; (b) an untyped formula; (c) a computed or indexed key, where a literal key is read and a computed one is refused; and (d) an undeclared name.
    • Pins: the eight new "each answers {}" sources, including the two legs the L2 asked for (100 / record.weighted, 100 / amount). The undeclared-name pin moved out of the CONTROL list. The no-field-map pin was retitled to {}, and 2 * 3 and a boolean keep their answers.
    • New CONTROL: record['quantity'] * 2, quantity * 2, a formula declared number, and a percent field still answer number.
    • At the inspector: a hand-declared currency over an untyped formula survives an edit.
    • Ablation D reds the M1 pins.
    • The declared deviation is accepted. The .? and [?] pins answer {} on the old head too, because the CEL checker does not type those spellings. They hold the new code's answer, and they do not discriminate against the old head.
  • S1.
  • S2. Both the JSDoc and the .describe() now say that a declared percent is kept under a money verdict and never re-stamped currency. The three reference pages are regenerated, and the new pin edits a percent to record.amount * 0.2 and asserts percent with no currencyConfig.
  • S3.
    • FormulaReturnDeclaration's doc now says that an absent returnType is no verdict, that currency answers carry the pair, and that a non-currency stamp removes a stale config.
    • The header and the function doc say that a bare same-currency ratio is proven plain but types dyn, so it answers {}.
    • Every sentence matches inferFormulaReturn's branches.
  • S4. Clause-②: yes (widening) is on all three records. The changeset's new "Widened:" paragraph names the member and says that a roll-up without it, count included, is read as possibly money. The levels stay patch.

Changeset, sentence by sentence (the moved paragraphs)

  • The numeric-path rule, with its five spellings, matches the code.
  • The FROM/TO list now adds the four M1 routes. All are pinned.
  • "A call with no field map therefore answers {} for any numeric expression that reads the record" is a real further move of the published answer (record.amount * 0.1 was number). It is stated, pinned and within the same FROM/TO. The one-line fix (read inferExpressionType) covers it.
  • "What still answers number" matches hasPlainUnit and the CONTROLs.
  • The percent bullet now says it is kept under a money verdict, which matches the inspector's early return.

N1 / N2

N1 (field-over-field quantities type dyn, so they keep currency) and N2 (a debounced intermediate can withdraw) are, as the L2 says, follow-up material. Neither makes a sentence on this head false. File N1 if it passes the business test: it is the card's defect on shapes no literal pins. I'd leave N2 unless it is reproduced in Studio.

Gates and routing

After CI is green and the delta L2 PASSes on b9ce479e, check-governed-merges.mjs --pr 35774 decides the landing route.


Generated by Claude Code

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#7 · os-tesla · session_01L9qibvVRcFWKrfWeG5jzPb

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: b9ce479e6de7a98539ebcd5cebdb787bc40a471c
Local-runs: none
Scope: packages/spec/src/data/field.zod.ts + packages/formula/src/formula-return.ts, packages/formula/src/formula-return.test.ts, ui/packages/app-shell/src/views/metadata-admin/inspectors/ObjectFieldInspector.tsx, ui/packages/app-shell/src/views/metadata-admin/celAuthoring.ts, ui/packages/app-shell/src/views/metadata-admin/inspectors/ObjectFieldInspector.returnTypeHeld-27485.test.tsx
Security-touching: no

Read: this is the delta review against the record at e5a7e08b (comment 7034135842). Card #35631: the body and its seven comments, three of them new to this review (claim amendments 7033719451 and 7034151496, os-dev-report 7035165295). PR #35774: the refreshed body, the 10-file list, the net diff against main, and the delta e5a7e08b..b9ce479e (8 files, +187/-66; ObjectFieldInspector.tsx and celAuthoring.ts are not in it). The check-runs on the head: 74, of which 63 success and 11 skipped, none failed or pending; Test Core, Test UI and Check Changeset are green. The seat's own delta check on the PR (7035256454) was not read. Code outside the diff was read in the head's tree. Nothing was built or run, so every answer quoted below for a shape no test pins is derived by reading.

Result: PASS. M1, S1, S2, S3 and S4 are closed on this head. Nits only: N1 and N2 stand for their follow-up cards, N3 and N4 are new.

① Derived judgments

  1. inferFormulaReturn: the {} answer is wider than at e5a7e08b, and the number answer strictly narrower. The early return moved from "the unit proof is unproven and a money operand is read" to "the unit proof is not a plain number and some read is not plain" (formula-return.ts:398). Every read the old test counted as a money operand is a non-plain read under the new one, so no source that answered {} at e5a7e08b answers number now. The delta cannot open a wrong number that was not there before; it only removes them. Right.
    • One more FROM/TO follows, and the changeset states it: a call with no field map answers {} for a numeric expression that reads the record (inferFormulaReturn('record.amount * 0.1') was number). No caller on main or in the diff calls it that way: the inspector seam passes the object's field map (celAuthoring.ts:788), and the showcase test passes one and asserts proven money. Right.
  2. The inspector is unchanged in the delta, and a wider {} withdraws nothing. stampFormulaType reads the verdict in two tests, declared?.returnType === 'currency' (ObjectFieldInspector.tsx:1148) and declared?.returnType !== 'number' (:1155), and reads its config only beside a currency answer (:1161). {} and number differ in one place: inside the declared-currency branch, where {} returns before any write. So an answer that moves from number to {} can only turn a withdraw into a keep. In every other declared state the two answers produce the same write, and a declared percent returns at :1146 before either test. Right.
  3. FieldSchema.returnType: JSDoc and .describe() only, as before. The enum is unchanged. The three reference pages carry the new string in all five places. Right.
  4. FormulaSourceField.summaryOperations: unchanged since e5a7e08b; now declared (S4).

② Semver level

  • Levels. Three patches, unchanged and right: the kind is none, and a non-protocol change ships patch whether it widens or not.
  • Clause-②. yes (widening) on the PR body and in the changeset body: right, for the optional member the exported FormulaSourceField gains. The (narrowing) arm is still not owed. The no-field-map change is an answer that says less, on an unchanged signature whose return type already held {}; it carries its FROM/TO.
  • FROM/TO. Present for every answer that moved, the no-field-map call included, with the one-line fix (read inferExpressionType). The two sentences the last record called untrue are gone: "always means" now reads "means", and the count sentence is conditioned on summaryOperations being passed. One list item overstates (N3).
  • Metadata-protocol. none: right, unchanged.
  • For the seat, outside the diff. The claim comment itself (7030625057) still carries the line Clause-②: no. Amendment 2 (7034151496) spells its key Clause-② (amended):. A reader that takes the claim's key line reads no. The PR body and the changeset, which Check Changeset read green, are right.

③ Boundary flags

  • open_questions. Empty in 7035165295. Nothing to answer.
  • Deviation: the optional-spelling pins do not discriminate against e5a7e08b. Accepted, with N3. The reason it is safe is stronger than the one given: these two legs cannot produce a wrong number even if deleted, because the walk then reaches record itself and answers {}. The reason given is incomplete: a discriminating optional shape exists.
  • Deviation: the worktree was recreated and origin/main was not merged this round. A process fact for the seat's ACCEPT. The overlap check is reported clean and the head's check-runs are green.
  • Deviation: check:dts-closure red once during a concurrent build; two families NOT MEASURED locally. Process facts. The check-runs on the head are the gate verdicts, and none failed.
  • Ablations D, E and F were run at ae8b9cf9, one commit before the head. Accepted. ae8b9cf9..b9ce479e touches the changeset, the three reference pages and twelve lines of formula-return.test.ts; the producer, the inspector and the inspector's test are the same blobs, so the three readings hold on the head. One correction to the report's list: D's second red, the no-field-map pin, was that pin's own failure at ae8b9cf9 (it still expected number) and not the ablation's. The last commit retitled it, and Test Core is green on the head.
  • N1 and N2 left untouched, "carrier: none". Right for this PR, as the last record directed. Neither has a card yet; the seat files them.
  • Declared types are trusted, as at e5a7e08b. A number field computed from an amount, a formula declared number (Studio stamps that from the CEL type, also when the money verdict is {}), a formula declared text, a JSON field: each reads as "not money". This was accepted in the last record's ③ and the delta does not move it: the old check asked the same question of a declaration. It is the one way an amount the proof cannot follow is still read as a quantity, one formula further on, and the author's remedy is unchanged: declare the inner formula currency, and the outer one is then proven money.
  • File surface. Unchanged from amendment 1; the delta stays inside the files already named.
  • SQL push-down. None: pure functions over an AST and an in-memory field map.
  • Author. objectstack-fleet[bot]. The PR is still a draft, which is the seat's to change.

④ Design judgment

Routes tried against the new read check. Money can enter an expression only through a read, and the walk visits every node (readsOnlyPlainFields, formula-return.ts:325-335).

Probe Result
A bare identifier naming a declared non-money field No route. A bare NAME is judged as record.NAME is (:333). The only bare identifier that is not a host read is a macro's own variable; see the next row.
A macro read, with the variable named after a declared plain field No route. The variable passes, but its values are the elements of the macro's source, and the source is itself a read the walk judges: a currency field, a hop or a literal list holding an amount fails there. A member read off the variable (q.price) fails because its receiver is not record. No stdlib function folds a list into a number (size and len count; min and max take two values), so a value leaves a macro only through a numeric index, which names no field and answers {}. A count of filtered rows answers number, which is right. An undeclared variable name answers {}: the safe side.
A has() read No route. has(record.x) is a call node holding the selection, so the read is judged like any other. parseCelToAst keeps the authored call and parses it without the lowering the checker needs (the rewriteIndexedHas doc in cel-engine.ts); the lowered form's .? is a member read too. A presence test in a ternary condition is outside the unit proof (branches only), so has(record.amount) ? 1 : 0 answers number: right, it is a flag. has(record.account.balance) ? record.account.balance : 0 answers {}.
A hop in any spelling, a read off previous or another root, a computed key, a read off a literal list or map, a receiver call on record, record passed whole {}. Any member or index node whose receiver is not the identifier record, or whose key is not a literal name, fails without descending (:328-332); a bare record fails at :333.
An inherited name (constructor) {}: own-key test at :296.
The [] spelling Live in both directions: record['amount'] * 0.1 is {} and record['quantity'] * 2 is asserted number (formula-return.test.ts:196, :221).
The .? and [?] spellings Right by reading in both directions; no live pin in either (N3).
A missing AST Falls through to number; not reachable by reading (N4).
{} at the inspector Withdraws nothing (① item 2). What it now keeps that e5a7e08b withdrew is a declared currency over a quantity the check cannot name: through a hop, off another root, at a numeric index, in a macro body (N1). An undeclared one-segment name cannot arise there: the editor lints against the same entries siblingDefs is built from and refuses an unknown name.

Does the producer header say what the code does? Yes (:51-73, and the function doc at :357-366). Does the spec text say what the inspector does? Yes. One pin per shape with a CONTROL? Yes, except the optional spellings (N3). The 24 sources of UNPROVEN_OVER_MONEY are each asserted under their own message.

M1: closed

S1: closed

S2: closed

S3: closed

S4: closed

No must-fix, no should-fix.

  • On M1. number is now answered only when the unit proof is a plain number, or every member, index and bare read names, in one segment off record, a declared field that hasPlainUnit accepts (:295-306). Route (a): the outer read's receiver is a read, not record. Route (b): a formula with no returnType is not plain. Route (c): [], .? and [?] are read as . is (:308-318). Route (d): an undeclared name is not plain, and its old number pin is gone. The pins are formula-return.test.ts:194-202 with both leg shapes, the CONTROLs at :211-222, the retitled no-field-map pin at :140-150, and at the inspector a hand-declared currency over record.subtotal * 0.1 surviving the edit to 0.12 (ObjectFieldInspector.returnTypeHeld-27485.test.tsx:323-329). Ablation D is red on "each answers {}". The header, the function doc and the changeset no longer say more than the code does.
  • On S1. The CONTROL edits to record.est_hours * 3, which differs from the harness default, so the stamp runs (:283-291); ablation E is red on it, on the new percent pin and on both spec: a formula has no percent return type, so a ratio formula (budget used, gross margin) reads as a bare number #35047 pins. The config path has its three pins, USD to EUR, dynamic and record mode (:302-321); ablation F is red on all three.
  • On S2. The JSDoc and the .describe() state the precedence (field.zod.ts:2406-2411): a declared percent is kept under a money verdict and never re-stamped currency. That is what ObjectFieldInspector.tsx:1146 does. Regenerated, and pinned at :293-300 of the harness file.
  • On S3. FormulaReturnDeclaration (formula-return.ts:97-113) says an absent returnType is no verdict and keeps the pair rule to a currency answer. The header says the bare same-currency ratio types dyn and answers {} (:68-73). No text in the file still tells a stamp to clear an absent member.
  • On S4. Clause-②: yes (widening) on the PR body and in the changeset, which names summaryOperations and says a roll-up passed without it, a count included, is read as possibly money.

N1 (nit) — stands, for its follow-up card, and is wider on this head. Besides field-over-field quantity arithmetic and the same-currency ratio, a quantity the read check cannot name answers {}, so an edit from money to record.account.employee_count * 2 keeps currency. This is the safe side of M1's fix and agrees with the published text ("an unproven verdict keeps it"). Proving these needs the related object's fields at the producer.

N2 (nit) — stands unchanged, for a follow-up card or accepted.

N3 (nit) — the optional spellings have no live pin, and two prose faces say they moved. record.?amount * 0.1 and record[?'amount'] * 0.1 multiply an optional, which the checker does not type as a number, so they answer {} on main and on every head, whatever the read check does with them. The repo's usable optional read carries .orValue(…) (validate-field-existence-spellings.test.ts:33-34). By reading, record.?amount.orValue(0) * 0.1 types as a number, answered number at e5a7e08b and answers {} here; record.?quantity.orValue(0) * 2 is the CONTROL that "every spelling" (formula-return.test.ts:217) lacks. Nothing wrong can come of the gap: the only regression such pins would catch is an optional quantity read falling back to {}. The prose: the changeset lists "the indexed and optional spellings" among the answers that moved from number, and the comment at formula-return.test.ts:193 says "each answered number before" over all six shapes. The PR body has it right. Fix the two sentences in place or leave them; the pins go to a follow-up card or are accepted.

N4 (nit) — readsOnlyPlainFields answers true for a missing AST (formula-return.ts:327), so a source the checker typed but parseCelToAst returned null for would fall through to number. By reading, no source gets there: the checker parses the same text under the same limits, and the indexed-has lowering parses the authored form first. Answering {} for a missing AST would make the default fail closed. Follow-up, or accepted.

Implemented-by: claude/issue-35631-inspector-currency-verdict
Reviewed-by: session_01L9qibvVRcFWKrfWeG5jzPb

VERDICT: PASS

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#7 · os-tesla · session_01L9qibvVRcFWKrfWeG5jzPb

Landing (2026-11-20T09:28Z), area d7-C under the standing go-ahead for pm-dispatch-reviewed PRs.

  • L1: ACCEPT 7033709816 at e5a7e08b, delta ACCEPT 7035256454 at b9ce479e (corrects the Clause-② reading to yes (widening)).
  • L2 (CONTRACT_REVIEW_TIER, published-schema face plus the Clause-②: yes (widening) declaration): FAIL 7034135842 at e5a7e08b (M1, S1–S4), delta PASS 7035793960 at b9ce479e; M1 and S1–S4 closed, nits only.
  • Claim: amendments 7033719451 (file surface), 7034151496 and 7035811007 (Clause-②: yes (widening)).
  • Checks at b9ce479e6de7a98539ebcd5cebdb787bc40a471c: 63 success, 11 skipped, 0 failed or pending; mergeable clean; check-governed-merges --pr 35774: NOT governed, 537 lines; landing-k: K = 3.
  • Left for follow-up cards: N1 (an unproven quantity keeps a declared currency), N3 (the optional-spelling pins do not discriminate). N2 and N4 are accepted as they are.
    Marking ready and arming auto-merge.

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review November 20, 2026 09:29
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 20, 2026
Merged via the queue into main with commit 401eb44 Nov 20, 2026
75 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/issue-35631-inspector-currency-verdict branch November 20, 2026 10:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Studio formula inspector: a kept currency return type goes stale when an edit stops computing money

2 participants