Skip to content

docs(skills): objectstack-automation carries the flow-authoring judgment of cloud's private corpus — option values, a named hour's zone, who an approval cascade runs as (#31155, port 2/3) - #31393

Merged
os-zhuang merged 5 commits into
mainfrom
claude/issue-31155-objectstack-automation
Nov 8, 2026

Conversation

@objectstack-fleet

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

Copy link
Copy Markdown
Contributor

Part of #31155 — card 1 of 4 of the objectstack-ai/cloud#3659 ruling-A split; this is the second per-domain port (objectstack-automation), after #31223 (objectstack-data). The objectstack-ui port follows as its own PR on the same card, so the card stays open.

Clause-②: no
Metadata-protocol: none

Rework round 1 (contract review 6718050728, FAIL on 2ab1ee0): origin/main 77a675d merged by merge commit b73f140 (no rebase, no force-push); main c0068ed (#31322) had added 24 bytes to references/state-machines-and-approvals.md under the first pin, so CI measured the merge result at 5844 against a 5838 row. The row is re-pinned AT the merged measurement after a same-file pay-down (the three legacy "(the old …)" glosses), its comment and the tables below carry main's true base 22908; SKILL.md item 4 now states the two legs' different consequences; the two pre-existing one-word errors the reviewer listed in that file are corrected in the same pass.

维护者速读

  • 改了什么:把云端私有搭建语料里「自动化」这一块、schema 表达不了的三条判断搬进公开的 objectstack-automation skill:① 流程条件和写入里的下拉值一律用选项的 value,不用用户嘴里说的标签(写在触发条件里:流程能过校验但永远不触发;写在 fields / filter 里:运行时以 invalid_option 拒绝);② 用户说「早上 9 点」就写 '0 9 * * *' 加 timezone: 'Asia/Shanghai',不要自己换算成 UTC 裸写(裸写按 UTC 跑、也没记录你指的是哪个时区);③ 对审批结果做出反应的流程以「做出决定的那个人」的身份运行,保持 runAs: 'user';只有 SLA 自动裁决和死亡运行释放这两种机器转换没有用户,要对它们也起反应的流程才声明 runAs: 'system'。外加 3 条 eval 用例。顺手把该 skill 一个参考文件里残留的 3 处中文注释改成英文(对外 skill 全英文),并改正该文件里两处原有小错(审批状态镜像值漏了 returned;一处示例条件缺 record. 前缀)。净增 71 行。返工第 1 轮:合并了 main(docs(skills, spec): guard the nullable amount in the approval-flow and hook-condition examples #31322 给同一文件加了 24 字节),体积上限按合并后实测重新钉住。
  • 为什么改:执行 cloud#3659 裁决 A(一个知识源:本地开发与云端 AI 用同一套公开 skills)。第 ③ 条云端原文写的是「审批服务以系统身份回写,所以下游流程必须声明 system」,对照 main 上的审批服务是错的(回写带着决定人的身份),本 PR 按运行时的真实行为搬入,并在卡上记了更正。
  • 风险与回滚:只改文档与 eval 夹具,无运行时改动;三个文件的体积上限按实测钉住(依据 cloud#3659 A 与「先削重复,余额按实测提高」,同文件先删了重复)。回滚 = revert 本 PR。
  • 先看:skills/objectstack-automation/references/state-machines-and-approvals.md(Approval Best Practices 第 4 条——身份判断,对照 packages/plugins/plugin-approvals/src/approval-service.ts 的 mirrorStatusField)、skills/objectstack-automation/references/examples-flows.md(示例里新增的 timezone)、skills/objectstack-automation/SKILL.md(Valid-but-silently-wrong 第 4 条)。
  • 两分钟验证:node scripts/check-skills-token-ratchet.mjs,预期全绿且 objectstack-automation 三行 headroom 0;python3 -c "import json;json.load(open('skills/objectstack-automation/evals/flows-triggers-approvals.json'))" 不报错。
  • 需要你做的:Tier H 受管面(skills/**),需要你的 APPROVED review 后由席位落地;本 PR 保持 draft。

What changes

Four files under skills/objectstack-automation/, one changeset, three token-ratchet rows.

  • SKILL.md § Valid-but-silently-wrong — item 4: a select is compared and written by its option value, never the label the request speaks, in the start condition AND every fields / filter entry. The two legs fail differently and the item says so: a label in the condition parses, matches no row, and the flow stages clean and never fires; a label in fields / filter fails the run at the write as invalid_option (packages/objectql/src/validation/record-validator.ts).
  • references/examples-flows.md — the schedule example writes schedule: { type: 'cron', expression: '0 9 * * *', timezone: 'Asia/Shanghai' } with the rule beside it: a bare expression runs in UTC; a wall-clock hour the request names is written as said with its IANA timezone, never converted to UTC by hand (nothing then records which zone was meant). The time-relative cadence comment shows the same shape. Same-file pay-down: the requires: ['automation', 'triggers'] / always-on job sentence, restated from SKILL.md § Prerequisite, is a pointer.
  • references/state-machines-and-approvals.md § Approval Best Practices — item 4: a flow reacting to the mirrored approvalStatusField runs as the person who acted (submit carries the submitter; approve / reject / recall / send-back the decider) and stays runAs: 'user'; only the SLA escalation auto-decision and the dead-run release carry no user, so a flow that must react to those too declares runAs: 'system'. Same-file pay-downs: the discount-approval example's four-line trigger comment (a restatement of SKILL.md § Trigger Configuration) is one pointer line; the three Chinese glosses (lines 145, 293, 366 on main) are gone; the three legacy "(the old entryCriteria / back_to_previous / reject_process)" glosses in § Branching, side-effects & rejection — approval-process keys with no author since ADR-0019 — are gone. Two one-word corrections of pre-existing text in the same file (the reviewer's optional items): the approvalStatusField row lists returned among the mirrored statuses (send-back writes it, approval-service.ts send-back path), and the dynamic-approval example's start condition reads record.status == 'submitted' like the rest of the file.
  • evals/flows-triggers-approvals.json — cases 17 (option value, never label; CEL envelopes, no single-brace token), 18 (a named hour with its zone, never a hand-converted UTC cron), 19 (an approval-outcome cascade stays runAs: 'user').
  • .changeset/31155-port-authoring-rules-automation.md — @objectstack/skills patch, Clause-②: no, Metadata-protocol: none.
  • scripts/check-skills-token-ratchet.mjs — three rows re-pinned AT the measurement (table below).

Language scope (the approver's review on #31223, verbatim 「skills 对外发布的版本应该全部用英文」; the account owner's 「同意」): every non-eval skills/** file this PR touches holds 0 CJK code points at the head (Python scan over the CJK, kana, fullwidth and CJK-punctuation blocks); eval prompt strings keep their Chinese under exemption (a); objectstack-i18n is untouched (exemption (b)). The touched reference file was one of the six pre-existing CJK carriers the delta reviewer listed on #31223; it is English now. The other five (objectstack-formula/SKILL.md, objectstack-ui/rules/navigation.md, objectstack-ui/rules/record-page.md, objectstack-upgrade/SKILL.md, objectui/guides/i18n.md) are not this PR's.

Line readings (skills/**, vs origin/main 77a675d, merged in)

reading before after
SKILL.md 445 452
references/examples-flows.md 134 136
references/state-machines-and-approvals.md 399 404
evals/flows-triggers-approvals.json 298 355
every skills/*/SKILL.md summed 4517 4524
whole shipped skills/ tree 20060 20131

Net +71 lines against the dispatch's +250 budget (evals included).

Token-ratchet rows (priced bytes; a SKILL.md's stamp line excluded)

row main 77a675d head ceil/4 ceiling (was → now) same-file pay-down shown
SKILL.md 25654 26108 (+454) 6527 6426 → 6527 (+101) none to cut; the row comment says so
references/examples-flows.md 5685 5976 (+291) 1494 1436 → 1494 (+58) the requires restatement
references/state-machines-and-approvals.md 22908 (after #31322's +24) 23299 (+391) 5825 5730 → 5825 (+95) the trigger comment; three Chinese glosses; three legacy "(the old …)" glosses

All three pinned AT the measurement, headroom 0 (the reference file's row is pinned 19 below the first round's 5838 and 19 below the merge-result reading CI rejected, 5844). Authority: the ruling of record that orders this text into the published skills, objectstack-ai/cloud#3659 letter A (ruling comment 6682024726, 2026-11-06: "How to write valid, working metadata lives in the public skills … The private corpus's rules of that kind move there"), via the standing 2026-10-27 ruling, verbatim and untranslated: 「A:先削重复,余额按实测提高」 (ruling record 6513306068).

No-loss mapping — the automation rows (v1 ledger 6711215678; corrections 6711710289, 6715112987; this PR's note on the card)

Classes as in the ledger: CLOUD (orchestration / hosted-only, stays), SPEC (restates packages/spec), E/R (parses clean, dead at runtime — the spec lane, #31224), STATED (the published skill already says it), PORT (judgment, ported here).

private rule id clause class target → this PR regression kept
14 trigger on the START node; one triggerType string; record-after-write for create-or-update; previous null on the create leg; no array of trigger types; bare CEL condition; fields / filter keys; no recordId; CEL value envelopes, no {…} tokens; isoDate / current_user envelopes SPEC + STATED automation/flow.zod.ts (top-level triggerType / trigger refused with the start-node prescription; node configs strictObject), automation/flow-template-token.ts (single-brace tokens refused at save); SKILL.md § Trigger Types / § Trigger Configuration / § Flow Variables / § Filter operands / § Valid-but-silently-wrong 1; objectstack-formula § 5 (previous is null on insert) cloud flow-value-envelope.test.ts (9 cases) pins the envelope teaching — the spec refusal and SKILL.md § Valid-but-silently-wrong 1 are its equivalent; eval 17 now pins the envelope shape too (dialect: 'cel', no single-brace token)
14 the user speaks the label; the stored value is the option value — map it in the condition AND every fields entry PORT SKILL.md § Valid-but-silently-wrong item 4 eval 17 (== 'lost' must_contain; == '已流失', status: '已流失' must_not_contain)
14 edges connect everything (an orphan action node never runs) E/R #31224 C —
14b timeRelative on the start node; offsetDays vs withinDays; filter INSIDE the descriptor; never a date-equality condition SPEC + STATED automation/time-relative-trigger.zod.ts; references/examples-flows.md § Time-relative triggers cloud flow-value-envelope.test.ts "rule 14b writes a time-relative flow value the same way" — same equivalent as 14
14b daily cadence only; a sibling filter beside timeRelative; runAs: 'user' on a swept flow E/R / already enforced #31224 B (cadence, sibling filter); runAs is lint flow-runas-unscoped (already enforced, 6711340388); the runAs: 'system' sweep is STATED in examples-flows.md —
14b write the user's wall-clock hour with its timezone, never a silent UTC conversion PORT references/examples-flows.md — the schedule example and the time-relative cadence comment. Verified on main: system/job.zod.ts CronScheduleSchema.timezone (described, IANA-checked); trigger-schedule/src/schedule-trigger.ts normalizeSchedule carries timezone onto the job (both the schedule and the time-relative trigger call it); service-job/src/cron-job-adapter.ts hands it to the cron library eval 18 (timezone: 'Asia/Shanghai', 0 9 * * * must_contain; 0 1 * * *, UTC+8 must_not_contain)
14b clock-arming honesty (CLOCK_TRIGGER_* warnings), the tier's record-driven way out CLOUD hosted / restriction profile stays in cloud
14c approval is a NODE: approvers: [{ type, value }], approver types, behavior; out-edges labelled approve / reject; manager resolves only when the directory is filled SPEC + STATED automation/approval.zod.ts; references/state-machines-and-approvals.md (approver table, behavior row, labelled edges in the example) —
14c "the approval service writes the outcome back with a SYSTEM write, which carries no user: a record-change flow reacting to it must declare runAs: 'system'" PORT, corrected — the cloud sentence conflicts with the runtime on main: packages/plugins/plugin-approvals/src/approval-service.ts mirrorStatusField is elevated but attributed (submit passes submitter_id; approve / reject / recall / send-back / revision-limit auto-reject pass actingUserId(context)); only the SLA auto-decision and the dead-run release pass null. Lint flow-runas-unscoped leaves record_change undecidable by design ("caught at run time") references/state-machines-and-approvals.md § Approval Best Practices item 4, stating what the runtime does eval 19 (runAs: 'user', the cascade's trigger shape must_contain; an approval node or a sys_approval_request read must_not_contain)
flow-node-types node type is the engine's vocabulary; a tool-named node = NO_EXECUTOR E/R + STATED SKILL.md § Flow Node Types + § Valid-but-silently-wrong 3; the test_flow / toggle_flow half is CLOUD. The E/R half (os validate / os build refusing a node type outside the composed registry) is in the ledger's row but NOT among #31224's four candidates — named on the card for the spec lane cloud authoring-rules.test.ts corpus integrity — stays in cloud
flow-node-tier, 14b-tier, 13-tier the tier's vocabulary CLOUD restriction profile (#31156 / cloud#3713) stay in cloud
process-approval-flow (solution_design) proactively draft the approval flow after the blueprint; its shape pointers are 14 / 14c / 17 CLOUD orchestration stays in cloud

Coverage decision the v1 ledger left to this PR: cloud flow-value-envelope.test.ts stays in cloud pointing at the moved text; eval 17 is the automation-side equivalent of its "every envelope the skill teaches passes clean" case (an envelope per field, no single-brace token), beside the spec refusal at save.

Conflicts with spec on main: none in the three ported clauses. One conflict with the runtime, resolved by porting the true statement (14c above); the cloud corpus's own sentence is for cloud to correct (card 4 of the split rewires that corpus).

Tests

Docs and eval fixtures only, no runtime change ⇒ no ablation owed. The eval file parses (json.load), ids 1–19 contiguous; a per-case cross-check over cases 17–19 finds no must_not_contain string inside its own expected_output. Prerequisite build for the skill gates under the shared verify lock: pnpm --filter '@objectstack/lint...' build — os-verify-lock: VERDICT command-exit 0 · held the lock 71s.

Acceptance notes

  • Cloud corpus text that is false against this repo's runtime (carrier: cloud, card 4 cloud#3714 or a cloud card): rule 14c's last sentence (quoted in the table). The hosted agent today over-elevates every approval cascade; the published skill now says what the service does.
  • Enforce-or-remove rows not in Enforce-or-remove: four metadata shapes cloud's authoring rules warn about still parse clean (boolean required, open flow start config, orphan action nodes, roll-up filter keys) #31224 (for the seat, not filed here): (i) flow-node-types' E/R half — a node type outside the composed registry parses (open string by contract, ADR-0018) and fails every run NO_EXECUTOR; the runtime audits it at boot (sealNodeTypeVocabulary), os validate does not; (ii) the mechanical half of rule 14's value-vs-label — a literal compared to a select field in a start condition, or written to one in fields / filter, that is none of the field's option values; cloud's graph-lint has flow_condition_uses_label / flow_field_value_uses_label, this repo's lint has no equivalent. The judgment half (the request speaks the label) is the prose ported here.
  • Pre-existing CJK on main in five other shipped non-i18n files (listed above): not this PR's; a separate card if the English-only rule is to cover the catalog.
  • Eval must_contain tokens == 'lost' and approval_status == 'approved' are prompt-specific values, as applicant_email / signed_copy / hotcrm.custom are in cases 6, 8 and 13; the root catalog has no taught-token oracle (that gate scans ui/skills only).

Verification

Head cited: 874185a4 (the rework commit on top of merge commit b73f140 of origin/main 77a675d; the union below ran on it). Derived with node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack — 64 families; every exit code captured to a file before any pipe (COMMAND > LOG 2>&1; status=$?); reconciled with --ran.

  • ✓ dispatch-gates --ran: 64 derived famil(ies) accounted for — 63 run, 1 NOT-MEASURED (1 DERIVED from a recorded exit 3).
  • 63 families exit 0, among them: node scripts/check-skills-token-ratchet.mjs :: exit 0 — skills/objectstack-automation/SKILL.md is 6527 tokens (ceiling 6527; headroom 0), references/examples-flows.md is 1494 tokens (ceiling 1494; headroom 0), references/state-machines-and-approvals.md is 5825 tokens (ceiling 5825; headroom 0), evals/flows-triggers-approvals.json is 5153 tokens — eval fixture, measured but not ratcheted; --self-test :: exit 0 (97 cases pass); pnpm check:role-word :: exit 0; pnpm --filter @objectstack/spec run check:skill-docs :: exit 0; check:skill-refs :: exit 0; pnpm --filter @objectstack/lint run check:doc-formula-expressions :: exit 0; pnpm check:lean-entry-closure :: exit 0; pnpm check:dts-closure :: exit 0; pnpm check:pm-dispatch-gates :: exit 0 (detached, tail --pid); check:nul-bytes, check:doc-authoring, check:closing-keyword-parity, check:skill-frame-sync, check:skill-identifier-liveness, check:skill-compatibility, check:pm-skill-id-lint and the rest exit 0.
  • NOT MEASURED locally: pnpm check:dual-build-cjs-loads :: exit 3 (PREREQUISITE NOT MET — needs every package's dist, a full pnpm build; CI's Lint & Repo Gates reads it).
  • Beyond the derived list, because the diff edits two os:check blocks (the schedule example; the dynamic-approval flow's condition): pnpm --filter @objectstack/spec run check:skill-examples :: exit 0 — 285 prose examples type-check across 3 surface(s).
  • Prerequisite builds under the shared verify lock, after the merge (AGENTS.md §9: packages/spec, lint and objectql sources moved on main): pnpm --filter '@objectstack/lint...' --filter '@objectstack/objectql...' --filter '@objectstack/client-react...' build — VERDICT command-exit 0 · held the lock 232s (round 0: 71s + 242s).
  • CJK scan (Python, the blocks named above) over every non-eval file in the three-dot diff — SKILL.md, references/examples-flows.md, references/state-machines-and-approvals.md, the changeset, and the lines this PR adds to the ratchet script: 0 lines. Eval fixture: parses, ids 1–19 contiguous.
  • Round-0 CI red (Type Check · source gates, job 128644219285: state-machines-and-approvals.md is 5844 tokens; the ratchet ceiling is 5838) is the must-fix above; the row now reads 5825 on the merged tree.
  • test:repo not run locally (no test file in the diff; CI Test Core). Governed skills/** ⇒ Tier H: draft kept; landing waits for an APPROVED review from GOVERNED_APPROVERS; no seat arms, queues or readies it. CI check-runs: read by the seat at hand-over, not awaited by the dev.

Generated by Claude Code

…udgment — option values, a named hour's zone, who an approval cascade runs as

Card 1 of the cloud#3659 ruling A split, the objectstack-automation port.
SKILL.md § Valid-but-silently-wrong item 4 (option value, never label);
references/examples-flows.md (timezone on config.schedule, the requires
restatement cut); references/state-machines-and-approvals.md (approval
cascade identity, corrected against the approval service; the trigger
comment cut to a pointer; three Chinese glosses removed). Three eval
cases (17–19). Three token-ratchet rows re-pinned AT the measurement.

Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012dn2AdARJtc4RgABPH7PHk
… measurement (6527)

The row the first commit missed; its comment carries the arithmetic and the
authority (cloud#3659 letter A; ruling record 6513306068).

Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012dn2AdARJtc4RgABPH7PHk
…ng their own must_not_contain strings; case 18 asks for a daily hour

Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012dn2AdARJtc4RgABPH7PHk
@github-actions github-actions Bot added the size/m label Nov 8, 2026
@github-actions github-actions Bot added documentation Improvements or additions to documentation tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface labels Nov 8, 2026
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:cloud#1 · os-bob · session_012dn2AdARJtc4RgABPH7PHk

Contract-review-claim: session_012dn2AdARJtc4RgABPH7PHk · head 2ab1ee0 · 2026-11-08T05:56Z

PR #31393 · port 2/3 of #31155 (objectstack-automation) · governed skills/** ⇒ CONTRACT_REVIEW_TIER · no record and no live claim on this head at read time. Record follows on this PR.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:cloud#1 · os-bob · session_012dn2AdARJtc4RgABPH7PHk

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: 2ab1ee035a5eeb11c087d32efadb899ad9000371
Local-runs: none
Scope: skills/objectstack-automation/SKILL.md, skills/objectstack-automation/evals/flows-triggers-approvals.json, skills/objectstack-automation/references/examples-flows.md, skills/objectstack-automation/references/state-machines-and-approvals.md + scripts/check-skills-token-ratchet.mjs and .changeset/31155-port-authoring-rules-automation.md (the rule and the gate that prices it, read as one), and on origin/main: packages/plugins/plugin-approvals/src/approval-service.ts (mirrorStatusField and its six call sites, actingUserId, attributedMirrorContext, SYSTEM_CTX), packages/spec/src/automation/flow.zod.ts (FlowSchema.runAs describe, node config), packages/spec/src/system/job.zod.ts (CronScheduleSchema.timezone), packages/triggers/trigger-schedule/src/schedule-trigger.ts + time-relative-trigger.ts (normalizeSchedule, FlowTriggerBinding.schedule), packages/services/service-job/src/cron-job-adapter.ts, packages/spec/src/data/field.zod.ts (SelectOptionSchema), packages/objectql/src/validation/record-validator.ts (invalid_option), packages/lint/src/lint-flow-patterns.ts (flow-runas-unscoped)

Full review of the first substantive head of this PR (port 2/3 of card #31155, the objectstack-automation domain; prior record on this card's first port: PASS 6715209241 on #31223, used as the model). Inputs: the PR body, the file list, the three-dot diff against origin/main 77a675d (merge-base 7189fb2), git merge-tree --write-tree origin/main 2ab1ee03 (conflict-free, tree 2b29cdb3), the card's ledger v1 6711215678 and corrections 6711710289 / 6715112987, ledger note 3 6717932694, the dev report 6717947219, #31223's CHANGES_REQUESTED review 5815596823 (verbatim 「skills 对外发布的版本应该全部用英文」) and the scope reply 6714903336, and the check-runs on this head and on the merge-base. Byte counts, the CJK scan and the eval-file checks are my own reads (git show piped to wc -c, Python over the file bytes), not the dev's. Claim on this head: 6717971271. ⛔ nothing was built, run or re-run locally; the ratchet numbers below are arithmetic over wc -c.

① Derived judgments

  1. Scope holds. The three-dot diff touches exactly the six PR files (+141 / −17); three commits (94028ae, 7220d55, 2ab1ee0), no merge. GitHub reports mergeable: true, mergeable_state: blocked (draft, Tier H). Labels documentation / size/m / tooling are the labeler's.
  2. Rule 14 — TRUE against spec and runtime. field.zod.ts SelectOptionSchema: value is "Stored value (lowercase machine identifier)", label is "Display label". A bare-CEL start condition reads the row, so record.status == 'Lost' compares the stored value against the label and never matches: the "stages clean and never fires" consequence is right for the condition leg. For the fields / filter leg the consequence is different: record-validator.ts L1807–1809 refuses a value outside the field's options as invalid_option at the write, so fields: { status: 'Lost' } fails the run rather than silently matching no row (see should-fix 1). The prescription itself — read options, write the value everywhere — is correct on both legs. Eval 17 pins it (== 'lost' must_contain; == '已流失', status: '已流失' must_not_contain).
  3. Rule 14b — TRUE against spec and runtime, for both triggers. job.zod.ts L61: CronScheduleSchema.timezone is optional, .default('UTC'), IANA-checked ("a UTC offset such as "UTC+8" is not one"). flow.zod.ts L694 types node config as z.record(z.string(), z.unknown()), so timezone under config.schedule passes parse. schedule-trigger.ts L597–619 normalizeSchedule copies a string timezone onto the job; L757 is the schedule flow's call, time-relative-trigger.ts L399–400 is the time-relative sweep's (falling back to TIME_RELATIVE_DEFAULT_CRON = '0 8 * * *', time-relative-trigger.zod.ts L228 — the "omit for daily 08:00 UTC" comment is exact); FlowTriggerBinding.schedule is lifted from the start node by the engine's resolveTriggerBinding for both. cron-job-adapter.ts L99 / L132: schedule.timezone ?? this.defaultTimezone, default 'UTC'. So a bare expression does run in UTC and records no zone, and the written timezone reaches the cron library — the examples-flows text and eval 18 (timezone: 'Asia/Shanghai', 0 9 * * *; never 0 1 * * * / UTC+8) are right.
  4. Rule 14c — the dev's correction is TRUE; verified at every call site. approval-service.ts mirrorStatusField (L4109) builds attributedMirrorContext ({ isSystem: true, userId: actorId, tenantId }, L4198–4215) when actorId is set and SYSTEM_CTX otherwise. Call sites: submit L4786 → row.submitter_id; decide L5257 → actingUserId(context); recall L5892 → actingUserId(context); revision-limit auto-reject L6323 → actingUserId(context); send-back (returned) L6365 → actingUserId(context); dead-run release L8168 → null with the comment "a flow that wants to react to a dead-run release declares runAs:'system'". The SLA sweep has no call site of its own: it auto-decides through decide() under SYSTEM_CTX (L538–552 SLA_ACTOR_ID), and actingUserId (L1123) returns null for a context with no userId, so that leg is user-less too. The method's own docstring (L4044–4068) says precisely what item 4 now says, including that since The #1888 user-less fail-open is wider than the lint that guards it — record-change flows fired by a system write run UNSCOPED, unlinted #3760 a runAs:'user' run with no trigger user has its data ops refused. Exactly two user-less transitions, both named in the ported text.
  5. English-only (the docs(skills): objectstack-data carries the hosted build agent's metadata-authoring judgment (cloud#3659 A, port 1 of 3) #31223 ruling). My scan over the CJK, kana, fullwidth and CJK-punctuation blocks: 0 code points at the head in SKILL.md, references/examples-flows.md, references/state-machines-and-approvals.md, the changeset and the ratchet script's added lines; main's reference file carried 8 (lines 145, 293, 366), all gone. Eval prompts keep Chinese under exemption (a); objectstack-i18n untouched (b).
  6. Eval file. Parses (json.load); 19 cases, ids 1–19 contiguous and unique, one key shape throughout. Cases 17–19: no must_not_contain string appears in its own expected_output, every must_contain string does. 17 tests rule 14 (value not label) plus the envelope shape (dialect: 'cel', no {record.); 18 tests 14b (named hour + IANA zone, no hand-converted UTC cron); 19 tests the corrected 14c (runAs: 'user', the cascade's record-after-update trigger, no approval node). Each maps to the rule it claims.
  7. Ratchet rows, recomputed. SKILL.md: 26127 bytes at the head, stamp line version: "18.3.0" 20 bytes, priced 26107 → ceil(26107/4) = 6527 = the row (base 25674 − 20 = 25654, as the comment says). references/examples-flows.md: 5976 → 1494 = the row (base 5685). references/state-machines-and-approvals.md: 23349 at the head → ceil = 5838 = the row — but the file moved on main after the branch base: c0068ed (docs(skills, spec): guard the nullable amount in the approval-flow and hook-condition examples #31322) added 24 bytes to the same file (record.amount != null && on the discount-approval condition, L90), so main is 22908, not the 22883 the comment and the PR body cite, and the merge result is 23374 priced → ceil(23374/4) = 5844, six over the pinned 5838. CI measures the merge ref: Type Check · source gates on this head is red with exactly that signature (check-skills-token-ratchet: … state-machines-and-approvals.md is 5844 tokens; the ratchet ceiling is 5838 (over by 6), lane verdict 31 passed / 1 red), and the same lane is green on the merge-base 7189fb2 and on main 77a675d — a new signature, so it counts. Authority for the rows is as stated (cloud#3659 A, 6682024726; record 6513306068); the same-file pay-downs are genuine deletions (the four-line trigger comment, the requires restatement, three glosses). The pin is right in method and wrong by the 24 bytes main added underneath it: must-fix 1.
  8. Same-file pay-downs lose nothing. The removed trigger comment's content is SKILL.md § Trigger Configuration (start-node binding, bare-CEL condition) and the record-* family is enumerated at SKILL.md L380–386; the removed requires: ['automation', 'triggers'] / always-on job sentence is SKILL.md § Prerequisite's table (L348–358, job° footnote), which the new pointer names. The three glosses (退回修改, 会签 ×2) were parenthetical translations of terms the English already defines.

② Semver level

.changeset/31155-port-authoring-rules-automation.md: '@objectstack/skills': patch, line-initial Clause-②: no and Metadata-protocol: none, matching PR body L3–4. Docs and eval fixtures only; no packages/spec export, schema or accept-set changes. Check Changeset and PR-body guards are green on the head. Patch is right.

③ Boundary flags

  • Author is objectstack-fleet[bot]; no login note owed. open_questions: [].
  • Dev deviation 1 (14c ported corrected, not dropped): answered — porting the TRUE statement is right. The dispatch clause drops a rule that contradicts the spec. The cloud sentence contradicts the runtime AND the spec: FlowSchema.runAs describe (flow.zod.ts L1226–1237) says the run's user is "the trigger user until a human decision, the decider after it" and that refusal under user is for "any record-change flow fired by a write that carried no user" — and the human legs of the mirror write do carry one. The ported sentence contradicts neither; dropping it would have left the published skill silent on the one case where the hosted agent over-elevates. Safe for an agent: the two user-less transitions are named, the consequence of ignoring them is stated (a runAs: 'user' flow fired by one "has its data steps refused" — The #1888 user-less fail-open is wider than the lint that guards it — record-change flows fired by a system write run UNSCOPED, unlinted #3760, the same words as the spec), and the remedy is scoped to "a flow that must react to those too". A flow that only ever reacts to human decisions and is later hit by an SLA auto-decision fails loudly at its first data step, which is the runtime's own behaviour, not a trap the text creates. The cloud corpus's sentence is correctly left for card 4 (cloud#3714). Item 4 and eval 19 stay.
  • Dev deviation 2 (ratchet comments cite record 6513306068 without the Chinese words): fine — the gate's quote requirement is on the PR body, which carries it verbatim.
  • Dev deviation 4 (the first gate batch stopped and re-run after fixing the self-spelled must_not_contain in 17/18): the final head is clean on that check (① 6).
  • Check-runs on 2ab1ee0, read 2026-11-08T05:58Z: 41 runs; 37 completed success or path-filtered skipped; Test Core (1/8) and Test Core (2/8) in_progress; 2 failure: Type Check · source gates (job 128644219285) and its parent TypeScript Type Check, failed step "Published skills token ratchet ([finding] the published skills bundle has no length budget — a maintainer ruling now establishes the principle, but nothing enforces it #10473) + its self-test", first error line the 5844 / 5838 message quoted in ① 7. Merge-base 7189fb2 and main 77a675d are green on that lane. Not a merge-base red; counts.
  • Tier H: draft kept; landing waits for an APPROVED review from GOVERNED_APPROVERS; no seat arms, queues or readies it. Nothing to disarm.
  • Out of scope, recorded for the seat (pre-existing on main, not this PR's): references/state-machines-and-approvals.md L366 lists the mirrored statuses as pending/approved/rejected/recalled but send-back writes returned (approval-service L6365); L315's example condition status == 'submitted' lacks the record. prefix the rest of the file uses. The five other CJK carriers the docs(skills): objectstack-data carries the hosted build agent's metadata-authoring judgment (cloud#3659 A, port 1 of 3) #31223 delta record listed remain main's.

④ Design judgment

  • SKILL.md item 4 (L291–296): holds against SelectOptionSchema and the card's eval prompt (17); the prescription is right. Should-fix 1 is wording — the fields / filter leg is refused as invalid_option at the write rather than silently matching no row, and an agent told "never fires" will look in the wrong place when a run fails. No must-fix.
  • references/examples-flows.md (L28–34, L104–105, L134–136): the schedule example and the cadence comment hold against CronScheduleSchema, normalizeSchedule and the adapter for both triggers; "a bare expression runs in UTC" is the adapter's literal default; the requires pointer resolves. check:skill-examples type-checks the example in CI (Lint · docs & code guards green). No must-fix.
  • references/state-machines-and-approvals.md item 4 (L397–405): holds against every mirrorStatusField call site, FlowSchema.runAs, and the lint rule's own statement that record_change is "caught at run time instead" (lint-flow-patterns.ts L573–578, L2005–2012). The one-line trigger pointer and the English terms lose nothing. No must-fix in the text; the must-fix is the row that prices it.
  • evals/flows-triggers-approvals.json 17–19: each case tests the rule it maps to, with no self-contradiction. No must-fix.
  • scripts/check-skills-token-ratchet.mjs (the gate for the rule): the state-machines-and-approvals.md row (L1071) is pinned AT the head's measurement and BELOW the landing measurement by 6 tokens, and the head's CI is red for it. Must-fix 1: merge origin/main, re-pin that row AT the merged measurement (23374 priced → 5844, or cut ≥ 24 priced bytes in the same file and pin where it lands), state the +24 that docs(skills, spec): guard the nullable amount in the approval-flow and hook-condition examples #31322 added in the row comment (the comment's "22883" base and the PR body table's main column are stale: main is 22908), and let CI re-read. The other two rows need no change unless main moves again under them.

Must-fix: 1 (the ratchet row vs the merge result, red on the head). Should-fix: (1) SKILL.md L293–296 — split the consequence: the condition leg never fires, the fields / filter leg is refused at run time as invalid_option; (2) PR body ratchet table and the row comment at scripts/check-skills-token-ratchet.mjs L1066 — the main base for the reference file is 22908 after #31322. Delta review on the next head by this reviewer.

Implemented-by: claude/issue-31155-objectstack-automation
Reviewed-by: session_012dn2AdARJtc4RgABPH7PHk

VERDICT: FAIL

…merged measurement; split item 4's two consequences

Contract review 6718050728 (FAIL on 2ab1ee0): main c0068ed had added 24
bytes to state-machines-and-approvals.md under the first pin, so CI measured
the merge result at 5844 against 5838. After the merge: three legacy
"(the old …)" glosses cut as the same-file pay-down, the mirrored statuses
list `returned`, the dynamic-approval condition reads `record.status`; the
row is 5825, pinned AT the measurement, its comment on main's 22908 base.
SKILL.md item 4 now says the condition leg never fires while the
fields / filter leg fails the run as invalid_option; it stays within 6527.

Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012dn2AdARJtc4RgABPH7PHk
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:cloud#1 · os-bob · session_012dn2AdARJtc4RgABPH7PHk

Contract-review-claim: session_012dn2AdARJtc4RgABPH7PHk · head 874185a · 2026-11-08T06:30Z

Delta review of the round-1 rework head (answers FAIL record 6718050728 on 2ab1ee0) · no record and no live claim on this head at read time. Record follows on this PR.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:cloud#1 · os-bob · session_012dn2AdARJtc4RgABPH7PHk

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: 874185a446e23dfa293c42eac40913586c81a5e3
Local-runs: none
Scope: skills/objectstack-automation/SKILL.md, skills/objectstack-automation/evals/flows-triggers-approvals.json, skills/objectstack-automation/references/examples-flows.md, skills/objectstack-automation/references/state-machines-and-approvals.md + scripts/check-skills-token-ratchet.mjs and .changeset/31155-port-authoring-rules-automation.md (the rule and the gate that prices it, read as one), packages/objectql/src/validation/record-validator.ts (invalid_option, for the reworded item 4), packages/plugins/plugin-approvals/src/approval-service.ts L6365 (send-back writes returned), docs/adr/0019-approval-as-flow-node.md (the carrier of the three cut legacy keys)

Delta review, round 1, of the head that answers my FAIL record 6718050728 on 2ab1ee0 (one must-fix: the state-machines-and-approvals.md ratchet row pinned below the merge-result measurement; two should-fixes). Between that head and this one: merge commit b73f140 of origin/main 77a675d (no rebase, no force-push) and the rework commit 874185a. Inputs: the rewritten PR body, the file list, the diffs 2ab1ee0..b73f140 and b73f140..874185a, the three-dot diff against current origin/main 405a78e and git merge-tree --write-tree against it, the dev's round-1 report 6718239255, and the check-runs on this head. Byte and line counts, the CJK scan and the merge checks are my own reads (git show piped to wc, git merge-tree, Python over the file bytes), not the dev's. Claim on this head: 6718254808. ⛔ nothing was built, run or re-run locally.

① Derived judgments

  1. The merge is clean and the rework is only what was ordered. git diff of b73f140 against git merge-tree --write-tree 2ab1ee03 77a675db is empty: the merge commit adds nothing of its own. 874185a touches three files only: scripts/check-skills-token-ratchet.mjs (two row comments and one row value), SKILL.md (item 4, five lines), references/state-machines-and-approvals.md (the three legacy glosses, the returned status, the record.status prefix). The eval file, references/examples-flows.md and the changeset are byte-identical to 2ab1ee0. The three-dot diff against origin/main 405a78e is still exactly the six PR files (+154 / −23); git merge-tree origin/main 874185a4 is conflict-free (tree 51bb8066) and GitHub reports mergeable: true, mergeable_state: clean, draft kept.
  2. Must-fix 1 answered — all three rows recomputed on the head AND on the merge result against current main. main moved 77a675d → 405a78e since the merge; on this PR's paths it touched only references/_index.md (generator-owned, four spec-path entries, a file the branch does not edit, so the merge takes main's copy; measured-not-ratcheted). The three priced files are identical at the head and in the merge result. SKILL.md: 26128 bytes, stamp line 20 → 26108 → ceil(26108/4) = 6527 = the row (L519; base 25654). references/examples-flows.md: 5976 → 1494 = the row (L964; base 5685). references/state-machines-and-approvals.md: 23299 → ceil(23299/4) = 5825 = the row (L1079), against main's true 22908 (docs(skills, spec): guard the nullable amount in the approval-flow and hook-condition examples #31322's +24 now named in the comment, L1070–1073). All three pinned AT the measurement, headroom 0, nothing new under them. CI agrees: the lane that was red is green on this head — Type Check · source gates job 128648872968 prints state-machines-and-approvals.md is 5825 tokens (ceiling 5825; headroom 0) and lane-verdict: typecheck-source-gates: OK -- 32 gate(s): 32 passed, 0 red.
  3. The same-file pay-down is genuine and loses nothing. The cut text is the three parentheticals "(the old per-step entryCriteria)", "(the old back_to_previous)", "(the old reject_process)" in § Branching, side-effects & rejection — names of the approval-process keys ADR-0019 collapsed onto flow nodes. No file under skills/ names them at the head and none did outside these glosses on main; a customer agent writes none of them today, and ADR-0019 remains their carrier. Net for the file against main: +391 bytes, 22908 → 23299.
  4. Should-fix 1 answered. SKILL.md item 4 (L291–296) now reads: the label in condition "parses, matches no row: the flow stages clean and never fires"; fields: { status: 'Lost' } / a filter "fails the run (invalid_option)" — the record-validator.ts L1807–1809 refusal, the two legs separated as asked, and the prescription unchanged. Tightened to the same 6527 (26107 → 26108 priced bytes, +1, within the ceil). The row comment (L507–509) says the same.
  5. Should-fix 2 answered. The PR body's ratchet table now reads main 22908 "(after docs(skills, spec): guard the nullable amount in the approval-flow and hook-condition examples #31322's +24)", head 23299, ceiling 5730 → 5825; the line-readings header names origin/main 77a675d merged in; the Verification section cites head 874185a and names the round-0 red signature it answers. Line readings checked against wc -l at the head: 445→452, 134→136, 399→404, 298→355, all exact.
  6. The two optional corrections were taken and are right. approvalStatusField row (L366) lists pending/approved/rejected/returned/recalled — returned is what send-back writes (approval-service.ts L6365). The dynamic-approval example's condition (L315) reads record.status == 'submitted', the prefix the rest of the file uses. Both are corrections of existing text, no new teaching, so the changeset is rightly unchanged.
  7. English-only holds. My scan over the CJK, kana, fullwidth and CJK-punctuation blocks: 0 code points at the head in SKILL.md, references/examples-flows.md, references/state-machines-and-approvals.md, the changeset and every line the PR adds to the ratchet script.
  8. Nothing else moved. Rules 14, 14b and the corrected 14c, eval cases 17–19 and the ledger mapping are as reviewed in 6718050728; no packages/spec path, no export, no accept-set change.

② Semver level

Unchanged: '@objectstack/skills': patch, line-initial Clause-②: no and Metadata-protocol: none; docs and eval fixtures only. Check Changeset and PR-body guards green on the head. Patch is right.

③ Boundary flags

  • Author objectstack-fleet[bot]; no login note owed. open_questions: [].
  • Dev deviation (PR body patched by the dev via relay issue_patch with the relay's signed trailer, on the coordinator's order): noted as the ordered exception; the body read back as the dev describes.
  • Dev deviation (14c stays ported corrected): stands, as answered in 6718050728 ③.
  • Check-runs on 874185a, read 2026-11-08T06:32Z: 46 runs, all completed — 31 success, 15 path-filtered skipped, 0 failure, 0 in progress. Lint & Repo Gates, TypeScript Type Check, Type Check · source gates, Build Core, Test Core (all shards), Governed Surface Queue Guard, Check Changeset, Dogfood Regression Gate among the successes. The round-0 red signature is gone.
  • Tier H: draft kept; landing waits for an APPROVED review from GOVERNED_APPROVERS; no seat arms, queues or readies it. The standing CHANGES_REQUESTED on docs(skills): objectstack-data carries the hosted build agent's metadata-authoring judgment (cloud#3659 A, port 1 of 3) #31223 is that PR's, not this one's (this PR has no review yet).
  • For the seat, not this PR's: main 405a78e's references/_index.md regeneration will be what the merge carries; check:skill-refs on the merge ref is the landing pre-check's read.

④ Design judgment

  • SKILL.md item 4: both consequences now match the engine (invalid_option at the write; a silent never-fire in the condition), and the remedy is one sentence. No must-fix.
  • references/state-machines-and-approvals.md: the cut glosses were names of a retired authoring surface, not guidance; the returned status and the record. prefix make two existing lines true. Item 4 of § Approval Best Practices is unchanged and still holds against every mirrorStatusField call site. No must-fix.
  • scripts/check-skills-token-ratchet.mjs: the row is pinned AT the measurement the landing tree will produce, with the base stated honestly and the +24 explained. No must-fix.
  • references/examples-flows.md, the eval file, the changeset: unchanged since the reviewed head. No must-fix.

Must-fix: none. Should-fix: none.

Implemented-by: claude/issue-31155-objectstack-automation
Reviewed-by: session_012dn2AdARJtc4RgABPH7PHk

VERDICT: PASS

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:cloud#1 · os-bob · session_012dn2AdARJtc4RgABPH7PHk

ACCEPT · 2026-11-08T06:35Z · head 874185a446e23dfa293c42eac40913586c81a5e3 · Tier H (governed skills/**) — awaiting a human approval

维护者速读

  • 改了什么:把 cloud 私有 AI 编写规则里「自动化」这一块移植进对外发布的 @objectstack/skills(objectstack-automation):① 选择字段在条件里比较、在字段里写入,都用选项的值,不用显示名——写在条件里会静默不触发,写进字段会在运行时报 invalid_option;② 用户说的「每天 9 点」按原样写,并在定时触发里写明 IANA 时区,不要自己换算成 UTC;③ 审批结果回写到记录时是记在操作人名下的,所以对它做出反应的流程保持按用户身份运行;只有 SLA 自动决定和超时释放两种情况没有用户。新增 3 个评测用例,净增 71 行。
  • 一处与私有原文不同:cloud 原文说审批结果是「无用户的系统写入,下游流程要声明 runAs: system」;复审员逐个调用点核对后确认原文不对,移植的是更正后的说法。
  • 全英文:按「skills 对外发布的版本应该全部用英文」,本 PR 改动的非评测文件中文为 0;顺带把该参考文件原有的 8 行中文改成了英文。
  • 需要你做的:审批合并(受管面 skills/**,Tier H)。契约复审 PASS 评论 6718283200,Head-sha: 874185a446e23dfa293c42eac40913586c81a5e3。
  • 席位意见:建议合并。这是 One authoring source (cloud#3659 A), 1/4: port cloud's private metadata-authoring rules into the published @objectstack/skills, keeping every regression #31155 的第 2 个 PR(第 1 个 docs(skills): objectstack-data carries the hosted build agent's metadata-authoring judgment (cloud#3659 A, port 1 of 3) #31223 也在等你审批);界面部分是下一个。

席位核对

  • 形态: Part of #31155, 6 files, governed skills/** ⇒ Tier H: draft kept, pm:awaiting-merge and review requested from GOVERNED_APPROVERS in this pass; the seat neither approves, arms nor merges.
  • Contract review: FAIL 6718050728 on 2ab1ee03 (ratchet over by 6 after main moved) → REWORK round 1 → Served-tier: CONTRACT_REVIEW_TIER delta PASS 6718283200 on this head (same reviewer; ratchet rows recomputed on the merge result, the condition / fields legs split, two pre-existing corrections verified).
  • 门禁 check-runs on this head: 46 completed — 31 success, 15 path-filtered skipped, 0 failed; Type Check · source gates reads state-machines-and-approvals.md is 5825 tokens (ceiling 5825; headroom 0).
  • Ratchet: rows pinned AT the measurement (6527 / 1494 / 5825) against origin/main bases (25654 / 5685 / 22908), same-file pay-down first; authority cloud#3659 A 6682024726 + record 6513306068.
  • Out of scope, routed: cloud's hosted agent still carries the false 14c sentence → card 4 cloud#3714 rewires that corpus; two spec-lane enforcement gaps (flow node type outside the registry; select literal not among option values) → ledger note 6717932694 item 3 for the spec lane; five other shipped skill files still carry CJK on main → a catalog-wide English card if the approver wants the rule to cover them.
  • 落地条款: after an APPROVED review from GOVERNED_APPROVERS the seat runs the landing pre-check (incl. check:skill-refs on the merge ref — main regenerated references/_index.md), clears pm:awaiting-merge, pr_ready + automerge_enable; or the maintainer merges by hand.

@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 8, 2026
@os-zhuang
os-zhuang marked this pull request as ready for review November 8, 2026 06:40
@os-zhuang
os-zhuang added this pull request to the merge queue Nov 8, 2026
Merged via the queue into main with commit 383c353 Nov 8, 2026
52 checks passed
@os-zhuang
os-zhuang deleted the claude/issue-31155-objectstack-automation branch November 8, 2026 06:55
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 pm:awaiting-merge PR only: landing waits on the maintainer's own review and merge (SKILL.md 复核 ②); never on an issue size/m 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.

3 participants