Skip to content

Commit 2e441d7

Browse files
clauded-gubert
authored andcommitted
refactor(apps): remove dead host accessor layer (Phase 5 / follow-up #4)
The base-runtime is the single source of truth for accessor behavior and the accessor:* message category is gone (Phase 4), so the host copies of the accessors are unreachable. This removes them and un-threads the vestigial accessor manager from the sandbox-execution core. - Drop the ignored `accessors: AppAccessorManager` parameter from the run*/ runTheCode methods of AppApi, AppSlashCommand, AppVideoConfProvider and AppOutboundCommunicationProvider, and the `accessors` field from their four managers (the app executes in the subprocess via sendRequest; the host accessor manager was never consulted). - Delete AppAccessorManager, its managers/index export, and AppManager's accessorManager field/constructor/getAccessorManager/purifyApp usage (purifyApp only cleared caches that were never populated). - Delete src/server/accessors/ (64 files) and the now-orphaned src/server/misc/UIHelper.ts. - Adapt tests: delete tests/server/accessors/ and the AppAccessorManager test; strip getAccessorManager/.accessors setup and assertions from the affected manager, AppManager and Deno-runtime tests. Behavior-neutral: host tsc error-set unchanged vs baseline; host node suites green (excluding the two deno-spawn integration suites, which require the deno binary and run in CI). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018FbxFGJWHiroxrdNPJRL3P
1 parent a21af99 commit 2e441d7

122 files changed

Lines changed: 84 additions & 6239 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

docs/proposals/apps-accessor-consolidation/README.md

Lines changed: 46 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -485,13 +485,13 @@ since consolidating more logic into the runtime makes the assumption more load-b
485485
dropping.
486486
3. **`messenger.sendRequest` timeout** — the runtime-side TODO becomes more prominent once all
487487
accessor traffic flows through it.
488-
4. **Drop the legacy `_accessors` threading + delete the dead host accessor layer.** Un-thread the
489-
ignored `accessors: AppAccessorManager` parameter from `AppApi.runExecutor`,
490-
`AppSlashCommand`/`AppVideoConfProvider`/`AppOutboundCommunicationProvider` `run*`/`runTheCode` and
491-
their managers; then delete `AppAccessorManager` (+ its `getAccessorManager()` on `AppManager` and
492-
the `purifyApp` call), the entire `src/server/accessors/` directory (now unreachable from the
493-
subprocess after Phase 4), the host `src/server/misc/UIHelper.ts` copy (its only importers are
494-
those deleted accessors), and the `managers/index.ts` export. Behavior-neutral cleanup; kept
488+
4. **Drop the legacy `_accessors` threading + delete the dead host accessor layer.** **landed as
489+
Phase 5** (§8). Un-threaded the ignored `accessors: AppAccessorManager` parameter from
490+
`AppApi.runExecutor`, `AppSlashCommand`/`AppVideoConfProvider`/`AppOutboundCommunicationProvider`
491+
`run*`/`runTheCode` and their managers; deleted `AppAccessorManager` (+ its `getAccessorManager()`
492+
on `AppManager` and the `purifyApp` call), the entire `src/server/accessors/` directory (unreachable
493+
from the subprocess after Phase 4), the host `src/server/misc/UIHelper.ts` copy (its only importers
494+
were those deleted accessors), and the `managers/index.ts` export. Behavior-neutral cleanup; kept
495495
separate from the Phase 4 message-path teardown because it touches the sandbox-execution core.
496496
(The parity harness is **not** removed — it became a permanent test utility the base-runtime
497497
accessor tests depend on.)
@@ -672,4 +672,42 @@ rather than removed).
672672
**End state (primary objectives met):** `BaseRuntimeSubprocessController` handles exactly one
673673
app-originated RPC category — `bridges:*` — with a single dispatcher and a single permission model,
674674
and accessor *behavior* lives in exactly one place, `packages/apps/base-runtime`. `handleAccessorMessage`
675-
and the entire `accessor:*` category are gone. What remains is dead-code removal (follow-up #4).
675+
and the entire `accessor:*` category are gone. What remains is dead-code removal (Phase 5 / follow-up #4).
676+
677+
### Phase 5 — Dead host accessor layer removal (follow-up #4) — ✅ landed
678+
679+
Physical removal of the now-unreachable host accessor code. Behavior-neutral: nothing on the
680+
subprocess path reached any of it after Phase 4.
681+
682+
1.**Un-threaded the vestigial `accessors` parameter** from the sandbox-execution core. The
683+
`run*`/`runTheCode` methods already ignored it (`_accessors`) — the app executes in the subprocess
684+
via `getRuntimeController().sendRequest`, so the host-side accessor manager was never consulted.
685+
Dropped the parameter from `AppApi.runExecutor`, `AppSlashCommand.runExecutorOrPreviewer`/
686+
`runPreviewExecutor`/`runTheCode`, all `AppVideoConfProvider.run*`/`runTheCode`, and
687+
`AppOutboundCommunicationProvider.runGetProviderMetadata`/`runSendOutboundMessage`/`runTheCode`, and
688+
updated the four managers' call sites. Removed the now-unused `private readonly accessors` field
689+
(and its `this.manager.getAccessorManager()` assignment) from `AppApiManager`,
690+
`AppSlashCommandManager`, `AppVideoConfProviderManager`, and `AppOutboundCommunicationProviderManager`.
691+
2.**Deleted `AppAccessorManager`** (`src/server/managers/AppAccessorManager.ts`), removed its
692+
`managers/index.ts` export, and removed `AppManager`'s `accessorManager` field, its
693+
`new AppAccessorManager(this)` construction, the `getAccessorManager()` accessor, and the
694+
`accessorManager.purifyApp(...)` call in `removeLocal` (a no-op — the caches it cleared were never
695+
populated once no host code called `getReader`/`getModifier`/etc.).
696+
3.**Deleted the entire `src/server/accessors/` directory** (64 files — the host copies of the
697+
readers, modifiers, builders, environment accessors, and the configuration/registration accessors)
698+
and the host `src/server/misc/UIHelper.ts` (only ever imported by those deleted accessors). The
699+
base-runtime holds the single source of truth for all of this.
700+
4.**Adapted tests:** deleted `tests/server/accessors/` (35 host-accessor unit tests — the
701+
base-runtime suites cover the equivalent behavior) and `tests/server/managers/AppAccessorManager.test.ts`;
702+
removed the `AppAccessorManager`/`getAccessorManager()`/`(x as any).accessors` setup and assertions
703+
from the four manager tests, `AppSettingsManager.test.ts`, `AppManager.test.ts`, the two Deno-runtime
704+
integration tests, and `AppListenerManager.test.ts`.
705+
706+
**Verification:** host `tsc` error-set unchanged vs the environmental-only baseline (no new errors);
707+
`test:node` host suites green (excluding the two `deno`-spawn integration suites, which require the
708+
`deno` binary unavailable in this environment); base-runtime suite unaffected (untouched by this phase).
709+
710+
**End state:** the `@rocket.chat/apps` host no longer contains any accessor implementation or accessor
711+
manager. The only accessor-shaped code left on the host is the bridge layer (`AppBridges`/`do*`) and
712+
`AppResourceBridge`; every accessor an app actually uses is built and resolved inside
713+
`packages/apps/base-runtime`.

packages/apps/src/server/AppManager.ts

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ import { AppCompiler, AppFabricationFulfillment, AppPackageParser } from './comp
1717
import { InvalidLicenseError } from './errors';
1818
import { InvalidInstallationError } from './errors/InvalidInstallationError';
1919
import {
20-
AppAccessorManager,
2120
AppApiManager,
2221
AppExternalComponentManager,
2322
AppLicenseManager,
@@ -87,8 +86,6 @@ export class AppManager {
8786

8887
private readonly compiler: AppCompiler;
8988

90-
private readonly accessorManager: AppAccessorManager;
91-
9289
private readonly listenerManager: AppListenerManager;
9390

9491
private readonly commandManager: AppSlashCommandManager;
@@ -153,7 +150,6 @@ export class AppManager {
153150

154151
this.parser = new AppPackageParser();
155152
this.compiler = new AppCompiler();
156-
this.accessorManager = new AppAccessorManager(this);
157153
this.listenerManager = new AppListenerManager(this);
158154
this.commandManager = new AppSlashCommandManager(this);
159155
this.apiManager = new AppApiManager(this);
@@ -200,11 +196,6 @@ export class AppManager {
200196
return this.compiler;
201197
}
202198

203-
/** Gets the accessor manager instance. */
204-
public getAccessorManager(): AppAccessorManager {
205-
return this.accessorManager;
206-
}
207-
208199
/** Gets the instance of the Bridge manager. */
209200
public getBridges(): AppBridges {
210201
return this.bridges;
@@ -1096,7 +1087,6 @@ export class AppManager {
10961087
this.listenerManager.lockEssentialEvents(app);
10971088
this.externalComponentManager.unregisterExternalComponents(app.getID());
10981089
await this.apiManager.unregisterApis(app.getID());
1099-
this.accessorManager.purifyApp(app.getID());
11001090
this.uiActionButtonManager.clearAppActionButtons(app.getID());
11011091
await this.videoConfProviderManager.unregisterProviders(app.getID());
11021092
await this.outboundCommunicationProviderManager.unregisterProviders(app.getID(), {

packages/apps/src/server/accessors/ApiExtend.ts

Lines changed: 0 additions & 15 deletions
This file was deleted.

packages/apps/src/server/accessors/AppAccessors.ts

Lines changed: 0 additions & 40 deletions
This file was deleted.

packages/apps/src/server/accessors/CloudWorkspaceRead.ts

Lines changed: 0 additions & 15 deletions
This file was deleted.

packages/apps/src/server/accessors/ConfigurationExtend.ts

Lines changed: 0 additions & 26 deletions
This file was deleted.

packages/apps/src/server/accessors/ConfigurationModify.ts

Lines changed: 0 additions & 14 deletions
This file was deleted.

packages/apps/src/server/accessors/ContactCreator.ts

Lines changed: 0 additions & 25 deletions
This file was deleted.

packages/apps/src/server/accessors/ContactRead.ts

Lines changed: 0 additions & 15 deletions
This file was deleted.

packages/apps/src/server/accessors/DiscussionBuilder.ts

Lines changed: 0 additions & 48 deletions
This file was deleted.

0 commit comments

Comments
 (0)