Skip to content

Commit 0189524

Browse files
refactor(service-automation): move AutomationEngine.resumeInternal's body into run-resume.ts (#25222 slice 8b) (#25734)
<!-- claude-projects-attribution: {"github_login":"os-project-manager"} --> _Requested by **Leehom** · [project thread](https://claude.ai/code/project/chan_01TenzsRopZj4jMbvjX8uz1X?thread=cmsg_01TenzsRopZj4jMbvjX8uz1XTuosfWWWQYxsF8dtsdzpc5)_ Part of #25222 Clause-②: no Metadata-protocol: none Slice 8b of the `engine.ts` split, move-only, under claim `6392268076` (Ruling-ref `6384677413`, ruling B; `6348891160`, the series' `.d.ts` bar). Scope is Release `6385919610`'s 8b paragraph: `resumeInternal` moves alone into `run-resume.ts`. **Is this the last slice?** It is the last slice the Release plans. With 8a (#25725) and this PR, slice 8 is done; the six bodies the Release keeps in the class stay there. Whether the card closes is the seat's call, so this PR does not close it. ## What moves - `AutomationEngine.resumeInternal`'s body (919 lines in the class) becomes `export async function resumeInternal` at the end of `run-resume.ts`, moved unedited. The class keeps the private method: its name, docblock, parameter comment and signature stay. The stub calls the body with a host literal and is no longer `async`; it returns the promise the moved function makes. - `RunResumeHost` gains 14 members, so it now holds 41. The function's `this` is a Pick of `RunResumeHost` over the 25 members the body reads. - `logger`, `flows`, `resuming` and `consumedSuspensions` go by value. Each one is assigned only at its declaration or in the constructor. The other 21 are late-bound method closures, so a spy or test double set on the instance is still the one called. - **Recursion stays on the class.** The body's own recursive call (`this.resumeInternal(childRunId, signal, true)`) goes through the host closure into the class stub. `bubbleToParent`'s call stays in the class and calls the stub directly. `subflow-hosted-approval-strand.test.ts` in plugin-approvals patches `resumeInternal` on the instance, and both paths still reach that patch. - **Four in-place exports in `engine.ts`**, the ones the Release names: `ChildRunRefusal`, `isRetryableResumeRefusal`, `carriesSubflowChildOutput` and `applyResumeSignal`. `ENGINE_BUILT_SIGNAL` stays unexported. The body reads no other unexported `engine.ts` name; a TypeScript checker pass over the base method listed exactly these four. - `run-resume.ts` imports `readCarriedRefusal` and `summarizeRun` directly. From `./engine.js` it also takes `FlowRefusalSignal`, `isRefusalSignal`, `isSuspendSignal`, the three new value exports and the types `ChildRunRefusal` and `ExecutionLogEntry`. Those values are read only at call time, so the cycle comment now lists all seven. Size: 2 files, 1,898 changed lines (+985 / -913). `engine.ts` goes from 9,882 to 9,006 lines. `check-governed-merges --branch HEAD` says NOT governed, with 0 of 2 paths on the register, under 3,000 lines. ## Proof that it moved nothing All readings below were taken in this container on head `d8bf1026` against base `f3fea0a03d`, the merge base and `origin/main` at the time. - **AST token identity** (TypeScript 6.0.3). The base method and the head function compare IDENTICAL on body leaf tokens (kind and text, 1,754 tokens), on parameters (17 tokens, with the head's `this` parameter dropped), on the return type (4 tokens) and on the `async` modifier. - **Negative control.** In a scratch copy of the head `run-resume.ts`, I changed one token: `this.resuming.delete(runId)` became `this.resuming.add(runId)`. Grep confirmed the edit landed (delete went 1 to 0, add went 1 to 2), and the comparison reads DIFFERENT with exit 1. - **Line accounting.** Every line deleted from `engine.ts` reappears, dedented four spaces, among `run-resume.ts`'s added lines. The five exceptions are the four declaration lines that gained `export` and the method's `private async` head line. - **Host sets.** The `this.X` reads in the head body, the Pick keys and the stub's host-literal keys are the same 25 names. Every Pick key is declared on `RunResumeHost`. - **`.d.ts`.** `dist/index.d.ts` and `dist/index.d.cts` are raw byte-identical at base and head, both sha256 `a5cbe3bbb8aff2805674e1d9f119946199697e469a3e8a5b9bc7eb4fc08bc7cb`. Raw identity holds, so the sorted-union bar holds trivially. The head `index.js` does contain the new `async function resumeInternal(` and base does not, so the head build is real. - **Export lists.** ESM and CJS each export 39 names, the same list in both bundles. The fingerprint over name, typeof and function name is `afcfb4e8069c1e10` at both ends. - **Hand readers, byte-identical output at base and head** (sha256 prefixes): - `check-startup-registry-verdict`: 46 seams, 39 read-only (`9209def6…`). Its `--self-test` is `fb8c875f…`. Its `--list` matches apart from line numbers, including `registerFlow`'s line. - `check-tenant-audit-census` (`52b71dc0…`): 239 sites certified, 163 decidable, 23 prose figures. Its `--self-test` is `fae0925f…`. - `tenant-audit-census`: human output `b1d732d2…`, and `--json` without `measuredAt` `dc3ff45e…`. - `check-system-context-census` (`6db2898d…`) and `isystem-census --json` (`fb320be9…`). - `check-platform-checklist` (`edee137b…`), `check-adr-symbol-anchors` (`7530e478…`) and `check-adr-anchors` (`1b79d342…`). ## Tests and gates - `@objectstack/service-automation` vitest on head: Test Files 201 passed (201), Tests 2636 passed (2636). - Package `typecheck` (`tsc --noEmit` plus `check:test-typecheck`) exits 0. ESLint `--no-inline-config` over `packages/services/service-automation` exits 0. - `dispatch-gates --commands --repo objectstack-ai/objectstack` derives 54 families on the 2 paths, and all 54 exit 0. Two of them first exited 3, PREREQUISITE NOT MET, and passed on re-run without any change to the code: - `check-plugin-teardown-shape --self-test` passed (48 cases) once the fixture commit `621a4876` was fetched into the shallow clone. - `check:dual-build-cjs-loads` passed after a full `pnpm build`. - `--ran` reconciles: 54 derived, 54 run, 0 NOT-MEASURED, 0 UNRUN. ## Acceptance notes - Comments inside the moved body that point by position ("the docblock above", "below") moved unedited, as in slices 1 to 8a. - Serial constraints, re-checked before this PR was opened: none of the 20 open PRs touches `engine.ts` or `run-resume.ts`. 18 were diffed against their merge base. #25588 (docs, pm-dispatch) and #25569 (cli CSP) have no merge base in this shallow clone, so I judged those two by title only. --- _Generated by [Claude Code](https://claude.ai/code/session_01Rg1PtyxbtSpabeP7j6fq8Y)_ Co-authored-by: Claude <noreply@anthropic.com>
1 parent 4cc17db commit 0189524

2 files changed

Lines changed: 985 additions & 913 deletions

File tree

0 commit comments

Comments
 (0)