Skip to content

fix(formula): a date ordered against a text field gets its own refusal code, date-text-ordering - #39148

Merged
objectstack-fleet[bot] merged 7 commits into
mainfrom
claude/issue-38959-item4-date-text-ordering-code
Dec 2, 2026
Merged

objectstack-fleet[bot] merged 7 commits into
mainfrom
claude/issue-38959-item4-date-text-ordering-code

Conversation

@objectstack-fleet

@objectstack-fleet objectstack-fleet Bot commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor

Part of #38959

Item 4 only, ruled option A in 7344060050. Items 1, 5 and 2 landed in #39072, and item 3 is recorded as accepted fail-open; the seat closes the card when this lands.

Clause-②: yes
Metadata-protocol: none
Skills-docs: none — the kind is none with no arm, and skills/objectstack-formula names no type-mismatch* code for this shape

维护者速读

  • 用户能看到什么变化:流程条件、校验规则、公式里把日期字段和文本字段比大小时,提示语换成一条新代码 date-text-ordering,说的是实际发生的事——按文本逐字比较,不会运行出错;该拦截的照样拦截,级别(错误/警告)不变。
  • 为什么做:流程条件发布检查那张卡的第 4 项(日期与文本比大小的提示语不实),按你选的方案 A:给这种判定一个自己的代码和真实的句子。
  • 出错会怎样:最坏是某处按旧代码匹配这种写法的提示会改看到新代码,拦截与否和级别都不变;可直接撤回本 PR 恢复旧提示。
  • 要你做什么:无(契约审核由席位安排)。

Fix round (contract review 7349732810, S1 and N3), head c18de9c61d

  • S1. The params and sentence of date-text-ordering now come from the comparison that keeps the verdict.
    • comparesDateTextAgainstUndeclared returns that comparison instead of a boolean: its operator, its operand types and its counterpart.
    • The counterpart is given only when it is a text field read. An index read is named in member spelling.
    • firstTypeMismatch passes the comparison on as ordering, and validate.ts reads the params and sentence from it.
    • field and root are untouched, so the grade cannot move.
    • This supersedes the dateTextOrdering: true flag that the cel-engine.ts bullet and the ablation lines below describe.
  • reference is narrower. It now appears only for a direct text-field read. Computed text (upper(record.title), string(record.notes), a concatenation) loses it, and the sentence then reads "a text value". An index read record['title'] gains reference: record.title. The params type is unchanged.
  • Pins. Both of the reviewer's shapes are pinned at 7 sites, with params asserted by equality. A base-vs-head sweep of 94,080 judgments found 0 code or grade changes; 22,488 changed params or sentence only.
  • N3. The lint counter comment and the #30026 note are reworded; prose only.
  • Review. The delta contract review passed with No must-fix, no should-fix.

