Skip to content

Console approvals inbox: the number shown on each request row is guessed from field names (first non-zero key matching /amount|total|price|…/), so it can show the wrong figure, and an app has no way to say which field to show #36477

Closed

Description

@os-bob

Summary

Each row in the console's approvals inbox shows a figure after the object name, for example <Object> · 81. The console picks that figure by looking at field names. It does not use anything the app declares. As a result:

  • On some objects it shows the wrong figure;
  • An app cannot correct it without renaming or reordering its own fields.

The same guessed value also drives the inbox's "amount (high to low)" sort.

Where (18.6.0; unchanged on main)

ui/apps/console/src/pages/system/ApprovalsInboxPage.tsx:

  • L337 AMOUNT_KEY_RE = /(amount|total|price|value|cost|sum|budget|salary|fee|revenue|balance|金额|总额|价格|费用|预算|金额)/i
  • L363–385 decisionAmountEntry: walks Object.entries(payload) in order. It skips bookkeeping keys and fields declared hidden: true, then returns the first key whose name matches the regex and whose value is a non-zero number.
  • Used for the row cell at L601 and L1701, and for the amount sort at L1259–1260.
  • In the 18.6.0 build: @objectstack/console/dist/assets/ApprovalsInboxPage-*.js, var kt=/(amount|total|price|…)/i / function At.

The payload is the record snapshot taken at submission (plugin-approvals snapshotRecord), so its key order is the object's field declaration order.

Repro

  1. An object has these two fields, declared in this order:
    • overdue_amount (currency), an incidental fact;
    • total_score (number), the figure approvers care about.
  2. The object's highlightFields lists total_score, not overdue_amount.
  3. Submit a record with overdue_amount = 80000 and total_score = 81 for approval.
  4. The approver's inbox row reads <Object> · 80,000, which approvers will read as a sum of money.
  5. A record with overdue_amount = 0 reads · 81, because the zero is skipped.

Any object with an incidental money-like field declared before its headline figure behaves the same way. Examples:

  • a leave request: a "deduction amount" shown instead of the days;
  • a purchase request: a "shipping fee" shown instead of the total.

Why an app cannot fix it

  • Nothing in @objectstack/spec 18.6.0 names the inbox figure:
    • the approval node has no such config;
    • the object's highlightFields is not read here.
  • The only levers are to rename the field, move it below the headline field, or mark it hidden / internal. Each one changes the data model for the sake of a display heuristic.

Expected

The inbox shows a figure the app chose, or none.

  • Option 1: read the object's highlightFields (or a new approval.summaryField / listFigureField on the object or the approval node) and show its first numeric field.
  • Option 2: when nothing is declared, show no figure rather than a name-based guess.

The amount sort should follow the same choice.

Relation: #25950 plans to rebuild the approvals UI on the SDUI renderer. Whatever that rebuild ends up doing, this row figure should be declared, not guessed.

Suggested grade

p2:

  • It is a wrong number in an approver's decision surface, with no app-side remedy;
  • But the approval page itself (snapshot, fields) shows the right values once the approver opens the request.

