Repository navigation
fix(app-shell): the formula inspector asks inferFormulaReturn before it keeps a currency result type - #35774
Conversation
…rency verdict Claude-Session: https://claude.ai/code/session_01L9qibvVRcFWKrfWeG5jzPb Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L9qibvVRcFWKrfWeG5jzPb Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L9qibvVRcFWKrfWeG5jzPb Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L9qibvVRcFWKrfWeG5jzPb Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L9qibvVRcFWKrfWeG5jzPb Co-authored-by: Claude <noreply@anthropic.com>
📓 Docs Drift CheckThis PR changes 2 package(s): 16 hand-written doc(s) name something this change touched — list omitted above 15 rows. Re-derive on the tree named below: ⛔ 7 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 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
|
…spector-currency-verdict
…er number Claude-Session: https://claude.ai/code/session_01L9qibvVRcFWKrfWeG5jzPb Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L9qibvVRcFWKrfWeG5jzPb Co-authored-by: Claude <noreply@anthropic.com>
… read Claude-Session: https://claude.ai/code/session_01L9qibvVRcFWKrfWeG5jzPb Co-authored-by: Claude <noreply@anthropic.com>
|
repo:objectstack#7 · os-tesla · session_01L9qibvVRcFWKrfWeG5jzPb Final green head: |
|
repo:objectstack#7 · os-tesla · session_01L9qibyQBB3KuDoNobNq9LH Seat checkL1: ACCEPT (L1-a, for area d7-C) at head
Owed before landing (a record, not code)Amend the claim's file surface. Claim 7030625057 names
The dev reports explain each widening (7032209353, 7033149333), and each is needed by the fix:
But the claim is what other seats' pre-claim and overlap checks read, and Your ruling A:
|
|
repo:objectstack#7 · os-tesla · session_01L9qibvVRcFWKrfWeG5jzPb Contract reviewServed-tier: 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 Result: FAIL on M1. Open on this head: M1, S1, S2, S3, S4. ① Derived judgments
② Semver level
③ Boundary flags
④ Design judgmentWhat was tried, and what held.
Does the spec text say exactly what the inspector does? Yes, except for 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 M1 (must-fix) — a
In Studio, (a), (b) and (c) lint clean ( This is the round-1 question on more routes, and ruling A already answers it: the producer makes Fix: on the numeric path, answer S1 (should-fix) — the card's CONTROL cannot fail, and the config-update path has no pin.
S2 (should-fix) — the spec text does not say what the inspector does with a declared S3 (should-fix) — the producer's own type doc now prescribes the opposite of the ruling. N1 (nit) — for a follow-up card, not this PR. The producer holds the proof (dimension 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 ( Implemented-by: 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>
|
repo:objectstack#7 · os-tesla · session_01L9qibyQBB3KuDoNobNq9LH Seat check (delta)L1: ACCEPT (L1-a, for area d7-C) at head Two conditions remain:
Correction to my ACCEPT 7033709816. I wrote that " Each finding, closed
Changeset, sentence by sentence (the moved paragraphs)
N1 / N2N1 (field-over-field quantities type Gates and routingAfter CI is green and the delta L2 PASSes on Generated by Claude Code |
|
repo:objectstack#7 · os-tesla · session_01L9qibvVRcFWKrfWeG5jzPb Contract reviewServed-tier: Read: this is the delta review against the record at 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
② Semver level
③ Boundary flags
④ Design judgmentRoutes tried against the new read check. Money can enter an expression only through a read, and the walk visits every node (
Does the producer header say what the code does? Yes ( M1: closed S1: closed S2: closed S3: closed S4: closed No must-fix, no should-fix.
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 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. N4 (nit) — Implemented-by: VERDICT: PASS |
|
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.
|
repo:objectstack#7 · os-tesla · session_01L9qibvVRcFWKrfWeG5jzPb
Requested by Tesla · project thread
Fixes #35631
Clause-②: yes (widening)
Metadata-protocol: none
维护者速读
What changes
settleFormulaTypein the Studio field inspector now asks the engine'sinferFormulaReturn(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:returnType: 'currency'with the provencurrencyConfig(absent for the tenant default currency), also on a formula that wasnumber.numberanswer withdraws a declaredcurrency:returnTypebecomesnumberand the stalecurrencyConfigis removed (the producer's contract informula-return.ts: the declaration is the pair, and an absent member is cleared).{}: a field-over-field quotient, two currencies meeting) keeps a declaredcurrency, as before. An engine without the export gives no money verdict and also keeps it.percentis 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 anumberor unproven verdict, and a money verdict too (never re-stampedcurrency; the spec text now says so). A text, boolean or date verdict still stamps, and now also clears a stalecurrencyConfig.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 ate5a7e08b): anumberanswer 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 barex. Only then does the CEL inference answer.Unproven, measured, with the answer at
e5a7e08bin brackets:record.account.balance * 0.9[number];returnType,record.subtotal * 0.2[number];record['amount'] * 0.1[number];record.unknown_field * 2[number];record.?amount * 0.1andrecord[?'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 declaredcurrency) and100 / amount(a bare identifier).CONTROLs that still answer
number: declared quantities in any spelling (record['quantity'] * 2, a barequantity * 2), a percent field, a formula declaringnumber, and acountroll-up whosesummaryOperationsis 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 wasnumber. A bare same-currency ratio (record.amount / record.tax) is proven plain, but cel-js types itdyn, so it answers{}as before.FormulaSourceFieldgains the optional membersummaryOperations(a widening, henceClause-②: yes (widening)). A roll-up passed without it, acountincluded, is read as possibly money.The header, the
FormulaReturnDeclarationdoc (an absentreturnTypeis no verdict; the pair rule coverscurrencyConfigbeside acurrencyanswer) and the function doc say exactly this. Runtime callers onmain: only the inspector, plus the showcase testmoney-format-declarations(proven money, unchanged, green).packages/spec/src/data/field.zod.ts: thereturnTypeJSDoc and.describe()said a declaredcurrencysurvives anumberverdict. That is no longer true, so the prose now restates the card's ruling (the Done-when on #35631):currencyis stamped when money is proven and withdrawn fornumber, an unproven verdict keeps it, and a declaredpercentis kept under a money verdict. The generatedcontent/docs/referencespages were regenerated withgen:docs. Prose only: no key, value or shape changes.Files to read first, by risk:
ui/packages/app-shell/src/views/metadata-admin/inspectors/ObjectFieldInspector.tsx:settleFormulaType/stampFormulaType(the async hand-off and the decision order).ui/packages/app-shell/src/views/metadata-admin/celAuthoring.ts:inferFormulaReturnDeclaration(feature-detected, error-swallowing,nullmeans no verdict).packages/formula/src/formula-return.ts:hasPlainUnit/readsOnlyPlainFields/memberReadand 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 theobjectstack#35631describe. 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, unstubbedinferFormulaReturn:record.amount * 0.1torecord.est_hours * 2) dropscurrencyandcurrencyConfig;currencyand{ fixed, USD };numberformula edited into money is stampedcurrencywith the source's config;currency;record.total * 0.9) is unproven and keeps a declaredcurrency;100 / record.amount, verdict{}) is still stampednumberfrom 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;percentis kept under anumberverdict. The edit is now to a different quantity expression (record.est_hours * 3); the old one equalled the harness default, so no stamp ran;percentedited torecord.amount * 0.2(a money verdict) stayspercent;currencyover a formula with noreturnTypesurvivesrecord.subtotal * 0.1to* 0.12(route b; it was withdrawn ate5a7e08b);currencyand 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 noreturnType, the three other spellings, an undeclared name) and one shape per leg (100 / record.weighted,100 / amount). CONTROLs: proven money still stampscurrencywith its config; quantities in every spelling, a percent field and anumberformula still answernumber; acountroll-up still answersnumber. 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,numberfor a constant.The existing pin "a
numberverdict keeps a declaredcurrencytoo" is renamed to say it runs with no money verdict from the engine. It holds unchanged.Readings at the final head
b9ce479eunless named:Test runs
@objectstack/formulatest: Test Files 69 passed (69), Tests 1906 passed (1906).typecheck: exit 0 (atae8b9cf9, producer source unchanged since).column-identity.ratchet.test.ts, run with@objectstack/formularebuilt 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-showcasemoney-format-declarations.test.ts: 5 passed.@objectstack/specformula-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.Ablations (scripts/ablation-replace.mjs; each leg landed on disk and was restored to blob == HEAD with an empty git diff HEAD)
false. Red: "a number formula edited into money is stamped currency".hasPlainUnitread a formula with noreturnTypeas plain (return field.returnType !== 'currency'), blob 61722a6b to 7b5806c3. Red: "each answers {}" (record.subtotal * 0.2) and the no-field-map pin.stampFormulaTyperemoved, 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.sameFlatRecord(...)totrue), blob 80b3157e to d6c9c6f3. Red: the USD-to-EUR, dynamic and record-mode pins.Acceptance notes
e5a7e08b(FAIL): M1 and S1 to S4 are fixed here. N1 and N2 are left for follow-up cards, as directed.record.?amountandrecord[?'amount']answered{}ate5a7e08btoo: 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.{}for a money-reaching expression it cannot prove, so a currency formula over a roll-up keeps its declaredcurrencyon edit. Before, it was withdrawn on anumberanswer.count(record.lines)answers{}(unproven:countis not a CEL function the checker types), so a declaredcurrencyis kept for that exact text. The pins use a typed count (record.est_hours * 2), which answersnumber.currencyConfigand clears one that is absent. AcurrencyConfigthe 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.@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 touchespackages/spec/src/**, so an L2 record is owed.Verification
Local gates at b9ce479
node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack: 117 families.--ranreconciliation: 117 of 117 accounted for, exit 0.check:dts-closurewent 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-examplesanswered exit 3 before the client packages were built; re-run after: exit 0, 346 examples.check-plugin-teardown-shape --self-test(shallow clone) andcheck: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.