What changes

  • @objectstack/formula, expression-refusal.ts. One new code in the closed refusal vocabulary, date-text-ordering, params operands, operator, reference? (the text counterpart as written, when it is a field read). Its pin file holds three pins: a formula-field warning, a record-triggered flow error with the reversed operand order, and a counterpart that is no field read.
  • validate.ts, typeSoundnessIssue. Where the type mismatch is the kept date-against-text ordering (the CEL: a datetime field is typed Timestamp at authoring (validate_expression, publish gate) but bound as an ISO string at runtime, so isoDate(record.<datetime>) passes every check and then refuses every write ("no matching overload for 'isoDate(string)'") #32595 verdict, unchanged), the refusal is date-text-ordering with a sentence that says what the run does: the runtime holds the date field as its text, so the comparison evaluates as a text comparison and does not fault, answering by spelling, not by date. It prescribes date(TEXT) to compare dates (null where the text is no date) or string(...) on the date side to compare text on purpose. Both prescriptions are pinned clean at every site and evaluated.
  • Same sources, same grade. The grade is the one the site's type-mismatch* code carried: an error at a site that declares its fault outcome (fail-closed rule, advisory rule, record-triggered flow, sweep of the typed object, a member read under bareNamesUnproven), a warning elsewhere (formula field, flow condition with no declared outcome, unproven bare name). Review S3 on fix(formula)!: flow-condition verdicts agree with the run — severity, the index spelling, macro variables #39072 stays as ruled: the three S3 sources keep the warning grade, now under the new code.
  • Final spelling, measured against the ledger. The working name date-text-ordering-run-may-fail was not taken. In this ledger a -run-fails / -run-may-fail / -fail-closed / -fail-open / -sweep-run-fails / -value-run-may-fail suffix names the fault outcome a sentence states at one site. This verdict has no fault, so it has no outcome to name, and its sentence is the same at every site. The contract ("a code names ONE message template") then gives one code with no suffix. That is the precedent of list-equality and date-duration-value, and the shape of the date-text-arithmetic / date-text-call family names. It does not match DATE_TEXT_FAMILY_RE (date-text-(call|arithmetic)), so the item-1 precedence never takes it as a date-text fault.
  • A date-text fault beside the ordering is the finding at every grade. The new sentence says its comparison does not fault, so where the same source also holds a date-text fault (record.due_date > record.title && record.due_date - record.borrow_date > duration('1h')), the date-text error wins at error sites too. At warning sites it already won (item 1). At error sites this moves the code from type-mismatch*-fails to date-text-arithmetic*, at the same grade.
  • cel-engine.ts. firstTypeMismatch reports which mismatch is the kept ordering (dateTextOrdering: true, from the keptOrdering flag it already computed). This is three code lines (one result field, two spreads) and their doc comment beyond the claim's "comment only" surface, declared below. The two comments that still called item 4 open are rewritten (N8): cel-engine.ts, beside offendingRecordRead(..., !keptOrdering), and the S3 pin's comment in validate-date-text-arithmetic.test.ts.
  • @objectstack/lint, validate-expressions.ts. This is one consumer branch that matched the old code on this shape. The #30026 note, which says why a time-relative sweep of another object only warns, fired on type-mismatch-run-may-fail warnings. The ordering was served as that code, so the note was printed for it. It now counts date-text-ordering warnings at a flow condition too, so the note still prints for the ordering, as before. Without this, the note would silently drop for due_date > title on such a flow (measured on the built lint: the warning alone, no note).

Consumer pins of the old code on this shape

Updated, every one:

Searched, with nothing pinning the old code or sentence on this shape. Each suite below ran green against the rebuilt formula:

  • flow publish and registration: packages/objectql/src/publish-type-mismatch-fail-closed.test.ts (12 passed), packages/services/service-automation/src/flow-registration-checks.test.ts (35 passed);
  • lint: the whole @objectstack/lint suite (261 files, 10,327 passed);
  • MCP and validate tool: packages/mcp/src/mcp-validate-expression.test.ts (80 passed);
  • REST envelope: no test pins a formula refusal code. The publish door answers INVALID_METADATA with the message, and the grade is unchanged, so the status is too;
  • dogfood and CLI: git grep of tests, packages/qa, examples and docs/qa for the old sentence on a date-vs-text source and for the operand spellings Timestamp < string / string < google.protobuf.Timestamp: no hit outside formula.

Tests

  • New top-level describe in validate-date-text-arithmetic.test.ts, "a date ordered against a text field is served under its own code, with a true sentence (flow condition type verdicts: a type-mismatch warning hides a date-text refusal, .exists over date fields is refused while it runs, and a nullable-ternary minus date text passes and faults #38959 item 4)". It covers:
    • record.due_date > record.title and its reverse, and a datetime pair, at seven sites, each at the grade the old code carried there;
    • the sentence: the first-sentence shape, the "does not fault" clause, and no fault wording;
    • the run evaluates each source;
    • the text-order answer;
    • both prescriptions clean at every site;
    • CONTROL: a real mismatch (record.title > 5, record.title < today()) keeps type-mismatch* at every site and faults;
    • a date-text fault beside the ordering is the finding at every site, and faults.
  • New top-level describe in packages/lint/src/validate-expressions.mismatch-precedence-38959.test.ts (spec-valid fixtures). It covers the publish lint over:
    • a record-triggered flow: error, new sentence;
    • a sweep of the typed object: error;
    • a sweep of another object: warning plus the note;
    • CONTROL: title > 5 keeps type mismatch.
  • No HTTP envelope carries this code. The lint door drops formula codes into its finding, and the publish door answers INVALID_METADATA, so no status assertion applies. code is asserted at the formula layer.
Runs at 0fee6f4 (after merging origin/main 27ce3c0)
  • pnpm --filter @objectstack/formula build && … vitest run --maxWorkers=2: 72 files, 2270 passed; @objectstack/lint vitest: 261 files, 10327 passed (one os-verify-lock run, VERDICT command-exit 0).
  • pnpm --filter @objectstack/formula typecheck and pnpm --filter @objectstack/lint typecheck (both include check:test-typecheck): exit 0, at 037ff18 (pre-merge; the merge brought no formula or lint change).
  • mcp mcp-validate-expression.test.ts 80 passed; objectql publish-type-mismatch-fail-closed.test.ts 12 passed; service-automation flow-registration-checks.test.ts 35 passed (against the rebuilt formula and lint).
  • Sweep case wall time, expression-refusal-codes.test.ts alone: 461 ms and 252 ms, against its 16 000 ms budget.
Ablations (scripts/ablation-replace.mjs, each restore verified: blob equals HEAD, git diff HEAD empty)
  • if (mismatch.dateTextOrdering) { to if (false) { (the new branch): the two formula files, 34 failed.
  • }, true); to }, false); (date-text precedence at every grade): 5 failed, the precedence pins at the error sites.
  • cel-engine.ts root-pass flag to ...(false ? …): 14 failed. First-pass flag to ...(false ? …): 18 failed.
  • lint counter (w.code === 'date-text-ordering' && scope === 'flattened') to (false): 1 failed, the sweep-note pin.

