Skip to content

报表图表加「显示数量为 0 的分组」开关(#36645 第 2 项拆出) #36722

In progress

Description

@objectstack-fleet

repo:objectstack#1 · os-warren · session_01JQwxbZeHNsF3RWcWpj7rGj

Split out of #36645 (item 2) · Source: #36374 spec item 3 · Maintainer's pick: decision card 2026-11-23 14:16Z, 「做,作为单独的功能卡」.

What. A report chart grouped by a field shows only the groups that have records. A sales manager charting deals by stage does not see the stages with no deals, so an empty stage looks like it does not exist rather than reading as zero. The report spec has no key to ask for those groups, so neither the renderer nor the report builder can offer it.

Expected.

Pointers. service-analytics already exports fillEmptyGroups(rows, columnAggregates). Check whether it is the right engine hook before writing a second zero-fill. Its CHANGELOG notes a past defect where shifted bucket keys were filled with a confident 0, so a date range needs a test.

Acceptance.

  • A spec test shows the key is optional and defaults off.
  • A renderer or analytics test covers a picklist grouping with an empty value and a date grouping with an empty bucket.
  • A builder test shows the switch round-trips through save.
  • The PR carries Clause-②: yes (widening) and its spec-baseline updates, and gets a contract-tier review before the queue.

Order. After #36705 merges, because it touches the same builder files.

Grading (proposed): area:build · Feature · a new authorable key asked for by the maintainer, no data harm without it ⇒ p2. Evidence: read (#36645, #36374 item 3, the decision card).

Dedupe: #36645 names this item and stops short of it; no other card carries it.

Activity

  1. added
    enhancement
    priority:p2
    pm:queue
    domain:ui
    on Nov 23, 2026
  2. objectstack-fleet commented on Nov 23, 2026

    @objectstack-fleet
    ContributorAuthor

    triage#1 · hotlong · session_01Q4EjjMnyLqJdzuktEmRPXH

    Triage: lands in area:build · domain:ui · priority:p2 · Feature · pm:queue; seat grade kept.
    Rationale: a report-chart switch to show zero-count groups, so an empty stage reads as 0 instead of looking absent. The maintainer picked it as its own feature card (14:16Z 「做,作为单独的功能卡」), split from #36645 item 2. It is a new spec key plus builder and renderer support. No current behaviour is wrong, so p2.

  3. objectstack-fleet commented on Nov 28, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#3 · os-tesla · session_01L9qibyUSf2nKJWW6qBemSU

    Premise corrected: the date half already holds on main — the executor runs fillEmptyTimeBuckets on every query (#26893, dataset-executor.ts ~1383–1386) and the report's dateRange reaches it as timeDimensions.dateRange (DatasetReportRenderer.tsx ~813–817), so every bucket in range shows with 0, switch or no switch. The card's date acceptance becomes a pin: date buckets are filled the same with the switch on or off. The option half holds: fillEmptyGroups (~322) only fills cells of existing rows; an option with no records shows no group today.

    Claim: PM loop round 1
    Session: session_01L9qibyUSf2nKJWW6qBemSU
    Thread session: session_01L9qibyFBwGSJLARjP5asi3
    Account: os-tesla
    Branch: claude/project-thread-19thpz
    Worktree: objectstack-issue-36722
    Domain: ui
    Area: o3-build (area:build p2, a seat card thread)
    Seat: repo:objectstack#3
    Seat rulings on the pre-claim report (/mnt/project-files/card-36722/pre-claim-report-bd5407ec.md, main bd5407e):

    • Route A (renderer fills, chart only): a new key on ReportChartSchema, chart.showEmptyGroups: z.boolean().optional() with no default (existing reports parse unchanged). When on, the renderer adds the declared options that have no row, valued by spec's emptyGroupValueFor (count / sum → 0, avg / min / max → empty). No fill when the result is truncated, sorted by a measure, or the field declares no options. Route B (executor fills, a new DatasetSelection request key) is not built: it is a second wire face for a chart-only ask; if tables or dashboards later need the same, that is its own card.
    • The report builder shows the switch only on chart types with a category axis (reportBuilderModel.ts ~70) and round-trips it through ...prev.
    • emptyGroupValueFor becomes plugin-report's first runtime import from @objectstack/spec: check the bundle-size gate and ui/ import rules first; if either refuses, stop and report.
    • Declaration: Clause-②: yes (widening), Metadata-protocol: added, @objectstack/spec minor; contract review L2 owed before queue; the PR body carries Skills-docs: (does a skill teach report chart keys? follow-up #N or none — REASON).
      File surface:
    • packages/spec/src/ui/report.zod.ts (+ generated outputs it moves), ui/packages/plugin-report/src/DatasetReportRenderer.tsx, ui/packages/plugin-report/src/builder/** (the switch), their tests, i18n keys for the switch label if new, changesets (@objectstack/spec minor, @object-ui/plugin-report patch, @object-ui/i18n patch if keys added).
      Stop on breach and explain in the report.
      Container & model: M, mode:thread, model: claude-opus-5-5 (default tier — dispatch-gates.mjs --tier: "no path-derived mandate"), effort: high, reason: the thread session serves this tier
      Writes: the PR only through the relay pr_create; comments, labels and bodies only through the relay write tools; report both numbers.
      Clause-②: yes (widening)
      Metadata-protocol: added
      Responsibility: a report author can turn on "show groups with no records" so a bar chart by status shows every declared status, zeros included, instead of silently dropping the empty ones.
      Premise: partly holds, read on origin/main bd5407e; corrected above
      Serial constraints cleared: none yet — overlap-check after the first commit, before the first push
      Readings owed in the report: the option fill per aggregate (count, sum, avg), the three no-fill controls, the date-bucket pin on and off, one ablation, a browser reading of the switch in the report builder.
  4. added
    pm:dispatched
    and removed
    pm:queue
    on Nov 28, 2026
  5. objectstack-fleet commented on Nov 28, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#3 · os-tesla · session_01L9qibyUSf2nKJWW6qBemSU

    Claim amendment 1 (file surface) to claim 7237658512. ui/AGENTS.md rule #2 (docs-driven) requires a feature change to update the package README and its content/docs page in the same PR, and the first surface left both out. Two paths are added, each as a short note on the new "show groups with no records" switch, in one separate commit:

    • Added: content/docs/ui/reports.mdx, one paragraph in the "An embedded chart" section.
    • Added: ui/packages/plugin-report/README.md, one sentence in the "Embedded chart" section.
      Nothing else changes. Clause-② yes (widening) and Metadata-protocol added stay as claimed.
  6. objectstack-fleet commented on Nov 28, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#3 · os-tesla · session_01L9qibyFBwGSJLARjP5asi3
    os-dev-report

    {
      "issue": 36722,
      "status": "done",
      "branch": "claude/project-thread-19thpz",
      "pr": "https://github.com/objectstack-ai/objectstack/pull/38284",
      "session": "session_01L9qibyFBwGSJLARjP5asi3",
      "premise_still_valid": "partly — the date half already holds on main (the executor fills every bucket of a report's period, #26893); the select-option half was real and is what this PR builds (Claim 7237658512, route A)",
      "summary": "ReportChartSchema gains chart.showEmptyGroups: z.boolean().optional(), no default. With it on, the dataset report chart adds every declared option of the xAxis field the answer left out (presence by stored value, authored label and localized label), carrying the stored value so relabelling, declared order and option colours treat it as a real group; measure cells are emptyGroupValueFor(aggregate) from @objectstack/spec/data (0 for count/sum, none for avg/min/max); with seriesBy one row per series value. Added rows are appended so drill indices still address the answer, and a mark on an added group opens no list. No fill when the report's order reaches the chart or the field declares no options. The report builder offers a 'Show groups with no records' switch on bar/line/donut; off removes the key, metric/table drop it. New locale key in 11 packs. Docs paragraph in content/docs/ui/reports.mdx and a README sentence (amendment 1, 7237862534). plugin-report moves @objectstack/spec from devDependencies to dependencies. Changesets: spec minor; plugin-report, i18n patch. Clause-② yes (widening), Metadata-protocol added, Skills-docs none — reason in the PR body.",
      "tests": "Fill per aggregate through the real chart props: count, an empty declared stage reads 0 at its declared place; sum 0; avg has no value. Controls with the switch on: switch off adds nothing; a measure order adds nothing; a text field with no declared options adds nothing; the selection sent is identical on and off. Date-bucket pin: a date axis over a period sends the same selection and draws the same buckets, 0 month included, on and off. Ablation via ablation-replace.mjs (fill condition forced false; restore blob == HEAD): 4 failed / 111 passed across the four touched suites, the four fill cases; controls and date pin stay green. Suites: four touched files 115 passed; ui vitest packages/plugin-report + packages/i18n 149 files, 2292 passed, 20 skipped; spec src/ui/report.test.ts 83 passed. Typecheck NOT MEASURED locally (workspace dependency d.ts not built; no error names the changed modules). Browser (showcase dev --fresh + console vite, Playwright, Backlog emptied on the local DB): switch off draws 4 statuses; on, the builder preview draws Backlog first at no height; hidden on Number; Save PUTs chart.showEmptyGroups: true then publishes; reloaded view draws 5 statuses and the builder reopens with the switch on. Screenshots in project files card-36722/.",
      "gates": "dispatch-gates --ran with recorded exit codes at 86c2dbee: 126 derived, 124 run exit 0, 2 NOT MEASURED exit 3 (check-plugin-teardown-shape --self-test: fixture commit outside the shallow clone; check:dual-build-cjs-loads: needs a full pnpm build), 0 unrun. First sweep (114 at 6508986c) found one real red, check:undeclared-dep-imports, fixed in 86c2dbee; the 12 families the lockfile change added ran at 86c2dbee. Seven spec gates first exited 3/1 against a stale dist and vitest scripts/ was OOM-killed; all re-ran exit 0 after a fresh spec build. Bundle-size and ui/ import-rule check for the first runtime spec import: library build externalizes bare specifiers (no growth), plugin-dashboard already does the same import, no eslint restriction. overlap-check VERDICT clean exit 0 at 8a299e70 (main, #38246, #38230, #38168).",
      "dogfood_battery": "n/a — no ! in the PR title and no (narrowing) arm",
      "mcp_calls": "6 GitHub MCP calls, all reads (issue_read get / get_comments on #36722, #36705, #36645), plus 1 session read and 1 PR activity subscription",
      "api_writes": "2 — fleet-write relay pr_create (POST pulls + assignees leg, read-back 9943 bytes identical, run 46138957938); this os-dev-report comment via post-stamped",
      "open_questions": [],
      "security_findings": "none",
      "out_of_scope_findings": [],
      "deviations": [
        "No-fill list: the chart's selection never sends limit/offset and the dataset answer carries no truncation signal, so 'truncated' does not occur on this path and has no test.",
        "The fill declines under ANY order that reaches the chart's selection (dimension order included), not only a measure order: appended rows have no place in an authored order. Narrows when the switch acts; refuses nothing. Spec TSDoc says so (8a299e70).",
        "A zero-row answer still draws no chart; the table under the chart is not filled (the key is chart-only).",
        "Surface: ui/packages/plugin-report/package.json and pnpm-lock.yaml (spec moved to dependencies, required by check:undeclared-dep-imports); the claim named no manifest file.",
        "Docs surface per claim amendment 1 (7237862534)."
      ]
    }
  7. objectstack-fleet commented on Nov 28, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#3 · os-tesla · session_01L9qibyUSf2nKJWW6qBemSU

    Claim amendment 2 (file surface) to claim 7237658512, recording what PR #38284 (head 86c2dbee) touches beyond amendment 1 (7237862534), per report 7238447636. Both paths are forced by a gate:

    • Added: ui/packages/plugin-report/package.json, which moves @objectstack/spec from devDependencies to dependencies. The renderer now imports it at runtime, and check:undeclared-dep-imports was red without the move. The lib build externalizes it, and plugin-dashboard already carries the same import.
    • Added: pnpm-lock.yaml, the lockfile entry that move rewrites.
      Nothing else changes. Clause-② yes (widening) and Metadata-protocol added stand as claimed, so an L2 at CONTRACT_REVIEW_TIER is owed before the queue.
  8. objectstack-fleet commented on Nov 28, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#3 · os-tesla · session_01L9qibyUSf2nKJWW6qBemSU

    Claim amendment 3 (file surface) to claim 7237658512, after amendments 1 (7237862534) and 2 (7238456293). It adds one path, which L1-a asked for as N1:

    • Added: the showEmptyGroups row in the report liveness ledger (liveness/report.json), citing its reader and its tests.
      Seat ruling on the S4 rework: the builder offers the switch only on the chart families that can draw an empty group, and that offer is the follow-up L1-a named N3 ("the switch shows where it does nothing"). N3 is therefore carried by this PR, with no separate card. Clause-② yes (widening) and Metadata-protocol added are unchanged.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area:builddomain:uienhancementpm:dispatchedpriority:p2

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions