Skip to content

fix(core): resolve {next_week_end} and {next_year_end} in the client date-macro resolver - #30364

Merged
objectstack-fleet[bot] merged 3 commits into
mainfrom
claude/project-thread-0sa93d
Nov 5, 2026
Merged

objectstack-fleet[bot] merged 3 commits into
mainfrom
claude/project-thread-0sa93d

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Requested by Bill · project thread
Fixes #30134

domain:ui#3 · os-bill · session_01Utp6CbPN5UYMnBaNJPJWfG

Clause-②: no — the client resolver catches up with tokens the spec already declares
Metadata-protocol: none

维护者速读

  • 改了什么:控制台的日期占位符解析器补上 {next_week_end}(下周日)与 {next_year_end}(明年 12 月 31 日),并加一条测试逐个核对 spec 声明的全部固定占位符都能在客户端解析。
  • 为什么改:spec 早已声明这两个占位符,服务端也能解析,但控制台原样显示 {next_week_end} 文本,比较区间与趋势标签随之出错。
  • 风险与回滚:只新增两个映射,既有占位符不变;回滚即撤销本 PR,无数据迁移。
  • 先看:ui/packages/core/src/utils/date-macros.ts(两行新映射)、date-macros.specTokens-30134.test.ts(防漂移钉)。
  • 两分钟验证:pnpm --dir ui exec vitest run packages/core/src/utils/__tests__/date-macros.specTokens-30134.test.ts,预期 38 条全绿。
  • 需要你做的:无,席位落地。

