Repository navigation
fix(formula)!: a flow condition's record. / previous. read of a date field takes the date-text verdicts, so timestamp(record.DATE_FIELD) is refused as its bare name is - #34935
Conversation
…n a flow condition Claude-Session: https://claude.ai/code/session_012MmDsS4GoHCgYwA2uv3n3C Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012MmDsS4GoHCgYwA2uv3n3C Co-authored-by: Claude <noreply@anthropic.com>
…rdict Claude-Session: https://claude.ai/code/session_012MmDsS4GoHCgYwA2uv3n3C Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012MmDsS4GoHCgYwA2uv3n3C Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012MmDsS4GoHCgYwA2uv3n3C Co-authored-by: Claude <noreply@anthropic.com>
…ow-record-date-text
📓 Docs Drift Check11 anchor(s) derived from 1 changed package(s); no hand-written page names any of them, so this run has nothing to list — not a clean bill of health. This check sees only pages that NAME a derived anchor: one that documents this change in prose, or enumerates it in an authoring dialect, names none and stays invisible to it on every run. What this run could not see
Coarse fallback — 12 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): Which tree this was computed onThis run read A worktree cut from an older # while this PR is open — GitHub drops the merge commit once it closes
git fetch origin ef691dd87ec57f7eba1edd4b36bc4f714a24c212 && git checkout ef691dd87ec57f7eba1edd4b36bc4f714a24c212
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin e8a78c4bdf0ec079cdb56e6e6c6f32d6f4ac8e42 36a9089a809745c2a0e02ee245a643ae73db07c8 && git checkout -B drift-repro e8a78c4bdf0ec079cdb56e6e6c6f32d6f4ac8e42 && git merge --no-ff 36a9089a809745c2a0e02ee245a643ae73db07c8
node scripts/docs-audit/affected-docs.mjs --json e8a78c4bdf0ec079cdb56e6e6c6f32d6f4ac8e42 |
…rdict a narrowing Claude-Session: https://claude.ai/code/session_012MmDsS4GoHCgYwA2uv3n3C Co-authored-by: Claude <noreply@anthropic.com>
|
repo:objectstack#4 · os-lizheng · session_012MmDsS4GoHCgYwA2uv3n3C 席位核对 · L1 ACCEPT · Head-sha: 60d4e1c · 2026-11-17T19:12ZCard #34662, revised claim 6955917834, dev reports 6955879892 and 6958060011. The seat read the source diff itself.
Contract-review-handoff: l2-review#3 — CONTRACT_REVIEW_TIER not taken in this seat; seat 4 routes contract reviews to the seated L2 seat by mailbox (2026-11-17T19:12Z) · head 60d4e1c |
|
repo:objectstack#4 · os-lizheng · session_012MmDsS4GoHCgYwA2uv3n3C Contract-review-claim: session_012MmDsS4GoHCgYwA2uv3n3C · head 60d4e1c · 2026-11-17T20:09Z The request to l2-review#3 (mailbox #34476) has waited about an hour with no answer, so this lane reviews at tier itself (contract-review.md (b)). The record is written by an isolated reviewer sub-agent at CONTRACT_REVIEW_TIER. |
|
repo:objectstack#4 · os-lizheng · session_012MmDsS4GoHCgYwA2uv3n3C Contract-review-claim: session_012MmDsS4GoHCgYwA2uv3n3C · head 60d4e1c · 2026-11-17T22:29Z Renewed: the 20:1x claim lapsed (2 hours, no record) while the reviewer sub-agent was stopped by a usage limit. It resumes now at CONTRACT_REVIEW_TIER. |
|
repo:objectstack#4 · os-lizheng · session_012MmDsS4GoHCgYwA2uv3n3C L2 round on head 60d4e1c: finding S1 sent back · 2026-11-17T22:46ZThe seat's at-tier reviewer sub-agent read this head and found no must-fix, one should-fix, and three nits. Its record is NOT posted as the record of this head: S1 (should-fix). The record-root date-text pass stands down on any operator fault of the roots' Timestamp typing (
Nits sent along: N1, one shared constant for the root-read gate ( Contract-review-hold: session_012MmDsS4GoHCgYwA2uv3n3C · head 60d4e1c · S1 fix in progress · until the fixed head is pushed |
… arithmetic against a number Claude-Session: https://claude.ai/code/session_012MmDsS4GoHCgYwA2uv3n3C Co-authored-by: Claude <noreply@anthropic.com>
|
repo:objectstack#4 · os-lizheng · session_012MmDsS4GoHCgYwA2uv3n3C 席位核对 · L1 delta ACCEPT · Head-sha: 1ce9b68 · 2026-11-18T00:26ZDelta from 60d4e1c (ACCEPT 6958189274); dev report 6965070044. The seat read the delta itself.
|
|
repo:objectstack#4 · os-lizheng · session_012MmDsS4GoHCgYwA2uv3n3C Contract-review-claim: session_012MmDsS4GoHCgYwA2uv3n3C · head 1ce9b68 · 2026-11-18T00:27Z The S1 fix head. A fresh isolated reviewer sub-agent at CONTRACT_REVIEW_TIER renders the record. |
…ow-record-date-text # Conflicts: # packages/lint/src/validate-expressions.test.ts
|
repo:objectstack#4 · os-lizheng · session_012MmDsS4GoHCgYwA2uv3n3C 席位核对 · L1 delta ACCEPT · Head-sha: 36a9089 · 2026-11-19T02:30ZDelta from 1ce9b68 (delta ACCEPT 6965140367): one merge of origin/main (
|
|
repo:objectstack#4 · os-lizheng · session_012MmDsS4GoHCgYwA2uv3n3C Contract-review-claim: session_012MmDsS4GoHCgYwA2uv3n3C · head 36a9089 · 2026-11-19T02:30Z The merge head. A fresh isolated reviewer sub-agent at CONTRACT_REVIEW_TIER renders the record. |
|
repo:objectstack#4 · os-lizheng · session_012MmDsS4GoHCgYwA2uv3n3C Contract reviewServed-tier: PR #34935 (card #34662), face ① Derived judgments
② Semver level
ADR-0087 disposition ③ Boundary flags
④ Design judgmentNo must-fix, no should-fix. Earlier graded findings (round on
Nits (no effect on correctness or on the declared contract; none needs the head to move):
Implemented-by: VERDICT: PASS |
|
repo:objectstack#4 · os-lizheng · session_012MmDsS4GoHCgYwA2uv3n3C Landing · Head-sha: 36a9089 · 2026-11-19T02:43Z
State: ready + auto-merge now (L1 delta ACCEPT above). #34662 closes on merge. The reviewer escalated the index spelling |
… is refused as its bare name is (objectstack-ai#36333) <!-- claude-projects-attribution: {"github_login":"os-project-manager"} --> _Requested by **Leehom** · [project thread](https://claude.ai/code/project/chan_01TenzsRopZj4jMbvjX8uz1X?thread=cmsg_01TenzsRopZj4jMbvjX8uz1X8UqWLrzTYpuat8L5eLdf2c)_ Fixes objectstack-ai#34946 Clause-②: no (narrowing) Metadata-protocol: narrowed Skills-docs: none — `skills/objectstack-formula/SKILL.md` already states "No date arithmetic. The build refuses `date + n` and `end - start`" and names no site it is limited to, so it now holds for a flow condition's `record.FIELD` / `previous.FIELD` reads as written repo:objectstack#4 · os-project-manager · session_01FEkQ5pb2t8Z8C64PkPyVt1 ## 维护者速读 - 用户能看到什么变化:作者在校验或发布流程时,若流程条件通过「当前记录」或「修改前记录」读取日期字段并直接加减数字,现在会和直接写字段名一样被拒,并提示改用按天计算的函数;以前这种写法能通过校验,运行时却每次失败。 - 为什么做:属于「表达式校验与作者护栏」,替编写流程的管理员和代写流程的 AI 助手解决「校验通过、流程每次运行都出错」的问题,与已修好的日期文本同类问题是同一族。 - 出错会怎样:若误判,作者在校验或发布流程时会看到一条拒绝;已保存的流程照常加载、照常注册,只在下次发布时要求改写;本改动可整体撤回。 - 要你做什么:这是收紧已接受写法的破坏性变更,需要你本人审阅、批准并亲手合并。L1 ACCEPT 7076562103,全量测试 0 失败 7076550688,契约 PASS 7076631700(座位 7,head f278fec);一个不阻塞的遗留写法(main 上同样存在,不是回归)和三个小问题另立 objectstack-ai#36377 跟进。 ## What changes A flow condition (start, edge, `decision` branch) is evaluated over a scope where the run's row is bound twice: its fields flattened to bare names, and the row itself as `record` (with the row before the write as `previous`). The date-arithmetic verdict typed the bare names only. `firstTypeMismatch`'s flattened record-root pass typed `record.FIELD` / `previous.FIELD` but kept only the text/boolean mismatch, so `record.due_date + 1 > 5` passed while `due_date + 1 > 5` was refused, and both fault at run time on the `YYYY-MM-DD` text on every run. Measured through `validateStackExpressions` (the `os validate` body) on a record-triggered flow (`record-after-update`), object `library_loan` with `due_date: date` and `picked_up_at: datetime` (both `required`), start condition: | start condition | before (`origin/main` 28ba01f) | after (this head) | |:---|:---|:---| | `due_date + 1 > 5` | 1 error, date arithmetic `google.protobuf.Timestamp + int`, `due_date` | 1 error (unchanged) | | `record.due_date + 1 > 5` | 0 | 1 error, same verdict, `record.due_date` named | | `previous.due_date + 1 > 5` | 0 | 1 error, same verdict, `previous.due_date` named | | `picked_up_at + 1 > 5` (CONTROL, datetime) | 1 error, `picked_up_at` | 1 error (unchanged) | | `record.picked_up_at + 1 > 5` (CONTROL) | 0 | 1 error, matching the bare name | | `previous.picked_up_at + 1 > 5` (CONTROL) | 0 | 1 error, matching the bare name | | `record.due_date < today()` (CONTROL) | 0 | 0 | | `timestamp(record.due_date) < now()` (CONTROL, date-text) | 1 error, date-text call | 1 error (unchanged, no second finding) | The datetime control: a `datetime` field is a Timestamp in the type check exactly as a `date` field is, and its bare name already took the date-arithmetic verdict, so its root reads now take that verdict too, word for word with the reference swapped. That is the dispatch's control ("keep whatever verdict the bare name gets for a datetime"). - `packages/formula/src/cel-engine.ts`, `firstTypeMismatch`: the record-root pass now answers `category: 'date-arith'` when its first operator fault is date/duration arithmetic against a number (`isDateArith`), with `field` and `root` from `offendingRecordRead(…, 'timestamp')`. The text/boolean branch is unchanged. The comment that said the `date-arith` verdict "stays the bare name's alone" is corrected, and the `root` field's doc and `recordRootReadsFaultDateArith`'s doc say the root read is answered there too. - `packages/formula/src/validate.ts`, `typeSoundnessIssue`: a root read's date verdict takes the row's arm (`dateArm` with `bareNamesUnproven` false), as the root read's type mismatch (objectstack-ai#30025) and date-text verdicts (`recordRootDateTextIssue`) already do. So `record.due_date + 1 > 5` stays `date-arithmetic-run-fails` where bare names are unproven or a flow variable shadows `due_date`. The bare name's arm is unchanged. - No double report: `recordRootDateTextIssue` runs only when `firstTypeMismatch` answers null, and it already stood down on this exact shape (`recordRootReadsFaultDateArith`). The objectstack-ai#34662 date-text pins are green and unchanged. - `packages/spec/src/migrations/entries/semantic/18.flow-condition-record-date-arithmetic-refused.ts`: the ADR-0087 semantic entry (a structured TODO; no mechanical rewrite, since a span in days and a shifted date are different intents), modelled on `18.cel-list-equality-refused.ts`. - `.changeset/34946-flow-record-date-arithmetic.md`: `minor` for `@objectstack/formula` and `@objectstack/spec` (`Metadata-protocol: narrowed` grades `minor`; spec ships the new ADR-0087 entry in its generated migration registry), the declaration lines, the **BREAKING** banner, a FROM to TO table, and `adr-0087: registered flow-condition-record-date-arithmetic-refused`. Reach (the dispatch asked to stop if the narrowing reached beyond flow conditions): the flattened scope is used only by flow conditions. `@objectstack/lint` passes it for start, edge and `decision` conditions, `@objectstack/service-automation`'s `registerFlow` (advisory only) and the MCP `validate_expression` tool's `flow_condition` site. Formula fields, validation rules, hooks and actions are `record`-scoped, where `record.due_date + 1` was already refused (`date-arithmetic`, `-fail-closed`, `-fail-open`). No widening was needed. ## Tests - `packages/formula/src/validate.test.ts`, new top-level describe (objectstack-ai#34946): `record.` and `previous.` date arithmetic refused under `date-arithmetic-run-fails` with full params (`operands`, `reference` naming the read), and the evaluator faults on them over the run's scope. CONTROL: the datetime field's root reads equal the bare name's verdict. Arms: `run-may-fail` with no declared outcome, `run-fails` kept on a root read when bare names are unproven or shadowed. CONTROL: `record.due_date < today()`, `previous.due_date < today()`, `date(record.due_date) < now()` and the prescribed rewrites (`daysBetween(record.due_date, today()) > 5`, `addDays(record.due_date, 1) < today()`, `addDays(previous.due_date, -7) < today()`) are clean. The date-text shapes keep their one finding (`date-text-call-run-fails`, `date-text-arithmetic-run-fails`) and `record.title > 5` keeps `type-mismatch-run-fails`. - `packages/lint/src/validate-expressions.test.ts`, new top-level describe: start, edge and `decision` conditions refuse `record.` / `previous.` at the bare name's path and severity, with the bare name's message and the reference swapped. Reported under `expression-invalid` through `runAuthoringRules('build', …)`, the rule body the runtime publish door runs. CONTROL: datetime root reads equal the bare name's findings at all three sites; `record.due_date < today()` stays clean; `timestamp(record.due_date) < now()` keeps exactly one date-text finding. - `packages/services/service-automation/src/flow-registration-schema-e2e.test.ts`, new top-level describe: `registerFlow` logs the date-arithmetic advisory for `record.` / `previous.` as for the bare name and still registers. CONTROL: an ordering against `today()` is not advised. - `packages/runtime/src/domains/meta-flow-condition-record-date-text.test.ts`, new top-level describe (objectstack-ai#34946, added at `f278fece6f`): the publish door (`publishMetaItem` over the real `ObjectQL` engine) refuses the bare name, `record.due_date` and `previous.due_date` date arithmetic with `INVALID_METADATA` / 422 and one date-arithmetic issue naming the read, leaving the item draft. CONTROL: a datetime field's root reads take the same refusal; `record.due_date < today()` publishes and goes active. The loan fixture gains one required `date` field `due_date`. Runs at `f278fece6f`: 4/4 passed; ablating the cel-engine record-root `isDateArith` branch turns exactly the 2 new tests red, restored to the HEAD blob with `git diff HEAD` empty and `ablation-dist-preflight --absent` clean. Publish door, first measured on head 4426723 as a scratch copy of the same rig (now committed as the pin above): | start condition | publish | date-arithmetic finding | row state | |:---|:---|:---|:---| | `due_date + 1 > 5` | `INVALID_METADATA` / 422 | `expression-invalid`, `due_date` | draft | | `record.due_date + 1 > 5` | `INVALID_METADATA` / 422 | `expression-invalid`, `record.due_date` | draft | | `previous.due_date + 1 > 5` | `INVALID_METADATA` / 422 | `expression-invalid`, `previous.due_date` | draft | | `picked_up_at + 1 > 5` (CONTROL) | `INVALID_METADATA` / 422 | `expression-invalid`, `picked_up_at` | draft | | `record.picked_up_at + 1 > 5` (CONTROL) | `INVALID_METADATA` / 422 | `expression-invalid`, `record.picked_up_at` | draft | | `previous.picked_up_at + 1 > 5` (CONTROL) | `INVALID_METADATA` / 422 | `expression-invalid`, `previous.picked_up_at` | draft | | `record.due_date < today()` (CONTROL) | published | none | active | At `f278fece6f` (the patch round: changeset regrade and the runtime pin): runtime pin 4/4 and its ablation as above; `dispatch-gates --commands` 98 families derived (one more than at 4426723: `check:route-envelope`); the families for the changed paths (`check-adr-0087-registration`, `check-changeset-no-major`, `check-empty-changeset`, `check:cross-package-test-inputs`, `check:test-source-alias`, `check:tier-file-adoption`, `check:route-envelope`) exit 0; `overlap-check` clean. The runs below and the dogfood battery are from 4426723; the patch round changed only the changeset and a runtime test file. <details><summary>Local runs (head 4426723)</summary> All under `scripts/pm/os-verify-lock.sh`, exit codes captured before any pipe: - `pnpm --filter @objectstack/formula build` exit 0; `pnpm --filter @objectstack/formula test` exit 0, Test Files 70 passed (70), Tests 2067 passed (2067); `pnpm --filter @objectstack/formula typecheck` exit 0 (test layer: 7 errors held in `test-typecheck-debt.json`, unchanged). - `pnpm --filter @objectstack/lint exec vitest run --maxWorkers=2 src/validate-expressions.test.ts` exit 0, Tests 529 passed (529). - `pnpm --filter @objectstack/service-automation exec vitest run --maxWorkers=2 src/flow-registration-schema-e2e.test.ts` exit 0, Tests 7 passed (7). - `pnpm --filter @objectstack/spec exec vitest run --maxWorkers=2 src/migrations` exit 0, Test Files 5 passed (5), Tests 198 passed (198) (spec built with the new entry; `gen:migration-registry` runs in its build). - `node scripts/pm/dispatch-gates.mjs --commands` derived 97 families for this diff; all 97 run locally, reconciled with `--ran`: "97 derived, 97 run, 0 NOT-MEASURED, 0 UNRUN". `pnpm check:dual-build-cjs-loads` first answered PREREQUISITE NOT MET (exit 3, no full build yet), then exit 0 after `check:type-check-debt` built the tree; every other family exit 0 on the first run. - Dogfood battery (the `!` title), on head 4426723: `pnpm --filter @objectstack/dogfood test` under the lock, VERDICT command-exit 0, Test Files 484 passed, 3 skipped (487), Tests 4107 passed, 68 skipped (4175), no failure. - `test:repo` (vitest `repo` project) not run locally: the diff touches none of its tests; it is CI's (`Test Core`). </details> <details><summary>Ablations (each committed first, mutated through scripts/ablation-replace.mjs, restored to the HEAD blob)</summary> 1. Subject: the new `isDateArith` branch of the record-root pass (`packages/formula/src/cel-engine.ts`). Anchor `if (rootTyped && isDateArith(rootTyped)) {` replaced by a never-true guard carrying `ABLATED_34946` (anchor 1 to 0, blob `8eb099d83f32` to `4975d5dd3077`), formula rebuilt, `ablation-dist-preflight.mjs @objectstack/formula ABLATED_34946` exit 0 (the marker reached `dist/`, which the lint and service-automation suites read). Red: formula `validate.test.ts` 3 failed / 236 passed (the three objectstack-ai#34946 verdict tests; the CONTROL for orderings and date-text stayed green), lint 5 failed / 524 passed (all five non-ordering objectstack-ai#34946 tests), service-automation 1 failed / 6 passed (the advisory test). Restored: blob back to `8eb099d83f32` = `HEAD:packages/formula/src/cel-engine.ts`, `git diff HEAD` empty, rebuilt, preflight `--absent` exit 0, lint 529/529 again. 2. Subject: the root read's arm in `typeSoundnessIssue` (`packages/formula/src/validate.ts`). Anchor `dateArm(scope, faultOutcome, mismatch.root !== undefined ? false : bareNamesUnproven)` replaced by `dateArm(scope, faultOutcome, bareNamesUnproven ...)` (blob `aeedf005910e` to `b35d7d64bb2a`). Red: formula `validate.test.ts` 1 failed / 146 passed, the arm test (`record.due_date + 1 > 5` under unproven bare names). Restored: blob `aeedf005910e` = HEAD, `git diff HEAD` empty, 147/147. </details> ## Acceptance notes - Kept as before, deliberately: where bare names are unproven and a source holds both a bare-name date-arithmetic fault and a root-read one (`due_date + 1 > 5 && record.due_date + 1 > 5`), the first (bare) verdict is reported, at `date-arithmetic-run-may-fail`. Still an error; the swap-to-the-root-read step `typeSoundnessIssue` does for a bare type mismatch was not extended to the date verdict. - The field a multi-date expression names is best effort, as for the bare name: `offendingRecordRead` names the first `timestamp` field read through a root, in field-map order. - Declarations follow the two closest precedents in this family (objectstack-ai#34935, objectstack-ai#36207): `Metadata-protocol: narrowed` with a `minor` changeset (regraded at `f278fece6f`). - Carried by objectstack-ai#36377: contract review 7076631700 S1 (a bare date ordering against text AND-ed before a `record.` date arithmetic still passes; measured first on that card) and nits N1–N3. ## Verification Read first, by risk: 1. `packages/formula/src/cel-engine.ts`, the new `isDateArith` branch of `firstTypeMismatch`'s record-root pass (the narrowing itself). 2. `packages/formula/src/validate.ts`, the `dateArm` call in `typeSoundnessIssue` (the root read's arm). 3. `packages/spec/src/migrations/entries/semantic/18.flow-condition-record-date-arithmetic-refused.ts` (the upgrade-guide text). Two-minute check: `pnpm --filter @objectstack/formula exec vitest run --maxWorkers=2 src/validate.test.ts -t 34946` shows 4 passing tests. --- _Generated by [Claude Code](https://claude.ai/code/session_01FEkQ5pb2t8Z8C64PkPyVt1)_ <!-- signed: repo:objectstack#4 · os-project-manager · session_01FEkQ5krBqrrgxCYgjXmfbv --> --------- Co-authored-by: Claude <noreply@anthropic.com>
Fixes #34662
Clause-②: no (narrowing)
Metadata-protocol: narrowed
Skills-docs: none —
skills/objectstack-formula/SKILL.mdalready states thedate-text-callrule (adate/datetimefield handed to a timestamp-only call, andtimestamp()over adatefield) withrecord.FIELDspellings and names no site it is limited to, so it now holds for a flow condition's root reads as written维护者速读
decision分支)里通过record.FIELD/previous.FIELD读日期字段时,现在与裸字段名一样接受 date-text 这一族校验;timestamp(record.borrow_date) < now()(borrow_date为 date 字段)在os validate和 flow 发布门被拒,错误码、措辞、结果分支(date-text-call-run-fails等)与裸名写法相同,提示改写为date(record.borrow_date)或isoDate(addDays(record.borrow_date, N))。YYYY-MM-DD文本,timestamp()解析不了,这条 flow 每次运行都失败;裸名写法早已被拒,record.写法却零告警通过。os validate和发布的 flow 条件,若经record./previous.把 date 字段交给timestamp()(或交给isoDate()、做文本日期运算),现在被拒,直到改写为date(record.FIELD);registerFlow仍只记 advisory 日志、照常注册,已存的 flow 在下次发布前继续运行。datetime 字段、date(...)改写、Timestamp 类型已判的形状(record.due_date + 1)不受影响。回滚即 revert 本 PR。packages/formula/src/validate.ts(recordRootDateTextIssue与typeSoundnessIssue的接入点)、packages/formula/src/cel-engine.ts(firstDateTextCall/firstDateTextVerdict新增的recordRootTypes参数与recordRootReadsFaultTimestampTyping)、.changeset/34662-flow-record-date-text.md。pnpm --filter @objectstack/formula exec vitest run --maxWorkers=2 src/validate-date-text-arithmetic.test.ts -t 34662,预期 6 个用例全部通过。What changes
A flow condition is evaluated over a scope where the run's row is bound twice: its fields flattened to bare names, and the row itself as
record(with the row before the write asprevious). The date-text family (date-text-call*,date-text-arithmetic*) typed the bare names only. Measured onorigin/mainfc5913e throughvalidateStackExpressions, with the card's fixture (library_loan,borrow_date: date,picked_up_at: datetime, startrecord-after-update):timestamp(record.borrow_date) < now()record.borrow_datenamedtimestamp(borrow_date) < now()timestamp(previous.borrow_date) < now()previous.borrow_datenamedtimestamp(record.picked_up_at) < now()(CONTROL)The same holds on an edge condition and on a
decisionbranch. The other members of the family missed root reads the same way and are covered by the same change:isoDate(record.picked_up_at) == '...'(0 findings before; the bareisoDate(picked_up_at)was refused) andrecord.due_date - record.borrow_date > duration('24h')(no date-text finding before).packages/formula/src/validate.ts:typeSoundnessIssueruns a record-root pass after the bare-name date-text pass, at flattened scope only:recordRootDateTextIssue. It typesrecord.FIELD/previous.FIELDwith every field's type (a flow variable shadows a bare name, never a root member), leaves every bare namedyn, and keeps onlydate-text-call*/date-text-arithmetic*. This is the record-root passfirstTypeMismatchalready runs for the text/boolean mismatch, applied to the date-text family. The outcome arm is the row's (dateArmwithbareNamesUnprovenfalse), as a root read keeps its outcome fortype-mismatch. A shape the Timestamp typing of the roots already faults on (record.due_date + 1) belongs to thedate-arithmeticfamily and stands down, the same order the flow value envelope uses.dateTextIssue/dateTextCallIssuetake the optional root typing, and the message names the read as written (verdict.root).packages/formula/src/cel-engine.ts:firstDateTextVerdictandfirstDateTextCalltake an optionalrecordRootTypes(flattened scope only) and pass it tobuildTypedEnv. On that pass a root read qualifies by the root typing alone, so aninput.FIELDread does not qualify. Without the argument every call is unchanged.DateTextVerdictgains the optionalroot.recordRootReadsFaultTimestampTypingis the stand-down probe. None of these is on the package's public entry..changeset/34662-flow-record-date-text.md:minorfor@objectstack/formula(the kindnarrowedtakes at leastminor), with the declaration lines, the BREAKING banner, a FROM to TO table and the ADR-0087 dispositionalready-registerednaming the three semantic entries (formula-timestamp-date-only-refused,formula-date-text-call-refused,formula-date-subtraction-refused). Theirsurfacetext already names flow conditions among the predicates judged with field types, spelled withrecord.FIELD, so it is left as is: this change makes that text true for a root read. No entry, generated file or registry changes.No producer change was needed outside
packages/formula.@objectstack/lint(os validate, and the runtime publish gate that runs the samerunStackExpressionPassesbody) and@objectstack/service-automation(registerFlow) already hand flow conditions the flattened hint with field types and the declared outcome. The fix reaches all three through the shared validator.Tests
packages/formula/src/validate-date-text-arithmetic.test.ts: new top-level describe in the date-text harness.record.andprevious.over a date field are refused underdate-text-call-run-failswith full params (call, reference, rewrite, shift), and the evaluator faults on them over the run's scope. CONTROL:datetimeand the prescribeddate(...)parse are clean and evaluate totrue. Arm pins:run-may-failwith no declared outcome;run-failskept on a root read when bare names are unproven. A flow variable shadowing the bare name leaves the root read judged.isoDate(record.picked_up_at)and root-read date-text arithmetic are refused. The stand-downs (record.due_date + 1, aninput.read) take no date-text code.packages/lint/src/validate-expressions.test.ts: new top-level describe. Start, edge anddecisionconditions refuserecord./previous.at the bare name's path and severity, with the shift text. Rule idexpression-invalidthroughrunAuthoringRules('build', ...). CONTROL:datetimestays clean through either root at all three sites.packages/runtime/src/domains/meta-flow-condition-record-date-text.test.ts(new; the flow publish door,saveMetaItemthenpublishMetaItemover the real engine): the bare name,record.andprevious.are each refused with{ code: 'INVALID_METADATA', status: 422 }, oneexpression-invaliddate-text issue each, and the item leftdraft. CONTROL:datetimethrough either root publishes (active).packages/services/service-automation/src/flow-registration-schema-e2e.test.ts: new describe.registerFlowlogs the date-text advisory forrecord./previous.as for the bare name and registers the flow. CONTROL:datetimeis not advised.Ablation, after the fix was committed (
scripts/ablation-replace.mjs --hold, trap restore): the record-root pass was disabled invalidate.ts(call guarded by a literal that never equals the source),@objectstack/formularebuilt, andablation-dist-preflight.mjsconfirmed the marker indist/index.jsanddist/index.mjs. Result: formula 4 failed / 83 passed, lint 4 failed / 1 passed, service-automation 1 failed / 4 passed, runtime 1 failed / 1 passed. Every refusal pin went red and every CONTROL stayed green. Restore: blob equal to HEAD,git diff HEADempty, rebuilt,--absentpreflight clean,git status --porcelainempty.Acceptance notes
Clause-②: no (narrowing),Metadata-protocol: narrowed: a pure narrowing, since the newrecordRootTypesparameter is on non-exported functions and nothing published widens. A contract-review-tier L2 review is owed before the queue; the seat routes it.publishMetaItem(seat: accepted as landed).registerFlowlogs a condition's schema-aware findings as an advisory and never throws, by contract (Formula guardrail: cel-js arithmetic silently returns null (double × int + bare identifiers) #1928,flow-registration-checks.ts); it does not refuse the bare spelling either. The refusal withcode/statusis the metadata publish gate (INVALID_METADATA/ 422), pinned inpackages/runtime;registerFlowis pinned for advisory parity.describe. So the formula, lint andregisterFlowpins went into their existing harnesses. The publish-door pin is a new file, because no harness pins a flow condition's date verdict at that door.recordroot is typed even when a flow declares a variable namedrecord. Thetype-mismatchrecord-root pass has always done the same, and this change does not alter it.date-arithmeticverdict (Timestamp typing,due_date + 1 > 5) refuses the bare name in a flow condition but notrecord.due_date + 1 > 5/previous.due_date + 1 > 5. Measured on this branch with arequireddate field: 1 error and 0 / 0 findings. The seat files it; this family stands down on that shape so as not to change its code.Verification
Final head 60d4e1c. Dogfood battery on it (the
(narrowing)arm):pnpm --filter '@objectstack/dogfood^...' buildthenpnpm --filter @objectstack/dogfood testunder the lock, VERDICT command-exit 0, Test Files 479 passed / 3 skipped (482), Tests 4072 passed / 68 skipped (4140). Merged-head (653f1fb) package tests and typechecks: formula 68 files / 1878 tests, lintvalidate-expressions.test.ts505/505, service-automation e2e 5/5, runtime publish-door 2/2, all four typechecks green. Gate readings and CI: the os-dev-report comments on the card.Premise table on origin/main fc5913e (built lint dist)
(LT spells the less-than operator.)
After the fix (same probe)
Generated by Claude Code