Skip to content

fix(approvals): a working-time deadline whose calendar read errors no longer fails the request open or the list - #35969

Merged
objectstack-fleet[bot] merged 4 commits into
mainfrom
claude/area-a4W-35953
Nov 21, 2026
Merged

objectstack-fleet[bot] merged 4 commits into
mainfrom
claude/area-a4W-35953

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Requested by Elon · project thread
Fixes #35953
Clause-②: no
Metadata-protocol: none

维护者速读

  • 用户能看到什么变化:审批步骤按工作日历计时时,若读取日历本身出错,提交审批不再失败,流程照常暂停等待审批;收件箱列表和单条审批照常打开,只是这一条暂不显示到期时间。
  • 为什么做:属于审批工作时间计时这条线,修补上一轮引入工作日历计时后留下的缺口:日历读取出错会让已建好、已通知审批人的申请所在流程失败,还会让整个收件箱打不开。
  • 出错会怎样:最坏情况是出错的那一条暂不显示到期时间、日历恢复前不会升级提醒;其他申请不受影响,改动可直接撤回。
  • 要你做什么:无。

What changes

On origin/main at 7de1bad5cb, ApprovalService.slaDeadline serves a calendar refusal as sla_due_refusal (ADR-0157 D9) and rethrows every other error, and projectWorkingTimeDue ran it per row with no guard. Its three callers all serve a row that is already written: openNodeRequest (after the sys_approval_request insert and the approval.requested notices), listRequests, and loadRequest (getRequest, listActions, and the decision paths that load the request). A calendar read that errored (a driver error reading sys_work_calendar, not a refusal) therefore:

  • made the open throw, so the approval node's catch answered the run success: false while a pending request it owns existed and its approvers had been told;
  • failed the whole list read, and every single read of that row.

The fix, packages/plugins/plugin-approvals/src/approval-service.ts: projectWorkingTimeDue now guards each row. On an error from slaDeadline it logs a warn naming the request and the error, and serves that row with no deadline; the loop goes on to the next row. One guard covers all three callers, so openNodeRequest needs no second one: the open returns the request it wrote, and the run suspends as usual.

What does not change:

  • A refusal is still served as sla_due_refusal; no new refusal code and no change to the served shape.
  • No wall-clock fallback (ADR-0157 D2): the erroring row carries neither sla_due_at nor sla_due_refusal.
  • The sweep (runEscalations) calls slaDeadline itself, inside its existing per-row try. It still skips the row, counts nothing for it, and asks the calendar again next pass; ADR-0042 §1 single shot is unchanged. The sweep's assertions in the new test pass on main too: they pin this, they do not fix it.
  • Log level warn: no persisted claim is lost, a read projection is missing one field (AGENTS.md, degradation log levels).

Not done: the optional per-pass refusal memo. It does not come for free: it needs a key across rows (organization plus calendar code plus the start-and-hours inputs) and a decision on whether a memoised refusal may serve rows of other organizations. It is left for its own card if the read cost matters.

Changeset .changeset/35953-sla-deadline-error-guard.md: @objectstack/plugin-approvals patch.

Read first (risk order):

  1. approval-service.ts, the projectWorkingTimeDue hunk: the try/catch around slaDeadline and the continue that leaves the row with no deadline.
  2. approval-service-sla-calendar-clock.test.ts, the new last describe: the calendar double that throws a plain Error for a chosen calendar code and delegates to the real WorkCalendarService otherwise.

Evals

Tests are in the existing harness file src/approval-service-sla-calendar-clock.test.ts, as a new top-level describe (4 tests). The calendar double is the real WorkCalendarService over the file's read double, except that a calendar code in a test-controlled set throws new Error('sys_work_calendar read failed: connection reset').

  1. The open returns the pending request, the row exists in sys_approval_request, neither sla_due_at nor sla_due_refusal is served, and a warning names the request.
  2. The approval node, driven through a real AutomationEngine flow, answers paused with one suspended run (on main: failed).
  3. A list with one erroring row and one good row: both are listed, the good row keeps sla_due_at (Tuesday 12:00 Shanghai, holiday skipped), the erroring row has no deadline; getRequest of the erroring row answers it.
  4. The sweep: the erroring row is skipped (escalated: 1, the good row only), escalated on the next pass once the calendar reads again, and a third pass escalates nothing.

Verification

Two-minute check: pnpm --filter @objectstack/plugin-approvals exec vitest run --maxWorkers=2 src/approval-service-sla-calendar-clock.test.ts prints Tests 16 passed (16).

Red on main (the guard ablated once)

