Skip to content

Working calendars ③: formula functions addWorkingDays / workingDaysBetween / addWorkingHours #35356

Description

@os-bill

③ maintainer-directed task · Source: maintainer ruling on #35340 (comment #35340 (comment); sub-cards approved 2026-11-19 06:03Z 「同意」「都是 p1」).

Blocked by #35354 (ADR) and the calendar service in ②. Ships in the same release as ② and ④ (#13655 constraint: no calendar without its formula surface).

维护者速读

  • 问题: 公式里没法算「两个工作日后」或「两个日期之间有几个工作日」。
  • 要做: 加三个工作日公式函数,按平台日历计算。
  • 不做会怎样: 日历建好了没人读,按 ADR-0049 是空摆设;各套件继续各算各的。
  • 你要做的: 无。

Scope

  • Add addWorkingDays(date, n, calendar?), workingDaysBetween(a, b, calendar?), addWorkingHours(datetime, h, calendar?) to the formula stdlib (packages/formula). Calendar resolution per the ADR: explicit code → org default → refuse.
  • Synchronous evaluation: the calendar is preloaded into the evaluation bindings, with cache invalidation when calendar rows change.
  • Pushdown refuses these functions (filter/aggregate), with a lint pointing authors to a write-time datetime column compared with {now}.
  • Hook/flow access if the sandbox needs a host function (check the sandbox surface; not assumed).
  • Docs and skills teaching text for the three functions.

Done when

Functions evaluate correctly across a weekend, a National Day week and a 调休 make-up Saturday; pushdown refuses them with a clear error; teaching text updated.

Non-goals

SQL-side calendar math, date macros in filters (later card).

Activity

  1. added
    priority:p1
    pm:blocked
    on Nov 19, 2026
  2. added theissue type on Nov 19, 2026
  3. objectstack-fleet commented on Nov 19, 2026

    @objectstack-fleet
    Contributor

    repo:objectstack#5 · os-bill · session_01Utp6Ca1jJvsA1dHsPwMiQb

    Unblocked 2026-11-19T13:52Z: blocker #35354 is closed. ADR-0157 merged as PR #35364 (f727061b88), and this card is one of its named enforcement cards. pm:blocked → pm:queue. Area data-1 dispatches the three siblings (#35355, #35356, #35357) on sibling branches and lands them together, as ADR-0157 D4 requires (same release).

  4. added
    pm:queue
    and removed
    pm:blocked
    on Nov 19, 2026
  5. objectstack-fleet commented on Nov 21, 2026

    @objectstack-fleet
    Contributor

    repo:objectstack#4 · os-elon-musk · session_016WV4d1ZJL93Kin2UHFXbFv

    Note for the PR that closes this card · 2026-11-21T01:15Z · from contract review 7054906389, N5 on #35966.

    Once the ADR-0157 D4 formula functions (addWorkingDays, workingDaysBetween, addWorkingHours) can be called from a formula, the shipping PR must also do two things:

    1. Remove the "Working-day formulas" row from PLANNED_ROWS in packages/spec/scripts/lib/platform-catalog.ts, then regenerate with pnpm --filter @objectstack/spec gen:skill-refs.
    2. Flip skills/objectstack-project/evals/project-process.json case 8 again, so it expects the functions to be available.

    No gate reads the rule "the shipping PR moves the row". It has been missed twice: calendars in #35642 and units in #35805.

  6. objectstack-fleet commented on Nov 21, 2026

    @objectstack-fleet
    Contributor

    triage#1 · hotlong · session_01Q4EjjMnyLqJdzuktEmRPXH

    Ruling-ref: maintainer 2026-11-21T13:1xZ, verbatim: 「同意」, approving triage's non-topic re-grade: p1 = "this week, or someone loses": main or release blocked, data silently wrong or lost, a common function that errors, AI taught wrong, an outside user's report.

    2026-11-21T13:20Z · p1 → p2 on the maintainer's word: a new feature (working-calendar formula functions), not a loss this week. Lane and state unchanged.

  7. added
    priority:p2
    area:workflow
    and removed
    priority:p1
    on Nov 21, 2026
  8. objectstack-fleet commented on Nov 23, 2026

    @objectstack-fleet
    Contributor

    repo:objectstack#3 · os-support-ai · session_01WGufzi4PechTRCTBrfxV8W

    Claim: PM loop round 2
    Session: session_01WGufzi4PechTRCTBrfxV8W
    Thread session: session_01WGufzi4y7vb1rP9MERYbw2
    Account: os-support-ai
    Branch: claude/project-thread-7jquxn
    Worktree: card thread container
    Domain: area:workflow (formula + automation)
    Seat: repo:objectstack#3
    File surface: packages/formula/**, packages/objectql/src/work-calendar-service*.ts (binding/cache only), the expression lint location the dev measures, packages/spec/scripts/lib/platform-catalog.ts + its generated refs, skills/objectstack-formula/**, skills/objectstack-project/evals/project-process.json, formula pages under content/docs/**, changesets
    Container & model: L, mode:card-thread, model: default — dispatch-gates.mjs --tier: "Model tier — no path-derived mandate", effort: high
    Clause-②: yes (three new callable formula functions widen the expression accept set; the dev measures whether a published schema moves)
    Metadata-protocol: none (to be measured)
    Responsibility: platform code in objectstack (formula stdlib, ADR-0157 D4/D6/D8/D11) | the calendar arithmetic and service already ship (#35355) | every app author who computes a due date in working days
    Thread-read: 7063199719
    Premise: holds — blockers #35354/#35355/#35357 closed; arithmetic already in packages/formula/src/work-calendar.ts (open point 3 settled); what remains is the formula surface, pushdown refusal + lint, teaching text, and the catalog row/eval flip of note 7054955353
    Serial constraints cleared: no open PR names #35356 or the three functions
    Ruling-ref: ADR-0157 (PR #35364); grade note 7063199719 (p1 → p2, scope unchanged). Open point 1 (a write-time due-date column meeting a D8 refusal) is settled by this card's contract review.

  9. added
    pm:dispatched
    and removed
    pm:queue
    on Nov 23, 2026
  10. objectstack-fleet commented on Nov 24, 2026

    @objectstack-fleet
    Contributor

    repo:objectstack#3 · os-support-ai · session_01WGufzi4PechTRCTBrfxV8W

    Claim amendment · 2026-11-24T01:14Z · to claim 7101714597 (PR #36796)

    File surface, widened to what the PR declares beyond the order (accepted by the seat; L1-b 7118804738 asked for it): packages/objectql/src/** engine facets + plugin.ts + the new formula-work-calendars.ts (calendar service held beside the engine; engine.ts itself unchanged at its facade ceiling), packages/lint/** (the functions refused outside formula/stored expressions and for a non-literal calendar code), ui/packages/core/** evaluator (the functions treated as unservable). Metadata-protocol: moves from none to added with @objectstack/formula at minor, per L1-b M1 (precedent #34433). Everything else in the claim stands.

  11. objectstack-fleet commented on Nov 24, 2026

    @objectstack-fleet
    Contributor

    repo:objectstack#3 · os-support-ai · session_01WGufzi4PechTRCTBrfxV8W

    Closed by PR #36796 (Tier H, approved and queued by os-zhuang, merged 3d6dea2, Fixes #35356). pm:dispatched removed · 2026-11-24T05:34Z. Follow-up N6 (objectExtensions defaultValue not walked by the build-time working-day refusal) is requested from triage in 7122583643.

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

Metadata

Metadata

Assignees

Labels

area:workflowpriority:p2

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions