Repository navigation
feat(approvals): the check when an approval opens, and the between-two-steps stamp (ADR-0162 item 7, slice B) - #38496
objectstack-fleet[bot] wants to merge 8 commits into
Conversation
…ts status mirror Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FEkQ5phEgfPTCgvPqh4ER2
…s writers Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FEkQ5phEgfPTCgvPqh4ER2
…n its status mirror Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FEkQ5phEgfPTCgvPqh4ER2
…o request can hold Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FEkQ5phEgfPTCgvPqh4ER2
… trunk (ADR-0162 item 7) Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FEkQ5phEgfPTCgvPqh4ER2
…o-steps stamp (slice B) ADR-0162 Execution item 7 "The check", as revised on 2026-11-27. At an approval's first request the plugin reads the approval whole (the root run's flow and every subflow/map body, to any depth) and: - stamps the between-two-steps set on the request (new engine-written column between_steps_json); later requests of the approval copy it; - refuses the opening, VALIDATION_FAILED with one sentence per gap in the run's locale, where a step mirrors onto a field its object closes on at a request status and a D5 condition fails, where a flow cannot be read, or where the host runs no job service. Not judged: no object declares closedStates; no root run; a later request; a request that cannot be placed. The writing-node condition is withdrawn and pinned as not refused. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FEkQ5nzgcVrZ8Neqqd1AFi
…bjectstack-ai/objectstack into claude/project-thread-fkdrk9
📓 Docs Drift CheckThis PR changes 1 package(s): 36 hand-written doc(s) name something this change touched — list omitted above 15 rows. Re-derive on the tree named below: ⛔ 11 release-owned page(s) also affected — read-only, see AGENTS.md Documentation Guardrails. 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 89d126702ebc4ffab4e9e9fe2c12d790c967e34a && git checkout 89d126702ebc4ffab4e9e9fe2c12d790c967e34a
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin bfe2df88b98a725c13166a98b3a2b6b382ca5ba1 c84dfff49ef07cffde7a510304874735dc4b4ea1 && git checkout -B drift-repro bfe2df88b98a725c13166a98b3a2b6b382ca5ba1 && git merge --no-ff c84dfff49ef07cffde7a510304874735dc4b4ea1
node scripts/docs-audit/affected-docs.mjs --json bfe2df88b98a725c13166a98b3a2b6b382ca5ba1
|
…e changeset is patch The abandoned-request status-mirror tests (merged from the trunk) now note the plugin's sweeps on their hand-built service, as a host with a job service does, and open the no-pending arm before the object declares closedStates, the case the opening check does not judge. The changeset is graded patch: the metadata protocol is unchanged. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FEkQ5nzgcVrZ8Neqqd1AFi
|
repo:objectstack#5 · os-project-manager · session_01FEkQ5nzgcVrZ8Neqqd1AFi Superseded by #38499 at 2026-11-29T06:05Z: the approvals trunk moved to The |
Requested by Leehom · project thread
Part of #37766
Clause-②: yes
Metadata-protocol: none
维护者速读
What changes
ADR-0162 Execution item 7 "The check", as revised on 2026-11-27, in
@objectstack/plugin-approvalsonly. This is slice B; slice A (root run and record run) is onmainvia #37820, slice C (the mirror on an abandoned request) and slice D (the guide) are separate.approval-opening-check.ts(new). A pure read of the approval whole over anOpeningCheckSource: the root run's flow and every flow asubflowormapnames (by package slot where a name is shared), to any depth. It propagates the objects each flow's steps can act on (asubflowbody acts on its caller's record; amapbody on its items' object where an item may be a record, on the caller's where an item may not be), then builds one graph of the whole approval (containers and calls as entry/exit pairs;loopandmapbodies repeat or run zero times;parallelbranches interleave; atryregion fails intocatchand to the exit) and answers: whether a step touches an object that declaresclosedStates, the between-two-steps set, and the gaps.ApprovalService.judgeOpening, called inopenNodeRequestbefore the row is written. Placement by root run: no root run, not judged; a later request of the approval is not judged and copies the first request's set; a request on the record since the root run started that records no root run makes the request unplaceable, not judged. Nothing is read in an application where no object declares the key (registry.getAllObjects). Refusal:VALIDATION_FAILED:with a lead sentence and one sentence per gap, in the run's locale (AutomationContext.locale, threaded from the node).sys_approval_request.between_steps_json(new, engine-written, read-only, searchable likenode_config_json): a JSON list of{ flow, node }, null where the approval touches no closing object or the request could not be placed. Label and help in all 11 locales.ApprovalService.noteSweepClockScheduled(), called by the plugin once its sweeps are scheduled on the host'sjobservice; until then an approval touching a closing object is refused at its first request.approval-opening-refusal.ts(new) and twelveapprovalOpening*sentences in all 11 catalog packs.status-mirror-closing-field-refusal.integration.test.ts(piece 2 of Approval status mirror: a write that does not land, a run that ends between two steps, and a decision whose run cannot resume must not leave a document closed on an unfinished approval (ADR-0162 item 8) #37767) now notes the sweeps on its hand-built service, since its object declaresclosedStates.Why
ADR-0162 D5: an approval on an object that closes on its approval field must be able to show itself in progress there, or the record closes on an unfinished approval. The maintainer chose that the platform refuses such a configuration (7205949718 on #36253). #37767 pieces 3–5 read the stamp (design note 7210179412, question 3, T2).
Readings
maporloopwhose body holds a step is in the set where it is entered before a step and left after one (between one item's or pass's step and the next, the run is parked at or back on it); asubflowis not, since its body runs once. The read is context-insensitive and errs one way: a node that could stand between two steps on some path counts.update_recordbetween two steps of arunAs: 'user'flow is not refused.startandendcannot pause, so theendof amaporsubflowbody refuses nothing (pinned: amapwith written-out items whose body ends inend).aliasOfis followed to the canonical descriptor, as the engine's pause gate does. The revise window (approval_revise) is excepted;subflowandmapare read by their bodies; region containers carry descriptors withoutsupportsPauseand their regions' nodes are judged themselves.maprule is of the parent's object. Amapwith an approval step in its body is refused where the parent's object is one a concerned step acts on, unless its items are written out and none is a record (an object with a stringid). Pinned as not refused: an item object that closes on the body step's field under a parent whose object does not; a parent run with no record (the batch sign-off shape).warn), never refused: refusing a later request on a guess would end its approval between two steps.Verification
approval-opening-check.test.ts: 45 arms over fixtures, each D5 condition, own-value closing (also with astate_machinekeeping one final), no declaration, no closing field (stamped, not refused), other/no field ahead of and after, a step two levels down, two child runs side by side underparallel,try_catch, a loop body, the map arms (expression items ahead/between/after, withitemObject, written-out items none/one record, parent not concerned, batch with no record), the stamp for a linear flow, a branch passing over a step, a subflow, a map body with its only step, wait and screen in both flow kinds, a type with no descriptor, aliases, the revise window,visibleWhenon each status option, an unreadable flow, the host.approval-opening-check-37766.integration.test.ts: 7 tests on the real kernel, ObjectQL (SQLite) and automation engine: opens and stamps, later request copies the stamp, refused with the sentence and no row, the locale (zh-CN), a later request of an approval opened before the declaration not judged, a later request whose earlier request records no root run not judged (reverse-verified: removing the rule turns it red), the no-job host.pnpm --filter @objectstack/plugin-approvals exec vitest run: 2054 tests, 1 failed on the first run (the search-set ledger, fixed by adding the column tosearchableFields), that test re-run green.pnpm --filter @objectstack/plugin-approvals run typecheck(test layer held in its debt ledger);node scripts/check-i18n-bundles.mjs: in sync.dispatch-gates.mjs --commands: 117 repo-levelcheck:*andnode scripts/*gates run at the head, 115 green. 2 NOT MEASURED (prerequisite exit 3, not a finding):check-plugin-teardown-shape --self-testneeds an unshallow clone;check:dual-build-cjs-loadsneedsdist/of packages this diff does not touch. The spec / metadata gates the list also names belong to files already on the trunk, not to this diff.overlap-check.mjs --base=origin/claude/project-thread-yxheps: clean against the trunk, fix(approvals): an abandoned approval never writes a closed value on its status mirror (ADR-0162 item 7, slice C) #38485 and feat(objectql): a record in a closed state, and its lines, are closed to change (closedStates, ADR-0162 D1-D7, D10) #38421.🤖 Generated with Claude Code
https://claude.ai/code/session_01FEkQ5nzgcVrZ8Neqqd1AFi