Skip to content

流程条件里 addDays(today(), N) 和日期字段比较:保存和发布都通过,但每次运行都求值失败(接 #37848) #38135

Description

@objectstack-fleet

repo:objectstack#3 · os-tesla · session_01L9qibyUSf2nKJWW6qBemSU

Filing gate: ① (b) side finding from the #37848 card thread, measured on origin/main 5b8ca36 (the readings close #37848, comment 7233296667). Source: fleet.
Grading: area:build · Bug · p2 · reach: every flow, validation or automation condition that compares addDays(today(), N) (or the same with a bare comparison in front) with a date field · evidence: measured at all three doors plus the runtime.
Dedupe: "addDays", "addDays today date field condition", "no such overload Timestamp dyn string", "date field CEL runtime" → 0 open.

维护者速读

  • 问题:流程条件写成「30 天后的日期大于到期日」这类,用 addDays(today(), 30) 和日期字段比,保存、校验、发布都通过,流程也会变成启用状态,但每次运行条件都求值失败,自动化一次都不会按预期执行。
  • 原因:日期字段在运行时是「年-月-日」文字。拿它和 today() 直接比时,运行时会自动转换;换成 addDays(today(), N) 就转换不了。
  • 修法:让运行时对 addDays 的结果也做同样的转换,跟 today() 一致。做不到的话,至少在保存时就拒掉,并提示用 date(record.due_date)。
  • 要你做的:无。

Measured (origin/main 5b8ca36, full table /mnt/project-files/card-37848/pre-claim-report-5b8ca361.md)

Ask

  1. A condition that compares addDays(today(), N) with a date field evaluates at run time the way the today() comparison already does. If that coercion cannot be extended, the save doors (os validate, publish, registerFlow) refuse the spelling and name date(record.<field>) as the fix.
  2. Pins at all three doors and in the flow runtime, with the today() and date() controls, and an ablation.

Acceptance

Activity

  1. added
    bug
    priority:p2
    domain:server
    on Nov 28, 2026
  2. objectstack-fleet commented on Nov 28, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#3 · os-tesla · session_01L9qibyUSf2nKJWW6qBemSU

    Claim: PM loop round 1
    Session: session_01L9qibyUSf2nKJWW6qBemSU
    Thread session: session_01L9qibwCgpPyKkN8vfDFgi2
    Account: os-tesla
    Branch: claude/project-thread-g2975a
    Worktree: objectstack-issue-37848
    Domain: formula
    Area: o3-build (area:build p2, a seat card thread)
    Seat: repo:objectstack#3
    Seat rulings on the pre-claim report (/mnt/project-files/card-38135/pre-claim-report-5b8ca361.md):

    • Route: extend the runtime rewrite, and do not refuse at save. today() comparisons are already accepted and evaluated right under ADR-0032 §1c, and addDays returns the same Timestamp. None of the three rewrite conditions is loosened.
    • Scope: one "call returns Timestamp" test replaces both hand-kept name lists, operandKind (:2405) and isTemporalCall (:1784). The equality path also takes date/datetime, from the same root cause. A drift pin enumerates every stdlib Timestamp signature.
    • The premise is wider than the card: == against addDays/date()/timestamp() silently answers false, and the flow is skipped. Both are fixed here.
    • Ask 2: the doors do not change under this route. Each door gets an "accepted without error" control, and the runtime pins carry the behaviour.
    • Metadata-protocol: semantic (minor). A spelling the doors already accept now means what it says at run time, so deployed flows that skipped or failed start firing. The changeset says so in plain words.
      File surface:
    • packages/formula/src/cel-engine.ts: the Timestamp-returning test, used by rewriteFaultedOperands and rewriteTemporalCallEquality.
    • packages/formula/src/cel-overload-retry-scope.test.ts and the Bare dateField == today() silently returns false — fix via AST temporal-comparison rewrite in the CEL engine #3183 describe in packages/formula/src/cel-engine.test.ts: comparison and equality pins with today()/daysFromNow() controls, the drift pin, and ablations.
    • A packages/services/service-automation runtime pin: a flow whose addDays condition fires, and an equality one on the matching day.
    • One .changeset/*.md (@objectstack/formula minor).
      Stop on breach and explain in the report.
      Container & model: S, mode:thread, model: default tier — dispatch-gates.mjs --tier: "no path-derived mandate", effort: high, reason: the thread session serves effort high
      Clause-②: no
      Metadata-protocol: semantic
      Responsibility: a flow, validation or automation condition that compares addDays(today(), N) (or addMonths, addWorkingDays, addWorkingHours, timestamp(), date(), datetime()) with a date field evaluates at run time the way the today() comparison does. It never passes at save and then fails or silently answers false at every run.
      Thread-read: none
      Premise: holds and is wider than the card, measured on origin/main 5b8ca36 (report above)
      Serial constraints cleared: none — no open PR touches packages/formula; #35295 edits validate.ts, a different file
  3. added
    pm:dispatched
    on Nov 28, 2026
  4. objectstack-fleet commented on Nov 28, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#3 · os-tesla · session_01L9qibwCgpPyKkN8vfDFgi2
    os-dev-report

    {
      "issue": 38135,
      "status": "done",
      "branch": "claude/project-thread-g2975a",
      "pr": "https://github.com/objectstack-ai/objectstack/pull/38152",
      "session": "session_01L9qibwCgpPyKkN8vfDFgi2",
      "premise_still_valid": true,
      "summary": "packages/formula/src/cel-engine.ts: one set, timestampReturningFunctions(), read from getDefinitions() of the engine's own environment (global functions whose every overload returns google.protobuf.Timestamp: now, today, daysFromNow, daysAgo, addDays, addMonths, date, datetime, addWorkingDays, addWorkingHours, timestamp). isTimestampCall asks it; the ADR-0032 1c ordering retry (operandKind) and the #3183 equality rewrite (rewriteTemporalCallEquality, gate included) both ask isTimestampCall, replacing the two hand lists. A date field ordered against addDays(today(), N) now evaluates instead of faulting; == / != against addDays, date(), timestamp() now match the named day instead of a silent false/true. The #7168 idempotence pin moved (date(record.due) == previous.due now wraps the counterpart, per the seat's ruling that equality takes date/datetime). Changeset @objectstack/formula minor, Clause-2 no, Metadata-protocol semantic, plain-words deployed-flows note.",
      "tests": "At daf4843f: formula vitest 72 files, 2181 passed (2181); formula typecheck VERDICT command-exit 0. service-automation flow-registration-schema-e2e.test.ts 10 passed (10); against the formula dist built from main its two new run pins were red (2 failed / 8 passed). lint validate-expressions.test.ts -t 38135: 3 passed; runtime meta-flow-condition-record-date-text.test.ts: 7 passed (7). Ablation via ablation-replace.mjs on isTimestampCall (set lookup -> old four-name list, marker ABLATION-38135, blob b3e4963cec31 -> 2fdcaff15a3b): 13 failed / 109 passed in cel-engine.test.ts + cel-overload-retry-scope.test.ts; restored blob == HEAD, git diff HEAD empty.",
      "gates": "dispatch-gates --commands at daf4843f: 72 derived, all run; --ran: 72 run, 0 NOT-MEASURED (derived zero). check:dts-closure (1) and check:dual-build-cjs-loads (3) first failed for a missing build and passed (0) after the full declaration build. Record /mnt/project-files/card-38135/gates-ran-daf4843f.list. PR CI: in_progress at report time.",
      "dogfood_battery": "n/a — no ! in the PR title and no (narrowing) arm",
      "mcp_calls": "0 GitHub MCP calls in the implementation round (reads via gh api GET search and git); subscribe_pr_activity on #38152",
      "api_writes": "3 — fleet-write relay: pr_create (#38152, assignee os-tesla), pr_request_reviewers (os-tesla), this os-dev-report comment",
      "open_questions": [],
      "security_findings": "none",
      "out_of_scope_findings": [
        "carrier: none · noted, not filed: addWorkingDays / addWorkingHours fault in a flow condition for the documented reason (no working calendar outside a formula or a stored field expression); unchanged, in the PR's Acceptance notes"
      ]
    }
  5. objectstack-fleet commented on Nov 28, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#3 · os-tesla · session_01L9qibwCgpPyKkN8vfDFgi2
    os-dev-report delta

    PR #38152 head moved daf4843 → 0479a49: one docs-only commit, no code change.

  6. objectstack-fleet commented on Nov 28, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#3 · os-tesla · session_01L9qibyUSf2nKJWW6qBemSU

    Closed-card tidy · 2026-11-28T07:59Z: the card closed when its PR merged; pm:dispatched comes off.

  7. removed
    pm:dispatched
    on Nov 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area:buildbugdomain:serverpriority:p2

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions