Skip to content

feat(formula): working-day functions addWorkingDays, workingDaysBetween and addWorkingHours over the organization calendar - #36796

Merged
os-zhuang merged 9 commits into
mainfrom
claude/project-thread-7jquxn
Nov 24, 2026
Merged

os-zhuang merged 9 commits into
mainfrom
claude/project-thread-7jquxn

Conversation

@objectstack-fleet

@objectstack-fleet objectstack-fleet Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Requested by Yibo Wang · project thread

Fixes #35356

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

Clause-②: yes (widening)
Metadata-protocol: added — a formula field's or a stored field's expression may now call addWorkingDays(...), workingDaysBetween(...) and addWorkingHours(...)
Skills-docs: updated here — skills/objectstack-formula/SKILL.md teaches the three functions and eval 8 of skills/objectstack-project/evals/project-process.json exercises them (the card's order names both)

维护者速读

  • 用户能看到什么变化:管理员和建模人员在公式字段里可以按组织的工作日历算到期日和剩余工作日,节假日、周末和调休上班日都会被正确跳过或计入。
  • 为什么做:工作日历系列的第三步,让服务时限和到期提醒不必再由各个应用自己写日历计算。
  • 出错会怎样:日历缺失或维护期不够时该公式读为空并在服务端记一行日志,记录照常保存,不会按自然日乱算;要撤回只需回滚本次改动。
  • 要你做什么:无。

Review round 2 (L1-b 7118804738, contract 7118785761)

  • M1. Metadata-protocol: added with @objectstack/formula at minor (the three names are a new accepted value of an authored expression, as with rmbUpper), and the Skills-docs: line, in this body and the changeset.
  • S1. os build now refuses the three in a field's expression defaultValue (the default step has no calendar, so every insert would land blank) and in a seed record's expression values at any depth (the seed loader has none either), with the stored due-time prescription. New module packages/lint/src/validate-working-day-sites.ts; a bare-string defaultValue is a literal and draws nothing (CONTROL).
  • S2. Already held: planFormulaProjection widens a named projection to every stored column, organization_id included, and cuts it back after evaluation. Now pinned: the stub driver honours fields, and "a projection that leaves organization_id out still counts each row in its own organization" asserts both the per-organization answer and that the driver was asked for organization_id. Ablation: skipping organization_id in the widening turns it red. Documented in the header of formula-work-calendars.ts.
  • S3. A kernel boot test: ObjectKernel + ObjectQLPlugin({ ql: engine }) serves objectql as the same engine and its formula counts with the plugin-installed calendar service. Ablation: removing the plugin's setFormulaWorkCalendarService call turns it red.
  • Open point 1 (option A stands). The docs page and the skill each say a blank stored due time stays blank until the record's next write; the docs and changeset add that a write while the calendar refuses blanks a previously valid value.
  • Nits. N1 the skill's timestamp(s) line and PRIOR() note reworded; N3 eval 8 says {now} for a filter and now() for a CEL condition; N4 the catalog's sys_work_calendar row names all three functions; N5 a blank start answers blank before any calendar is read (test added).
  • fix(lint)!: refuse == / != on a list-valued field reached through a lookup hop #36673. Still open at this head; this branch merges main once it lands, per the seat.

What changes

Three formula functions over the organization's working calendar (ADR-0157 D4), with the evaluation contract this card had to settle.

  • addWorkingDays(day, n[, code]): the calendar day n working days after day (before it, for a negative n). day itself never counts, and 0 answers day. The answer is a calendar day at UTC midnight, as today() and a date field are.
  • workingDaysBetween(start, end[, code]): the working days after start up to and including end, negative when end is earlier. It is the inverse: workingDaysBetween(d, addWorkingDays(d, n)) == n.
  • addWorkingHours(start, hours[, code]): the instant hours of working time after start, counted as elapsed time in the calendar's time zone (D11, open point 3). A start outside working time begins at the next working period's start.

All three count through work-calendar.ts, the arithmetic the calendar service and the approval clock already use, so there is one walk and one daylight-saving rule.

Packages.

  • @objectstack/formula: working-day.ts registers the functions as CEL stdlib over EvalContext.workCalendars (pure data, the existing binding pattern). working-day-needs.ts reads, from an expression's AST, which calendars it names: the default for a two-argument call, and each quoted-literal code. cel-to-filter.ts refuses the three as a filter (CompileError('unsupported')), prescribing the stored due-time field. They join CEL_STDLIB_FUNCTIONS.
  • @objectstack/objectql: formula-work-calendars.ts resolves exactly the calendars a formula plan names, per row organization (organization_id, else the read's tenant), through WorkCalendarService.resolve, so its cache and invalidation are reused. A refusal is handed over as data. Wired into find / findOne, the insert and update responses, the summary-fold dependents and stored expressions (computeStoredExpressions). The plugin installs the kernel's calendar service beside the engine (setFormulaWorkCalendarService), and each formula path reaches it through its host's facade, so engine.ts stays at its facade line ceiling (6857) with no new member.
  • @objectstack/lint: refuses the three at every expression site except a formula field's and a stored field's expression (check(), the declared flow predicate and value slots, a field's expression defaultValue, seed values), and refuses a calendar code that is not a quoted literal (judgeFieldFormula).
  • @object-ui/core: a form treats a formula that calls one as unservable, because the calendar is loaded for the server's read and never handed to the form.
  • Docs and skills: the formula docs page gains a Working days section; objectstack-formula documents the three functions inside its existing ceiling; the platform catalog drops the "Working-day formulas" Planned row and names the formulas on sys_work_calendar's row; project-process eval 8 now expects addWorkingHours( and a stored due time, and refuses PLATFORM-CANDIDATE.

Contract choices (D4: the card's to settle, pinned by tests).

  • The calendar code is a quoted literal. The engine loads the calendars an expression names before it evaluates it, so a computed code names a calendar nobody loaded. To choose a calendar per record, branch between literal calls. The lint refuses a computed code with that prescription.
  • A blank start day or start instant answers blank (a due date with no start has none), before any calendar is read. A blank count, or a blank end of workingDaysBetween, refuses.
  • Hook sandbox: no host function is added. A hook reads the stored due-time field.

Decision for review

Open point 1: a stored field's expression that meets a D8 refusal stores blank, and the write goes through, with one log line naming the object, the field and the refusal.

Why this option and not "the write fails":

  • It matches D8's read behaviour: a formula field that meets the same refusal reads null and logs once. A stored due time and a computed one then answer the same way for the same calendar state.
  • A failing write would block every record whose span crosses the end of the maintained period, for example every case opened in late December before an administrator enters next year's holidays. That is the non-blocking stance ADR-0157 D9 takes for the approval clock.
  • The column is not silently wrong: it is blank, never a weekly-pattern or wall-clock guess, and the next write after the calendar is fixed counts. The author-facing cost is said in the docs and the skill: a blank stored due time stays blank until the record's next write, and a write while the calendar refuses blanks a value that was valid before.

Pinned by engine-formula-working-day.test.ts › "a refused count stores blank and the write goes through, with one line naming the field". The alternative is one branch in computeStoredExpressions: rethrow instead of storing blank.

Tests

  • packages/formula/src/working-day.test.ts: a cn_mainland calendar (Asia/Shanghai, 09:00-12:00 and 13:00-18:00, National Day 10-01..07 off, Saturday 10-10 on) against a weekly-only CONTROL calendar. Covers a weekend, the National Day week, the 调休 Saturday, negative and zero counts, date, today() and timestamp inputs, blank handling, the inverse property, DST spring-forward and fall-back, every refusal (no default, not maintained, not loaded, code not loaded), the needs analysis, and the pushdown refusal with an addDays CONTROL.
  • packages/objectql/src/engine-formula-working-day.test.ts: the real WorkCalendarService over a stub driver. A read over the National Day week onto the 调休 Saturday, a weekend on findOne, two organizations each on its own default, the write response, D8 past maintained_through and with no default (null, one log line, never a wall-clock count), no service, D6 stored count and stored blank on refusal, the cache serving until invalidate(), no calendar read for a projection whose formulas call none, a projection without organization_id (S2), and a kernel boot through ObjectQLPlugin (S3).
  • packages/lint/src/validate-expressions.working-day-35356.test.ts: accepted at a formula and a stored expression (including the branch between literal codes); refused at a validation rule, an action's visible, a flow condition, a sharing rule (both the expression lint and the enforceability pass), a field's expression defaultValue and a seed value; a computed code refused; addDays and bare-string CONTROLs.
  • authored-site-expression.test.ts classifies the new gate passes and the value-site walk; validate-expressions.test.ts excuses the new import tail sites.
  • ui/packages/core/.../formulaRecord-35033.test.ts: a working-day formula and a formula reading it are unservable; addDays CONTROL computes.

Acceptance notes

  • Release pairing (D4, same release as the objects): npm view @objectstack/objectql version and @objectstack/formula read 18.6.0, which carries no calendar code. The changesets of Working calendars ②: sys_work_calendar objects, calendar service and Setup page #35355 and Working calendars ④: approval escalation clock key (wall_clock | working_time) #35357 are still pending on main, so this PR ships in the same release as them.
  • Contract-review tier: packages/spec carries no function list or schema that changes (its only diff is the catalog generator's row list, packages/spec/scripts/**, unpublished). The published list that widens is @objectstack/formula's CEL_STDLIB_FUNCTIONS (three names). Measured: not CONTRACT_REVIEW_TIER by the order's spec criterion; the seat decides.
  • Metadata-protocol added: no authorable key or authorable-surface/** shard moves, but an authored expression accepts three new function names (corrected in round 2 from none).
  • File surface beyond the order's list, each declared: objectql engine facets (engine-find.ts, engine-insert.ts, engine-update.ts, engine-security-resolvers.ts, engine-top-level.ts, plugin.ts) and the new formula-work-calendars.ts, because the formula read and write paths are where the calendars are loaded; engine.ts and work-calendar-service.ts are unchanged. packages/lint/** is the measured expression-lint location. ui/packages/core/** keeps the form from computing a formula the server's write-path check already calls unservable.
  • Skills readings (skills/**, published): skills/objectstack-formula/SKILL.md 491 → 485 lines, 6090 tokens. Its ceiling rises 6008 → 6090 (+82) under the standing ruling 「A:先削重复,余额按实测提高」 (record 6513306068): restatement was deleted first in the same file (changed lines remove 789 priced bytes and add 1130), and the balance the round-2 sentences need is raised to the measured value, as the comment in scripts/check-skills-token-ratchet.mjs records. skills/** makes this PR governed.

Verification

Two-minute check: pnpm --filter @objectstack/formula exec vitest run src/working-day.test.ts shows the National Day and 调休 Saturday cases passing.

Read first (by risk): packages/objectql/src/formula-work-calendars.ts (which organization a row counts in), packages/objectql/src/engine-top-level.ts (computeStoredExpressions, the open point 1 branch), packages/formula/src/working-day.ts (the public contract).

Local gates (dispatch-gates --ran: 122 derived families accounted for, 118 run, 4 NOT-MEASURED)
  • Round 2 at 5e11588: formula working-day.test.ts 23 passed; objectql engine-formula-working-day.test.ts 13 passed; lint validate-expressions.working-day-35356, validate-expressions, authored-site-expression 606 passed; platform-catalog.test.ts 20 passed; tsc --noEmit formula, objectql, lint green; check-skills-token-ratchet, check-facade-delegation-only, check-nul-bytes, check-skill-links, check-skill-identifier-liveness, check-skill-top-level-keys, check-skill-frame-sync, check-changeset-fixed, check-empty-changeset, check-changeset-no-major green.

Round 1:

  • All 139 derived commands run at the final source; green except the following.
  • NOT MEASURED (exit 3, need a built closure; CI builds it): check:skill-examples, check:dual-build-cjs-loads, check:lean-entry-closure, check-plugin-teardown-shape --self-test (its positive control is pinned to a commit this shallow clone cannot reach).
  • pnpm --dir ui exec vitest run scripts/: 1 red, unit-registry-absence-collision cannot import modules that resolve @objectstack/client, which is unbuilt here. Environment, not this diff; CI runs it built.
  • check:facade-delegation-only was red on the first run (engine.ts 32 lines over its ceiling); fixed by moving the calendar wiring into formula-work-calendars.ts, re-run green.
  • Typecheck (tsc --noEmit and check:test-typecheck): @objectstack/formula, @objectstack/objectql, @objectstack/lint green.
  • Suites: @objectstack/formula 2133 passed; @objectstack/objectql 14363 passed; @objectstack/lint 9475 of 9479 passed, the 4 reds were two ledgers naming the new gate passes, fixed and both files re-run green (592 passed); ui/packages/core 4769 passed, 27 skipped.

…n calendar

The engine resolves the calendars a formula plan names, per row organization,
through the work calendar service before evaluating; a refusal is handed over
as data and reads null with one log line (ADR-0157 D2, D4, D8). A stored
expression stores blank on a refusal and the write goes through (D6, open
point 1).

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WGufzi4y7vb1rP9MERYbw2
The publish lint refuses a working-day call at every expression site but a
formula field's and a computed field's expression, prescribing the stored due
time, and refuses a calendar code that is not a quoted literal (ADR-0157 D4,
D6). The form treats a formula calling one as unservable.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WGufzi4y7vb1rP9MERYbw2
…atalog

The formula docs page and objectstack-formula document addWorkingDays,
workingDaysBetween and addWorkingHours; the platform catalog drops its
Planned row; the business-hours SLA eval expects the functions (ADR-0157 D4).

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WGufzi4y7vb1rP9MERYbw2
…'s ceiling

Delete restatement the file already carries (the built-ins line's timestamp
repeat, the date-arithmetic note, the Salesforce-flavor examples and
translations the translation table lists) and compress the working-day
paragraph, so the ceiling stays where it was.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WGufzi4y7vb1rP9MERYbw2
…ne, not on its facade

The engine facade is at its line ceiling: the plugin installs the calendar
service in formula-work-calendars.ts and each formula path reaches it through
its host's facade.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WGufzi4y7vb1rP9MERYbw2
@github-actions github-actions Bot added size/xl 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 Nov 24, 2026
@github-actions

github-actions Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 3 package(s): @objectstack/formula, @objectstack/lint, @objectstack/objectql, touching 70 documentable anchor(s). ⚠️ 1 changed file(s) yielded no anchor (packages/formula/src/index.ts), so the pages documenting them are NOT COVERED by this run — this is not a clean bill of health for those files.

28 hand-written doc(s) name something this change touched — list omitted above 15 rows. Re-derive on the tree named below: node scripts/docs-audit/affected-docs.mjs --json f46ce5b4afc9933142b5c72205c71e0475d6cabd.

⛔ 7 release-owned page(s) also affected — read-only, see AGENTS.md Documentation Guardrails.

What this run could not see
  • 1 changed file(s) yielded no anchor (packages/formula/src/index.ts) — pages documenting those are invisible to this run
  • 12 name(s) were too generic to anchor anything (single lowercase words)
  • the SDK route bridge reached 69 of 252 client-bound route-ledger rows — the other 183 have no registrar path: tail to select them, so pages documenting THEIR client methods cannot appear above, on this or any run. Of those 183: 0 are remediable by widening that discovery convention (an in-repo file declares the path; the convention did not scan it); 59 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 — 34 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 f46ce5b4afc9933142b5c72205c71e0475d6cabd → packageMentionDocs.

Which tree this was computed on

This run read content/docs from c5f0deef0c8e57eea3b249049fa517df22599cc6 — the merge of head 762e6a6c7eea45e81f4aa859d0813ad7118254e2 into base f46ce5b4afc9933142b5c72205c71e0475d6cabd, 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 c5f0deef0c8e57eea3b249049fa517df22599cc6 && git checkout c5f0deef0c8e57eea3b249049fa517df22599cc6
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin f46ce5b4afc9933142b5c72205c71e0475d6cabd 762e6a6c7eea45e81f4aa859d0813ad7118254e2 && git checkout -B drift-repro f46ce5b4afc9933142b5c72205c71e0475d6cabd && git merge --no-ff 762e6a6c7eea45e81f4aa859d0813ad7118254e2

node scripts/docs-audit/affected-docs.mjs --json f46ce5b4afc9933142b5c72205c71e0475d6cabd

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

Advisory only, and a precision-first one (#9192): a page is listed because it names a
symbol, wire route or SDK method this diff touched — not because it mentions a changed
package. Each row says which anchor put it there, so a wrong row is reportable rather than
merely annoying. To re-verify, run the docs-accuracy-audit workflow scoped to these files:
node scripts/docs-audit/affected-docs.mjs f46ce5b4afc9933142b5c72205c71e0475d6cabd → pass the list as
args.docs, on the commit named under Which tree this was computed on.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#3 · os-support-ai · session_01WGufzi4y7vb1rP9MERYbw2
os-dev-report

{
  "issue": 35356,
  "status": "done",
  "branch": "claude/project-thread-7jquxn",
  "pr": "https://github.com/objectstack-ai/objectstack/pull/36796",
  "session": "session_01WGufzi4y7vb1rP9MERYbw2",
  "premise_still_valid": true,
  "summary": "addWorkingDays / workingDaysBetween / addWorkingHours registered as CEL stdlib over per-evaluation calendar data (@objectstack/formula), with pushdown refusal. objectql resolves exactly the calendars a formula plan names per row organization through WorkCalendarService (read, write response, summary folds, stored expressions); a D8 refusal reads null with one log line, and a stored expression stores blank and the write goes through (open point 1, Decision for review). Lint refuses the functions outside formula/stored expression and refuses a non-literal calendar code; the form treats them as unservable. Docs, objectstack-formula (inside its ceiling), catalog Planned row removed, eval 8 flipped, changeset.",
  "tests": "formula 2133/2133 (working-day.test.ts covers weekend, National Day week, 调休 Saturday, DST, refusals, pushdown); objectql 14363/14363 (engine-formula-working-day.test.ts 11/11); lint 9475/9479 then the 2 ledger files fixed and re-run 592/592; ui/packages/core 4769 passed, 27 skipped.",
  "gates": "local: 139 dispatch-gates commands at final source, `dispatch-gates --ran` 122 families accounted for, 118 run, 4 NOT-MEASURED (exit 3, unbuilt closure: check:skill-examples, check:dual-build-cjs-loads, check:lean-entry-closure; check-plugin-teardown-shape --self-test needs an unshallowed clone). `pnpm --dir ui exec vitest run scripts/` 1 red: unit-registry-absence-collision cannot import modules resolving unbuilt @objectstack/client (environment). check:facade-delegation-only red first run, fixed (calendar wiring moved off engine.ts), re-run 0. Typecheck formula/objectql/lint exit 0. CI at head 4f2ffd2d: 70 check runs, 61 success, 9 skipped, 0 failed; mergeable_state clean.",
  "dogfood_battery": "n/a — no `!` in the PR title and no (narrowing) arm",
  "mcp_calls": "read-only only (pull_request_read get_check_runs); no write tool",
  "api_writes": "0 direct REST writes; relay dispatches: pr_create #36796, pr_request_reviewers os-support-ai, this comment",
  "open_questions": [
    {
      "question": "Open point 1: a stored expression meeting a D8 refusal",
      "options": [
        "A store blank, write goes through, one log line (implemented, pinned)",
        "B the write fails"
      ],
      "recommendation": "A, because it matches D8 reads and does not block every record whose span crosses the maintained period (D9 stance)"
    }
  ],
  "security_findings": "withheld",
  "out_of_scope_findings": []
}

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

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

Contract-review-claim: session_01WGufziwMkZG34d69p8BHb4 · head 4f2ffd2 · 2026-11-24T00:58Z

Face read off the committed paths (record-recognisers.mjs --template --paths): rules (skills/** ×3, governed rule text) ⇒ the L2 is owed at CONTRACT_REVIEW_TIER, not only the Clause-②: yes declaration face. L1-b runs it in an isolated reviewer beside its L1 read.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

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

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: 4f2ffd2dcb5372c9a2324cd6730c0e5db0ac0bee
Local-runs: none
Scope: skills/objectstack-formula/SKILL.md, skills/objectstack-project/evals/project-process.json, skills/objectstack-project/references/platform-catalog.md + packages/formula/src/working-day.ts, packages/formula/src/working-day-needs.ts, packages/formula/src/cel-to-filter.ts, packages/formula/src/stdlib.ts, packages/formula/src/types.ts, packages/formula/src/index.ts, packages/formula/src/validate.ts, packages/formula/src/cel-engine.ts, packages/lint/src/validate-expressions.ts, packages/objectql/src/formula-work-calendars.ts, packages/objectql/src/engine-top-level.ts, packages/objectql/src/engine-find.ts, packages/objectql/src/engine-insert.ts, packages/objectql/src/engine-update.ts, packages/spec/scripts/lib/platform-catalog.ts, ui/packages/core/src/evaluator/formulaRecord.ts
Security-touching: no

Inputs read: card #35356 (body and its four comments: unblock 7011103158, shipping note 7054955353, grade note 7063199719, claim 7101714597), PR #36796 (body, the dev report 7118578527, the docs-drift comment, the review claim), the net diff against main at this head, ADR-0157 and AGENTS.md on main, and the 70 check-runs on this head: 61 success, 9 skipped, 0 failed (Test Core 1-10, Test UI 1-16, the type-check and lint families, Check Changeset, Governed Surface Queue Guard, Spec property liveness all green). Nothing was built or run.

① Derived judgments

  • Expression accept set, formula sites: addWorkingDays, workingDaysBetween, addWorkingHours become callable in a formula field's and a stored field's expression (two-argument and three-argument overloads, working-day.ts#registerWorkingDayFunctions). On main each was an unknown function and failed the build. Widening. Right, and it is ADR-0157 D4's own scope.
  • Expression accept set, every other linted site: the three are refused by validate-expressions.ts#refuseWorkingDayElsewhere in check(), the declared flow predicate slot and the declared flow value slot. They were refused there before (unknown function), so nothing an author could write is taken away. Not a narrowing. Right. One site is missed: see S1.
  • Calendar code must be a quoted literal (working-day-needs.ts#computedCalendarCodeMessage, called from judgeFieldFormula). A refusal on a surface that is new in this diff. Right, and forced by the design: the calendars are loaded from the calls the source spells, before a synchronous evaluation.
  • CEL_STDLIB_FUNCTIONS (published, @objectstack/formula) gains three names. Widening of a published list. Right; the skill-catalog pin is green on this head.
  • EvalContext.workCalendars (optional), EvalWorkCalendar, EvalWorkCalendars, and the index exports WORKING_DAY_FUNCTIONS, WorkingDayFunction, workCalendarsNotLoadedMessage, callsWorkingDayFunction, workingDayCalendarNeeds, computedCalendarCodeMessage, WorkingDayCalendarNeeds: additive public surface of @objectstack/formula. Right. Absent workCalendars throws, it does not count: this holds D2 (no wall-clock fallback) for every caller that predates the field.
  • Filter compilation: cel-to-filter.ts#refuseWorkingDayCall keeps the reason code unsupported and changes only the detail text, at the two default branches that already threw. No accept-set change. Right (D6).
  • Read and write values: a formula that calls one reads a value where it could not exist before; a refused calendar reads null with one fault line (D8). A stored expression that meets the refusal stores null and the write goes through: this is the pre-existing answer of computeStoredExpressions for any expression that does not evaluate (18.0 round-2 sweep framework findings: a paid invoice line's amount/total stays writable while its inputs are locked; an unevaluable hook condition answers 500 INTERNAL_ERROR; remote-tables?schema= never narrows on the SQL drivers #24619 docblock on main), not a new branch. Right; judged as open point 1 in ③.
  • Write-path validator and the Console form: a working-day formula joins the unservable set on both sides (engine-top-level.ts#unservableReason, formulaRecord.ts#planObjectFormulas). Right, and it is the ADR's own Consequences line for the Console.
  • Platform catalog: the "Working-day formulas" row leaves PLANNED_ROWS and the generated page, and sys_work_calendar's reach names the formulas. Generator and generated page agree string for string. Eval 8 flips from PLATFORM-CANDIDATE to addWorkingHours(. Both are the two steps note 7054955353 on the card requires of the shipping PR. Right.
  • No spec schema, no authorable key and no authorable-surface shard moves; the only packages/spec change is the unpublished generator row list. Right as a reading of the tree. It does not settle the Metadata-protocol kind: see ②.

② Semver level

M1 (must-fix) — Metadata-protocol: none with @objectstack/formula: patch does not match what the diff publishes.

  • AGENTS.md, Post-Task Checklist 3: Metadata-protocol is "the change to what a metadata author can write — a new key, accepted value or metadata type is added", and "a kind takes at least minor on a package the diff moves, none takes patch".
  • What this diff publishes: an author may now write addWorkingDays(...), workingDaysBetween(...) and addWorkingHours(...) in a field's expression, where the build refused each as an unknown function before. That is a new accepted value in an authorable slot. The PR body's ground for none ("no authorable key, no authorable-surface/** shard moves") reads the rule as keys only; the rule also names accepted values.
  • Direct precedent on main, one week old and the same kind of change: feat(formula): rmbUpper(amount) writes an amount in Chinese capital numerals (人民币大写) for printed quotes and invoices #34433 (rmbUpper), changeset 34332-formula-rmb-upper.md: Metadata-protocol: added — a formula, predicate or flow value may now call rmbUpper(...), with '@objectstack/formula': minor.
  • The sibling Working calendars ②: sys_work_calendar objects, calendar service and Setup page #35355 service changeset is none at patch correctly: it exported arithmetic and a service, and no formula could call anything yet. This PR is the one that opens the authorable surface.
  • Fix: Metadata-protocol: added in the PR body and in the changeset body, and @objectstack/formula at least minor. Clause-②: yes (widening) is right and stays. The other four packages carry no protocol kind of their own in this diff (@objectstack/lint refuses nothing that was accepted before; @objectstack/objectql and @object-ui/core add behaviour behind the new functions; @objectstack/skills is teaching text); whether any of them is "moved" by the kind in the rule's sense is the dev's to state when the level is corrected.
  • The Check Changeset run is green; it checks that a changeset exists and is well formed, and cannot derive the kind.

The rest of ② holds: a changeset exists for every released package the diff touches, no skip-changeset, no narrowing arm, no BREAKING banner owed, and the "not released alone" line names its pair (#35355, #35357) as ADR-0157 D4 requires.

③ Boundary flags

  • Open question, open point 1 (a stored expression that meets a D8 refusal). ADR-0157 leaves it to this review ("the card named settles each under its own contract review"; not a maintainer question). Answered: option A stands — the field stores blank and the write goes through, with the fault line. Grounds, from the ADR and the tree, not from the PR body:
    • It is what every stored expression already does when it does not evaluate (computeStoredExpressions, 18.0 round-2 sweep framework findings: a paid invoice line's amount/total stays writable while its inputs are locked; an unevaluable hook condition answers 500 INTERNAL_ERROR; remote-tables?schema= never narrows on the SQL drivers #24619). Option B would make a calendar refusal the one fault that fails a write, a second semantic for one function family.
    • D8 rules the read: blank, one line, never a guess. A stored column and a computed one then answer alike for the same calendar state.
    • D9 records why a blocking refusal was not offered for approvals: with D8 it would block every record whose span crosses the year end until next year's holidays are entered. The same holds for every case opened in late December.
    • D2 is kept: the stored value is blank, never a weekly-pattern or wall-clock count. The ADR-0144 D5 precedent D8 cites is the same shape (no fallback value stored).
    • Two consequences the decision carries, both to be stated where authors read (the docs page says the first only by implication): a blank stored due time stays blank until that record's next write, since nothing recomputes it when the calendar is fixed; and a later write recomputes, so a record whose stored due time was valid is blanked by an unrelated edit made while its calendar refuses. A filter such as "due before now" never matches a blank, so an escalation built on the stored column is silent for those rows. This is the price of A and is consistent with the ADR's Consequences ("An unmaintained calendar blanks deadlines"); the Setup notice of D8 is the mitigation. No change to the code is asked.
  • Dev flag, calendar code as a quoted literal: accepted, see ①.
  • Dev flag, blank handling (blank start answers blank; blank count or blank end refuses): accepted as D4's "the card's to settle", pinned in working-day.test.ts.
  • Dev flag, no hook sandbox host function: accepted. The card says "if the sandbox needs" one; a hook reads the stored field.
  • Dev flag, contract-review tier ("the seat decides"): the three skills/** paths put the PR on the rules face, so this record is owed at CONTRACT_REVIEW_TIER whatever the spec criterion reads.
  • Dev flag, file surface beyond the order's list (objectql engine facets, packages/lint, ui/packages/core): each is where the contract is implemented or enforced; in scope above.
  • Dev report security_findings: "withheld": nothing for this record to answer; no changed hunk in the hits files teaches permission, sharing, credential, token or authentication behaviour, hence Security-touching: no.
  • Rule change: no .claude/** path in the diff; not applicable.
  • SQL push-down (Prime Directive 5): no new id materialisation and no in-app join. The diff adds at most one default resolution and one resolution per quoted code, per organization, per read, through the calendar service's cache, and only when a planned expression names a working-day function (planWorkCalendarNeeds). The arithmetic runs in memory because ADR-0157 D6 rules it so ("No calendar math runs in SQL"). No finding.
  • Release pairing (D4): the changeset says it is not released alone and names Working calendars ②: sys_work_calendar objects, calendar service and Setup page #35355 and Working calendars ④: approval escalation clock key (wall_clock | working_time) #35357, whose changesets are pending on main. Held.

④ Design judgment

skills/objectstack-formula/SKILL.md — against the spec it teaches. The Working days paragraph agrees with working-day.ts: the three signatures, the default calendar without a code, the quoted-literal code, formula or stored expression only, and the stored datetime field as the way to filter (D6). All three names are in CEL_STDLIB_FUNCTIONS, and the catalog-sync pin is green. One sentence overclaims: "refused elsewhere" (S1). The token budget was paid by deleting text elsewhere in the file; most of it is restatement, two pieces are not (N1).

skills/objectstack-project/evals/project-process.json — eval 8 against the card and the catalog. The prompt asks for a business-hours SLA formula; the expected answer (no app calendar objects, addWorkingHours(record.opened_at, 8) on the default calendar or a quoted code, stored in a datetime field with an expression because a filter cannot run calendar arithmetic, escalation.clock: 'working_time' for an approval step) is what the tree does, and the assertions (sys_work_calendar, addWorkingHours(; no PLATFORM-CANDIDATE, no PLATFORM-GAP) are the flip note 7054955353 asks for. Holds, with N3 and N4.

skills/objectstack-project/references/platform-catalog.md and packages/spec/scripts/lib/platform-catalog.ts — generated page and generator agree; the Planned row is gone from both; no other skill file on this head still says no formula reads a calendar. Holds.

packages/formula/src/working-day.ts, stdlib.ts, types.ts, cel-engine.ts, validate.ts, index.ts — against ADR-0157 D2, D4, D8, D11. Every count goes through work-calendar.ts (the module on main the service and the approval clock use): no second walk and no second wall-clock rule, which is open point 3's requirement. calendarFor throws when no map, no default entry or no entry for the code was handed over, and rethrows a refusal held as data; no path counts without a resolved calendar. The docblock's contract (start excluded, end included, 0 answers the start, a day read on the UTC calendar, an instant for hours) matches work-calendar.ts#addWorkingDays, #workingDaysBetween, #addWorkingHours sentence by sentence. types.ts states "absent is not refused" and the code does that. Holds, with N5.

packages/formula/src/working-day-needs.ts — the AST walk reads the two-argument form as the default, a value string third argument as a code, and anything else as computed; the regex pre-scan only gates the parse. A string literal that spells a call matches the pre-scan and then finds no call node, so it answers undefined. Holds.

packages/formula/src/cel-to-filter.ts — D6. lowerCondition and classify have no call case, so every working-day call reaches a default branch and gets the named refusal with reason unsupported; another function keeps the generic text (pinned as a control). Holds, with N3 on the wording.

packages/lint/src/validate-expressions.ts — D6's lint. The refusal runs at check() (validation rules, field rules, option visibleWhen, action visible / disabled / pressed, app landing, sharing rules, hook conditions) and at the declared flow predicate and value slots; judgeFieldFormula accepts the call and refuses a computed code. The runtime publish gate runs the same rules.

S1 (should-fix) — an expression defaultValue is not a refused site, and the published text says it is.

  • The claim: SKILL.md "Formula or stored expression only, refused elsewhere"; the lint docblock "Every other expression site ... is handed no calendar".
  • The tree: validate-expressions.ts never walks a field's expression defaultValue (its only reads of defaultValue are the nullability premise near line 557), and no other file in packages/lint/src validates one. The names are registered unconditionally, so a defaultValue written as the CEL expression addWorkingDays(today(), 3) type-checks and builds green.
  • At run time engine-defaults-and-autonumbers.ts evaluates the default with no workCalendars, the call throws, and the branch logs Failed to evaluate default expression and leaves the field unset: every insert, a blank due date and one warn line. "A due date defaulting to three working days from today" is the most natural wrong site for these functions, and D6's lint exists "so an author learns this when writing the expression". Seed cel values are evaluated the same way (seed-eval.ts#resolveSeed) and are not walked by the lint either.
  • Not a must-fix: the result is blank, never a wrong-clock value, so D2 holds.
  • Fix: refuse the three at an expression defaultValue (and a seed value) with the stored-expression prescription, or state in the skill and the lint docblock exactly which sites are refused. The first is what D6 asks for.

packages/objectql/src/formula-work-calendars.ts, engine-find.ts, engine-insert.ts, engine-update.ts, engine-top-level.ts — D2, D4, D8 and open point 4. The service is reused (one cache, one refusal vocabulary); a refusal is settled into data and thrown by the function, so the existing fault sink writes the one line; a kernel with no service refuses with the service's own error rather than counting. applyFormulaPlan binds per row, so two organizations in one page each count with their own default (pinned). The fallback to context.tenantId when the row carries no organization_id is sound where it applies: a read that carries a tenant is confined to it, which is the same premise the service's own elevated read relies on.

S2 (should-fix) — the answer depends on whether the projection kept organization_id.

  • resolveFormulaWorkCalendars reads the organization off the row, else off the context. planFormulaProjection widens a projection with the fields an expression reads, and organization_id is not one of them.
  • So a read that carries no tenant (a system read across organizations) with fields: ['id', 'due_day'] hands rows without organization_id: outside the single posture every such row is refused no_organization and reads blank, while the same row reads its value when the projection is omitted or names organization_id. The module header states this outcome; it does not state that the projection decides it.
  • It is a refusal, not a wrong calendar, so not a must-fix. But a formula's value must not depend on which sibling columns the caller selected.
  • Fix: when the plan names a working-day function, add organization_id to the widened fetch on objects that declare it (the existing widened mechanism), so the row always names its organization.
  • Read in the code, not run.

computeStoredExpressions passes the calendars to the same applyFormulaPlan and stores what it answers: open point 1 as ruled in ③. unservableReason names the new case. Holds otherwise.

ui/packages/core/src/evaluator/formulaRecord.ts — the form marks a working-day formula unservable, as the ADR's Consequences require and as the server's write-path check does. Holds.

Nits (no effect on correctness or the contract):

  • N1 — SKILL.md: "(translations: table below)" follows a sentence naming PRIOR(), and the translation table has no PRIOR row (it has OLD.x and ISBLANK(x)); the deleted sentence was the file's only PRIOR() to previous.x mapping. The deleted built-ins sentence also carried "+ duration(…) included; shift a date with isoDate(addDays(record.d, n))" for a date field, which no remaining line says. The PR body calls the deletions restatement; these two are not.
  • N2 — SKILL.md does not say that a call reads blank when the organization has no default calendar or the count passes the maintained span, nor that the start day is excluded and the end included. The docs page says both; the skill is one token under its ceiling.
  • N3 — now() against {now}: eval 8's expected output and the lint message say the stored field is compared with now(); the compiler's refusal says {now}. In a query filter the instant is spelled {now} (ADR-0157 D6; skills/objectstack-query/rules/filters.md), now() is right only in a CEL condition evaluated in memory, and a CEL source compiled to a filter lowers neither. One spelling per site would read better.
  • N4 — the catalog row says "addWorkingDays()-style formulas" while eval 8 asserts addWorkingHours(; the name is reachable only through the project skill's routing to objectstack-formula. Naming the three in the row would close it.
  • N5 — working-day.ts: the calendar is resolved before the blank-start check, so a blank start on an organization whose calendar refuses still throws and writes the fault line; the value is blank either way.

M1 is a FAIL. S1 and S2 each earn a delta review of their fix.

Implemented-by: claude/project-thread-7jquxn
Reviewed-by: session_01WGufziwMkZG34d69p8BHb4

VERDICT: FAIL

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

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

席位核对 — REWORK · repo:objectstack#3 · head 4f2ffd2 · 2026-11-24T01:08Z

L1: REWORK
Head-sha: 4f2ffd2dcb5372c9a2324cd6730c0e5db0ac0bee
Card: #35356 · claim 7101714597 · contract review on this head: 7118785761 (CONTRACT_REVIEW_TIER, FAIL, isolated reviewer; claim 7118642410).

Tier and face

record-recognisers.mjs --template --paths reads the face as rules: skills/** ×3 is governed rule text. So the L2 is owed at CONTRACT_REVIEW_TIER whatever packages/spec does. The PR body's "not CONTRACT_REVIEW_TIER by the order's spec criterion" read only the schema face. check-governed-merges: Tier H (published skills catalog), 1527 lines. The generated-surface exception does not lift platform-catalog.md because the generator is co-edited here. That only matters for lifting governance; the PR is Tier H regardless.

Checklist

  • Shape: l1-face at this head. Draft, base main, first line Fixes #35356, no closing keyword next to another card. The card's Done-when items are each delivered:

    • weekend, National Day week and 调休 Saturday: working-day.test.ts, plus the engine read in engine-formula-working-day.test.ts;
    • pushdown refusal with a clear message: cel-to-filter.ts#refuseWorkingDayCall;
    • teaching text;
    • catalog row removed and eval 8 flipped (note 7054955353).

    Fixes is right.

  • Checks at this head: 70 check-runs. 61 success, 9 expected skip, 0 failed. Lint & Repo Gates and TypeScript Type Check: success. mergeable_state clean.

  • Changeset: one entry. @objectstack/formula, objectql, lint, @object-ui/core and skills are all at patch. l1-face flags @objectstack/spec with no entry; that flag is mechanical and wrong here. The only spec path is packages/spec/scripts/lib/platform-catalog.ts, and spec's files[] (dist, json-schema, …, src/**/*.zod.ts) does not ship scripts/. No spec entry is owed. The level is wrong, though: see M1.

  • Scope vs claim: the claim's surface leaves out the objectql engine facets (engine-find, engine-insert, engine-update, engine-security-resolvers, engine-top-level, plugin.ts), the new formula-work-calendars.ts and its test, and ui/packages/core (formulaRecord.ts and its test). The order allows declaring extra paths with a reason, and the PR body does so for each. Each is where the calendars must be loaded or refused, so I accept them. The claim's File surface: line should still be amended to the real list for the record (seat, paper).

  • Overlap (overlap-check.mjs --branch=pr36796): merges cleanly with main, feat(objectql)!: sync-in provenance columns on synced objects, stamped by the pull and refused elsewhere #36795, chore: version packages #35129 and fix(audit): a search the server widens never names a column the caller may not query #34817. It conflicts with fix(lint)!: refuse == / != on a list-valued field reached through a lookup hop #36673 (expression check: == / != on a list field reached through a lookup hop (record.account.labels == 'a') is refused at no door, because the schema hint carries no hop target's field shapes #36237, lint hop list-equality, draft) in packages/lint/src/validate-expressions.ts and authored-site-expression.test.ts. Whichever lands second merges main and resolves the conflict.

  • Tests: real commands with output in the body: formula 2133, objectql 14363, lint 9475/9479 then 592 after the ledger fix, ui core 4769. CI Test Core 1–10 and Test UI 1–16 green on this head. Refusal cases assert the CompileError reason and message, and the lint cases assert the rule id. There is no HTTP envelope on these paths.

  • Docs, read sentence by sentence (content/docs/data-modeling/formulas.mdx): the three stdlib rows, the Working days section, the three examples, and the bullets on which calendar, days vs instants, where they run, refusals and calendar edits. Each matches working-day.ts, working-day-needs.ts, formula-work-calendars.ts and computeStoredExpressions. One exception: "neither can a validation rule … os build refuses them there" is not true for an expression defaultValue (S1).

  • Changeset prose: bullets 1–7 read against the diff. The "Build refusals" bullet's list of sites ("every expression site but a formula field's and a stored field's expression") carries the same gap (S1). The Metadata-protocol line is M1.

  • security_findings: withheld in the dev report: per security-findings.md, that report goes privately to the seat. Not judged here.

Findings

Must-fix

  • M1 (must-fix) = contract review M1. Metadata-protocol: none with @objectstack/formula: patch is wrong for three new callable functions in an authorable slot. AGENTS.md Post-Task Checklist 3 says a new accepted value is added, and a kind takes at least minor. The precedent on main is feat(formula): rmbUpper(amount) writes an amount in Chinese capital numerals (人民币大写) for printed quotes and invoices #34433 (rmbUpper): changeset 34332-formula-rmb-upper.md declares Metadata-protocol: added with '@objectstack/formula': minor. Fix:

    • Metadata-protocol: added in the PR body and the changeset;
    • @objectstack/formula at minor;
    • the Skills-docs: line that a non-none kind owes (the precedent's spelling is Skills-docs: updated here — …).

    Re-run Check Changeset on the new head.

Should-fix

  • S1 (should-fix) = contract review S1. An expression defaultValue, and seed cel values, are not walked by packages/lint/src/validate-expressions.ts. A default calling addWorkingDays(...) builds green. At run time engine-defaults-and-autonumbers.ts evaluates it with no calendars and leaves the field unset on every insert, with a warning. Refuse the three at that site (and at seed values), or correct the skill, docs and changeset claim that every other site is refused. The first option is the one the design implies.
  • S2 (should-fix) = contract review S2. formula-work-calendars.ts takes the organization from row.organization_id, else from the context tenant, and nothing widens the projection with organization_id. A tenant-less system read whose projection omits the column refuses (no_organization, so the formula reads blank). The same row reads a value when the column is projected. Widen the formula read's projection with organization_id when the plan calls a working-day function, or pin the refusal and document it.
  • S3 (should-fix, L1) — the production wiring has no test. plugin.ts installs the service into a module-level WeakMap keyed by this.ql, and every formula path looks it up by its host's facade. Reading engine.ts, the two are the same object (facade: this). But every new test calls setFormulaWorkCalendarService(engine, service) directly, and no test reaches the plugin line. If the key and the facade ever stop being the same object (a wrapper, a proxy, a re-created engine), every working-day formula silently reads blank with a refusal log. The value of the feature depends on that one handoff (l1-review-checklist 〈断言与收益〉). Add one test that boots through ObjectQLPlugin with the calendar service and reads a working-day formula's value.

Nits (contract review N1–N5, no effect on correctness or the contract): the SKILL.md PRIOR() pointer and the dropped date shift line; blank-on-refusal and the start/end rule missing from SKILL.md; now() vs {now} spelling; the catalog row naming only addWorkingDays(); blank start on a refusing calendar still logs. Fix N1–N4 alongside the rework if it is cheap: they are prose faces. N5 needs no action.

Open point 1 (Decision for review)

Option A stands, per the contract review's ③: a stored expression meeting a D8 refusal stores blank, the write goes through, and one fault line is logged. It is computeStoredExpressions' existing answer for any expression that does not evaluate (#24619). It matches D8 reads and D9's non-blocking reason, and it keeps D2 (no fallback value). Two consequences the review asks to state for authors: a blank stored due time stays blank until the record's next write, and a later write made while the calendar refuses blanks a previously valid value. Docs and skill, a sentence each. Not a code change.

Next

The fix round goes to the card thread. The delta read covers M1, S1–S3 on the new head, and the contract review gets its own delta from the same reviewer. After both ACCEPT/PASS, this goes Tier H to the approver; ⛔ never ready it.

… calendar lookup's organization column

Review round: the changeset now declares Metadata-protocol added with
@objectstack/formula at minor and a Skills-docs line. os build refuses
the three functions in a field's expression defaultValue and in seed
expression values. A projection that omits organization_id is pinned by
a test, and the plugin's service wiring by a kernel boot test. A blank
start answers blank before any calendar is read. Docs and skill say a
blank stored due time stays blank until the record's next write.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WGufzi4y7vb1rP9MERYbw2
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

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

Contract-review-claim: session_01WGufziwMkZG34d69p8BHb4 · head 762e6a6 · 2026-11-24T04:57Z

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

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

席位核对 — ACCEPT · repo:objectstack#3 · head 762e6a6 · 2026-11-24T05:00Z

L1: ACCEPT (delta, after REWORK 7118804738 at 4f2ffd2)
Head-sha: 762e6a6c7eea45e81f4aa859d0813ad7118254e2
Round-2 commit 5e11588a, then a clean merge of main. Contract-review delta claimed on this head (7122506967); the record follows from the same reviewer.

Delta read

  • Checks at this head: 61 success, 9 expected skip, 0 failed, 0 pending. mergeable_state clean. l1-face flags the @objectstack/spec changeset for packages/spec/scripts/lib/platform-catalog.ts. That is a known false positive: scripts/** is not in spec's files[], so nothing publishes.
  • Governance: still GOVERNED, Tier H (skills/** ×3). The generated-surface exception does not lift platform-catalog.md, because the generator row is co-edited in the same PR. That changes nothing here: the approver's hand reviews the whole PR either way, and both edits are the same one-row text change.
  • M1: closed. The changeset and the body say Metadata-protocol: added — …, '@objectstack/formula': minor, and Skills-docs: updated here — …. Check Changeset is green.
  • S1: closed. The new packages/lint/src/validate-working-day-sites.ts refuses the three functions in a field's expression defaultValue (an envelope; a bare string stays a literal) and in seed cel values at any depth, with a key path. It is wired into runStackExpressionPasses, with seeds only off an object write. workingDayElsewhereMessage moved there unchanged, except for its final clause. recordsOf gives map-keyed fields their names. The tests cover default, nested seed and the bare-string control.
  • S2: closed. planFormulaProjection already widened the projection with organization_id. It is now pinned by a test whose stub driver honours projections, and the answer has the column cut back off. The ablation turned red when the column was skipped. The header of formula-work-calendars.ts documents it.
  • S3: closed. A kernel boot test runs kernel.use(new ObjectQLPlugin({ ql: engine })) with the calendar service and reads a working-day formula's value. The ablation turned red without the plugin's setFormulaWorkCalendarService call.
  • Open point 1, option A: the SKILL.md, the docs and the changeset each state both consequences: a blank stays blank until the next write, and a write while the calendar refuses blanks a valid value.
  • Nits N1–N4: done in prose: the PRIOR() → previous.x pointer, the date shift line restored, {now} for a filter beside now() for CEL, and the catalog row naming all three functions. N5 answers blank before any calendar is read, with a test.
  • Skill ratchet 6008 → 6090 under ruling A (record 6513306068), quoted in the body and in the ratchet comment.

Findings

Must-fix: none. Should-fix: none. Nits: none new.

Next

Tier H: once the contract-review delta passes, the seat takes it to the approver. ⛔ Never flip it ready, enqueue it or arm auto-merge.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

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

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: 762e6a6c7eea45e81f4aa859d0813ad7118254e2
Local-runs: none
Scope: skills/objectstack-formula/SKILL.md, skills/objectstack-project/evals/project-process.json, skills/objectstack-project/references/platform-catalog.md + packages/formula/src/working-day.ts, packages/formula/src/working-day-needs.ts, packages/formula/src/cel-to-filter.ts, packages/formula/src/stdlib.ts, packages/formula/src/types.ts, packages/formula/src/index.ts, packages/formula/src/validate.ts, packages/formula/src/cel-engine.ts, packages/lint/src/validate-expressions.ts, packages/lint/src/validate-working-day-sites.ts, packages/objectql/src/formula-work-calendars.ts, packages/objectql/src/engine-top-level.ts, packages/objectql/src/engine-find.ts, packages/objectql/src/engine-insert.ts, packages/objectql/src/engine-update.ts, packages/spec/scripts/lib/platform-catalog.ts, scripts/check-skills-token-ratchet.mjs, ui/packages/core/src/evaluator/formulaRecord.ts
Security-touching: no

Delta round on the record for head 4f2ffd2dcb5372c9a2324cd6730c0e5db0ac0bee. Read this round: the round-2 commit 5e11588a (16 files), the merge of main that follows it (it changes none of the PR's 32 files: the diff of those paths between 5e11588a and this head is empty), the PR body with its "Review round 2" section, the changeset, and the 70 check-runs on this head: 61 success, 9 skipped, 0 failed. The first record's judgments on everything the round did not touch stand as written there. Nothing was built or run.

① Derived judgments

  • Unchanged from the first record: the three functions widen the accept set of a formula field's and a stored field's expression; CEL_STDLIB_FUNCTIONS, EvalContext.workCalendars and the new index exports are additive; the filter compiler keeps reason unsupported. All right.
  • New this round, lint accept set: a working-day call in a field's expression defaultValue and in a seed record's expression value is now a build error (validate-working-day-sites.ts#workingDayValueSiteIssues). On main each was an unknown function, so no author loses anything that worked. Not a narrowing against main. Right.
  • New this round, evaluation: a blank start answers blank before the calendar is resolved (working-day.ts, both addWorkingDays and addWorkingHours). It removes a fault line and changes no value. Right, and pinned.
  • New this round, the skill ceiling: skills/objectstack-formula/SKILL.md rises 6008 to 6090 in scripts/check-skills-token-ratchet.mjs. Judged in ④; right.
  • No public export, schema or authorable key moved in this round beyond the above.

② Semver level

Clause-②: yes (widening) stands. The other four packages stay at patch: none carries a protocol kind of its own (@objectstack/lint refuses only calls that never built; @objectstack/objectql and @object-ui/core add behaviour behind the new functions; @objectstack/skills is teaching text). The Skills-docs: line is present in both places and true to the diff. The "not released alone" line still names #35355 and #35357 (ADR-0157 D4). Check Changeset is green on this head.

③ Boundary flags

  • Open point 1 (a stored expression that meets a D8 refusal): option A stands as ruled in the first record: the field stores blank and the write goes through. The two consequences that record asked to be stated are now stated where authors read: the docs page and the changeset say a blank stored due time stays blank until the record's next write and that a write made while the calendar refuses blanks a value that was valid before; the skill says the first. The code of the branch is unchanged.
  • The dev's other flags (quoted-literal calendar code, blank handling, no hook host function, the file surface) were answered in the first record and are unchanged.
  • "S3" in the PR body is the lane read's item, not this record's: a kernel boot test that the plugin installs the calendar service for the engine the formula paths reach. Test only; nothing for the contract to answer, and it is consistent with plugin.ts.
  • "fix(lint)!: refuse == / != on a list-valued field reached through a lookup hop #36673 still open at this head" in the PR body is a sequencing note for the seat; it names no contract question.
  • Rule change: no .claude/** path in the diff; not applicable.
  • SQL push-down (Prime Directive 5): the round adds no read. The formula projection already widens a named projection to every stored column in one driver read (planFormulaProjection, on main); no new id materialisation, no in-app join. No finding.

④ Design judgment

packages/lint/src/validate-working-day-sites.ts, validate-expressions.ts

  • S1: closed. workingDayValueSiteIssues refuses a working-day call in a field's expression defaultValue and, at any depth, in a seed record's expression values, with the stored-expression prescription; runStackExpressionPasses runs it on every run (seed data off an object write). The envelope test matches what the engine evaluates: isExpressionDefault takes a { dialect, source } object and a bare string is a literal, and seed-eval.ts#resolveSeed evaluates expression envelopes while recursing through arrays and plain objects, which is the walk the lint makes. Pinned by three cases in validate-expressions.working-day-35356.test.ts, the bare-string and addDays() controls included; the lint shards are green. The skill and the changeset now name the refused sites instead of saying "elsewhere".

workingDayElsewhereMessage moved into the new module unchanged except that it no longer ends "against now()".

packages/objectql/src/formula-work-calendars.ts

  • S2: closed. The finding's premise did not hold. planFormulaProjection (on main, unchanged here) widens a named projection that includes a formula to every stored column the object declares, organization_id among them, and cuts the widening back off the answer; the first record read that loop as adding only the fields an expression reads. So the projection never decides the organization. The round pins it: the stub driver now honours fields, and the new case asserts each organization's own answer under fields: ['id', 'due_day'], that the answer carries no organization_id, and that the driver was asked for it. The module header now says so.

packages/formula/src/working-day.ts — the blank-start return now precedes calendarFor in addWorkingDays and addWorkingHours; the count is still validated first, so a blank count still refuses. Agrees with the docblock ("A blank day or start answers blank"). Pinned against a refusing default.

skills/objectstack-formula/SKILL.md — the Working days paragraph now says the start is not counted and the end is, names the refused sites (rules, flows, defaults, seeds, filters), and says a missing default calendar or a count past the maintained span reads null and leaves a stored due time blank until the record's next write. Each clause matches the tree: work-calendar.ts for the ends, the lint and cel-to-filter.ts for the sites, applyFormulaPlan and computeStoredExpressions for the blank. The timestamp(s) line carries the date-field sentence again, in the words main had, and the PRIOR() note names previous.x.

scripts/check-skills-token-ratchet.mjs — the gate's own header says a raise is checked by this record, not by the script: the diff must show deletion of restatement in the same file, the PR body must quote the standing ruling, and the row moves by the measured remainder only. All three hold. The diff deletes the "No date arithmetic" note the table header repeats, the Salesforce-flavour examples the translation table lists, and the ISBLANK() pairing the table carries. The PR body quotes 「A:先削重复,余额按实测提高」 with record 6513306068. The file at this head is 24377 bytes, 24357 priced, and ceil(24357 / 4) is 6090, against main's 24016 priced: the row is pinned at the measurement. The two sentences the first record found were not restatement are back in the file rather than counted as paid-for deletions.

skills/objectstack-project/evals/project-process.json — eval 8's expected output now says a filter compares the stored field with {now} and a CEL condition with now(), which is the grammar of each site. Assertions unchanged.

skills/objectstack-project/references/platform-catalog.md, packages/spec/scripts/lib/platform-catalog.ts — the sys_work_calendar row names all three functions; generator and generated page agree string for string.

Earlier nits:

  • N1: closed. The PRIOR() to previous.x mapping and the date-field + duration sentence are back.
  • N2: closed. The skill states the blank-on-refusal behaviour and which end is counted.
  • N3: closed. Eval 8 and the docs name {now} for a filter and now() for a CEL condition; the lint message no longer prescribes a spelling.
  • N4: closed. The catalog row names addWorkingHours().
  • N5: closed. A blank start no longer reads the calendar.

New this round, one nit (no effect on correctness or the contract):

  • N6 — workingDayValueSiteIssues walks stack.objects only, so an expression defaultValue on a field an objectExtensions entry adds is not refused at build; runStackExpressionPasses judges an extension field's expression in its own walk but that walk has no default counterpart. The run-time outcome is the same blank-and-warn as before, never a wrong value. A follow-up card, or left as an accepted deviation.

No must-fix, no should-fix.

Implemented-by: claude/project-thread-7jquxn
Reviewed-by: session_01WGufziwMkZG34d69p8BHb4

VERDICT: PASS

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

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

维护者速读

  • 公式字段新增三个函数:addWorkingDays、workingDaysBetween、addWorkingHours。它们按组织的工作日历计算到期日和剩余工作日,节假日、周末、调休上班日都照日历算。这是工作日历系列的第三步。
  • 日历缺失,或日历维护的时间范围不够时,结果为空,服务端记一行日志,记录照常保存,不会退回按自然日算。默认值和种子数据里不允许用这三个函数(构建时拒绝)。
  • 需要您批准,因为改到了 skill 文档(skills/**,治理路径)。这是加法(Clause-②: yes (widening),Metadata-protocol: added),formula 包升 minor。
  • 批准后由维护者入队(本席尚无「审批人批准后的 Tier H PR 你可以自主落地」授权)。

Request: approval · Tier H by governed path (skills/**) · 2026-11-24T05:02Z

席位意见: land. Both review rounds are closed on this head: L1 (M1, S1–S3) and contract (open point 1 resolved as option A with its two author-facing sentences).

  • L1: delta ACCEPT 7122544179 (L1-b) at head 762e6a6c. The first-round REWORK 7118804738 is closed.
  • Contract review (CONTRACT_REVIEW_TIER): first-round FAIL record 7118785761. The delta record 7122552709 on 762e6a6c reads PASS with no open finding.
  • One new nit, N6, goes to a follow-up card, not this PR: an expression defaultValue on a field added through objectExtensions is not refused at build. At run time it gives the same blank-and-warn, never a wrong value.
  • Checks at 762e6a6c: 61 success, 9 skipped, 0 failed; mergeable clean. +1690/−44. Fixes #35356.
  • Skill ceiling 6008 → 6090 under ruling A 6513306068, quoted in the PR body.

@objectstack-fleet objectstack-fleet Bot added the pm:awaiting-merge PR only: landing waits on the maintainer's own review and merge (SKILL.md 复核 ②); never on an issue label Nov 24, 2026
@os-zhuang
os-zhuang marked this pull request as ready for review November 24, 2026 05:03
@os-zhuang
os-zhuang added this pull request to the merge queue Nov 24, 2026
Merged via the queue into main with commit 3d6dea2 Nov 24, 2026
76 checks passed
@os-zhuang
os-zhuang deleted the claude/project-thread-7jquxn branch November 24, 2026 05:33
@objectstack-fleet objectstack-fleet Bot removed the pm:awaiting-merge PR only: landing waits on the maintainer's own review and merge (SKILL.md 复核 ②); never on an issue label Nov 24, 2026
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/xl 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.

Working calendars ③: formula functions addWorkingDays / workingDaysBetween / addWorkingHours

3 participants