Skip to content

refactor(service-automation): move the registration-time checks into flow-registration-checks.ts (#25222 slice 1) - #25270

Merged
objectstack-fleet[bot] merged 3 commits into
mainfrom
claude/project-thread-nirtwt
Oct 23, 2026
Merged

objectstack-fleet[bot] merged 3 commits into
mainfrom
claude/project-thread-nirtwt

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Requested by Sales · project thread

Part of #25222
Clause-②: no
Metadata-protocol: none

Slice 1 of the engine.ts split. The bodies of the eight registration-time checks of AutomationEngine (registrationChecks, registrationCheckRefusals, validateNodeConfigKeys, validateDecisionModes, validateApiTriggerSecret, collectUndeclaredConfigKeys, validateFlowExpressions, detectCycles) move, unedited, to the new module packages/services/service-automation/src/flow-registration-checks.ts. The module-level declarations that only those bodies read move with them. It is move-only, and the card stays open for the later slices. Branch: claude/project-thread-nirtwt, the harness-pinned branch for this session; it names no issue, so the claim comment on #25222 is the identity record.

⚠️ This PR stays a draft until one question is ruled (below). The published .d.ts is not byte-identical to base: 18 lines differ, and every one of them is the same string-literal union printed with two members swapped. No move-only shape can avoid it, as measured below. The claim said this thread stops on any .d.ts change, so it is reported as needs_decision, and skip-changeset here is provisional on that ruling.

Open question: the .d.ts bar for this series

What differs. dist/index.d.ts and index.d.cts (identical to each other, before and after) differ from base on 18 lines:

  • 9 lines print the field-type union with "summary" | "record" as "record" | "summary".
  • 9 lines print _lockSource as "artifact" | "package" | "env-forced" instead of "package" | "artifact" | "env-forced".

Nothing else differs. With string-literal unions sorted, both files hash the same before and after: sha256 bb7fefdc30c19ebb1dac308eeb00418a79c8465b9409f511f66c56cf7d398cd5 (raw base fa59fa6b2b0b…eb44158, raw head 061f950a0047…350f965b; the head build is deterministic over two builds). The ESM and CJS bundles export the same 39 names before and after.

Why, measured. TypeScript prints a union's members in the order their literal types were created, and the DTS build type-checks the whole program in source-file order, where a module comes before the file that imports it. So the moved bodies are now checked before all of engine.ts, not at base line 10922. An instrumented copy of the TypeScript 6.0.3 checker, driving the same program tsup's DTS build creates, shows where each literal is first created:

literal base head
"summary" engine.ts:1141 engine.ts:1057 (the same line)
"record" engine.ts:1233 @objectstack/formula index.d.ts:450, reached while checking flow-registration-checks.ts
"package", "artifact" engine.ts:2468, :2546 flow-registration-checks.ts:214 (resolving FlowParsed in registrationChecks' return type)

The moved signatures name FlowParsed or FlowNodeParsed, and engine.ts must import the module to call them. So any split of this file into a module engine.ts imports moves this checking ahead, and later slices will reorder unions the same way. Union member order carries no meaning in TypeScript: assignability, narrowing and inference are the same.

Options.

Recommendation A. On the long-term axis, the base order is itself an accident of which engine.ts line first touches each literal, so any ordinary edit can flip it; holding a split to it holds the split to an accident. On preventing AI mistakes, the normalised check stays strict, because every other byte must match. On business need and on not spreading scope, B adds release noise with no consumer, and there is no new gate either way.

The pattern later slices repeat

Members the moved bodies read, found by walking each body (base 0f1eeee line numbers): the methods are at :10922-:11679. The fields are actionDescriptors (a Map, never reassigned), logger (assigned only in the constructor) and objectSchemaResolver (reassignable through setObjectSchemaResolver). The methods are deriveTriggerBinding, valueEnvelopeRefusals, and the moved methods themselves where one calls another.

Shape B of #23050, one host per function.

  • The class keeps each private method with its name, docblock and position, because tsup emits private members with their JSDoc into the .d.ts. Each body is now one host literal and fn.call(host, …).
  • RegistrationCheckHost types every member as the class member itself (AutomationEngine['m']), so a renamed member is a compile error. There is no cast, and no member becomes public or protected.
  • Each moved function types its this parameter as the Pick of RegistrationCheckHost over exactly the members its own body reads. The method annotates its host literal as the ThisParameterType of that function, which gives the closures their parameter types and rejects an extra member.
  • validateDecisionModes and detectCycles read no member, so their methods call them directly.
  • Methods are passed as late-bound closures, (...a) => this.m(...a), so a spy or test double set on the instance is still the one called.
  • Fields are passed by value. That equals a live read because each is read inside one synchronous call: the moved bodies contain no await, and objectSchemaResolver is read once, in an immediately invoked function.
  • One measured difference: this.objectSchemaResolver?.(objectName) now runs with the host as its receiver instead of the engine. Every setter in the repo passes an arrow function (plugin.ts:1256 and the tests), and an arrow ignores its receiver.
  • The moved bodies keep saying this., so the moved lines are unedited.
  • Module-level declarations moved verbatim with the bodies, because nothing else reads them: ConfigSchemaNode, BULK_INTENT_GUIDANCE, FLOW_NODE_UNKNOWN_KEY_GUIDANCE (with its docblock), RegistrationCheckSite, RegistrationCheckRefusal, UndeclaredConfigKey, STORED_FLOW_PATH, storedGraphPath and storedGraphMemberPath. Four comment-plus-import groups that only the moved bodies used moved too. engine.ts imports the four interfaces type-only, because its stubs and flowRegistrationTodo still name them. The package entry re-exports nothing new.

Proof of move-only

  • Moved block (git diff --color-moved=plain --color-moved-ws=allow-indentation-change 0f1eeee HEAD over the two files): 665 deleted and 697 added lines are detected as moved. The rest:
    • Deleted, not moved (7): three import lines narrowed, because the names they also imported moved; and the four interface lines that gained export in the module.
    • Added, not moved (122): in engine.ts, the four narrowed import lines, the import of the module with its comment, and the eight stub bodies (53 lines found nowhere in base). In the module, the license header, the module docblock, the imports, RegistrationCheckHost with its docblock, one pointer docblock per function and the rewritten signature heads (65 lines). The other 4 are lines such as a blank or a bare import { that git does not pair with a moved block.
  • An independent check: a script finds 698 of the module's 763 lines as verbatim runs of base engine.ts (method bodies de-indented one level), and names each of the other 65. Every line deleted from engine.ts is in the module, apart from the 7 above.
  • .d.ts: see the open question.
  • Bundles: the ESM and CJS export lists are identical (39 names each). The bundle JS bytes differ, because code moved within it.

Readers re-pointed

Readers examined and not re-pointed:

  • text-slot-template.test.ts walks all of src/, so it already reads the module.
  • check-startup-registry-verdict scans all of packages/. The engine.ts mentions in it and in docs-audit/affected-docs.mjs are self-test fixtures, not path reads of the moved lines.
  • The dispatcher-error-vocabulary row for flowRegistrationTodo stays where it was, because that function did not move.
  • There is no ADR anchor for engine.ts; the package's only anchor is flow-precedence.ts. No docs/qa or liveness anchor names a moved method. The generated reference doc names validateNodeConfigKeys, which still exists.
  • No path:line citation in the repo points into the moved ranges (base :140-:219, :2302-:2335, :2346-:2375, :10922-:11679). Lines after the first range in engine.ts shift up, by 615 after the method block.

Acceptance notes

  • The .d.ts question above is the one open item. Nothing else is outside this slice.

Gates

All at 45536612, on base 0f1eeee (origin/main when this PR opened).

  • pnpm --filter @objectstack/service-automation test: Test Files 198 passed (198), Tests 2618 passed (2618), the same as base. VERDICT command-exit 0.
  • src/flow-activation-ledger.test.ts after the pin migration: 47 passed. With either injection above, 1 failed and 46 passed.
  • pnpm --filter @objectstack/service-automation typecheck: exit 0 (tsc --noEmit, and check:test-typecheck with 0 files / 0 errors in the debt ledger).
  • eslint over the three touched files: exit 0.
  • pnpm --filter @objectstack/service-automation build: exit 0, including check-dts-emitted (2/2 declaration files). dist/index.d.ts and index.d.cts sha256 061f950a0047c61b0e747dcfefb44c64bdf4c21150faafb72364d1a2350f965b, the same as the two earlier head builds.
  • dispatch-gates derivation with no paths: 58 commands, 1505 changed lines, under the 3000-line human-merge threshold. --ran reconciliation: 58 derived, 57 run, 1 NOT-MEASURED, 0 UNRUN.
    • 57 of 58 exit 0.
    • NOT MEASURED: check:dual-build-cjs-loads, reason: PREREQUISITE NOT MET (exit 3 after its self-test passed; 40 package entry points name a dist/ this container has not built). As a narrow stand-in, packages/services/service-automation/dist/index.cjs and index.js both load, with 39 exports each. CI runs the gate over a full build.
  • Census gates run on base and on head, compared:
    • Identical output: check-system-context-census, check-registry-log-declared, check:durability-log-level, check:issue-citations.
    • Only the scanned counts move, by the one new file: check-undeclared-dep-imports (3281 to 3282 files, 2813 to 2817 specifiers, the module's own four imports), check:dispatcher-error-vocabulary (3369 to 3370 files, the same 56 classified sites), check:doc-authoring (1406 to 1407 sources), check-startup-registry-verdict (3396 to 3397 files, the same 46 seams).
    • check-issue-citations.mjs: the 58 citations this change adds across 2 files all resolve.

Per command (exit code):

  • node scripts/check-ci-filter-parity.mjs exit 0
  • node scripts/check-closing-keyword-parity.mjs exit 0
  • node scripts/check-closing-keyword-parity.mjs --self-test exit 0
  • node scripts/check-comment-mask-adoption.mjs exit 0
  • node scripts/check-comment-mask-adoption.mjs --self-test exit 0
  • node scripts/check-comment-mask-corpus.mjs exit 0
  • node scripts/check-dts-emitted.mjs --self-test exit 0
  • node scripts/check-issue-citations.mjs exit 0
  • node scripts/check-keyed-text-bounds.mjs exit 0
  • node scripts/check-keyed-text-bounds.mjs --self-test exit 0
  • node scripts/check-platform-object-tenancy-census.mjs exit 0
  • node scripts/check-platform-object-tenancy-census.mjs --self-test exit 0
  • node scripts/check-plugin-teardown-shape.mjs exit 0
  • node scripts/check-plugin-teardown-shape.mjs --self-test exit 0 (the first run exited 3 because this shallow clone lacked the pinned fixture commit; it passed after git fetch --depth=1 of that commit)
  • node scripts/check-position-name-fold-loaders.mjs exit 0
  • node scripts/check-position-name-fold-loaders.mjs --self-test exit 0
  • node scripts/check-registry-log-declared.mjs exit 0
  • node scripts/check-registry-log-declared.mjs --self-test exit 0
  • node scripts/check-rest-log-spy-declared.mjs exit 0
  • node scripts/check-rest-log-spy-declared.mjs --self-test exit 0
  • node scripts/check-system-context-census.mjs exit 0
  • node scripts/check-system-context-census.mjs --self-test exit 0
  • node scripts/check-tenant-audit-census.mjs exit 0
  • node scripts/check-tenant-audit-census.mjs --self-test exit 0
  • node scripts/check-undeclared-dep-imports.mjs exit 0
  • node scripts/check-undeclared-dep-imports.mjs --self-test exit 0
  • node scripts/docs-audit/check-affected-docs.mjs exit 0
  • node scripts/docs-audit/check-drift-comment.mjs exit 0
  • pnpm --filter @objectstack/spec run check:duration-unit-keys exit 0
  • pnpm check:closed-ceremony-text exit 0
  • pnpm check:cross-package-test-inputs exit 0
  • pnpm check:dispatcher-error-vocabulary exit 0
  • pnpm check:doc-authoring exit 0
  • pnpm check:driver-memory-census exit 0
  • pnpm check:dts-closure exit 0
  • pnpm check:dual-build-cjs-loads exit 3
  • pnpm check:durability-log-level exit 0
  • pnpm check:engine-double-contract exit 0
  • pnpm check:error-status-conformance exit 0
  • pnpm check:gitlink-declared exit 0
  • pnpm check:issue-citations exit 0
  • pnpm check:lean-entry-closure exit 0
  • pnpm check:logger-receiver-detach exit 0
  • pnpm check:nul-bytes exit 0
  • pnpm check:objectql-double-limit exit 0
  • pnpm check:org-identifier exit 0
  • pnpm check:page-declaration-shape exit 0
  • pnpm check:published-files exit 0
  • pnpm check:query-options-erasure exit 0
  • pnpm check:refd-timer-probe exit 0
  • pnpm check:slot-lookup exit 0
  • pnpm check:sourcemap-no-sources-content exit 0
  • pnpm check:test-source-alias exit 0
  • pnpm check:tier-file-adoption exit 0
  • pnpm check:type-check-coverage exit 0
  • pnpm check:type-check-debt exit 0
  • pnpm check:watch-hint-literal exit 0
  • pnpm check:where-matcher exit 0

Generated by Claude Code

…f engine.ts

The bodies of AutomationEngine's registration checks (registrationChecks,
registrationCheckRefusals, validateNodeConfigKeys, validateDecisionModes,
validateApiTriggerSecret, collectUndeclaredConfigKeys,
validateFlowExpressions, detectCycles) move unedited, re-indented one level,
to flow-registration-checks.ts, with the module-level declarations only they
read. The class keeps each method (name, docblock, position) and calls its
body with a host literal of exactly the members the body reads.

Claude-Session: https://claude.ai/code/session_01Mnj4nkWuhJ18xEdZvb2cjE
Co-authored-by: Claude <noreply@anthropic.com>
…10243 grep pins

The `flowEnabled` retirement pins read `engine.ts` as text. The registration
checks' bodies now live in `flow-registration-checks.ts`, so the pins read
both files, and the writer pin also splits at a moved body's top-level
declaration. An injected `this.flowEnabled` or `this.flowLedgerDisabled.add(`
in the new module fails each pin.

Claude-Session: https://claude.ai/code/session_01Mnj4nkWuhJ18xEdZvb2cjE
Co-authored-by: Claude <noreply@anthropic.com>
@objectstack-fleet objectstack-fleet Bot added the skip-changeset PR has no user-facing published change; bypasses the changeset gate label Oct 22, 2026
@objectstack-fleet
objectstack-fleet Bot requested a review from os-sales October 22, 2026 18:49
@github-actions github-actions Bot added the tests label Oct 22, 2026
@github-actions

github-actions Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 1 package(s): @objectstack/service-automation, touching 36 documentable anchor(s).

18 hand-written doc(s) name something this change touched — list omitted above 15 rows. Re-derive on the tree named below: node scripts/docs-audit/affected-docs.mjs --json ea33919f56a9879f95a00d45418385ff7dbb974f.

⛔ 8 release-owned page(s) also affected — read-only, see AGENTS.md Documentation Guardrails.

What this run could not see
  • 10 name(s) were too generic to anchor anything (single lowercase words)
  • the SDK route bridge reached 54 of 206 client-bound route-ledger rows — the other 152 have no registrar path: tail to select them, so pages documenting THEIR client methods cannot appear above, on this or any run. Of those 152: 0 are remediable by widening that discovery convention (an in-repo file declares the path; the convention did not scan it); 55 are structural — on a ledger where NOT ONE row is declared in-repo, so no discovery change reaches them at any price; 97 are undecided (no in-repo declaration, on a ledger that has other in-repo registrars — absence and an unreadable spelling are not distinguishable here). The rows themselves: node scripts/docs-audit/affected-docs.mjs --bridge-coverage
  • a page that states a rule by its inputs shares no identifier with the emitter that implements the rule, so an emitter-only diff cannot list it — not on this run and not on any run. Measured on fix(driver-sql): emit varchar(maxLength) for a text field a declared index keys on #11430: content/docs/protocol/objectql/types.mdx documents the text-family column mapping by the ObjectQL type names it maps FROM (text / textarea / html) while the diff changed createColumn; it went unlisted, and it was the page that diff falsified, in four places. No shared token exists to detect this on, so a rule your change carries has to be re-read by hand in the pages that restate it.
  • a key NAME is not a key, so the hand re-read the line above prescribes can land on the wrong schema. The same spelling is authorable on one governed type and a [REMOVED] tombstone on another for each of active, aria, joins, objects, template, tools and version (censused on [finding] tools is a key on BOTH AgentSchema (tombstoned, dead) and SkillSchema (live, cloud-attested), so a name-based search attributes skill examples to the agent key — it produced a false stop-the-line alarm on PR #19059 #19093 over the liveness ledger's governed types, top-level keys); nothing in a search result distinguishes the two, so a grep hit on a LIVE example reads as evidence about the DEAD key. Measured on fix(spec): the agent.tools liveness row says dead — it claimed live on a key the schema tombstoned #19059: content/docs/ai/agents.mdx was reported as contradicting the agent.tools tombstone over its tools: example at :161, which is inside the defineSkill({ block opened at :155 — the page was already correct. Settle ownership by PARSING the value against both schemas, never by the name: that literal PASSES SkillSchema, and as an AgentSchema it FAILS at tools with the tombstone prescription. ⛔ These names are not the whole class — a key retired through a .strict() guidance map leaves no tombstone in the walked shape and none of them here (tool.category, live as AIToolDefinition.category).

Coarse fallback — 6 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): node scripts/docs-audit/affected-docs.mjs --json ea33919f56a9879f95a00d45418385ff7dbb974f → packageMentionDocs.

Which tree this was computed on

This run read content/docs from ee06033e8d5c6daa4a069b44bb120af7bc6d6e7c — the merge of head 97b6fb795421644f879bb82df06ed00520aecd1a into base ea33919f56a9879f95a00d45418385ff7dbb974f, which is what actions/checkout gives a pull_request run. Not the PR head.

A worktree cut from an older main holds a different content/docs, so re-deriving there can legitimately return a different list — that is a different tree, not a wrong row. To answer on the same tree:

# while this PR is open — GitHub drops the merge commit once it closes
git fetch origin ee06033e8d5c6daa4a069b44bb120af7bc6d6e7c && git checkout ee06033e8d5c6daa4a069b44bb120af7bc6d6e7c
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin ea33919f56a9879f95a00d45418385ff7dbb974f 97b6fb795421644f879bb82df06ed00520aecd1a && git checkout -B drift-repro ea33919f56a9879f95a00d45418385ff7dbb974f && git merge --no-ff 97b6fb795421644f879bb82df06ed00520aecd1a

node scripts/docs-audit/affected-docs.mjs --json ea33919f56a9879f95a00d45418385ff7dbb974f

⚠️ That checkout carried uncommitted changes, so the commit above does not fully identify what was read.

Advisory only, and a precision-first one (#9192): a page is listed because it names a
symbol, wire route or SDK method this diff touched — not because it mentions a changed
package. Each row says which anchor put it there, so a wrong row is reportable rather than
merely annoying. To re-verify, run the docs-accuracy-audit workflow scoped to these files:
node scripts/docs-audit/affected-docs.mjs ea33919f56a9879f95a00d45418385ff7dbb974f → pass the list as
args.docs, on the commit named under Which tree this was computed on.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

Seat check (ACCEPT)

Takeover of the landing window under the maintainer's 2-hour rule, recorded on #25222. Session session_01UBfoEFdVTZ9yyEX5HxsHe4 · head 97b6fb795421644f879bb82df06ed00520aecd1a (the relay pr_update_branch merge of origin/main ea33919f into 455366125) · Clause-②: no · Ruling-ref: 6348891160 · 2026-10-23T16:18Z

item reading
Shape 3 files under packages/services/service-automation/src/ (engine.ts, flow-registration-checks.ts new, flow-activation-ledger.test.ts), +828/−677 = 1505 lines. git diff --stat ea33919f 97b6fb79 names only those three. check-governed-merges.mjs --pr 25270: NOT governed, under the 3000-line human-merge threshold. The merge brought in no conflict and changed none of the three files.
Premise, measured Ruling A item 1, re-read on the merged tree. Base built at ea33919f (turbo run build --filter=@objectstack/service-automation..., real .d.ts), then the package rebuilt with the head's src/. Raw sha256, index.d.ts = index.d.cts on each side: base 6c9d35348b0eeb4e885daed936d3e04fc3566cebc34c7894e40a2d80f9038507, head 8fc937b1e1efa57ee91dce01f391cb5943241cf4312fa55daa2f16981298b772. Normalised (the ruling's one-liner, verbatim), all four files: 32aab1ec7a95b4e90d8d50a2e06b36d3b8207e25e1e527068b7d3460020794fb, and cmp of the normalised base and head is silent. Raw diff: 36 lines, 18 pairs, 9 _lockSource and 9 field-type "summary" | "record" swaps, nothing else. Positive controls on head line 4453: made public → d1cc729c169cf615fd9e8d512a831dea5bab317539174de74c056afba34a6c53; renamed → 6634ead71ede1db1f992b71fd85815c8d6420796a4036bc0a5df0a4fdf757892; both differ. Export lists: ESM 39 and CJS 39, equal to base name by name. Items 1(a)–(d) hold.
Gate check-runs All 41 check runs on 97b6fb79: 33 success, 8 skipped (opt-in and path-filtered legs), 0 failed. Test Core 1/6–6/6 and the aggregate, the Type Check legs, the Lint legs, Governed Surface Queue Guard, and the claim guards are all green. Local, on the same head: pnpm --filter @objectstack/service-automation test gave Test Files 198 passed (198) and Tests 2619 passed (2619).
Accepted deviations The raw .d.ts bytes differ (union member order only), as ruled A. skip-changeset stays (item 4).
Out of scope, where it goes Slice 2 and later stay with the domain:services seat. This act does not start them. The card stays open as Part of.
Landing clause Not governed and under 3000 lines, so pr_ready + automerge_enable through the relay, and the queue merges it. Landing authority: the maintainer's 「只要卡片2小时没进展,你应该都可以接手」 (Objectstack project chat, 2026-10-23T15:42Z). ⛔ No approval review is filed by this seat.

Generated by Claude Code

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review October 23, 2026 16:19
@objectstack-fleet
objectstack-fleet Bot enabled auto-merge October 23, 2026 16:19
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Oct 23, 2026
Merged via the queue into main with commit 4c8f40a Oct 23, 2026
42 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/project-thread-nirtwt branch October 23, 2026 16:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/xl skip-changeset PR has no user-facing published change; bypasses the changeset gate tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants