Commit Graph

7 Commits

Author SHA1 Message Date
joshavant 4bdec77639 Revert "fix(plugins): verify installed harness authority owners"
This reverts commit dfdc71322c.
2026-08-07 18:40:17 -05:00
Vincent Koc dfdc71322c fix(plugins): verify installed harness authority owners 2026-08-07 15:07:12 +08:00
Peter Steinberger 1e9a620a28 refactor(gateway): remove deferred channel load flag; 503 plugin routes until runtime ready (#117852)
* refactor(gateway): remove deferred channel load flag; 503 plugin routes until runtime ready

* test(agents): make setup middleware load intent explicit

* test(gateway): pin webhook startup routing outside SPA
2026-08-02 00:36:21 -07:00
Peter Steinberger e4d1b7e0d3 refactor(plugins): move plugin contributions into the registry bundle (#117372)
* refactor(plugins): move plugin contributions into the registry bundle

* fix(plugins): guard embedding owner union and drop unused test-util imports

* fix(plugins): break registry facade import cycles

* fix(plugins): remove obsolete registry snapshot seams

* test(gateway): preserve plugin runtime mock exports

* test(auto-reply): install builder registry in diagnostics fixture

* test(plugins): activate registry-backed capability fixtures
2026-08-01 06:57:01 -07:00
lee-xydt f78d58379a fix(plugins): clone registration record metadata for transactional rollback isolation (#108084)
* fix(plugins): deep-clone registry snapshot values for transactional rollback isolation

Shallow spread / new Map() copies nested objects by reference, so
in-place mutations on PluginRecord fields and Map values inside
arrays leak through rollback() — violating transactional isolation.

Wrap array items, Map values, and object properties in a recursive
deep-clone helper that preserves function references so handlers
and resolvers are not lost. Fixes #106647.

* fix(plugins): replace generic deep-clone with targeted shallow record cloning

Replace the recursive deepCloneRegistryValue with cloneRegistryEntry that
shallow-clones registration records to isolate primitive metadata fields
while preserving opaque plugin-owned instances (providers, services,
channels, harnesses, resolvers) by reference. A generic deep-clone was
too broad: it converted every plugin-owned object into a plain object,
losing prototypes, internal slots, and shared identity.

Add a class-instance regression test proving that providers survive
snapshot/rollback with their prototype chain intact and methods callable.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix(plugins): add curly braces and fix TS type assertions for CI

- Add curly braces to single-line if statements in cloneRegistryEntry
  to satisfy eslint curly rule
- Use `as unknown as ProviderPlugin` double cast for test class instance
- Call test methods on original variable instead of through registry type

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* test: add loader-scenario rollback proof for two sequential plugin transactions (#106647)

Simulate the real loader pattern from loader-runtime-candidate L492-531:
transaction 1 registers a class-backed provider and commits, transaction 2
mutates registry state and rolls back. Prove the first plugin's metadata is
restored and its class-backed provider instance, prototype, and methods
survive the rollback.

* fix(plugins): snapshot active PluginRecord in registration transactions (#106647)

Add activeRecord parameter to createPluginRegistrationTransaction so
the active record's array fields (toolNames, hookNames, providerIds, etc.)
are snapshotted at transaction creation and restored on rollback.
Without this, the loader's recordPluginError path re-pushes the record
with stale id arrays from the failed register() call.

Also replace flat container copies in snapshotPluginRegistry with
cloneRegistryEntry that shallow-clones individual registration records
while preserving opaque plugin-owned objects by reference.

Update all three production callers (loader-runtime-candidate,
loader-channel-runtime, loader-cli-registry) to pass activeRecord.

* fix(plugins): snapshot all mutable PluginRecord metadata in transactions (#106647)

Expand activeRecord snapshot from array-only to full cloneRegistryEntry
so scalars (httpRoutes, hookCount), flags (configSchema, enabled,
memorySlotSelected), and Dates are also restored on rollback. Runtime
objects (configUiHints, configJsonSchema, contracts) stay by reference.

Also update the activeRecord JSDoc to reflect the broader contract.

* fix(plugins): restore exact rollback record shape

Co-authored-by: 詹幸心0668001037 <zhan.xingxin@xydigit.com>

* test(plugins): cover date rollback isolation

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: Peter Steinberger <steipete@gmail.com>
Co-authored-by: 詹幸心0668001037 <zhan.xingxin@xydigit.com>
2026-07-28 08:24:48 -04:00
Peter Steinberger 0ecd449a43 fix(plugins): report missing plugin modules as missing, not boundary escapes (#115053)
* fix(plugins): report missing plugin modules as missing, not boundary escapes

The root-scoped open helper returns a classified failure, but five plugin
loader sites collapsed every failure into "escapes plugin root or fails
alias checks". A plugin artifact that is simply absent — e.g. while
dist/extensions/<id> is being re-emitted by a build — was therefore
logged as a containment violation.

Classify the failure instead: missing (ENOENT/ENOTDIR), unreadable
(coded), or an actual boundary/alias rejection. The containment check is
unchanged; only the reported reason is. Also drops the never-supplied
boundaryLabel/boundaryRootDir parameters on loadChannelPluginModule so
one root carries one label.

* test(infra): rename lint-flagged local helper in boundary failure test
2026-07-28 07:06:24 -04:00
Peter Steinberger ab3f057cfd refactor: split plugin loader by responsibility (#108513)
* refactor(plugins): split plugin loader

* refactor(plugins): keep loader helpers internal

* refactor(plugins): remove unused loader type import

* test(plugins): cover split runtime registry boundary
2026-07-15 17:51:13 -07:00