approval-service.ts restored from 7de1bad5cb on disk under a trap (disk hash f1d462d986 equals main's blob; guard text occurrences 0), tests from the branch, then restored from HEAD (git diff HEAD empty, git status --porcelain empty). The subject is imported by relative path from src/, so no dist/ rebuild sits between the mutation and the run.

  • open: Error: sys_work_calendar read failed: connection reset thrown by openNodeRequest
  • node: expected 'failed' to be 'paused'
  • list: the same error thrown by listRequests
  • sweep: runEscalations and the good row's escalation pass; the red is the erroring row's listActions read (it loads the request), the read seam the fix covers
  • Test Files 1 failed (1), Tests 4 failed | 12 passed (16)

Green on the fix: Tests 16 passed (16).

Package suite, typecheck and derived gates at dd312c3
  • pnpm --filter @objectstack/plugin-approvals test: Test Files 126 passed (126), Tests 1803 passed (1803)
  • pnpm --filter @objectstack/plugin-approvals typecheck: exit 0, check:test-typecheck: OK
  • node scripts/pm/dispatch-gates.mjs --commands: 72 commands; 70 exit 0; pnpm check:dual-build-cjs-loads and pnpm check:i18n exit 3 PREREQUISITE NOT MET (they need a whole-workspace build and the built CLI closure), NOT MEASURED locally, CI runs both. --ran reconciliation: 72 derived famil(ies) accounted for — 70 run, 2 NOT-MEASURED.
  • node scripts/pm/overlap-check.mjs --branch=claude/area-a4W-35953: VERDICT clean exit 0, merges cleanly into origin/main.
  • test:repo and the full dogfood battery are CI's (no ! in the title, no narrowing arm).

Acceptance notes

  • An erroring row is served with neither sla_due_at nor sla_due_refusal, so a reader cannot tell it from a node with no SLA until the calendar reads again; only the server log says why. A calendar_error refusal code would say it on the row, but that is a served-shape change that needs a contract read, so it is out of this PR by the seat's scope.
  • The sweep logs its existing escalation failed for request warning for the erroring row on each pass; unchanged.

Session: https://claude.ai/code/session_016WV4czKnDE6hsyXQzB9wB2

🤖 Generated with 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 Nov 21, 2026
@github-actions

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 1 package(s): @objectstack/plugin-approvals, touching 2 documentable anchor(s).

2 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:

  • content/docs/automation/approvals.mdx (via ApprovalService (symbol, a top-level class))
  • content/docs/automation/flows.mdx (via ApprovalService (symbol, a top-level class))

⛔ 2 release-owned page(s) also name something this change touched. These are read-only:

  • content/docs/releases/v17/17-6.mdx (via ApprovalService (symbol, a top-level class))
  • content/docs/releases/v18/18-1.mdx (via ApprovalService (symbol, a top-level class))

content/docs/releases/ is RELEASE-OWNED (AGENTS.md "Documentation Guardrails"): release
notes are written centrally at release time, and a code PR that edits them is the exact PR
that guardrail exists to stop. They are still audited — read-only. If one of them is actually
wrong, file an issue or open a dedicated docs-only PR; do not edit it here.

What this run could not see
  • the SDK route bridge reached 65 of 247 client-bound route-ledger rows — the other 182 have no registrar path: tail to select them, so pages documenting THEIR client methods cannot appear above, on this or any run. Of those 182: 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; 123 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 — 6 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 523ada4cc0cf4308616249fd3364c630875a9c6e → packageMentionDocs.

Which tree this was computed on

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

node scripts/docs-audit/affected-docs.mjs --json 523ada4cc0cf4308616249fd3364c630875a9c6e

⚠️ 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 523ada4cc0cf4308616249fd3364c630875a9c6e → 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#4 · os-elon-musk · session_016WV4cwxJaQdC11ABGtTez8

L1 verdict (L1-a): ACCEPT at head dd312c3b9568958f53cb7ac364cf38de75a0cfc4 (Fixes #35953: a working-time deadline whose calendar read errors, without being a refusal, no longer fails the request open or the whole list). It delivers Asks 1 and 2 and every pin the card names. Ask 3 (the memo) was optional and is not done. Nothing is owed.

Gates on this head: l1-face --pr 35969 CLEAN (13 items, none flagged). Check-runs at dd312c3: 37 success, 16 expected skip, 0 failed, 0 pending. Lint & Repo Gates and TypeScript Type Check both success. Dogfood battery not owed.

What I checked:

  • One guard covers all three serve paths. openNodeRequest, the list read and getRequest all project through projectWorkingTimeDue. It is the only caller of slaDeadline besides the sweep, and the sweep already catches per row. So a single try in the per-row loop is the whole fix. On a throw, the row is served with neither sla_due_at nor sla_due_refusal and a warn names the request. There is no wall-clock answer (D2), and a refusal is still served as before.
  • The tests, and the guard really carries them. I ran approval-service-sla-calendar-clock.test.ts at this head: 16 passed. Positive control: I made the guard rethrow, and all four new cases went red (the open, the run that suspends rather than fails, the list and single read, and the sweep). Restored, 16 green, git status clean. The four cases are the card's pins: the open returns the request it wrote and the run is paused with one suspended run; a list keeps the good row's deadline beside the bad one; the sweep skips the bad row, escalates it once the calendar answers, and then does not escalate it again (ADR-0042 §1 single shot).
  • The changeset, sentence by sentence. "opening the request threw after the row was written and its approvers were told, so the approval node failed its flow run" is the card's N1, which the new test reproduces. "every list read and single read" is true by the three callers above. "served with no deadline and the error is logged as a warning … the other rows keep their deadlines … still sla_due_refusal … never falls back … the sweep still skips … the served request shape is unchanged" all match the diff. No field was added. The doc comments on slaDeadline and projectWorkingTimeDue say the same.
  • Clause-②: no and Metadata-protocol: none fit, because the served shape is unchanged. The patch changeset is on the one published package touched.

The area's out-of-scope reading: agreed. The card offered either "serve the row with no deadline" or a calendar_error code "if the served shape admits one under contract review". The PR took the first, which needs no contract change. The cost is that the inbox then shows no countdown and no reason for that row, so it looks like a step with no SLA, while the sweep keeps retrying and the server log names the request. That's acceptable for an error that is not a refusal: a driver failure is an operator's problem, not something an organization admin fixes in Setup. If it should ever tell the user, that is a new card with its own contract read, not a gap in this one.

Landing: not governed. The seat confirms, and a4-W lands.


Generated by Claude Code

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

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

Landing (area a4-W, seat 4) · 2026-11-21T09:31Z · head dd312c3b9568958f53cb7ac364cf38de75a0cfc4

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review November 21, 2026 09:31
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 21, 2026
Merged via the queue into main with commit 62daf7d Nov 21, 2026
54 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/area-a4W-35953 branch November 21, 2026 09:56
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/m tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

2 participants