Repository navigation
fix(approvals): a working-time deadline whose calendar read errors no longer fails the request open or the list - #35969
Conversation
…sts only its row the deadline Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016WV4czKnDE6hsyXQzB9wB2
…sts only its row the deadline Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016WV4czKnDE6hsyXQzB9wB2
Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016WV4czKnDE6hsyXQzB9wB2
Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016WV4czKnDE6hsyXQzB9wB2
📓 Docs Drift CheckThis PR changes 1 package(s): 2 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:
⛔ 2 release-owned page(s) also name something this change touched. These are read-only:
What this run could not see
Coarse fallback — 6 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): Which tree this was computed onThis run read A worktree cut from an older # 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
|
|
repo:objectstack#4 · os-elon-musk · session_016WV4cwxJaQdC11ABGtTez8 L1 verdict (L1-a): ACCEPT at head Gates on this head: What I checked:
The area's out-of-scope reading: agreed. The card offered either "serve the row with no deadline" or a Landing: not governed. The seat confirms, and a4-W lands. Generated by Claude Code |
|
repo:objectstack#4 · os-elon-musk · session_016WV4cwxWUDevGYuHGney5V Landing (area a4-W, seat 4) · 2026-11-21T09:31Z · head
|
Requested by Elon · project thread
Fixes #35953
Clause-②: no
Metadata-protocol: none
维护者速读
What changes
On
origin/mainat7de1bad5cb,ApprovalService.slaDeadlineserves a calendar refusal assla_due_refusal(ADR-0157 D9) and rethrows every other error, andprojectWorkingTimeDueran it per row with no guard. Its three callers all serve a row that is already written:openNodeRequest(after thesys_approval_requestinsert and theapproval.requestednotices),listRequests, andloadRequest(getRequest,listActions, and the decision paths that load the request). A calendar read that errored (a driver error readingsys_work_calendar, not a refusal) therefore:catchanswered the runsuccess: falsewhile a pending request it owns existed and its approvers had been told;The fix,
packages/plugins/plugin-approvals/src/approval-service.ts:projectWorkingTimeDuenow guards each row. On an error fromslaDeadlineit logs awarnnaming 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, soopenNodeRequestneeds no second one: the open returns the request it wrote, and the run suspends as usual.What does not change:
sla_due_refusal; no new refusal code and no change to the served shape.sla_due_atnorsla_due_refusal.runEscalations) callsslaDeadlineitself, inside its existing per-rowtry. 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 onmaintoo: they pin this, they do not fix it.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-approvalspatch.Read first (risk order):
approval-service.ts, theprojectWorkingTimeDuehunk: thetry/catcharoundslaDeadlineand thecontinuethat leaves the row with no deadline.approval-service-sla-calendar-clock.test.ts, the new lastdescribe: the calendar double that throws a plainErrorfor a chosen calendar code and delegates to the realWorkCalendarServiceotherwise.Evals
Tests are in the existing harness file
src/approval-service-sla-calendar-clock.test.ts, as a new top-leveldescribe(4 tests). The calendar double is the realWorkCalendarServiceover the file's read double, except that a calendar code in a test-controlled set throwsnew Error('sys_work_calendar read failed: connection reset').sys_approval_request, neithersla_due_atnorsla_due_refusalis served, and a warning names the request.AutomationEngineflow, answerspausedwith one suspended run (onmain:failed).sla_due_at(Tuesday 12:00 Shanghai, holiday skipped), the erroring row has no deadline;getRequestof the erroring row answers it.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.tsprintsTests 16 passed (16).Red on main (the guard ablated once)
approval-service.tsrestored from7de1bad5cbon disk under a trap (disk hashf1d462d986equals main's blob; guard text occurrences 0), tests from the branch, then restored fromHEAD(git diff HEADempty,git status --porcelainempty). The subject is imported by relative path fromsrc/, so nodist/rebuild sits between the mutation and the run.Error: sys_work_calendar read failed: connection resetthrown byopenNodeRequestexpected 'failed' to be 'paused'listRequestsrunEscalationsand the good row's escalation pass; the red is the erroring row'slistActionsread (it loads the request), the read seam the fix coversTest 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: OKnode scripts/pm/dispatch-gates.mjs --commands: 72 commands; 70 exit 0;pnpm check:dual-build-cjs-loadsandpnpm check:i18nexit 3 PREREQUISITE NOT MET (they need a whole-workspace build and the built CLI closure), NOT MEASURED locally, CI runs both.--ranreconciliation: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 intoorigin/main.test:repoand the full dogfood battery are CI's (no!in the title, no narrowing arm).Acceptance notes
sla_due_atnorsla_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. Acalendar_errorrefusal 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.escalation failed for requestwarning for the erroring row on each pass; unchanged.Session: https://claude.ai/code/session_016WV4czKnDE6hsyXQzB9wB2
🤖 Generated with Claude Code