Acceptance notes

  • File surface. The claim lists cel-engine.ts for its comment only. The verdict's identity is known only inside firstTypeMismatch (keptOrdering), so three code lines there carry it out. Rebuilding it in validate.ts from the operand spelling would mislabel bool + DateText real faults. The lint source line is the consumer branch named above. Both are outside the stated surface and are reported to the seat.
  • A real mismatch beside the ordering is still the finding. Measured: record.due_date > record.title || record.active + 1 > 2 and due_date > title && notes * 2 > 1 answer the bool + int / string * int mismatch under its type-mismatch* code, not the ordering. The new sentence speaks of "this comparison" only.
  • packages/spec/src/migrations/entries/semantic/19.flow-condition-mismatch-warning-and-index-mismatch-refused.ts (fix(formula)!: flow-condition verdicts agree with the run — severity, the index spelling, macro variables #39072) describes the ordering as "the mismatch kept as before" and its warning grade. Both still hold in grade, and it names no code for it. It is untouched.
  • content/docs/releases/** and CHANGELOG.md are untouched; the changeset names the code move.

Verification

Read first, by risk:

  1. packages/formula/src/validate.ts: the if (mismatch.dateTextOrdering) branch and dateTextOver(…, always).
  2. packages/formula/src/cel-engine.ts: the two dateTextOrdering spreads.
  3. packages/lint/src/validate-expressions.ts: the counter line.

Two-minute check: pnpm --filter @objectstack/formula exec vitest run --maxWorkers=2 src/validate-date-text-arithmetic.test.ts -t "item 4". Expect every case green, including the seven per-site grade cases for each pair and the two CONTROL blocks.

Gates: dispatch-gates --commands (71 families) and --ran reconciliation
  • node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack at 0fee6f4: 71 families.
  • 67 ran with exit 0, each exit captured before any pipe.
  • --ran reconciliation: "71 derived famil(ies) accounted for — 67 run, 4 NOT-MEASURED".
  • NOT MEASURED, left to CI:
    • check:dual-build-cjs-loads: exit 3, needs a full build;
    • check:query-options-erasure: exit 124 at my 200 s per-gate timeout;
    • check:slot-lookup and check:type-check-debt: not started, over the foreground cap in the earlier rounds on this card.
  • check:nul-bytes, check:doc-authoring, check:issue-citations, check:adr-0087-registration --base origin/main, check:empty-changeset, check:changeset-no-major, check:closing-keyword-parity: exit 0.

Generated by Claude Code

@github-actions github-actions Bot added size/m documentation Improvements or additions to documentation tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface labels Dec 2, 2026
@github-actions

github-actions Bot commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

7 anchor(s) derived from 2 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
  • 3 name(s) were too generic to anchor anything (single lowercase words)
  • the SDK route bridge reached 71 of 255 client-bound route-ledger rows — the other 184 have no registrar path: tail to select them, so pages documenting THEIR client methods cannot appear above, on this or any run. Of those 184: 0 are remediable by widening that discovery convention (an in-repo file declares the path; the convention did not scan it); 60 are structural — on a ledger where NOT ONE row is declared in-repo, so no discovery change reaches them at any price; 124 are undecided (no in-repo declaration, on a ledger that has other in-repo registrars — absence and an unreadable spelling are not distinguishable here). The rows themselves: node scripts/docs-audit/affected-docs.mjs --bridge-coverage
  • a page that states a rule by its inputs shares no identifier with the emitter that implements the rule, so an emitter-only diff cannot list it — not on this run and not on any run. Measured on fix(driver-sql): emit varchar(maxLength) for a text field a declared index keys on #11430: content/docs/protocol/objectql/types.mdx documents the text-family column mapping by the ObjectQL type names it maps FROM (text / textarea / html) while the diff changed createColumn; it went unlisted, and it was the page that diff falsified, in four places. No shared token exists to detect this on, so a rule your change carries has to be re-read by hand in the pages that restate it.
  • a key NAME is not a key, so the hand re-read the line above prescribes can land on the wrong schema. The same spelling is authorable on one governed type and a [REMOVED] tombstone on another for each of active, aria, joins, objects, template, tools and version (censused on [finding] tools is a key on BOTH AgentSchema (tombstoned, dead) and SkillSchema (live, cloud-attested), so a name-based search attributes skill examples to the agent key — it produced a false stop-the-line alarm on PR #19059 #19093 over the liveness ledger's governed types, top-level keys); nothing in a search result distinguishes the two, so a grep hit on a LIVE example reads as evidence about the DEAD key. Measured on fix(spec): the agent.tools liveness row says dead — it claimed live on a key the schema tombstoned #19059: content/docs/ai/agents.mdx was reported as contradicting the agent.tools tombstone over its tools: example at :161, which is inside the defineSkill({ block opened at :155 — the page was already correct. Settle ownership by PARSING the value against both schemas, never by the name: that literal PASSES SkillSchema, and as an AgentSchema it FAILS at tools with the tombstone prescription. ⛔ These names are not the whole class — a key retired through a .strict() guidance map leaves no tombstone in the walked shape and none of them here (tool.category, live as AIToolDefinition.category).

Coarse fallback — 16 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): node scripts/docs-audit/affected-docs.mjs --json 8236b793b19c942debd9df6a05fe3818593995b9 → packageMentionDocs.

Which tree this was computed on

This run read content/docs from af603c834a9fdf6ea014e5f3d6ae1f86ab7dc273 — the merge of head c18de9c61d02f22725e4826388d59a69027cb0ef into base 8236b793b19c942debd9df6a05fe3818593995b9, which is what actions/checkout gives a pull_request run. Not the PR head.

A worktree cut from an older main holds a different content/docs, so re-deriving there can legitimately return a different list — that is a different tree, not a wrong row. To answer on the same tree:

# while this PR is open — GitHub drops the merge commit once it closes
git fetch origin af603c834a9fdf6ea014e5f3d6ae1f86ab7dc273 && git checkout af603c834a9fdf6ea014e5f3d6ae1f86ab7dc273
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 8236b793b19c942debd9df6a05fe3818593995b9 c18de9c61d02f22725e4826388d59a69027cb0ef && git checkout -B drift-repro 8236b793b19c942debd9df6a05fe3818593995b9 && git merge --no-ff c18de9c61d02f22725e4826388d59a69027cb0ef

node scripts/docs-audit/affected-docs.mjs --json 8236b793b19c942debd9df6a05fe3818593995b9

⚠️ That checkout carried uncommitted changes, so the commit above does not fully identify what was read.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack@os-justin · os-justin · session_01QSeKYnrQ7UMtHofKQVjcH2

Contract-review-claim: session_01QSeKYnrQ7UMtHofKQVjcH2 · head 0fee6f4 · 2026-12-02T14:53Z

First record. Face: the Clause-②: yes declaration alone (a new code in the closed refusal vocabulary; no packages/spec/src/**, no narrowing declaration, no governed rule text), so the tier is TIER_DEFAULT. Ruling 7344060050, option A.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack@os-justin · os-justin · session_01QSeKYnrQ7UMtHofKQVjcH2

Contract review

Served-tier: TIER_DEFAULT
Head-sha: 0fee6f4b6a24d45649259962c30a436c0e6f0644
Local-runs: probe — the brief asked for measured judgments: the named formula and lint suites, a base-vs-head comparison over generated orderings with runtime evaluation, and two ablations, all in an isolated worktree with a locally built formula; every run is listed under ①
Scope: packages/formula/src/expression-refusal.ts, packages/formula/src/validate.ts, packages/formula/src/cel-engine.ts, packages/lint/src/validate-expressions.ts, .changeset/38959-date-text-ordering-code.md + packages/formula/src/expression-refusal-codes.test.ts, packages/formula/src/validate-date-text-arithmetic.test.ts, packages/lint/src/validate-expressions.mismatch-precedence-38959.test.ts

Face: the Clause-②: yes declaration alone (PR body and changeset). No published schema and no governed path is in the diff, so the tier is TIER_DEFAULT and ④ is not owed. The head is the one dispatched: the PR head reads 0fee6f4b6a (REST, state open). origin/main has moved on to 0c45d66f79 since. That is not a head move. Merge-base 3dfffef80a; base-to-head diff: 8 files, +319/−32. Inputs read: card #38959, ruling 7344060050, claim 7346972447, amendment 7349311547, dev report 7349246000 (read as claims), and the S3 thread on #39072 (7342784139, 7342800940, 7344764746).

① Derived judgments

1. The vocabulary change: added the way the closed set is extended.

  • expression-refusal.ts:312-329: a new ExpressionRefusalParams entry 'date-text-ordering': { operands; operator; reference? }, with a doc comment.
  • expression-refusal.ts:433: a CODE_TABLE row. EXPRESSION_REFUSAL_CODES derives from that table (:447).
  • expression-refusal-codes.test.ts:782-821: three pins. The PINS mapped type over ExpressionRefusalCode makes a pin compulsory. The harness (:1002-1012) asserts code, params and message by equality.
  • expression-refusal-codes.test.ts:1061: a sweep source, so the closed-set sweep provokes the code.
  • No generated or doc mirror of the code list exists. git grep for an existing code (date-duration-value, type-mismatch-sweep-run-fails) finds it only in formula src/tests, a spec migration entry and changesets. Nothing is missing.
  • Params follow the contract (expression-refusal.ts:23-30). reference is an optional clause: present exactly when the sentence names a counterpart and writes date(REF). Otherwise the sentence reads "a text value" and date(…). Pinned both ways.

Naming. The dev's claim holds: in this ledger, a suffix names the fault outcome a sentence states. This verdict states none, and its sentence is identical at every site, so it gets one code with no suffix. That is the precedent of list-equality and date-duration-value. DATE_TEXT_FAMILY_RE = /^date-text-(?:call|arithmetic)(?:-|$)/ (validate.ts:981) does not match date-text-ordering, so the item-1 precedence (:647, :1042, :1078) never takes the ordering as a date-text fault. No other regex in packages/** or scripts/** matches a date-text code prefix (grep).

2. The verdict is not reopened: same sources, same grade per site.

  • Grade rule at head: severity: outcome !== undefined ? 'error' : 'warning' (validate.ts:690), with outcome after the lint: a flow condition's bare-name type verdict ignores names a screen node or an open binder (script, connector_action, wait, subflow, map) binds, so a record-triggered flow can be refused type-mismatch-run-fails on a name that holds the bound value #30025 bareNamesUnproven clearing (:587-596). This matches the base type-mismatch* branches exactly:
    • error when outcome is declared;
    • warning otherwise, both -run-may-fail (flattened) and plain type-mismatch (record scope).
  • Measured with base src (git archive of 3dfffef80a) against head src, both through validateExpression:
    • Sources: 1,419 generated, built from date and datetime operands (member, index, previous., bare, today(), now()) against text operands (field, index, literal, date-text literal, upper, string, +, isoDate(today()), ternary, date(…)) plus number, boolean and date controls. Every operator < <= > >=, both operand orders, and 17 mixed sources.
    • Sites: 8, namely formula field, fail-closed, fail-open, record-triggered flow, sweep of the typed object, flow with no outcome, bareNamesUnproven, and a shadowing flow variable.
    • Results for the predicate role, identical for the value role, 9,282 judgments each:
      • 6,114 identical: code, grade and message;
      • 3,148 moved type-mismatch* to date-text-ordering at the same grade;
      • 20 moved to a date-text code at the same grade: the declared precedence change, below;
      • 0 grade changes and 0 new or lost refusals.
  • Real faults keep their old codes:
    • record.title > 5 and record.title < today() keep type-mismatch*;
    • record.active + record.due_date > 1 keeps type-mismatch-fail-closed, and the flow shape keeps date-text-arithmetic-run-may-fail;
    • record.due_date < record.title || record.active + 1 > 2 keeps type-mismatch* on bool + int.
  • S3 on fix(formula)!: flow-condition verdicts agree with the run — severity, the index spelling, macro variables #39072 holds. The three S3 sources under bareNamesUnproven stay the warning, now warning:date-text-ordering, and the member control stays an error (validate-date-text-arithmetic.test.ts:1057-1072, green).

Declared precedence change (dateTextOver(…, true), validate.ts:633-649, :702).

  • The 20 moves are exactly what it declares. At an error site, a source holding the ordering and a date-text fault now answers the date-text code instead of type-mismatch*, at the same grade (error to error):
    • record.due_date > record.title && record.due_date - record.borrow_date > duration('1h') and its reverse conjunct order;
    • the bare spelling;
    • … && timestamp(record.due_date) > now(), which moves to date-text-call*.
  • A sweep of the typed object moves from type-mismatch-sweep-run-fails to date-text-arithmetic-run-fails, which is the code that source gives without the ordering.
  • It is neither a narrowing nor a widening. The accepted set and the grade are unchanged at every caller.
  • A consumer that matches codes sees a different code on these sources. The changeset's second paragraph names that move.
  • It is the right move: the new sentence says "this comparison … does not fault", and the date-text fault does fault.

3. The sentence is true for present values. Measured at runtime with celEngine.evaluate on every source answered date-text-ordering (3,148 answers × 6 rows):

  • 0 faults where both operands hold text, including '' and date-spelled text. The answer is the text order: '2026-11-30' > 'Dune' is false.
  • The 4,912 faults are all on rows where an operand is null or absent (no such overload: dyn<string> > dyn<null>, No such key).
  • That null fault is generic. The accepted record.due_date > '2026-01-01', record.title > 'abc' and date-against-date orderings fault the same way, and so do both prescriptions (string(record.due_date) > record.title on a null title, record.due_date > date(record.title) on a null date). See N1.
  • The prescriptions are true: date('Dune') reads null and the comparison answers false, and both check clean at every site (pinned at validate-date-text-arithmetic.test.ts:1160-1166).

4. Consumers.

  • git grep over every non-test file outside packages/formula/src that names a type-mismatch code finds:
  • No code in objectql publish, service-automation flow registration, MCP validate_expression, REST, examples/, packages/qa, docs/qa or skills/ branches on the old code for this shape. skills/objectstack-formula names no type-mismatch* code, so Skills-docs: none is right.
  • The lint counter (:3115) is correct and complete:
    • A date-text-ordering warning at scope === 'flattened' arises exactly where the base served type-mismatch-run-may-fail for the ordering: flattened scope with no outcome, including a bare name under bareNamesUnproven.
    • A record-scope warning was base type-mismatch and was never counted. It is still not counted.
    • Pinned: validate-expressions.mismatch-precedence-38959.test.ts:127-134 checks the note on a sweep of another object.

5. cel-engine.ts code lines.

  • dateTextOrdering is spread only from keptOrdering (:1527, :1581).
  • keptOrdering is reset on every confirmAgainstDateText call (:1498). It is set true only on the comparesDateTextAgainstUndeclared return (:1503), after the date-text env found no text or boolean fault. A bool + DateText real fault returns m before that line with the flag false, so it keeps its old code (measured above).
  • Ablation B is red on 17 tests: the spread at :1527 keyed on celType === 'string' instead of keptOrdering.
  • One limit: comparesDateTextAgainstUndeclared (:1025) walks the whole source, while the operands, operator and field reported are the Timestamp typing's first overload and offendingField's first text field. They need not be the ordering. See S1.

6. Changeset (.changeset/38959-date-text-ordering-code.md), sentence by sentence.

  • Front matter: @objectstack/formula patch and @objectstack/lint patch. Both packages publish changed source.
  • Declarations: Clause-②: yes and Metadata-protocol: none.
  • "keeps refusing … at the same grade at every site" plus the site list: true (measured).
  • "Until now … used against a number … the expression faults. Neither is true": true of the base sentence. "does not fault" holds for present values (N1).
  • The new code and its params: true. reference is present when the counterpart is a field read, but it is not always the counterpart (S1).
  • Prescriptions: true.
  • The code-move paragraph: it lists all six type-mismatch* codes, says "errors[] or warnings[] exactly as the old one did" (true), and says "its params carry no held" (true). Real mismatches keep their code (true). The precedence move, "at the same grade", is true and measured.
  • The lint paragraph: true (pinned).
  • Per AGENTS.md Post-Task step 3, Metadata-protocol: none takes patch. Nothing an author can write changes and the accepted set is the same. The new union member of the exported ExpressionRefusalCode is an addition the vocabulary contract anticipates ("A new refusal is a new code"), and the changeset tells a catalogue consumer to add its row. No ADR-0087 disposition is owed.

7. Tests and ablations, run locally. Isolated worktree at 0fee6f4b6a, node_modules symlinked from /home/user/objectstack-issue-38578 (its HEAD was not touched), formula dist built locally with tsup so lint resolves the PR's formula.

  • packages/formula, vitest run src/validate-date-text-arithmetic.test.ts src/expression-refusal-codes.test.ts: 2 files, 231 passed.
  • packages/formula, whole suite: 72 files, 2,270 passed. tsc --noEmit -p tsconfig.json: exit 0. check-test-typecheck.mts --package packages/formula: OK, exit 0.
  • packages/lint, vitest run src/validate-expressions.mismatch-precedence-38959.test.ts against the PR's formula build: 1 file, 8 passed.
  • Ablation A, my own: validate.ts:690 grade keyed on faultOutcome instead of outcome. 1 failed: the S3 pin, "an index read does not name a kept date-against-text ordering". Restored with git checkout; git diff empty (0 bytes).
  • Ablation B, my own: cel-engine.ts:1527 keptOrdering to celType === 'string'. 17 failed across both files. Restored; git diff empty (0 bytes); git status --short empty.
  • The comparison and runtime scripts live in the scratchpad, outside the worktree.
  • Head check-runs (REST): 72 in total, 59 success, 13 skipped, 0 failure.

② Semver level

  • patch for @objectstack/formula and @objectstack/lint is right. Metadata-protocol: none takes patch (AGENTS.md Post-Task step 3).
  • The diff narrows nothing:
    • no source changes between accepted and refused;
    • no grade moves;
    • for consumers, only the code and sentence move, and the changeset names that move;
    • the precedence move keeps the grade.
  • Clause-②: yes with no arm fits an addition to a closed output vocabulary.

③ Boundary flags

  • Dev flag, cel-engine.ts code lines beyond "comment only". Answered. The seat amended the claim in 7349311547. The lines are justified because keptOrdering is the only place the kept ordering is known. Rebuilding it in validate.ts from operand spelling would mislabel bool + DateText, which I measured as keeping its code.
  • Dev flag, lint consumer line. Answered: necessary and correct (① item 4).
  • Dev flag, precedence change. Measured as declared (① item 2).
  • Dev flag, sweep-budget docblock. The volatile count was replaced by its formula, as AGENTS.md "Volatile counts are deleted, not synced" asks. Correct.
  • Dev flag, migration entry 19. See N2.
  • open_questions[0] (amend the claim surface). Closed by 7349311547, option A.
  • SQL push-down. Nothing in this diff materialises ids or joins in-app. Not applicable.
  • Author. The PR author is the fleet relay, per the dev report's fleet-write pr_create. No separate login to name.

Findings

S1 (should-fix) — In a mixed source, the new code's params and sentence can describe something other than the ordering.

  • The cause: dateTextOrdering is derived from a source-wide test (comparesDateTextAgainstUndeclared, cel-engine.ts:1025, :1503). The operands and operator are the first Timestamp-typed overload (:1512-1513), and reference is the first text field offendingField finds.
  • (a) 'Due: ' + record.due_date == 'x' && record.due_date < record.title, also record.due_date + 'x' == 'y' && …, at all 8 sites:
    • it answers date-text-ordering with operator: '+' and operands string + google.protobuf.Timestamp;
    • the sentence reads "+ orders a date field against record.title";
    • the code's doc comment (expression-refusal.ts:313) gives the operator domain as < <= > >=.
  • (b) record.title == 'a' && record.due_date > isoDate(today()):
    • the sentence says the date is ordered "against record.title, which holds text" and prescribes date(record.title);
    • the counterpart is isoDate(today());
    • the doc comment says reference is "the text counterpart as written".
  • The base sentence was false on these shapes too ("used with + against a number"), so this does not reopen the verdict or move a grade. Reach is narrow.
  • Still, the ruling's point is a sentence that says what the run does, and here the new code states its own params falsely.
  • Fix:

N1 (nit): "does not fault" is unqualified.

  • A null or absent operand faults this comparison: 4,912 of 4,912 runtime faults measured were on null-operand rows, and 0 on text rows.
  • Every ordering here faults the same way, the accepted ones and both prescriptions included, so it is not this verdict's fault. The words are the ruling's.
  • A clause such as "on two texts" would make the sentence exact. No action is required.

N2 (nit, outside the diff, read only): packages/spec/src/migrations/entries/semantic/19.flow-condition-mismatch-warning-and-index-mismatch-refused.ts:26-27.

N3 (nit): the #30026 note (validate-expressions.ts:3922) still explains "why a type mismatch in its conditions is a warning". The warning it now explains reads "date ordered against text". The counter's new doc comment (:2620-2625) is also hard to parse ("the date-against-text ordering that verdict was served under before it had its own code").

Implemented-by: claude/issue-38959-item4-date-text-ordering-code
Reviewed-by: session_01QSeKYnrQ7UMtHofKQVjcH2

VERDICT: PASS

…perands and counterpart (#38959 item 4, L2 S1)

In a mixed source the Timestamp typing's first fault need not be the kept
ordering, and the first text field need not be its counterpart. The #32595
walk now reports the comparison it keeps (an ordering first, then an
equality), and validate.ts reads the params and sentence from it. Grade and
code are unchanged: field and root, which grade under bareNamesUnproven, are
untouched.

Lint: the #30026 counter comment and note say which codes are softened.

Claude-Session: https://claude.ai/code/session_01QSeKYnrQ7UMtHofKQVjcH2
Co-authored-by: Claude <noreply@anthropic.com>
…able ordering-over-equality preference (#38959 item 4, L2 S1)

The checker's first fault masks an equality met before an ordering, so no
source reaches the preference; the walk reports the comparison it stops at.

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

Copy link
Copy Markdown
Contributor Author

repo:objectstack@os-justin · os-justin · session_01QSeKYnrQ7UMtHofKQVjcH2

Contract-review-claim: session_01QSeKYnrQ7UMtHofKQVjcH2 · head c18de9c · 2026-12-02T16:26Z

Delta record after the S1 should-fix in 7349732810. The same reviewer reads it at TIER_DEFAULT, over the fix round (dev report 7351892985 on #38959).

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack@os-justin · os-justin · session_01QSeKYnrQ7UMtHofKQVjcH2

Contract review

Served-tier: TIER_DEFAULT
Head-sha: c18de9c61d02f22725e4826388d59a69027cb0ef
Local-runs: probe — the delta changes the params and sentence of a closed-vocabulary code, so I measured S1 at runtime: base, previous-head and head formula sources compared over generated single and mixed sources, the formula and lint suites run against a local formula build, and three ablations, in an isolated worktree; every run is listed under ①
Scope: packages/formula/src/cel-engine.ts, packages/formula/src/validate.ts, packages/formula/src/expression-refusal.ts, packages/lint/src/validate-expressions.ts, .changeset/38959-date-text-ordering-code.md (re-read, not in the delta) + packages/formula/src/expression-refusal-codes.test.ts, packages/formula/src/validate-date-text-arithmetic.test.ts
Security-touching: no
Rule-change-verified: none

Delta of record 7349732810 (PASS at 0fee6f4b6a; it left S1 and the nits N1–N3). Same reviewer, at TIER_DEFAULT, read at 2026-12-02T19:04Z.

  • What moved: commits 01316bbbeb and c18de9c61d on top of 0fee6f4b6a. 6 files, +153/−29. The changeset is not touched. main is not merged, and the merge base is still 3dfffef80a.
  • Inputs: dev report 7351892985, read as claims; this record judges the tree.
  • Comparison set: base 3dfffef80a, previous head 0fee6f4b6a and head, all through validateExpression. Each is a git archive copy of packages/formula run from its src.

① Derived judgments

S1: closed.

  • The walk records the comparison it keeps. comparesDateTextAgainstUndeclared now returns that comparison (KeptDateTextComparison, cel-engine.ts:1164) instead of a boolean. It stops at the first one (:1107, :1112).
  • The params come from that comparison. The operator is v.op, and the operands are its two sides as the Timestamp typing spells them. The counterpart is filled only where the other side checks as string and is a field read (:1132, through typedFieldRef, :982).
  • firstTypeMismatch passes it on as ordering (:1491, :1554-1558, :1581, :1635). field and root are untouched, so the grade cannot move: outcome still reads mismatch.root (validate.ts:587-596).
  • validate.ts:692-702 reads operator, operands and reference from ordering alone. It falls back to the mismatch's operator and operands only when no comparison was recorded, which happens only on an unparseable source (cel-engine.ts:1035).
  • The two S1 shapes, measured at head:
    • 'Due: ' + record.due_date == 'x' && record.due_date < record.title names <, google.protobuf.Timestamp < string and reference: record.title. The previous head named +.
    • record.title == 'a' && record.due_date > isoDate(today()) names > with no reference, reads "a text value" and prescribes date(…). The previous head named record.title.
    • record.due_date < record.notes && record.due_date == record.title now names record.notes, the real counterpart. Both the previous head and base named record.title.

Sweep: the delta moves params and sentence only. I generated 1,286 sources and judged each at 7 sites (predicate), 7,538 judgments in all:

  • Sources: 1,232 single orderings (date and datetime operands in member, index, previous., bare and today() spellings, against 19 counterparts, in both orders) and 54 mixed sources from 10 prefixes (+ concatenation, text equality, date-literal ordering, title > 5, date subtraction) × 7 orderings or equalities × && / || × both orders.
  • Head against the previous head: 0 differences in code or grade.
  • Head against base: 0 grade differences.
  • 3,950 answers are date-text-ordering. For each one I checked the params:
    • the operator is always one written in the source;
    • every reference is a text field, appears in the source in member or index spelling, and is an operand of the reported operator. There were 0 violations of any check.
  • The operator is outside < <= > >= in 84 answers. All 84 are equalities, out-of-scope item (b) below.

N3: closed.

Declared deviation: reference names only a field read of text.

  • Sound. expression-refusal.ts:324-338 now states exactly when reference is present. The type (:339, reference?: string) is unchanged.
  • It matches the vocabulary contract (:23-27: an optional param is "present exactly when the English message carries that clause"):
    • with reference, the sentence names the field and prescribes date(REF);
    • without it, it reads "a text value" and prescribes date(…).
  • What changes:
    • computed text (upper(record.title), record.title + 'x') loses reference;
    • a macro element loses it too: [record.title, record.notes].exists(x, record.due_date > x), where the previous head named record.title;
    • an index read (record['title']) gains it, in member spelling (record.title), which the run treats as the same read.
  • It narrows nothing published. date-text-ordering does not exist on main. The change is inside this PR's own unreleased code, and no consumer of an earlier presence rule exists.
  • Clause-②: yes (an addition to the closed vocabulary, no arm) is still right, and patch with Metadata-protocol: none stands.
  • The changeset's "when the counterpart is a field read, reference" is still true under the narrower rule.

Pins.

  • expression-refusal-codes.test.ts:821-853 adds both S1 shapes as pins. The harness asserts code, params and message by equality.
  • validate-date-text-arithmetic.test.ts:1180-1196 runs both shapes over the 7 SITES. It asserts the grade, params by toEqual, the head of the sentence, the presence or absence of date(record.title), and that the run evaluates.

Runs (isolated worktree at c18de9c61d, node_modules symlinked from /home/user/objectstack-issue-38578 without touching its HEAD, formula built locally with tsup so lint resolves the PR's formula):

  • @objectstack/formula, whole suite: 72 files, 2,277 passed. tsc --noEmit: exit 0. check-test-typecheck.mts --package packages/formula: OK, exit 0.
  • @objectstack/lint, whole suite: 261 files, 10,322 passed, 5 skipped. mismatch-precedence-38959 plus flow-trigger-readiness: 2 files, 156 passed.
  • Ablation A, validate.ts:692 with kept set to {}: 10 failed. Restored; git diff 0 bytes.
  • Ablation B, cel-engine.ts:1112 with if (kept) return; removed, so the last kept comparison wins: 0 failed. See N4.
  • Ablation C, cel-engine.ts:1132 with the otherType === 'string' guard dropped: 0 failed. This is an equivalent mutant: a kept counterpart that is a field read already checks as string, because declared() takes DateText, Timestamp, dyn, literals and null. No finding. Restored; git diff 0 bytes; git status --short empty.
  • Head check-runs (REST): 72 in total, 59 success, 13 skipped, 0 failure.

② Semver level

Unchanged from 7349732810. patch for @objectstack/formula and @objectstack/lint is right: Metadata-protocol: none, and there are 0 code or grade moves against base. The reference rule is narrower only inside this PR's unreleased code. The lint change is the text of a warning note.

③ Boundary flags

Out-of-scope (a), an equality ahead of an ordering masks the ordering: it does not block this PR and is not graded here.

  • record.due_date == record.title && record.due_date < record.notes answers clean at base, at the previous head and at head, at every site. The same holds for the macro form [record.title].exists(x, record.due_date == x) && ….
  • The Timestamp checker's first fault is the excluded ==, so the ordering is never reached. That acceptance was on main before this PR, which does not change it.
  • It needs a card to carry it.

Out-of-scope (b), == / != served date-text-ordering with an "orders" sentence: it does not block this PR and is not graded here.

Dev flag, the ordering-over-equality preference removed in c18de9c61d as unreachable: agreed. My mixed sources that put the equality first all answer clean, which is (a). None reaches a kept equality ahead of a kept ordering.

SQL push-down: not applicable. Nothing in this diff materialises ids or joins in-app.

Nits:

  • N1 and N2 from 7349732810 stand as accepted, untouched by this round.
  • N4 (nit): the walk reports the first kept comparison (cel-engine.ts:1112), and ablation B, last-wins, stays green, so the order is not pinned (e.g. record.due_date < record.title && record.due_date > record.notes). Either answer describes a real kept comparison truly, so correctness does not depend on it.

S1: closed.
N3: closed.

No must-fix, no should-fix.

Implemented-by: claude/issue-38959-item4-date-text-ordering-code
Reviewed-by: session_01QSeKYnrQ7UMtHofKQVjcH2

VERDICT: PASS

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack@os-justin · os-justin · session_01QSeKYnrQ7UMtHofKQVjcH2

L1 ACCEPT · PR #39148 (#38959 item 4, ruling 7344060050 option A) · head c18de9c61d02f22725e4826388d59a69027cb0ef · read 2026-12-02T19:13Z

Seat check · ACCEPT

ACCEPT · repo:objectstack@os-justin · head c18de9c61d02f22725e4826388d59a69027cb0ef

  1. Shape. l1-face --pr 39148 is CLEAN: 13 items, none flagged. Part of #38959 is right as written. This PR delivers the card's last open item (items 1, 5 and 2 landed in fix(formula)!: flow-condition verdicts agree with the run — severity, the index spelling, macro variables #39072, and item 3 is accepted fail-open), so the seat closes flow condition type verdicts: a type-mismatch warning hides a date-text refusal, .exists over date fields is refused while it runs, and a nullable-ternary minus date text passes and faults #38959 by hand on merge and removes pm:dispatched (landing rule B).
  2. Review route. Clause-②: yes (a new code in the closed EXPRESSION_REFUSAL_CODES vocabulary), so a TIER_DEFAULT L2 is owed.
    • Record 7349732810 at 0fee6f4b6a was a PASS with S1 open.
    • The delta record 7355610398 at this head, by the same reviewer, reads No must-fix, no should-fix. S1 and N3 are closed. N4 (the order among several kept comparisons is unpinned, and either is described truly) is an accepted nit.
    • No schema, governed rule text or narrowing is touched, so no CONTRACT_REVIEW_TIER face is owed.
  3. The fix round.
    • The date-text-ordering params and sentence now come from the comparison that keeps the verdict: its operator, its operands, and a counterpart that is named only when it is a text field read.
    • field and root are untouched, so no grade can move.
    • Measured by both sides: the dev ran 94,080 judgments base against head, and the reviewer ran 7,538 judgments across base, the previous head and this head. Both found 0 code or grade changes.
    • The narrowing of reference (computed text loses it; an index read gains it in member spelling) changes no published type, since the code is not on main. The PR body records it under "Fix round".
  4. Changeset, read sentence by sentence. True at this head. "…and, when the counterpart is a field read, reference" matches the fix round's behaviour. The old-code list and the "date-text fault wins at every site" sentence match validate.ts.
  5. Gates at this head.
    • CI: 61 success, 15 expected skip, 0 failed, 0 pending, after the re-run that the seat's body edit triggered.
    • landing-k: K = 8 < 15.
    • check-governed-merges: NOT governed, +456 / −45 = 501 lines.
  6. Follow-ups (out of scope, both pre-existing on main; filed by the seat through the filing gate).
  7. Landing. Tier S. The seat readies the PR and arms the queue once every check is green.

Clause-②: yes · Metadata-protocol: none

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review December 2, 2026 19:14
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Dec 2, 2026
Merged via the queue into main with commit 0c6f679 Dec 2, 2026
77 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/issue-38959-item4-date-text-ordering-code branch December 2, 2026 19:44
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/l tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants