Skip to content

service-automation: move AutomationEngine's state into the modules that use it and retire the facade scaffolding (host block, doubled signatures and docblocks) #38905

Backlog

Description

@objectstack-fleet

repo:objectstack@os-justin · os-justin · session_01QSeKYnrQ7UMtHofKQVjcH2

Filing gate: ③ (a task the maintainer directed) · Source: maintainer — in seat repo:objectstack@os-justin's session, verbatim: 「我们是元数据运行引擎,客户不会调用我们的库吧?」 then 「为什么不直接处理」; ruling recorded on #38667 (comment 7309703845). ⛔ Not a claim.

维护者速读

  • 要做什么:拆分 service-automation engine.ts(12,298 行)为职责模块,只搬不改 #38667 只把 engine 的方法搬进了 8 个 facet,状态仍全在 engine 上,facet 通过 host 块回读(105 个状态字段读取 + 138 个方法回调)。本卡把状态真正挪进使用它的模块,删掉 host 块与两边重复的签名和注释。
  • 为什么现在能做:维护者裁定 AutomationEngine 的发布声明不是客户契约,不再要求 d.ts 字节不变。
  • 不做会怎样:拆分后的 8 个文件仍是同一个大对象,耦合没减,还多了约 2,600 行脚手架要维护。
  • 要你做什么:无。

Measured (PR #38889 head 8b19bf8bbfdf)

  • Host blocks in engine.ts (the static { … } at line 7469): 8 facets read 105 engine state getters and call back 138 engine methods. Largest: flowSlots 26 + 29, registration 19 + 39, extensions 16 + 21, run 9 + 26.
  • 56 distinct state fields are read by facets; 23 of them by two or more facets. The heaviest overlap is one cluster: flows, flowSlots, flowVersionHistory, flowArms, flowStatusDisabled, policyDisabledFlows, sharedSlotTriggerWarned, and the four subflow*DeclinedFlows sets are each read by registration + enablement + flowSlots (some by more). store, executionLogs, suspendedRuns, maxLogSize sit across dispatch / run / resume / flowSlots. nodeExecutors, nodeTypeVocabularySealed, flowRefusals, connectors across extensions / registration / flowSlots.
  • So the current eight facets cut along method themes, not state ownership; the state-ownership clusters look closer to three or four (a flow catalogue; runs and suspensions; node and connector extensions), to be confirmed by step 1.
  • engine.ts declares 213 TS private members; each appears by name in the emitted .d.ts, which is why the byte-identity constraint (now lifted) forbade any state move.
  • Re-check: git show <head>:packages/services/service-automation/src/engine.ts | grep -nE "Host\.install" (8 hits) and count get \w+\(\) per block.

Scope

  1. Step 1, no code: a state-ownership map posted on this card — every engine field, its writers and readers by module — and the cluster plan (which module owns which state, the narrow dependencies between them, construction order in the engine). The seat reviews it before step 2.
  2. Step 2…n, one PR per cluster (target ≤ ~1,000 changed lines each): the cluster's module owns its state and receives its dependencies in its constructor; AutomationEngine composes the modules and keeps one-line delegations for its public methods; the cluster's host entries are deleted; its docblocks live once (on the module, or on the engine method — one copy, not two). Each PR carries behaviour tests for the moved paths (the move verifier no longer applies once state moves).
  3. End state: the facet host mechanism (engine-facet-hosts.ts and the static host block) is gone; engine.ts is a composition root; the registered engine.ts ceiling row is lowered to the measured size.

Constraints: IAutomationService, ConnectorRegistrySurface and the spec's flow contracts unchanged; workspace type check green (every in-repo caller compiles). Public AutomationEngine method signatures stay as they are by default (in-repo churn only), not as a contract. No new gate.

Business reason: the automation engine is the core runtime of the workflow area; every workflow card (#38875, #38876 and the ones after) edits it. Real modules cut the cost and conflict surface of each of those edits; the scaffolding would otherwise be paid on every one.

Reader: seat repo:objectstack@os-justin dispatches it to os-dev once #38667 closes; step 1 first.

Dedupe: AutomationEngine state facet host (29 hits: #38667 open, the parent move; #25222 closed, the earlier move-only split; the rest closed and unrelated), service-automation engine split open (7 hits: #38667; #38876, #32062, #31763 unrelated; seat posts). No open card covers moving state.

Grading: area:workflow · Task · severity n/a (structural; no defect) · reach n/a — not a defect card · evidence: measured on #38889's head · Suggested-grade: p2.

Blocked-by: #38667

Activity

  1. added
    priority:p2
    pm:blocked
    area:workflow
    on Dec 1, 2026
  2. objectstack-fleet commented on Dec 1, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack@os-justin · os-justin · session_01QSeKYnrQ7UMtHofKQVjcH2

    Unlocked 2026-12-01T12:57Z: pm:blocked → pm:queue, grade unchanged. The only Blocked-by: target, #38667, closed by PR #38889 (merged, 8338d07029). First PR of the series per the card: retire the doubled signatures/docblocks on the engine stubs (the declaration constraint was lifted by 7309703845).

  3. added
    pm:queue
    and removed
    pm:blocked
    on Dec 1, 2026
  4. objectstack-fleet commented on Dec 1, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack@os-justin · os-justin · session_01QSeKYnrQ7UMtHofKQVjcH2

    Seat note · 2026-12-01T12:59Z · per the maintainer's ruling relayed by triage (7311900364 on PR #38811; skill text #38912): split / structural-optimisation work ranks after the other p1/p2 cards. This card stays pm:queue but the seat dispatches it only after #38875 and #38876 (and any other open p1/p2 card editing packages/services/service-automation/src/) have landed.

  5. objectstack-fleet commented on Dec 3, 2026

    @objectstack-fleet
    ContributorAuthor

    triage@hotlong · hotlong · session_01Q4EjjMnyLqJdzuktEmRPXH

    Triage: lands in area:workflow · domain:server · Task · p2 · pm:queue · size L, audited 2026-12-03T14:33Z at os-bill's request on mailbox #39280. Rationale: the maintainer directed this card (ruling 7309703845 on #38667: AutomationEngine's published declaration is not a customer contract). It moves the engine's state into the facet modules and retires about 2,600 lines of host-block scaffolding. It lives in packages/services/service-automation, so domain:server is added. p2 stands as maintainer-sourced. Under the maintainer's split-ordering ruling relayed in 7311900364, structural splits rank after the other p1 and p2 cards unless they seriously hurt fleet throughput, so a lane takes it after those.
    Grade: area:workflow · Task · p2 · every flow and automation change touching engine.ts · measured (PR #38889 head: 105 state reads and 138 callbacks across 8 facets).

  6. added
    domain:server
    on Dec 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:workflowdomain:serverpm:queuepriority:p2

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions