Repository navigation
Commit f284ab2
docs(adr): amend ADR-0053 D-D1 in place — the bare-day upper bound moves to one shared lowering at the seams (#20754)
Part of #5930
Clause-②: no
**Step 1 of the maintainer's ruling on #5930** (comment 5902355785,
2026-09-30, 「5930 v18 启动」): the ADR-0053 D-D1 amendment, drafted by the
`domain:engine` seat for the maintainer's hand. **Tier H — this PR stays
a draft.** It changes no behaviour. The code slice (step 2) waits on it
(Prime Directive #13) and cites it. #5930 stays open for steps 2 to 4.
## What changes
One file, `docs/adr/0053-date-and-datetime-semantics.md` (+122 / -11):
- **D-D1 is amended in place** (the ruling's D5). What a bare-day upper
bound *means* is unchanged. *Where* it is applied moves from each
comparison emitter to one shared `FilterCondition → FilterCondition`
lowering. The original text stays. It is struck only where the amendment
makes it false: the heading's placement, the lead-in sentence,
`ObjectQLStrategy`'s "single execution-path authority", the primitive's
home, and "emitter-side". An **Amended (2026-09-30)** block at the end
of D-D1 states the placement step 2 will follow, in ten numbered items:
1. one lowering, applied once: a bare-day `$lte` becomes `$lt` the next
day; `$between` becomes two conjuncts; the last supported day drops the
bound;
2. where it runs: the seven seam positions of the design's §3.6, named
by symbol;
3. at a seam, **after the doors and after filter-token resolution**
(Acceptance note 1);
4. where it lives: `@objectstack/spec/data`, never the package root
entry (D3);
5. drivers receive the lowered filter (D4 (b));
6. D-A1 and D-E3 are kept, and D-E3 becomes structural;
7. the column-type scope is unchanged;
8. `dateRange` windows (Acceptance note 2);
9. the interim state: idempotent copies until each face's deletion card;
10. the open confidence gap the ruling recorded.
- **The status line** gains an `Amended (2026-09-30, D-D1, #5930)` entry
in the file's existing style, with the ruling id and date.
## Dispatch hypotheses, measured at `97005aed04`
- **H1 held.** D-D1 is the section "Operator-sensitive translation lives
at the comparison EMITTERS". Its line "One primitive backs all of them:
`nextUtcCalendarDay` (`@objectstack/core`)" was already out of date. The
later D-D2 ("The primitive lives in `spec`") moved the primitive to
`@objectstack/spec/data`, and `packages/core/src/utils/datetime.ts`
re-exports it. It is the same decision (where the D-D rule's code
lives), so the amended section reconciles it with a strike and a
pointer.
- **H2 held, and nothing outside D-D1 needed an edit.** Each section
that restates the placement was checked:
- the first D-D2 (the conformance axis) stays true: the suites it names
exist and still pin row results;
- D-E3 is kept as ruled and stays true; it is the property the amendment
makes structural;
- D-E4's struck paragraph is past history and stays true;
- the second D-D2's decision (the primitive lives in spec) is what the
ruling's D3 extends; its "six backends now share one definition" is a
dated record of the emitter era, and amendment item 9 covers it;
- D-A3.1 item 1 is a first-run record that names today's strategy arms;
it stays true through the interim state;
- D-A3.2's "the whole-day rule must NOT reach" a time column stays true,
because the lowering uses the same primitive;
- D-A1 is untouched.
- **H3 held: no other ADR cites D-D1's placement.**
- `git grep -n -E "D-D[0-9]*" -- docs/adr` outside ADR-0053: 0 hits
(exit 1). Control leg `D-E3|D-F1` outside ADR-0053: 1 hit (exit 0),
ADR-0074's status line citing D-F1.
- No other ADR mentions `nextUtcCalendarDay` or a whole-day or bare-day
bound (0 hits, exit 1).
- The ADRs that cite ADR-0053 (0054, 0074, 0104) cite its storage and
read semantics, not this placement.
- No ADR index lists ADR-0053's status. The one `scripts/adr-anchors/`
entry that names ADR-0053 (on `sql-driver.ts`) pins D-F1 to D-F3, not
D-D1.
- So no second file had to change.
- **H4 delivered**, with two precision points that the design's §3.6
table does not carry (Acceptance notes 1 and 2).
## Gates at `f04f3711b7`
`node scripts/pm/dispatch-gates.mjs --commands --repo
objectstack-ai/objectstack` (no paths) derived 19 commands. All 19 were
run and all exited 0. `--ran` reconciliation: 19 derived, 19 run, 0
NOT-MEASURED, 0 UNRUN.
- `node scripts/check-adr-links.mjs` (+ `--self-test`): 691 relative
link destinations under `docs/adr/` resolve
- `node scripts/check-adr-symbol-anchors.mjs` (+ `--self-test`): 2138
anchors across 140 records resolve
- `pnpm check:adr-anchors`: OK, 39920 citations across 4917 files
resolve
- `pnpm check:doc-authoring`, `pnpm check:nul-bytes` (9378 text files,
no control bytes), `pnpm check:pm-governed-merges`, `pnpm
check:pm-prior-rulings`
- `node scripts/check-ci-filter-parity.mjs`, `node
scripts/check-closing-keyword-parity.mjs` (+ `--self-test`), `node
scripts/check-comment-mask-corpus.mjs`
- `pnpm --filter @objectstack/lint run check:doc-formula-expressions`
(after building `@objectstack/lint` and its closure with `OS_SKIP_DTS=1`
under the verify lock; the tree stayed clean)
- `pnpm check:cross-package-test-inputs`, `pnpm
check:driver-memory-census`, `pnpm check:gitlink-declared`, `pnpm
check:refd-timer-probe`, `pnpm check:watch-hint-literal`
Changeset: none. `docs/adr/**` ships in no package, so the PR carries
`skip-changeset`. No package is touched, so no package build or test is
owed.
## Acceptance notes (not filed)
1. **The design's §3.6 engine positions sit before token resolution.**
On the engine, the comparand doors run in the first stage of `where`
admission (`lowerWhereFilterArray`), and filter tokens resolve in the
second (`resolveWhereTokens` on the read verbs, `withResolvedWhere` on
`update` / `delete`). `aggregations[i].filter` and `having` follow the
same order. Read at `97005aed04`: `engine.ts` lowers at 11245 and
resolves at 11323 (`find`), and lowers at 13004 and resolves at 13017
(`update`). A lowering placed "after `normalizeFilterComparandTypes`",
as the design's table reads, would meet `{today}` unresolved and leave
it bare. Once the faces' copies are deleted, the #3777 loss would return
on every token bound. Amendment item 3 therefore states "after the doors
and after filter-token resolution". The analytics seams already resolve
tokens first (`analytics-service.ts` `resolveQueryTokens`), and the read
scope resolves at its own entry. Carrier: the step-2 card, which cites
item 3.
2. **`dateRange` windows are not `FilterCondition`s.** The design's §3.2
names only `$lte` and `$between`. But an explicit `dateRange` window end
takes the whole-day rule too, in `NativeSQLStrategy`, the preview
evaluator and the memory cube face. Item 8 records the consequence: a
window reaches the lowering only once its face expresses it as the `{
$gte, $lte }` pair that the ObjectQL strategy already hands the engine.
Until then its window arm is an interim copy. Carrier: the step-3 card.
3. **The RLS compile seam's column-type reading is left to
measurement.** `judgeCompiledComparands` reads nothing but the filter.
Its `using` output reaches typed drivers, which rewrite `datetime` only,
and its `check` output reaches `matchesFilterCondition`, which rewrites
type-blind. Item 7 keeps the scope unchanged and leaves the choice to
the card that wires that seam. Carrier: the step-2 card.
4. **ADR-0053 has two sections headed `D-D2`** ("Consequences for D-A3"
and "The primitive lives in `spec`"). They are left as they are. The
ruling and `calendar-day.ts` cite "D-D2" for the primitive, so renaming
either would move a citation. Carrier: none; noted only.
## 维护者速读(草稿)
**改了什么**:只改一份架构决策记录(ADR-0053)里的一节(D-D1),不改代码,也不改任何产品行为。这一节规定"筛选到某天为止(含当天全天)"这条规则在哪里执行。今天它在
10 个文件里各写一份;修订后,改为在各入口处由一个共享模块统一换算一次,各数据源只接收换算好的条件。
**为什么改**:同一条"含当天"规则现在手抄了 10 个文件、41
处。调查实测到两个问题:报表的读取权限范围里完全没有这条规则(最后一天的数据会被漏掉,#20733);另一个面曾先转存储格式再换算,顺序写反(#20661)。您
9 月 30 日裁定「5930 v18
启动」,第一步就是先改这份决策记录。后续代码卡必须以它为施工依据;若不先改,代码就等于悄悄推翻一条已接受的决定。
**风险与代价(含回滚)**:本 PR
只是文档,不影响任何客户数据或查询结果;回滚就是还原这一个提交。真正的风险在后续代码卡,修订里已写明两条:(1) 换算必须放在解析
{today} 这类日期占位符之后,否则带 {today} 的筛选会重新漏掉当天(第 3 条);(2)
直接调用数据驱动、绕过入口的调用方,在各处副本删除后不再自动"含当天"。这是裁定 D4(b) 接受的取舍,影响范围尚未实测,已列为"待测"(第
10 条)。
**席位意见**:
**你要做的(一个动作)**:读 ADR-0053 D-D1 末尾的修订块(10 条)。同意就在本 PR 上批准(Approve);不同意就在
PR 上留言,指出要改的条目。
---
_Generated by [Claude
Code](https://claude.ai/code/session_01DEvba2nBuD4tWzfq8r8NFY)_
Co-authored-by: Claude <noreply@anthropic.com>1 parent 7053333 commit f284ab2
1 file changed
Lines changed: 122 additions & 11 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| |||
702 | 702 | | |
703 | 703 | | |
704 | 704 | | |
705 | | - | |
| 705 | + | |
706 | 706 | | |
707 | 707 | | |
708 | 708 | | |
709 | 709 | | |
710 | 710 | | |
711 | | - | |
712 | | - | |
| 711 | + | |
| 712 | + | |
| 713 | + | |
| 714 | + | |
| 715 | + | |
| 716 | + | |
713 | 717 | | |
714 | 718 | | |
715 | 719 | | |
| |||
719 | 723 | | |
720 | 724 | | |
721 | 725 | | |
722 | | - | |
723 | | - | |
724 | | - | |
| 726 | + | |
| 727 | + | |
| 728 | + | |
| 729 | + | |
725 | 730 | | |
726 | 731 | | |
727 | 732 | | |
728 | | - | |
| 733 | + | |
| 734 | + | |
729 | 735 | | |
730 | 736 | | |
731 | 737 | | |
| |||
737 | 743 | | |
738 | 744 | | |
739 | 745 | | |
740 | | - | |
741 | | - | |
742 | | - | |
| 746 | + | |
| 747 | + | |
| 748 | + | |
| 749 | + | |
| 750 | + | |
| 751 | + | |
| 752 | + | |
| 753 | + | |
| 754 | + | |
| 755 | + | |
| 756 | + | |
| 757 | + | |
| 758 | + | |
| 759 | + | |
| 760 | + | |
| 761 | + | |
| 762 | + | |
| 763 | + | |
| 764 | + | |
| 765 | + | |
| 766 | + | |
| 767 | + | |
| 768 | + | |
| 769 | + | |
| 770 | + | |
| 771 | + | |
| 772 | + | |
| 773 | + | |
| 774 | + | |
| 775 | + | |
| 776 | + | |
| 777 | + | |
| 778 | + | |
| 779 | + | |
| 780 | + | |
| 781 | + | |
| 782 | + | |
| 783 | + | |
| 784 | + | |
| 785 | + | |
| 786 | + | |
| 787 | + | |
| 788 | + | |
| 789 | + | |
| 790 | + | |
| 791 | + | |
| 792 | + | |
| 793 | + | |
| 794 | + | |
| 795 | + | |
| 796 | + | |
| 797 | + | |
| 798 | + | |
| 799 | + | |
| 800 | + | |
| 801 | + | |
| 802 | + | |
| 803 | + | |
| 804 | + | |
| 805 | + | |
| 806 | + | |
| 807 | + | |
| 808 | + | |
| 809 | + | |
| 810 | + | |
| 811 | + | |
| 812 | + | |
| 813 | + | |
| 814 | + | |
| 815 | + | |
| 816 | + | |
| 817 | + | |
| 818 | + | |
| 819 | + | |
| 820 | + | |
| 821 | + | |
| 822 | + | |
| 823 | + | |
| 824 | + | |
| 825 | + | |
| 826 | + | |
| 827 | + | |
| 828 | + | |
| 829 | + | |
| 830 | + | |
| 831 | + | |
| 832 | + | |
| 833 | + | |
| 834 | + | |
| 835 | + | |
| 836 | + | |
| 837 | + | |
| 838 | + | |
| 839 | + | |
| 840 | + | |
| 841 | + | |
| 842 | + | |
| 843 | + | |
| 844 | + | |
| 845 | + | |
| 846 | + | |
| 847 | + | |
| 848 | + | |
| 849 | + | |
| 850 | + | |
| 851 | + | |
| 852 | + | |
| 853 | + | |
743 | 854 | | |
744 | 855 | | |
745 | 856 | | |
| |||
0 commit comments