Activity

  1. objectstack-fleet commented on Nov 22, 2026

    @objectstack-fleet
    Contributor

    triage#1 · hotlong · session_01Q4EjjMnyLqJdzuktEmRPXH

    Triage: lands in domain:ui (ui/apps/console approvals inbox) · pm:queue; rationale: area:workflow (approvals; it had no area) · Bug · each inbox row shows a figure picked by guessing from field names, not from anything the app declares. Some objects show the wrong figure, and the same guess drives the 「amount (high to low)」 sort; an app cannot correct it without renaming fields. 18.6.0 and main; reported by os-bob → p2 · size S. Linked under topic #36243 (审批收尾).

  2. added
    area:workflow
    domain:ui
    pm:queue
    priority:p2
    on Nov 22, 2026
  3. objectstack-fleet commented on Nov 23, 2026

    @objectstack-fleet
    Contributor

    repo:objectstack#3 · os-support-ai · session_01WGufzi4PechTRCTBrfxV8W

    Claim: PM loop round 1
    Session: session_01WGufzi4PechTRCTBrfxV8W
    Account: os-support-ai
    Branch: claude/issue-36477-inbox-figure-highlightfields
    Worktree: objectstack-issue-36477
    Domain: domain:ui
    Seat: repo:objectstack#3
    File surface: ui/apps/console/src/pages/system/ApprovalsInboxPage*.tsx and its tests (stop on breach; explain in the report)
    Container & model: S–M, mode:subagent, model: default — dispatch-gates.mjs --tier: "Model tier — no path-derived mandate", effort: high
    Clause-②: no
    Metadata-protocol: none
    Responsibility: platform code in objectstack (console ApprovalsInboxPage decisionAmountEntry) | the object's declared highlightFields already names its headline fields | every approver reading the console approvals inbox
    Thread-read: 7080105943
    Premise: holds (line numbers corrected: AMOUNT_KEY_RE ~:337, uses ~:601, ~:1289-1290, ~:1731)
    Serial constraints cleared: no open PR touches ApprovalsInboxPage.tsx; #25950 (SDUI rebuild) open but not in flight
    Seat route: the card's Option 1 with the existing key plus Option 2 — the row figure is the first numeric/currency entry of the object's highlightFields, none when nothing numeric is declared; the sort follows; AMOUNT_KEY_RE removed; no new key. Precedent: ADR-0085 ("No second 'important fields' list … One curated list, every surface") and the highlightFields docblock in packages/spec/src/data/object.zod.ts ("first entry wins where only one fits"). Told to the maintainer 2026-11-23 10:37Z with a veto window.

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

    @objectstack-fleet
    Contributor

    repo:objectstack#3 · os-support-ai · session_01WGufzi4PechTRCTBrfxV8W
    os-dev-report

    {
      "issue": 36477,
      "status": "done",
      "branch": "claude/issue-36477-inbox-figure-highlightfields",
      "pr": "https://github.com/objectstack-ai/objectstack/pull/36698",
      "pr_number": 36698,
      "head_sha": "e6dddc0fbd9fcfafc15640c3b57643a8666545ef",
      "session": "session_01WGufzi4PechTRCTBrfxV8W",
      "premise_still_valid": true,
      "summary": "Seat route implemented. The inbox row figure and the amount sort now use the first highlightFields entry that names a numeric field (number, currency, percent, summary, or a formula whose returnType is number, currency or percent) that the object does not declare hidden. An object with no such entry shows no figure. AMOUNT_KEY_RE and the name scan are deleted, and no new key was added. Decisions: the zero-skip is dropped (a declared 0 shows); a hidden highlight entry is skipped and the next numeric entry wins; while the metadata read is pending or after it fails, the row shows no figure. Premise measured at c1e6cf75: every order line number held (AMOUNT_KEY_RE :337, decisionAmountEntry :363, uses :601 / :1289-1290 / :1731). The page's per-object read (getObjectSchema) does carry highlightFields and field types, but its hook in hiddenFields.ts kept only the hidden-field names. Reading the figure from that same read (no second fetch; the pinned cost test still asserts 2 reads for 2 objects) therefore required editing hiddenFields.ts, which is outside the surface; see deviations.",
      "tests": "At e6dddc0f, under os-verify-lock: `pnpm --dir ui exec vitest run --maxWorkers=2 apps/console/src/pages/system/ApprovalsInboxPage.queueHiddenAmount.test.tsx apps/console/src/pages/system/hiddenFields.test.ts` gave Test Files 2 passed (2), Tests 22 passed (22), VERDICT command-exit 0. Ablation: both source files restored to base c1e6cf75 (on disk: page AMOUNT_KEY_RE=3 hits, module inboxFigureField=0 hits); the page test gave Tests 4 failed | 3 passed (7), with the 4 behaviour pins red and the 3 pins of behaviour the base already had passing. Restore: git checkout HEAD, hashes matched the HEAD blobs, git diff HEAD empty. A first ablation that restored only the page was void (7/7 failed on an import error, useHiddenFieldsByObject is not a function) and is not counted. No build stands between source and test: vitest aliases @object-ui to source.",
      "gates": "Local, at e6dddc0f. `pnpm exec turbo run type-check --concurrency=2 --filter=@object-ui/console` under the lock: exit 0, Tasks 76 successful / 76 total, console cache miss; its tsconfig includes the tests. A first bare `pnpm --filter @object-ui/console run type-check` exited 2 on unbuilt @object-ui dist (prerequisite, not a verdict). eslint on the 4 changed ts/tsx files: exit 0. `dispatch-gates.mjs --commands --repo objectstack-ai/objectstack`: 37 commands, all run, all exit 0 (exit codes captured per command). `--ran` reconciliation: 37 derived, 37 run, 0 NOT-MEASURED, 0 UNRUN. CI at report time: 22 check-runs on e6dddc0f (5 completed, 15 in_progress, 2 queued), mergeable_state blocked (draft and required checks pending), so in_progress. check-governed-merges --pr 36698: NOT governed (0 of 5 paths); 755 changed lines, under 3000.",
      "line_budget": "755 changed lines (+427 / -328) across 5 files, against the 3000 human-merge threshold: under. .changeset +14/-0; ApprovalsInboxPage.queueHiddenAmount.test.tsx +146/-137; ApprovalsInboxPage.tsx +59/-96; hiddenFields.test.ts +76/-15; hiddenFields.ts +132/-80. No skills/** touched.",
      "files_changed": [
        ".changeset/36477-inbox-figure-highlightfields.md",
        "ui/apps/console/src/pages/system/ApprovalsInboxPage.queueHiddenAmount.test.tsx",
        "ui/apps/console/src/pages/system/ApprovalsInboxPage.tsx",
        "ui/apps/console/src/pages/system/hiddenFields.test.ts",
        "ui/apps/console/src/pages/system/hiddenFields.ts"
      ],
      "deviations": [
        "Outside the file surface: ui/apps/console/src/pages/system/hiddenFields.ts and hiddenFields.test.ts. The order says to take highlightFields from the existing per-object read and add no second fetch, and that read's hook lives in hiddenFields.ts and exposed only hidden names. It now derives the figure field per object (inboxFigureField, readInboxFigureField, useInboxFigureFieldByObject; readHiddenFields and useHiddenFieldsByObject are replaced, and only this page imported them). The order says 'Stop on breach'; the dispatch message says 'declare any file outside the surface as a deviation'. I followed the dispatch message and flag the conflict here. The alternative inside the surface was a second getObjectSchema per object from the page, which would turn the pinned cost test from 2 reads to 4.",
        "Removed the page's isBookkeepingKey helper and its isSystemManagedField import; the name scan was their only reader.",
        "The first ablation run was void (import error) and was redone with both source files at base; both runs are reported."
      ],
      "dogfood_battery": "n/a — no `!` in the PR title and no (narrowing) arm",
      "mcp_calls": "0",
      "api_writes": "2 relay writes: (1) fleet-write pr_create (POST /repos/objectstack-ai/objectstack/pulls draft=true, then POST /issues/36698/assignees os-support-ai) via repository_dispatch, run 45176585729 success, body read back byte-identical (7969 bytes); (2) post-stamped issue comment on #36477 (os-dev-report). git push is not counted.",
      "open_questions": [],
      "security_findings": "none",
      "out_of_scope_findings": [
        "carrier: none · noted, not filed — the sort option keeps the label 'Amount (high→low)', but it now orders on the declared figure, which can be a score or count rather than an amount (wording observation, in PR Acceptance notes)",
        "carrier: none · noted, not filed — no docs page describes the inbox figure; content/docs/automation/approvals.mdx and content/docs/capabilities/approvals.mdx are silent (in PR Acceptance notes)"
      ],
      "clause_2": "no (in PR body and changeset)",
      "metadata_protocol": "none — measured: no packages/spec change, no authorable key added, removed or changed in meaning; the existing object highlightFields gains one more reader (in PR body and changeset)"
    }
  6. objectstack-fleet commented on Nov 24, 2026

    @objectstack-fleet
    Contributor

    repo:objectstack#3 · os-support-ai · session_01WGufzi4PechTRCTBrfxV8W

    Closed by PR #36698 (merged 6206939, Fixes #36477). pm:dispatched removed · 2026-11-24T00:07Z.

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

Metadata

Metadata

Assignees

Labels

area:workflowdomain:uipriority:p2

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions