Skip to content

feat(automation): ADR-0096 follow-ups — runtime re-materialization + connector origin (#2977) - #3001

Merged
os-zhuang merged 2 commits into
mainfrom
claude/adr-0096-rematerialization
Jul 16, 2026
Merged

feat(automation): ADR-0096 follow-ups — runtime re-materialization + connector origin (#2977)#3001
os-zhuang merged 2 commits into
mainfrom
claude/adr-0096-rematerialization

Conversation

@os-zhuang

@os-zhuangos-zhuang commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Follow-ups to the merged ADR-0096 (#2994). Tracking: #2977. Two cohesive additions to @objectstack/service-automation:

1. Runtime re-materialization

Provider-bound declarative connectors: instances (ADR-0096) materialized only at boot — a connector published from Studio, or introduced by a dev reload, did not become dispatchable until a full restart. materializeDeclaredConnectors is now a reconcile against the declared set, run both at boot and on metadata:reloaded (the Studio-publish / dev-reload hook that already re-syncs flows):

  • Add newly-declared instances; tear down removed / newly-enabled:false ones (calling their close, e.g. an MCP connection); re-materialize only instances whose signature — a stable hash of provider + providerConfig + auth + identity — changed. An unchanged MCP instance is not reconnected on an unrelated metadata reload.
  • Boot stays fatal ("fail loudly", unchanged): unknown provider / invalid providerConfig / unresolvable credentialRef / name conflict aborts startup.
  • Reload is soft: the same problems are logged and the offending entry skipped, so a bad publish never crashes a running server. A changed instance's old connector keeps serving until its replacement materializes successfully.

Tracking moved from a materializedConnectorClosers array to a materializedConnectors Map (name → { signature, close }).

2. Connector origin on the descriptor

ConnectorDescriptor (served by GET /api/v1/automation/connectors) now carries origin: 'plugin' | 'declarative', so the flow designer can distinguish a materialized declarative instance from a plugin-registered connector. Additive — the field is always present; existing consumers ignore it. (Enables the Studio picker to label declarative connectors; that UI change lands separately in objectui.)

Verification

  • Reload reconcile: 6 tests (publish-after-boot / remove / newly-disabled / unchanged-untouched / changed-re-materialized / soft-failure-survives). origin: asserted on the descriptor.
  • service-automation green (26 files, 285 tests); runtime dispatcher green (523 tests) — the new required descriptor field breaks no consumer. Full DTS build clean; ESLint clean; changeset included.
  • ADR-0096 updated: "boot-time only" scope note replaced with a "Runtime reconcile (landed)" section.

Compatibility

Additive — boot behavior is byte-for-byte unchanged (same fatal: true path); the descriptor gains a field. No schema or authorable-key changes.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Pbmw3pMqNJfPbkvwh9Fkjs

…connectors (#2977)
Provider-bound declarative `connectors:` instances materialized only at boot, so
a connector published from Studio (or a dev reload) did not become dispatchable
until a restart. `materializeDeclaredConnectors` is now a reconcile against the
declared set, run at boot (fatal) and on `metadata:reloaded` (soft):
- Adds newly-declared instances, tears down removed / newly-`enabled:false` ones
(calling their `close`, e.g. an MCP connection), and re-materializes only those
whose signature — a stable hash of provider + providerConfig + auth + identity —
changed. An unchanged instance is left untouched (no needless MCP reconnect on
an unrelated metadata reload).
- Boot keeps the "fail loudly" contract (throws → fatal bootstrap). Reload is
soft: unknown provider / unresolvable credentialRef / factory failure / name
conflict is logged and the entry skipped, never crashing the live server; a
changed instance's old connector keeps serving until its replacement
materializes successfully.
Tracking (`materializedConnectorClosers` array → `materializedConnectors` Map)
carries the signature + close per name. 6 new reload tests (add/remove/disable/
unchanged/changed/soft-failure); service-automation suite green (285 tests).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Pbmw3pMqNJfPbkvwh9Fkjs
@vercel

vercelBot commented Jul 16, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

ProjectDeploymentActionsUpdated (UTC)
specReadyReadyPreview, CommentJul 16, 2026 4:04am

Request Review

@github-actionsgithub-actionsBot added size/m documentation Improvements or additions to documentation tests tooling labels Jul 16, 2026
@github-actions

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 1 package(s): packages/services.

6 hand-written doc(s) reference the affected code and may need an implementation-accuracy re-verification:

  • content/docs/automation/webhooks.mdx(via packages/services)
  • content/docs/kernel/runtime-services/audit-service.mdx(via packages/services)
  • content/docs/kernel/runtime-services/index.mdx(via packages/services)
  • content/docs/kernel/runtime-services/settings-service.mdx(via packages/services)
  • content/docs/plugins/packages.mdx(via packages/services)
  • content/docs/protocol/kernel/i18n-standard.mdx(via packages/services)

Advisory only. To re-verify, run the docs-accuracy-audit workflow scoped to these files:
node scripts/docs-audit/affected-docs.mjs origin/main → pass the list as args.docs.

…-0096 #2977)
`getConnectorDescriptors()` (served by GET /api/v1/automation/connectors) now
includes `origin: 'plugin' | 'declarative'` per connector, so a designer can tell
a materialized declarative instance (ADR-0096) apart from a plugin-registered
connector. Additive: the field is always present; existing consumers ignore it.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Pbmw3pMqNJfPbkvwh9Fkjs
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentationImprovements or additions to documentationsize/mteststooling

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@os-zhuang@claude