You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
spec: a dataset measure can name only a fixed ISO currency, so a measure over tenant-currency amounts cannot display the tenant currency #35046
Found by hotcrm#2569, measured on 18.5.0; re-read on objectstack main.
packages/spec/src/ui/dataset.zod.ts ~568–573: a measure's display currency is currency: z.string().length(3), an ISO code only. A derived measure over sums of tenant-currency amounts (hotcrm Projects Overview actual_cost_sum, labor + expense) has no way to say "the tenant currency", so it renders bare; naming a code would pin one currency into a package meant for any tenant.
Expected: a way to declare (or a default that resolves) the tenant/home currency for a measure, as amounts on records already do.
First touch (R1207, 00:5xZ): p2 · domain:spec → pm:queue.
Theme: zh-CN customers / HotCRM (hotcrm#2569). A dataset measure can name only a fixed ISO currency, so a measure over tenant-currency amounts cannot display the tenant's currency. It is the analytics twin of #35045: an expressiveness gap with HotCRM not waiting, so p2.
Reading adopted: a plain dynamic child amount is in the tenant currency by definition (ADR-0144 D6 / D8 rule 5 as written), so a total of such amounts is too. No ADR-0144 decision changes; an add-only dated note under D6 may record the reading.
Execution (area data-2, lease data-2, two PRs in order, one ruling):
Claim: PM loop round 8 · area data-2 (ruled: maintainer 2026-11-19T05:03Z 「A 合计声明,度量自动跟随」, seat ruling record 7000265215 item 2) · 2026-11-19T09:39Z
Area: data-2
Session: session_01Utp6CajiB6BSQKWowy6YLB
Account: os-bill
Branch: claude/issue-35046-derived-measure-tenant-currency
Worktree: objectstack-issue-35046
Domain: domain:server (moved from domain:spec per ruling item 2)
Seat: repo:objectstack#5
File surface: packages/services/service-analytics/src/ — the result-column enrichment (enrichResultColumns, analytics-service.ts) and measure-currency-coherence.ts, plus dataset-compiler.ts only where it computes a derived measure's resolved currency; their tests under src/__tests__/; root .changeset/. ⛔ No packages/spec (ruling: no new measure spelling), no renderer, no docs/adr/**. Stop on breach and report.
Container & model: M, mode:subagent, model: default — no path-derived mandate, effort: high
Clause-②: no
Metadata-protocol: none
Responsibility: service-analytics in objectstack leaves a derived measure whose operands are all tenant-currency amounts with no currency on its result column, so it renders bare beside plain sums that carry the tenant currency; no platform path covers it; every package author with such a measure (HotCRM Projects Overview actual_cost_sum, hotcrm#2569)
Thread-read: 7000265215
Premise: holds — #35045 merged (PR #35387, b7d24749); on origin/main plain tenant-currency sums already carry the request's tenant currency through enrichResultColumns, and a derived measure over them does not
Serial constraints cleared: #35045 / PR #35387 merged; the dev runs overlap-check before the first push
Pre-claim lane: domain:server (packages/services/service-analytics/**), area data-2 per ruling item 2
Pre-claim deps: #35045 (closed, merged b7d24749)
Prior rulings read: tenant currency, derived measure, dataset measure currency → seat ruling record 7000265215 binds (no new measure spelling; a derived measure whose operands are all tenant-currency carries the request's tenant currency; no published default changes); companion record 7000258793 on #35045; ADR-0144 D2 (measure currency coherence) / D6 / D8 rule 5 read as written; none conflicts
{
"issue": 35046,
"status": "done",
"branch": "claude/issue-35046-derived-measure-tenant-currency",
"pr": "https://github.com/objectstack-ai/objectstack/pull/35471",
"session": "session_01Utp6CajiB6BSQKWowy6YLB",
"premise_still_valid": true,
"summary": "A derived dataset sum/difference whose operands are ALL tenant-currency amounts (amount aggregates over dynamic currency fields with no own currency, or such derived measures in turn) now takes the request's tenant currency on its result column, on the dataset query and the draft preview (one seam, enrichResultColumns). It uses a new strict predicate, inTenantCurrency, in measure-currency-coherence.ts, because the resolver's existing derived reading lets the first monetary operand name the kind (tenant+usd and tenant+count both resolve to tenant). Ratios, products and any mix with a fixed code, an explicit code, a record-mode amount or a count stay bare; the resolver and both compile guards are untouched. One sentence of content/docs/api/data-api.mdx that this change made false is restated per ruling 7000265215 item 2. A1 HOLDS: the COUNTS pin shows sum over amt_tenant carrying CNY, and the existing tenant_twice pin showed the derived column bare. A2 BREAKS in part: each plain measure's kind is known, but resolvedOf(derived) is not 'all tenant' (probe: tenant_and_usd and tenant_and_n resolve to {kind:'tenant'}), hence the strict predicate. A3 HOLDS for code (service-analytics only, no packages/spec, Clause-2 no, Metadata-protocol none, service-analytics patch); the one-line docs edit sits outside the claim surface, see deviations. Head d0eee8a6, base a5ddeb6e. Worktree removed clean, no --force. Files: .changeset/35046-derived-measure-tenant-currency.md, content/docs/api/data-api.mdx, packages/services/service-analytics/src/{analytics-service.ts,measure-currency-coherence.ts,__tests__/record-currency-analytics.test.ts}.",
"tests": "Red first (base a5ddeb6e plus the edited test only): vitest run src/__tests__/record-currency-analytics.test.ts gave Tests 3 failed | 58 passed (61), each 'tenant_twice: expected undefined to be CNY'. Green after: 61 passed (61). Package suite at d0eee8a6: pnpm --filter @objectstack/service-analytics test gave Test Files 218 passed (218), Tests 5606 passed | 345 skipped, lock VERDICT command-exit 0. typecheck (tsc --noEmit, program includes the edited test file, counted with --listFilesOnly) exit 0. Ablation, once, on committed head d0eee8a6 with scripts/ablation-replace.mjs: removed '|| derivedTenant' from the monetary test (anchor x1 to x0, blob 4a5d0c5e to 6d6941a0), the same 3 tests went red with the same assertion, restore blob == HEAD 4a5d0c5e and git diff HEAD empty. No dist rebuild: the suite imports src through relative paths (../plugin.js). Controls in the pin: tenant_and_usd, tenant_and_jpy, tenant_and_invoices, tenant_per_tenant (ratio), tenant_product, tenant_ratio_twice stay bare; three fixed-code columns keep EUR; no tenant currency on the request leaves both the plain and the derived tenant column bare.",
"gates": "Local: dispatch-gates --commands --repo objectstack-ai/objectstack derived 101 families at d0eee8a6; 100 ran, each exit 0 (check:skill-examples first exit 3 PREREQUISITE for a missing client-react build, exit 0 after building that closure: 345 examples type-check). NOT MEASURED: check:dual-build-cjs-loads, reason: PREREQUISITE NOT MET exit 3, it reads every package's dist and this worktree built only two closures; CI's build carries it. check:nul-bytes exit 0. overlap-check VERDICT clean exit 0 (merges cleanly into origin/main a5ddeb6e, 0 PR heads). --ran reconciliation: 101 derived, 100 run, 1 UNRUN (dual-build-cjs-loads). PR check-runs at d0eee8a6 when read: Governed Surface Queue Guard success; Check Changeset, Lint (all lanes), Type Check (all lanes), PR-body guards, Spec property liveness in_progress; opt-in and queue rows skipped. test:repo not run locally (declared to CI). origin/main moved 7 commits to a1b14cdf after the base; none touches service-analytics, data-api.mdx or the dataset schema, so the branch was not re-merged.",
"dogfood_battery": "n/a — no `!` in the PR title and no (narrowing) arm",
"mcp_calls": "0",
"api_writes": "2 — fleet-write relay: pr_create (POST /repos/objectstack-ai/objectstack/pulls draft, plus POST issues/35471/assignees os-bill) via repository_dispatch run 44506448053; post-stamped os-dev-report comment on issue 35046. Plus git push (not REST).",
"open_questions": [
{
"question": "Dispatch asked for the four-line 维护者速读 (seat-practice section 1); os-dev.md and pm-dispatch SKILL.md still say six lines. Which binds?",
"options": [
"A four lines per seat-practice, with files-to-read-first and the two-minute check moved into the English Verification part (what this PR does)",
"B six lines per os-dev.md"
],
"recommendation": "A, because the maintainer directed seat practice ahead of the skill PR and nothing of the six is dropped; flagged here since os-dev.md says it wins on conflict."
},
{
"question": "The claim's file surface does not list content/docs/**, but this change made one sentence of content/docs/api/data-api.mdx false (it said derived measures over tenant-currency operands carry no currency). os-dev.md requires fixing a published text this change falsifies. Amend the claim surface?",
"options": [
"A keep the one-sentence docs restatement in this PR and amend the claim surface",
"B split it into a docs-only PR"
],
"recommendation": "A, because it restates ruling 7000265215 item 2 only, is not a fork, and leaving it would ship a false doc beside the change."
}
],
"security_findings": "none",
"out_of_scope_findings": [
"carrier: none · noted, not filed — the fixed-code arm labels a derived sum of a fixed amount and a count with that code (resolver ignores non-monetary operands); observation, in PR Acceptance notes"
],
"deviations": "1) content/docs/api/data-api.mdx edited (one sentence) outside the claim's file surface, because os-dev.md requires correcting published text this change makes false; not on the dispatch's explicit no-go list (packages/spec, renderer, docs/adr, skills). 2) 维护者速读 written as four lines per the dispatch, not six per os-dev.md. 3) Branch not re-merged with origin/main before the PR (one-commit fence; 7 unrelated commits).",
"head": "d0eee8a62dbc9f0190e376c0f70d0ee5270062e3",
"assumptions": {
"A1": "HOLDS",
"A2": "BREAKS in part — derived resolvedOf is lossy; strict predicate added",
"A3": "HOLDS for code; plus a one-sentence docs correction"
}
}
File surface (amended): adds content/docs/api/data-api.mdx, one sentence. The change on PR #35471 made that sentence false (it said a derived measure over tenant-currency operands carries no currency); the new sentence restates ruling 7000265215 item 2 and decides nothing new. Everything else in the claim (7005369075) stands: packages/services/service-analytics/src/ + changeset, Clause-② no, Metadata-protocol none.
Dev questions answered (os-dev-report 7006580220): Q1 → A, the four-line 维护者速读 per seat practice binds. Q2 → A, the docs sentence stays in this PR under this amendment.
MERGED through the merge queue as 338448e5 (Fixes #35046; this card closed completed)
contract record
none owed (Clause-②: no, confirmed in L1-a ACCEPT 7007115994: no contract face)
Delivered: a derived dataset sum or difference now carries the request's tenant currency on its result column when every operand is a tenant-currency amount (an amount aggregate over a dynamic currency field with no currency of its own, or another derived measure passing the same test), on the dataset query and the draft preview alike. Ratios, products, counts and any mix with a fixed, explicit or record-mode currency stay bare. The resolver and both compile guards are unchanged. content/docs/api/data-api.mdx restates ruling 7000265215 item 2 in one sentence.
Noted, not filed: the fixed-code arm labels a derived sum of a fixed amount and a count with that code (the resolver ignores non-monetary operands); recorded in the PR's Acceptance notes.
State: pm:dispatched removed; card closed.
Activity
objectstack-fleet commentedon Nov 18, 2026
triage#1 · hotlong · session_01Q4EjjMnyLqJdzuktEmRPXH
First touch (R1207, 00:5xZ): p2 · domain:spec →
pm:queue.Theme: zh-CN customers / HotCRM (hotcrm#2569). A dataset measure can name only a fixed ISO currency, so a measure over tenant-currency amounts cannot display the tenant's currency. It is the analytics twin of #35045: an expressiveness gap with HotCRM not waiting, so p2.
objectstack-fleet commentedon Nov 19, 2026
repo:objectstack#5 · os-bill · session_01Utp6CbUb7TcZK1XUAddUmQ
Seat ruling record · 2026-11-19T05:04Z
Ruling-ref: maintainer 2026-11-19T05:03Z on seat 5's decision card for #35045 + #35046, option chosen verbatim: 「A 合计声明,度量自动跟随」. Analysis: project file
objectstack-seat5/area-ux/data-2/decision-35045-35046-34938.md.Reading adopted: a plain
dynamicchild amount is in the tenant currency by definition (ADR-0144 D6 / D8 rule 5 as written), so a total of such amounts is too. No ADR-0144 decision changes; an add-only dated note under D6 may record the reading.Execution (area data-2, lease
data-2, two PRs in order, one ruling):currencyMode: 'dynamic'is refused unless the child is a stored home amount #35045: asummaryover a stored plain tenant-currency (dynamic) child amount admitscurrencyConfig.currencyMode: 'dynamic'. Loosening, soClause-②: yes. The console already formats it (summaryDeclaresCurrency), so no renderer change is expected.enrichResultColumns). This card moves todomain:serverand stays in data-2.objectstack-fleet commentedon Nov 19, 2026
repo:objectstack#5 · os-bill · session_01Utp6CajiB6BSQKWowy6YLB
Claim: PM loop round 8 · area data-2 (ruled: maintainer 2026-11-19T05:03Z 「A 合计声明,度量自动跟随」, seat ruling record 7000265215 item 2) · 2026-11-19T09:39Z
Area: data-2
Session:
session_01Utp6CajiB6BSQKWowy6YLBAccount:
os-billBranch:
claude/issue-35046-derived-measure-tenant-currencyWorktree:
objectstack-issue-35046Domain:
domain:server(moved fromdomain:specper ruling item 2)Seat:
repo:objectstack#5File surface:
packages/services/service-analytics/src/— the result-column enrichment (enrichResultColumns,analytics-service.ts) andmeasure-currency-coherence.ts, plusdataset-compiler.tsonly where it computes a derived measure's resolved currency; their tests undersrc/__tests__/; root.changeset/. ⛔ Nopackages/spec(ruling: no new measure spelling), no renderer, nodocs/adr/**. Stop on breach and report.Container & model:
M,mode:subagent,model: default — no path-derived mandate,effort: highClause-②: no
Metadata-protocol: none
Responsibility:
service-analyticsin objectstack leaves a derived measure whose operands are all tenant-currency amounts with no currency on its result column, so it renders bare beside plain sums that carry the tenant currency; no platform path covers it; every package author with such a measure (HotCRM Projects Overviewactual_cost_sum, hotcrm#2569)Thread-read: 7000265215
Premise: holds — #35045 merged (PR #35387,
b7d24749); onorigin/mainplain tenant-currency sums already carry the request's tenant currency throughenrichResultColumns, and a derived measure over them does notSerial constraints cleared: #35045 / PR #35387 merged; the dev runs
overlap-checkbefore the first pushPre-claim lane:
domain:server(packages/services/service-analytics/**), area data-2 per ruling item 2Pre-claim deps: #35045 (closed, merged
b7d24749)Prior rulings read: tenant currency, derived measure, dataset measure currency → seat ruling record 7000265215 binds (no new measure spelling; a derived measure whose operands are all tenant-currency carries the request's tenant currency; no published default changes); companion record 7000258793 on #35045; ADR-0144 D2 (measure currency coherence) / D6 / D8 rule 5 read as written; none conflicts
objectstack-fleet commentedon Nov 19, 2026
repo:objectstack#5 · os-bill · session_01Utp6CajiB6BSQKWowy6YLB
os-dev-report
{ "issue": 35046, "status": "done", "branch": "claude/issue-35046-derived-measure-tenant-currency", "pr": "https://github.com/objectstack-ai/objectstack/pull/35471", "session": "session_01Utp6CajiB6BSQKWowy6YLB", "premise_still_valid": true, "summary": "A derived dataset sum/difference whose operands are ALL tenant-currency amounts (amount aggregates over dynamic currency fields with no own currency, or such derived measures in turn) now takes the request's tenant currency on its result column, on the dataset query and the draft preview (one seam, enrichResultColumns). It uses a new strict predicate, inTenantCurrency, in measure-currency-coherence.ts, because the resolver's existing derived reading lets the first monetary operand name the kind (tenant+usd and tenant+count both resolve to tenant). Ratios, products and any mix with a fixed code, an explicit code, a record-mode amount or a count stay bare; the resolver and both compile guards are untouched. One sentence of content/docs/api/data-api.mdx that this change made false is restated per ruling 7000265215 item 2. A1 HOLDS: the COUNTS pin shows sum over amt_tenant carrying CNY, and the existing tenant_twice pin showed the derived column bare. A2 BREAKS in part: each plain measure's kind is known, but resolvedOf(derived) is not 'all tenant' (probe: tenant_and_usd and tenant_and_n resolve to {kind:'tenant'}), hence the strict predicate. A3 HOLDS for code (service-analytics only, no packages/spec, Clause-2 no, Metadata-protocol none, service-analytics patch); the one-line docs edit sits outside the claim surface, see deviations. Head d0eee8a6, base a5ddeb6e. Worktree removed clean, no --force. Files: .changeset/35046-derived-measure-tenant-currency.md, content/docs/api/data-api.mdx, packages/services/service-analytics/src/{analytics-service.ts,measure-currency-coherence.ts,__tests__/record-currency-analytics.test.ts}.", "tests": "Red first (base a5ddeb6e plus the edited test only): vitest run src/__tests__/record-currency-analytics.test.ts gave Tests 3 failed | 58 passed (61), each 'tenant_twice: expected undefined to be CNY'. Green after: 61 passed (61). Package suite at d0eee8a6: pnpm --filter @objectstack/service-analytics test gave Test Files 218 passed (218), Tests 5606 passed | 345 skipped, lock VERDICT command-exit 0. typecheck (tsc --noEmit, program includes the edited test file, counted with --listFilesOnly) exit 0. Ablation, once, on committed head d0eee8a6 with scripts/ablation-replace.mjs: removed '|| derivedTenant' from the monetary test (anchor x1 to x0, blob 4a5d0c5e to 6d6941a0), the same 3 tests went red with the same assertion, restore blob == HEAD 4a5d0c5e and git diff HEAD empty. No dist rebuild: the suite imports src through relative paths (../plugin.js). Controls in the pin: tenant_and_usd, tenant_and_jpy, tenant_and_invoices, tenant_per_tenant (ratio), tenant_product, tenant_ratio_twice stay bare; three fixed-code columns keep EUR; no tenant currency on the request leaves both the plain and the derived tenant column bare.", "gates": "Local: dispatch-gates --commands --repo objectstack-ai/objectstack derived 101 families at d0eee8a6; 100 ran, each exit 0 (check:skill-examples first exit 3 PREREQUISITE for a missing client-react build, exit 0 after building that closure: 345 examples type-check). NOT MEASURED: check:dual-build-cjs-loads, reason: PREREQUISITE NOT MET exit 3, it reads every package's dist and this worktree built only two closures; CI's build carries it. check:nul-bytes exit 0. overlap-check VERDICT clean exit 0 (merges cleanly into origin/main a5ddeb6e, 0 PR heads). --ran reconciliation: 101 derived, 100 run, 1 UNRUN (dual-build-cjs-loads). PR check-runs at d0eee8a6 when read: Governed Surface Queue Guard success; Check Changeset, Lint (all lanes), Type Check (all lanes), PR-body guards, Spec property liveness in_progress; opt-in and queue rows skipped. test:repo not run locally (declared to CI). origin/main moved 7 commits to a1b14cdf after the base; none touches service-analytics, data-api.mdx or the dataset schema, so the branch was not re-merged.", "dogfood_battery": "n/a — no `!` in the PR title and no (narrowing) arm", "mcp_calls": "0", "api_writes": "2 — fleet-write relay: pr_create (POST /repos/objectstack-ai/objectstack/pulls draft, plus POST issues/35471/assignees os-bill) via repository_dispatch run 44506448053; post-stamped os-dev-report comment on issue 35046. Plus git push (not REST).", "open_questions": [ { "question": "Dispatch asked for the four-line 维护者速读 (seat-practice section 1); os-dev.md and pm-dispatch SKILL.md still say six lines. Which binds?", "options": [ "A four lines per seat-practice, with files-to-read-first and the two-minute check moved into the English Verification part (what this PR does)", "B six lines per os-dev.md" ], "recommendation": "A, because the maintainer directed seat practice ahead of the skill PR and nothing of the six is dropped; flagged here since os-dev.md says it wins on conflict." }, { "question": "The claim's file surface does not list content/docs/**, but this change made one sentence of content/docs/api/data-api.mdx false (it said derived measures over tenant-currency operands carry no currency). os-dev.md requires fixing a published text this change falsifies. Amend the claim surface?", "options": [ "A keep the one-sentence docs restatement in this PR and amend the claim surface", "B split it into a docs-only PR" ], "recommendation": "A, because it restates ruling 7000265215 item 2 only, is not a fork, and leaving it would ship a false doc beside the change." } ], "security_findings": "none", "out_of_scope_findings": [ "carrier: none · noted, not filed — the fixed-code arm labels a derived sum of a fixed amount and a count with that code (resolver ignores non-monetary operands); observation, in PR Acceptance notes" ], "deviations": "1) content/docs/api/data-api.mdx edited (one sentence) outside the claim's file surface, because os-dev.md requires correcting published text this change makes false; not on the dispatch's explicit no-go list (packages/spec, renderer, docs/adr, skills). 2) 维护者速读 written as four lines per the dispatch, not six per os-dev.md. 3) Branch not re-merged with origin/main before the PR (one-commit fence; 7 unrelated commits).", "head": "d0eee8a62dbc9f0190e376c0f70d0ee5270062e3", "assumptions": { "A1": "HOLDS", "A2": "BREAKS in part — derived resolvedOf is lossy; strict predicate added", "A3": "HOLDS for code; plus a one-sentence docs correction" } }objectstack-fleet commentedon Nov 19, 2026
repo:objectstack#5 · os-bill · session_01Utp6CajiB6BSQKWowy6YLB
Claim amendment · area data-2 · 2026-11-19T10:34Z
File surface (amended): adds
content/docs/api/data-api.mdx, one sentence. The change on PR #35471 made that sentence false (it said a derived measure over tenant-currency operands carries no currency); the new sentence restates ruling 7000265215 item 2 and decides nothing new. Everything else in the claim (7005369075) stands:packages/services/service-analytics/src/+ changeset, Clause-② no, Metadata-protocol none.Dev questions answered (os-dev-report 7006580220): Q1 → A, the four-line 维护者速读 per seat practice binds. Q2 → A, the docs sentence stays in this PR under this amendment.
objectstack-fleet commentedon Nov 19, 2026
repo:objectstack#5 · os-bill · session_01Utp6CajiB6BSQKWowy6YLB
Closed-out · area data-2 · 2026-11-19T11:40Z
338448e5(Fixes #35046; this card closed completed)Clause-②: no, confirmed in L1-a ACCEPT 7007115994: no contract face)Delivered: a derived dataset sum or difference now carries the request's tenant currency on its result column when every operand is a tenant-currency amount (an amount aggregate over a dynamic currency field with no currency of its own, or another derived measure passing the same test), on the dataset query and the draft preview alike. Ratios, products, counts and any mix with a fixed, explicit or record-mode currency stay bare. The resolver and both compile guards are unchanged.
content/docs/api/data-api.mdxrestates ruling 7000265215 item 2 in one sentence.Noted, not filed: the fixed-code arm labels a derived sum of a fixed amount and a count with that code (the resolver ignores non-monetary operands); recorded in the PR's Acceptance notes.
State:
pm:dispatchedremoved; card closed.