Skip to content

fix(plugin-dashboard): a compareTo KPI tile shows its number when the reader picks All time - #26027

Merged
objectstack-fleet[bot] merged 9 commits into
mainfrom
claude/project-thread-gumm4f
Oct 26, 2026
Merged

objectstack-fleet[bot] merged 9 commits into
mainfrom
claude/project-thread-gumm4f

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Requested by Steve · project thread

Fixes #25970

Clause-②: no
Metadata-protocol: none

What changes

A dataset-bound widget with compareTo now asks for a comparison only when its resolved filter carries a date condition on the compared field (on any field when compareTo.dimension is omitted). When the filter dates nothing, which is what the reader's All time on the dashboard date filter produces, the widget sends the same query a widget without compareTo sends and the tile shows its number with no comparison badge.

  • ui/packages/plugin-dashboard/src/DatasetWidget.tsx: new exported filterDatesField(filter, dimension?). The widget's declared comparison becomes declaredCompareTo; the compareTo the query, the signature and the overlay read is that value only when filterDatesField holds. No window is lowered either, so runtimeFilter is untouched in that case.
  • ui/packages/plugin-dashboard/SKILL.md: the "When NOT to use compareTo" line now separates a date condition that is not a closed window (still an error) from a filter that dates nothing (no comparison, no error).

Mechanism, measured

Picking All time calls onChange(undefined) (DashboardFilterBar.tsx, the ALL sentinel). buildWidgetScopedFilter skips an empty value, so DashboardRenderer merges no condition and the widget's own filter reaches DatasetWidget unchanged: the date key is ABSENT, not an open range. For the HotCRM "Selected Period" tile that means a runtime filter with no date at all, the case this PR omits the comparison for.

The ruling this PR implements (the seat's delegated call)

  • An author-declared one-bound window ($gte only, e.g. a YTD tile) stays an error. The executor and the spec define compareTo only on a two-bound window, so the widget still sends compareTo, and the executor's refusal names the fix. HotCRM's YTD / QTD / 12M tiles written as one bound keep erroring until they are written as a closed pair.
  • Two dated fields with no compareTo.dimension stay the executor's ambiguity error.
  • The omission applies only when the filter carries no date condition on the compared field at all. "A date condition" is any ISO-date operand under the field, at any depth and in any position ($or / $not included), deliberately wider than the windows extractDateWindows lowers. A custom range with only a start date picked in the filter bar ({ $gte }) therefore also keeps erroring.

Tests

At head b256ae44:

  • ui/packages/plugin-dashboard whole package, vitest run --maxWorkers=2 packages/plugin-dashboard/ under the verify lock: Test Files 188 passed (188), Tests 1842 passed, 6 skipped.
  • New in DatasetWidget.compareTo.test.tsx: filterDatesField unit cases, and four widget cases against a source that answers the way the executor does: no filter, a non-date filter, a named dimension left undated (all three send no compareTo and render the number with no badge), and a one-bound $gte window (still sends compareTo and shows the refusal).
  • New DashboardRenderer.compareToAllTime-25970.test.tsx drives the real Radix select: under the default this_quarter range the tile compares, then after picking All time the last selection is exactly the no-comparison query, the number shows, and no badge appears. A YTD tile ($gte only, opted out of the dashboard filter) keeps the refusal.
  • Four existing fixtures declared compareTo with no dated filter and had the mock answer a __compare column the real executor would have refused (DatasetWidget.test.tsx forwarding case, colorVariant, comboPresentation, dimensionlessMeasures-11261). Each now states a closed window. The objectui#7495 control (bar vs pie with no window) now uses a one-bound filter so its refusal still has something to refuse.
  • pnpm --filter @object-ui/plugin-dashboard type-check: exit 0; tsc -p tsconfig.test.json --listFiles includes both changed compareTo test files.
  • Ablation, once: the omission condition replaced with the bare declared value through scripts/ablation-replace.mjs (anchor x1 to x0, marker x0 to x1, restored blob equal to HEAD). The three omission cases and the All-time dashboard case went red (4 failed, 36 passed); the one-bound and YTD cases stayed green, as they pin unchanged behaviour.

Gates

node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack at b256ae44: 46 derived commands, each run, every one exit 0. --ran with exit codes: "46 derived famil(ies) accounted for — 46 run, 0 NOT-MEASURED (a DERIVED zero)". node scripts/check-sdui-manifest.mjs is among them after the re-record; node scripts/check-changeset-fixed.mjs (roster under .changeset) also exit 0. Type-check lanes, Test Core and the wide-population families are CI's.

Acceptance notes

  • A widget whose author wrote compareTo with no date anywhere and no dashboard date filter bound to it now shows no comparison silently, where it used to show the refusal. At runtime that case cannot be told apart from the reader's All time, and the ruling puts the reader's case first. Catching it would belong at authoring time (a lint on compareTo over a widget that no date filter can reach); not filed here.
  • The dataset-bound path of ObjectChart (ui/packages/plugin-charts) does not forward compareTo to queryDataset at all, so it never hit this refusal. Observation only.

Generated by Claude Code

When the resolved filter dates nothing on the compared field (the reader
picked All time on the dashboard date filter), DatasetWidget asks for no
comparison instead of sending compareTo with no window for the executor
to refuse. An author-written one-bound window still reaches the executor
and keeps its loud refusal.

Claude-Session: https://claude.ai/code/session_01RJW3o457EFFwmLN1429vn9
Co-authored-by: Claude <noreply@anthropic.com>
A filter that dates nothing is now asked no comparison by every family,
so the control's refusal needs a date condition that is no closed window.

Claude-Session: https://claude.ai/code/session_01RJW3o457EFFwmLN1429vn9
Co-authored-by: Claude <noreply@anthropic.com>
…omparison

Four fixtures declared compareTo with no dated filter and had the mock
answer a __compare column the executor would have refused. A comparison
is now asked only over a dated window, so each states one.

Claude-Session: https://claude.ai/code/session_01RJW3o457EFFwmLN1429vn9
Co-authored-by: Claude <noreply@anthropic.com>
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

席位核对

ACCEPT · domain:ui seat 2 · session_01SMps7wq7rBTk53e8KTSEup · 2026-10-26T09:34Z · head b256ae44

  1. 形态: draft → main; the first content line is Fixes #25970, which is correct because the whole card lands. The body has no other closing keyword (objectui#7495 is mentioned without a verb). Assignee is os-steve. Clause-②: no and Metadata-protocol: none lead their lines in both the PR body and the changeset.
  2. 前提实测: the seat read DatasetWidget.tsx at this head. runtimeFilter is produced by resolveFilterPlaceholders (~L839) before filterDatesField runs, so a {current_year_start} one-bound window reaches the gate as an ISO date. It still sends compareTo and keeps the refusal, which matches the seat's ruling in claim 6411700534. filterDatesField walks $-operators at any depth and matches only ISO_DATE_RE operands under the compared field (or any field when there is no dimension). Only the no-date case drops compareTo, and the window lowering is skipped with it.
  3. 门禁 check-runs: none at this head yet, since the PR was opened at 09:31Z. Landing waits on the head-pinned Lint & Repo Gates and TypeScript Type Check success plus all checks green. The dev's local union (46 derived families exit 0, plugin-dashboard 188/188 files) proves only the local subset.
  4. 接受的偏差: four existing fixtures outside the claimed test file were changed (DatasetWidget.test, colorVariant, comboPresentation, dimensionlessMeasures-11261), plus the spec: register the three AI_* quota codes in the error-code ledger (ruled Option A on the cloud#1168 vocabulary fork) #7495 control. Each one pinned compareTo over an undated filter that the real executor refuses, so each must flip with this behaviour. All are in the same package and the same gate family, and the PR body names each one. The SKILL.md edit is the line the claim allowed.
  5. 范围外去向: two observations stay unfiled. The first is an authoring-time lint for compareTo that no date filter can reach. The second is that ObjectChart's dataset path never forwards compareTo. Neither one is a defect that this PR touches or makes false.
  6. 落地条款: no governed path, +313/−18, scripts/sdui-manifest.record.json re-recorded, root .changeset/ patch for @object-ui/plugin-dashboard. Once the checks are green at this head, the seat lands via relay pr_ready + automerge_enable.

scripts/sdui-manifest.record.json taken from main; re-recorded in the next commit.

Claude-Session: https://claude.ai/code/session_01RJW3o457EFFwmLN1429vn9
Co-authored-by: Claude <noreply@anthropic.com>
@github-actions github-actions Bot added size/m documentation Improvements or additions to documentation tooling labels Oct 26, 2026
A comparison is asked only over a dated window, so the delta tile's
fixture states one.

Claude-Session: https://claude.ai/code/session_01RJW3o457EFFwmLN1429vn9
Co-authored-by: Claude <noreply@anthropic.com>
@github-actions github-actions Bot added the tests label Oct 26, 2026
@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review October 26, 2026 10:20
@objectstack-fleet
objectstack-fleet Bot enabled auto-merge October 26, 2026 10:20
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Oct 26, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to a conflict with the base branch Oct 26, 2026
os-zhuang pushed a commit that referenced this pull request Oct 26, 2026
… different packages stop conflicting (#26120)

<!-- claude-projects-attribution: {"github_login":"os-elon-musk"} -->
_Requested by **Elon** · [project
thread](https://claude.ai/code/project/chan_01WedDzV26nniwxv7jC88B9D?thread=cmsg_01WedDzV26nniwxv7jC88B9DPXV532seCFDcrkAJybGzsf)_

Fixes #26051

Clause-②: no
Metadata-protocol: none

Part of the p1 merge-queue backlog work (#26074). Dispatched by seat
`domain:devx#1` (#6023), claim 6415558140, card-thread session
`session_01SMJGPXxFBpbgAgXdnsXKVS`.

## What changes

`scripts/sdui-manifest.record.json` carried ONE
`inTree.registrySourcesSha256` over the `src/` of all 27 ui registry
packages, so any two ui PRs that touched any registry package conflicted
on that line. Now:

- **One record per registry package**, one file each, one line each:
`scripts/sdui-manifest.sources/PACKAGE.json` =
`{"package","sources","sha256","manifestSha256"}` (the package's own
`src/` digest, its file count, and the sha256 of the artefact it was
verified against). 27 files.
- **The shared record** (`scripts/sdui-manifest.record.json`, same path)
keeps only what describes the artefact: `sha256`, `components`,
`generatedAt`, and `inTree` = `modulesRoot`, `objectuiWorkspaceVersion`,
`registryRecords` (the directory). The retired `registryPackages` /
`registrySources` / `registrySourcesSha256` are refused if they
reappear.
- **The reached package set** is the set of record files: a reached
package with no record (new package, new dependency edge into the
registry, deleted record) is RED; a record the registry no longer
reaches (removed package, dropped edge) is RED.
- `sdui.manifest.json` is byte-identical (sha256 `1f6e1ccb925a…`, 106
components).

`lint.yml`'s command line (`node scripts/check-sdui-manifest.mjs
--self-test && node scripts/check-sdui-manifest.mjs`) is unchanged and
keeps working. No `.github/**` or `ui/.github/**` edit.

## Measured first (Ask 1): own `src/` per package, not
dependency-inclusive

Tree: objectstack `0a6948210c` (base), 27 reached packages, 922 non-test
sources.

**Detection is the same as one digest over the set.** Any edit under any
reached package's `src/` moves exactly that package's digest, so a
single PR's edit is caught exactly as before; a dependency's edit is
caught through the dependency's own record. Dependency-inclusive digests
add no single-PR detection. They would only add conflicts, and at this
cost (records a `src/` edit would touch):

| package edited | own `src/` (this PR) | dependency-inclusive |
|:--|:-:|:-:|
| `types` | 1 | 25 |
| `core` | 1 | 21 |
| `data-objectstack`, `i18n` | 1 | 19 |
| `react`, `react-runtime`, `sdui-parser` | 1 | 18 |
| `components` | 1 | 17 |
| `fields` | 1 | 14 |
| `plugin-detail` | 1 | 10 |
| `plugin-form`, `plugin-grid` | 1 | 2 |
| the other 11 plugins | 1 | 1 |

**Merge experiment, real tree, `git merge-tree --write-tree` (no merge
driver routes these paths; `git check-attr merge` = unspecified, so this
is GitHub's answer):** each branch appends a comment to one `src/` file
and runs the generator.

| pair | before (single digest, on `0a6948210c`) | after (this PR, on
`a8114011`) |
|:--|:--|:--|
| `plugin-grid/src/FormulaBar.tsx` × `plugin-form/src/DrawerForm.tsx` |
exit 1, CONFLICT in `scripts/sdui-manifest.record.json` | exit 0, clean;
the merged tree passes `check-sdui-manifest` (exit 0) |
| `plugin-grid/src/FormulaBar.tsx` × `plugin-grid/src/ObjectGrid.tsx` |
(conflicts) | exit 1, CONFLICT in
`scripts/sdui-manifest.sources/plugin-grid.json` only, by design |

**The open ui PRs today** (registry packages each changes, non-test
`src/` only; none changes `sdui.manifest.json`): #25987 i18n,
plugin-grid, plugin-list · #25998 plugin-detail · #26040 components,
i18n · #26045 i18n · #26027 plugin-dashboard · #26030 plugin-grid ·
#26033 core, plugin-form, plugin-grid · #26042 plugin-form · #26044 i18n
· #26048 i18n, plugin-map · #26050 fields, plugin-grid · #26062 fields.
Under the single digest all 12 conflict pairwise (12 serial landings).
Under this layout they conflict only within a shared package; the
largest group is `i18n` (5 PRs), so they can land in 5 rounds, e.g.
{#25987, #25998, #26027, #26042, #26062} → {#26040, #26030} → {#26045,
#26033} → {#26044, #26050} → {#26048}, assuming no source-level
conflicts between them.

## The check (Ask 2)

`checkTreeWithoutPin` compares each reached package's digest with its
own record and names every stale package (`ui/packages/plugin-grid: now
38 file(s) sha256 …, recorded …`), every unrecorded package, every
record the registry no longer reaches, every record verified against
another artefact, and every malformed record, then prints the one
command: `node scripts/gen-sdui-manifest-node.mjs`. The pin mode
(`.objectui-sha` present) is untouched.

**Why `manifestSha256` is in every package record, and why one line:** a
PR that changes the artefact re-records every package against the new
sha256, so it still conflicts with every in-flight registry PR, which
must regenerate on the merged tree (that is today's behaviour, kept for
the case where it matters). Two PRs on the same package touch the same
line and conflict. One line per file guarantees git cannot merge a
digest from one side with an artefact sha256 from the other; a record
that is not in the producer's one-line form is RED.

**What this does not force, stated rather than implied:** two PRs on
different packages that each leave the artefact unchanged, where only
their combination would change it, land without any run seeing the
combination. Under the single digest their textual conflict forced that
run. Here the next regeneration of any registry package sees the
combination. Dependency-inclusive digests would close this only along
import edges (not between siblings that interact through
`ComponentRegistry`), at the fan-out above. No stale or missing registry
source passes: every source edit still reds until regenerated, and every
package added to or removed from the reached set still reds.

## Self-test (Ask 3)

29 rows (was 22), roster and floor updated. New or changed in-tree rows:
a staged edit to one package is RED naming that package and NOT naming
`plugin-form` or `core`; a new package the registry reaches; a new
workspace edge (now names `ui/packages/unrelated`); a removed package
(names `scripts/sdui-manifest.sources/types.json`); a deleted package
record; a record verified against another artefact; a record out of its
one-line form; a record from the single-digest layout; and the producer
re-recording only the moved package (it back-dates the shared record
first, so a producer that stamps today's date reds the row).

Ablations, one at a time through `scripts/ablation-replace.mjs`, each
restored with `git diff HEAD` empty:

| guard removed | self-test |
|:--|:--|
| the other-artefact comparison (gate) | exit 1, row "a package record
verified against another artefact is RED" expected RED got GREEN |
| the one-line form comparison (gate) | exit 1, row "a package record
out of its one-line form is RED" |
| the unreached-record list (gate) | exit 1, row "a removed registry
package is RED naming its record" |
| the `generatedAt` carry (producer) | exit 1, row "the producer
re-records only the package whose sources moved": the second run changed
the shared record too |
| the per-package record write (producer) | exit 1, the two producer
rows |

## The generator (Ask 4)

It re-records only the packages whose line changed and leaves the others
byte-identical; it removes a record the registry no longer reaches; it
prints which packages it re-recorded. The shared record moves only with
the artefact: `generatedAt` and the provenance version are carried while
the artefact's sha256 is unchanged (the same rule the pin-keyed fields
already follow), so a regeneration on another day no longer moves a
shared line.

**It still builds, and why:** the build plus the enumeration is the only
oracle that says whether `sdui.manifest.json` moved. A record written
without it would stamp a current digest on a manifest no run checked,
which is the narrowing this card forbids. The 8 minutes is a cold turbo
cache, not the build of one package. Measured on `0a6948210c`, one
container, no remote cache (`TURBO_TOKEN` unset):

| run | wall | turbo |
|:--|:-:|:--|
| cold | 8m49s | 0 of 63 cached, 8m43s |
| nothing moved | 6s | 63 of 63 cached |
| one edit under `plugin-grid/src` | 33s | 61 of 63 cached, 27s |
| one edit under `core/src` | 2m50s | 41 of 63 cached, 2m44s |

## Readers moved (Ask 5)

- `docs/releases-maintenance.md`: the regenerate section describes the
per-package records, the re-record rule and which PRs still conflict.
- `scripts/check-changeset-no-major.mjs`: the "measured out" comment,
the real-build assertion (neither record is shipped) and the
records-only control now cover `scripts/sdui-manifest.sources/`. Its
`--self-test` passes (456 assertions).
- `scripts/ui-import/README.md` is not edited: line 140 records what the
cutover's step 4 wrote at the time, and that file still exists at that
path.
- `git grep -n "sdui-manifest.record"` outside CHANGELOGs: only the two
scripts, the docs page, `check-changeset-no-major.mjs` and that
historical README line. `git grep registrySourcesSha256`: only the
retired-field list and its self-test row.

## After this lands: what an in-flight ui PR does (once)

A ui PR whose branch re-recorded the old single digest conflicts once on
`scripts/sdui-manifest.record.json`:

```sh
git merge origin/main                                   # conflict in scripts/sdui-manifest.record.json
git checkout --theirs scripts/sdui-manifest.record.json  # take main's layout
node scripts/gen-sdui-manifest-node.mjs                  # re-records only this PR's package(s)
git add scripts/sdui-manifest.record.json scripts/sdui-manifest.sources sdui.manifest.json
git commit
```

After that, PRs on different registry packages no longer conflict with
each other on the record.

## Gates

Local, on `a8114011` (derived with `node scripts/pm/dispatch-gates.mjs
--commands`): 39 of the 40 derived families exit 0, including `node
scripts/check-sdui-manifest.mjs --self-test` (29 cases) and `node
scripts/check-sdui-manifest.mjs`, `node
scripts/check-changeset-no-major.mjs --self-test` and `--base
origin/main`, `pnpm check:nul-bytes`, `pnpm check:watch-hint-literal`,
`pnpm check:required-contexts`, `pnpm check:doc-authoring` and `pnpm
--filter @objectstack/lint run check:doc-formula-expressions` (after the
lint closure build). `pnpm check:pm-dispatch-gates` was still running
when this PR opened; its reading goes into the report comment on #26051,
and CI runs it in Lint & Repo Gates.

CI on the PR's check-runs: pending at the time of writing; the seat
reads them.

Changeset: none, `skip-changeset`. The diff touches only root `scripts/`
(private), `docs/` and the records; `sdui.manifest.json` is
byte-identical and neither record is copied into
`packages/console/dist/` (the `check-changeset-no-major` real-build
assertion above).

Not Tier H: no governed path (`git diff --name-only` has no `.github/`,
`.claude/`, `docs/adr/`, `skills/`, `AGENTS.md`, `CLAUDE.md`).

## Acceptance notes

- `i18n` is the hot package: 5 of the 12 open ui PRs touch its `src/`,
so they still serialize on `scripts/sdui-manifest.sources/i18n.json`.
Whether locale data belongs in the digest at all is a narrowing question
(it would let a source change pass unregenerated), not something this PR
decides.
- The cold-cache cost of a regeneration (8m43s here) is a
fresh-container property; card threads run with no turbo remote cache.

---
_Generated by [Claude
Code](https://claude.ai/code/session_01SMJGPXxFBpbgAgXdnsXKVS)_

---------

Co-authored-by: Claude <noreply@anthropic.com>
scripts/sdui-manifest.record.json taken from main; re-recorded in the next commit.

Claude-Session: https://claude.ai/code/session_01RJW3o457EFFwmLN1429vn9
Co-authored-by: Claude <noreply@anthropic.com>
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Oct 26, 2026
@github-actions

Copy link
Copy Markdown
Contributor

⛔ merge queue 构建失败 — 先分诊,再决定要不要重排

队列构建 40337868008 红了。队列跑的是全量套件(PR 侧 CI 只跑 affected 子集),
所以失败的测试可能在本 PR 没碰过的包里 —— 那不是重排能修的。每次盲目重排都会让排在后面的所有 PR 重建一轮。

分类:failure —— 按下面的日志分诊。

失败的 job(日志抽取,best effort):

  • Test UI (14/16) — 失败步骤: Run the ui tests (shard 14/16)

    × after a successful save: the shell leaves at once 1064ms
    FAIL   @object-ui/console  src/pages/settings/__tests__/SettingsView.shellLeave-13231.test.tsx > CONTROLS: the page registers only while it holds edits (objectui#13231) > after a successful save: the 
      ↳ 失败原因: (这条 FAIL 之后 12 行内没有可识别的原因行 —— 点进 job 看)
    

↳ 失败原因 是判读的关键:超时(Test timed out in … / Hook timed out in …)多半是负载/时序,不是本 PR 的回归;
断言(AssertionError: …)才指向真实的行为改变。两者的 FAIL 行长得一模一样,只有这一行能区分。

⚠️ 断言这一侧有一类例外,判据是断言在测什么,不是它是不是 AssertionError。 断言的对象是产品行为(一个值、一个形状、一次拒收)⇒ 照上面读:真实的行为改变,去查,⛔ 不要重排掉;
断言的对象是这次实验自身的有效性前提(跑完的耗时、负载下的先后、任何只在时间预算内才成立的条件)⇒ 它跟超时是同一类,同样对负载敏感,重排一次是合法的判别手段。
识别是机械的:断言的消息或它比较的值本身点名了一段时长、一个时间戳、一个耗时计数。实测过的一对 —— AssertionError: SecurityPlugin.init() ran: expected false to be true 测的是产品行为(真回归);
AssertionError: this run took over a second, so second-precision stamps could have differed too: expected 1006 to be less than 1000 测的是实验前提:它守护的那条不变式当时是绿的,同一个 head 原样重排一次即成功。
穿着 AssertionError 外衣的时间测量,仍然是时间测量。(⛔ 这只改「怎么读一次红」,不改「哪些测试可以重排」——后者由别处管。)

跨 PR 相同签名(24h,按失败测试文件聚合):

历史信号:

  • 本 PR 过去 24h 无队列失败记录(首次)。
  • 过去 24h 队列共有 31 个失败构建(不含本次)。

分诊清单:

  1. 失败测试在本 PR 改动的包里 → 真回归,修 PR。
  2. 失败测试与本 PR 无关 → 看上面的「跨 PR 相同签名」;已有汇总 issue ⇒ flaky/环境问题实锤,去那张 issue 上谈,修好前重排只会再烧一轮全队列。
  3. 两者都不是 → 可能与同组 PR 语义冲突;等前面的 PR 落地或失败出队后再重排一次即可,不要连续重排。

Generated by Claude Code · merge-queue-triage workflow (#4859)

Merged via the queue into main with commit 4391c50 Oct 26, 2026
61 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation size/m tests tooling

Projects

None yet

2 participants