What changes

  • resolveDateMacros (@object-ui/core) resolves {next_week_end} as the Sunday of next week (Monday-start weeks, the same week {next_week_start} opens, per the spec's DATE_MACRO_DESCRIPTIONS entry "Sunday of next week") and {next_year_end} as Dec 31 of next year ("Dec 31 of next year").
  • The resolver's header list now names both, and its "keep in sync" note points at the new pin instead of promising a future de-duplication.
  • New date-macros.specTokens-30134.test.ts: iterates the spec's exported DATE_MACRO_TOKENS (imported from @objectstack/spec/data, not copied) and fails on any token the client leaves unresolved; pins next_week_end from a Monday, a Sunday and across the 2026→2027 year boundary (Wed 2026-12-30 → 2027-01-04..2027-01-10), and next_year_end on Dec 31 and Jan 1.
  • No new dependency: @object-ui/core already depends on @objectstack/spec at runtime.
  • Changeset @object-ui/core: patch.

Tests

Changed tests plus every test file importing the changed module or its importers (head 8dec3da, re-run after the main merge)
  • pnpm --dir ui exec vitest run over the 5 date-macros / dashboard-filters / filter-tokens test files: Test Files 5 passed, Tests 114 passed.
  • The 13 test files importing compare-to / dashboard-filters / filter-tokens: Test Files 13 passed, Tests 250 passed.
  • After merging origin/main: the two date-macros files, Tests 46 passed.
  • pnpm exec turbo run type-check --filter=@object-ui/core --concurrency=2 (runs tsconfig.test.json too): 4 tasks successful.
  • Ablation (scripts/ablation-replace.mjs --delete of the next_week_end entry, source import, no dist on the path): the new file went red, 2 failed ({next_week_end} resolves to a day or an instant, {next_week_end} is the Sunday of next week); git diff HEAD empty after the restore leg.

Acceptance notes

  • The card's observation on ui/packages/types/src/data-protocol.ts (FilterBuilderDateRangePreset) is not changed here. The union is a deliberately separate vocabulary (renamed from DateRangePreset in objectui#4167 because it adds future windows the dashboard schema refuses), so deriving it from DATE_RANGE_PRESETS would drop tomorrow, next_week, next_year, next_7_days and next_90_days that its filter-builder surface uses. Its doc comment's counts ("thirteen", "eight") no longer match the spec table, which now holds sixteen. Reported to the seat; not filed.

Verification

dispatch-gates on 8dec3da

node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack: 35 derived families, each run with its exit code recorded before any pipe, all exit 0 (including node scripts/check-sdui-manifest.mjs). --ran reconciliation: 35 derived, 35 run, 0 NOT-MEASURED, 0 UNRUN.


Generated by Claude Code

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:ui#3 · os-bill · session_01Utp6CbPN5UYMnBaNJPJWfG

Known red, not this PR's · Lint UI (job 127126632397). Same signature as main-red anchor #30367: @objectstack/spec check:liveness reports query/searchFields → packages/objectql/src/engine.ts (the citation lost its key when PR #30341 moved engine.ts docblocks). This diff touches only ui/packages/core and a changeset. The fix lands on main through #30367; this PR merges origin/main after it, then the seat re-reads CI.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:ui#3 · os-bill · session_01Utp6CbPN5UYMnBaNJPJWfG

维护者速读

  • 改了什么:控制台的日期占位符解析器补上 {next_week_end}(下周日)和 {next_year_end}(明年 12 月 31 日),并加一条测试逐个核对 spec 声明的全部固定占位符都能在客户端解析。
  • 为什么改:spec 早已声明这两个占位符,服务端也能解析,但控制台原样显示 {next_week_end} 文本,比较区间与趋势标签随之出错(Console date macros: {next_week_end} and {next_year_end} stay unresolved in the client #30134)。
  • 风险与回滚:只新增两个映射,既有占位符不变;回滚即撤本 PR,无数据迁移。
  • 先看:ui/packages/core/src/utils/date-macros.ts 的两行新映射,date-macros.specTokens-30134.test.ts 的防漂移钉。
  • 两分钟验证:pnpm --dir ui exec vitest run packages/core/src/utils/__tests__/date-macros.specTokens-30134.test.ts,预期全绿。
  • 需要你做的:无,席位落地。
  • 席位意见:可合。

席位核对 — ACCEPT · head f235369

  • 形态:3 文件 +65/−5。check-governed-merges --pr 30364:NOT governed,70 行 ≤ 3000。Fixes #30134。
  • 契约复审:Clause-② no(resolveDateMacros 签名不变,只多解析两个 spec 已声明的占位符;无新导出、无 i18n 键)。Metadata-protocol none。
  • 席位读码:next_week_end 取周一起始的下周的周日,与 {next_week_start} 同一周,符合 spec DATE_MACRO_DESCRIPTIONS;防漂移测试直接迭代 spec 导出的 DATE_MACRO_TOKENS,不是抄一份,跨年(2026-12-30 → 2027-01-04..10)已钉。@object-ui/core 本就运行时依赖 @objectstack/spec,无新依赖。
  • 前提实测:消融删 next_week_end 映射 2 红;合 main 后 head f235369 上 date-macros 及引用方 15 文件 296/296。
  • 门禁 check-runs:head 上 55 个,44 success、11 skipped(Test Core、Build Core、Build Docs、Dogfood、Temporal、opt-in 冒烟等 server/core/opt-in 项,ui-only diff 的预期跳过),无红。
  • 接受的偏差:无。
  • 范围外去向:卡上关于 FilterBuilderDateRangePreset 的观察 → Acceptance notes(该联合类型有意比 dashboard 词表多出未来区间,不能直接派生);FilterBuilderDateRangePreset 附近过时的「thirteen/eight」注释 → Acceptance notes,不立卡。
  • 落地条款:中继 pr_ready + automerge_enable;合并后清 pm:dispatched,在 Console date macros: {next_week_end} and {next_year_end} stay unresolved in the client #30134 发落地评论。

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review November 5, 2026 10:16
@objectstack-fleet
objectstack-fleet Bot enabled auto-merge November 5, 2026 10:16
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 5, 2026
Merged via the queue into main with commit d3f23d2 Nov 5, 2026
56 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/project-thread-0sa93d branch November 5, 2026 10:43
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/s tests tooling

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Console date macros: {next_week_end} and {next_year_end} stay unresolved in the client

1 participant