Skip to content

spec: a formula has no percent return type, so a ratio formula (budget used, gross margin) reads as a bare number #35047

Closed
1 of 2 issues completed

Description

@objectstack-fleet

repo:hotcrm#1 · huangyiirene · session_01J8VVAnPkgK6CWrJa6t7Fk5

Found by hotcrm#2569, measured on 18.5.0; re-read on objectstack main.

packages/spec/src/data/field.zod.ts:2384: returnType: z.enum(['number', 'text', 'boolean', 'date', 'currency']). A formula that computes a percentage (hotcrm budget_used_pct, gross_margin_pct on the project) reads 0.0 / 100.0 with no %, beside stored percent fields that render with the sign.

Expected: returnType: 'percent' (rendered like a percent field, with its scale), or an equivalent display hint on formula fields.


Generated by Claude Code

Sub-issues

Sub-issues

1 of 2 Issues completed
Loading 2 sub-issues

Activity

  1. objectstack-fleet commented on Nov 18, 2026

    @objectstack-fleet
    ContributorAuthor

    triage#1 · hotlong · session_01Q4EjjMnyLqJdzuktEmRPXH

    First touch (R1207, 00:5xZ): p2 · domain:spec → pm:queue.

    Theme: zh-CN customers / HotCRM (hotcrm#2569). A formula has no percent return type, so ratio formulas (budget used, gross margin) read as bare numbers. A new capability with HotCRM not waiting, so p2.

  2. added
    domain:spec
    pm:queue
    priority:p2
    on Nov 18, 2026
  3. objectstack-fleet commented on Nov 19, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#5 · os-bill · session_01Utp6CajiB6BSQKWowy6YLB

    Claim: PM loop round 5 · area data-2 · 2026-11-19T07:44Z
    Area: data-2
    Session: session_01Utp6CajiB6BSQKWowy6YLB
    Account: os-bill
    Branch: claude/issue-35047-formula-percent-return
    Worktree: objectstack-issue-35047
    Domain: domain:spec
    Seat: repo:objectstack#5
    File surface: packages/spec/src/data/field.zod.ts (returnType enum + its describe; the formula/percent scale rule), every reader that switches on a formula's returnType (spec, packages/objectql / formula typing if any, ui/packages/fields renderer, ui/packages/app-shell metadata-admin options and their zh-CN labels), generated reference pages and api-surface artefacts, tests, content/docs pages that list the return types, root .changeset/. ⛔ No docs/adr/**, no skills/** (follow-up owed if a skill lists return types). Stop on breach and report.
    Container & model: M, mode:subagent, model: default — no path-derived mandate, effort: high
    Clause-②: yes (widening)
    Metadata-protocol: added
    Responsibility: packages/spec in objectstack has no percent formula return type, so a ratio formula (budget used, gross margin) renders as a bare number beside stored percent fields; no platform path covers it; every package author with a ratio formula (HotCRM budget_used_pct, gross_margin_pct)
    Thread-read: 6965497509
    Premise: holds — on origin/main: field.zod.ts returnType: z.enum(['number', 'text', 'boolean', 'date', 'currency'])
    Serial constraints cleared: PR #35387 (#35045, same area) edits field.zod.ts's currencyConfig describe, not the returnType line; overlap-check decides at push
    Pre-claim lane: domain:spec (packages/spec/** + its ui readers, kept in lane under area-lease 留道)
    Pre-claim deps: none named
    Prior rulings read: formula, returnType, percent, scale → #22727 (currency return type added with one shared config shape) is the precedent to mirror; ADR-0079 reads returnType for display-name eligibility (percent must be classed like number there); no ruling refuses a percent return type

  4. added
    pm:dispatched
    and removed
    pm:queue
    on Nov 19, 2026
  5. objectstack-fleet commented on Nov 19, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#5 · os-bill · session_01Utp6CajiB6BSQKWowy6YLB

    Claim released · area data-2 · 2026-11-19T15:26Z

    The maintainer handed the data area to a new seat; area data-2 releases this card unstarted on the platform (no commit, no PR). Back to pm:queue, unassigned, for the new seat.

    Handover: the dev finished the work, but its commit was refused by the session's command classifier before any push. The branch claude/issue-35047-formula-percent-return exists on the remote at a main commit with no commits of its own. The finished diff is saved as the project file objectstack-seat5/area-ux/data-2/wip-35047.patch (applies to the main of its day; re-read against the current main before reuse). The dev's report and the claim above on this thread carry the design; nothing in the patch has been reviewed.

  6. added
    pm:queue
    and removed
    pm:dispatched
    on Nov 19, 2026
  7. objectstack-fleet commented on Nov 19, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#5 · os-bill · session_01Utp6CajiB6BSQKWowy6YLB

    Release withdrawn · area data-2 · 2026-11-19T15:28Z

    The release above is withdrawn: the maintainer asked in the area thread to re-claim this card and to commit it to its card branch and open a draft PR. The original claim on this thread stands unchanged (Area, Branch, File surface, declarations). Area data-2 finishes it: commit, draft PR, review, landing and close-out.

  8. added
    pm:dispatched
    and removed
    pm:queue
    on Nov 19, 2026
  9. objectstack-fleet commented on Nov 19, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#5 · os-bill · session_01Utp6CajiB6BSQKWowy6YLB
    os-dev-report

    {
      "issue": 35047,
      "status": "done",
      "branch": "claude/issue-35047-formula-percent-return",
      "pr": "https://github.com/objectstack-ai/objectstack/pull/35565",
      "session": "session_01Utp6CajiB6BSQKWowy6YLB",
      "premise_still_valid": true,
      "summary": "Round 2 on draft PR #35565, head 2cafa561fd. One new commit, docs only: content/docs/data-modeling/formulas.mdx and field-types.mdx now list 'percent' wherever they enumerate a formula returnType. Each states the convention from the field.zod.ts describe: a fraction (0.25 shows 25%, so the expression divides) unless the formula declares max above 1, then percentage points; scale counts the decimal places of the displayed percentage (absent: 0); percentDisplay picks bar or plain; declared, never inferred. field-types.mdx's Console paragraph also says percent is drawn as a percent field draws it. Feature semantics unchanged; no content/docs/releases, skills or docs/adr edits; PR body not touched. overlap-check is clean against origin/main de395b428d and the two open PRs that share files (#35510, #34817).",
      "tests": "All at head 2cafa561fd under os-verify-lock (slot issue-35047-dev). Touched test files: spec 4 files, 83/83 tests; objectql engine-formula-scale 28/28; lint validate-predicate-path-refs 62/62; service-analytics formula-return-type-measure 10/10; @object-ui/fields formulaFaces.returnType-11748 115/115; @object-ui/app-shell ObjectFieldInspector.returnTypeHeld-27485 6/6. Lock VERDICT command-exit 0. Full suites: @objectstack/spec test, Test Files 856 passed + 1 skipped (857), Tests 27395 passed; @objectstack/objectql test, Test Files 616/616, Tests 13911/13911. Lock VERDICT command-exit 0. Typecheck: spec, objectql, lint, service-analytics typecheck and @object-ui/fields and @object-ui/app-shell type-check all exited 0 (lock VERDICT command-exit 0). The first typecheck attempt exited 2 for every package except spec with TS7016: the existing dist had been built without declarations. That run measured nothing. After a declaration build of the 71-package dependency closure (pnpm --workspace-concurrency=2, filters objectql/service-analytics/lint/app-shell/fields dependencies plus spec; lock VERDICT command-exit 0), all six exited 0. Ablation: not applicable; this round changes only docs and no tested behaviour.",
      "gates": "Local: node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack derived 128 families at 2cafa561fd. All 128 ran, each exit code captured before any pipe. On the first pass, 9 exited 1 or 3 because spec and its dependencies had no .d.ts on disk: ui vitest scripts/, spec check:api-surface, check:dual-source-exports, check:entry-nameability, check:exported-any, check:generated, check:skill-examples, check:dts-closure, check:dual-build-cjs-loads. After the declaration build all 9 exited 0, including check:generated ('All 14 generated artifacts are up to date') and ui scripts 171 passed + 2 skipped. dispatch-gates --ran with per-command exit codes: 128 derived, 128 run, 0 NOT-MEASURED, 0 UNRUN (a derived zero). check:docs-spec-enumerations, check:doc-formula-expressions, check:i18n and check:nul-bytes exit 0. Local-only families: check:skill-frame-freshness exit 0. check:dev-prereqs exit 1: 9 of 108 workspace packages have no dist, ui leaves outside this closure such as @object-ui/app-shell and @object-ui/cli. That is a reading of this box's build state, not of the diff. CI on head 2cafa561fd: 70 check-runs, 61 success and 9 skipped, none red. Required contexts: Lint & Repo Gates success, TypeScript Type Check success, Test Core success, Build Core success, Governed Surface Queue Guard success, Lint UI success, Type Check UI success, Test UI success, Build & E2E UI success, Live E2E UI success, Dogfood Regression Gate success. Also Check Changeset success, Flag docs affected by code changes success, Build Docs success.",
      "dogfood_battery": "n/a: the PR title has no '!' and the Clause-2 declaration is yes (widening), with no (narrowing) arm",
      "mcp_calls": "0",
      "api_writes": "1: this os-dev-report comment on #35047 through post-stamped.mjs (relay route); plus one git push of 2cafa561fd to the card branch (not a REST write)",
      "open_questions": [],
      "security_findings": "none",
      "out_of_scope_findings": [
        "carrier: seat (fenced follow-up, not filed). skills/objectstack-data/rules/field-types.md line 130 lists formula returnType as number, text, boolean, date, currency and omits percent. Published skill prose, so it falls under this order's skills/** fence and is named here for a skills-lane follow-up. Dedupe words: skills field-types returnType percent; formula return types skill",
        "carrier: none (noted, not filed). field-types.mdx's 'In the Console' paragraph also does not say how a currency formula is drawn. That gap is older than this card and outside its scope; this round added only the percent clause"
      ]
    }
  10. objectstack-fleet commented on Nov 19, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#5 · os-bill · session_01Utp6CajiB6BSQKWowy6YLB

    Claim amendment · area data-2 · 2026-11-19T17:22Z

    File surface (amended): adds packages/lint/src/validate-predicate-path-refs.test.ts. Its shipped-predicate census counts == / != literal comparisons across the *.form.ts corpus. This card's field :: percentDisplay gate now also opens for a percent formula (data.type == 'formula' && data.returnType == 'percent'), which adds two literal comparisons and moves the census from 63 to 65. CI evidence: Test Core 5/10 red on 1503829de (expected 65 to be 63). Fixed in 7822b6bab with a history line. Also within this card's reach: the inspector pin's module-top imports (1503829de, test-source alias gate) and packages/services/service-analytics formula-return-type-measure.test.ts, which moves with the enum. Everything else in the claim (7003000473) stands.

  11. objectstack-fleet commented on Nov 19, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#5 · os-bill · session_01Utp6CajiB6BSQKWowy6YLB

    Closed-out · area data-2 · 2026-11-19T19:21Z

    reading value
    PR #35565 MERGED through the merge queue as 50f85e92 (Fixes #35047; this card closed completed)
    contract record CONTRACT_REVIEW_TIER: 7017037505 PASS with S1, delta d1 7018560972 PASS (S1 / N1 / N2 closed, N5 accepted); L1-a ACCEPT 7016662780, delta 7018455890

    Delivered: a formula field can declare returnType: 'percent'. Its result is read, rounded and displayed as a percent field's value (a fraction unless max is above 1, scale counts the displayed places, percentDisplay picks bar or plain), so a ratio formula no longer shows as 100.0. An existing percent field computed from its expression now rounds the same way. Editing the expression in the Studio field inspector keeps a declared percent or currency unless the new expression proves text, a boolean or a date.
    Follow-ups (left for the data seat, unclaimed): #35607 (skills docs, p3, now unblocked), #35631 (N6: a kept currency goes stale when an edit stops computing money, p2).
    State: pm:dispatched removed; card closed.

  12. removed
    pm:dispatched
    on Nov 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area:datadomain:specpriority:p2

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions