fix(models): give drive a PluginConfiguration so it can be disabled safely - #11017
Open
clayrisser wants to merge 1 commit into
Open
fix(models): give drive a PluginConfiguration so it can be disabled safely#11017clayrisser wants to merge 1 commit into
clayrisser wants to merge 1 commit into
Conversation
…fely `[driveModel, driveId]` had no config tuple element, so drive's PluginConfiguration got `classFilter: undefined` — and pluginFilterTx (core/utils.ts) reads undefined as "exclude every tx this plugin contributed", class definitions included. DISABLED_FEATURES=drive therefore left the client with drive txes referenced but drive:class:* missing, and anything still resolving one threw out of Hierarchy.getClass/getDomain: Inbox (the export service opens a drive DocNotifyContext on every export), the screen-recorder save flow (drive:class:Drive / drive:class:Folder), doc embeds of drive files. Drive only contributes three docs to the shared UI surfaces — one workbench Application and two presentation ObjectSearchCategories — so that pair is the whole classFilter; everything else stays. `hidden` is deliberately unset: the builder computes `enabled = config.enabled && !config.hidden`, so hiding would drop the Application for every deployment, flag or no flag. The default import is the merged model plugin (as chunter does) because the base `@hcengineering/drive` namespace has no config strings of its own. Co-authored-by: Cursor <cursoragent@cursor.com> Signed-off-by: Clay Risser <clayrisser@gmail.com> Co-authored-by: Cursor <cursoragent@cursor.com>
clayrisser
force-pushed
the
fix/models-all-drive-class-filter
branch
from
August 13, 2026 06:47
bf57866 to
03e2627
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
models/all/src/index.ts:416registers drive with a two-element tuple:so its
PluginConfigurationis built with noclassFilter.pluginFilterTx(foundations/core/packages/core/src/utils.ts:844-859) reads a missingclassFilteras "exclude everything this plugin contributed":So when drive is excluded —
DISABLED_FEATURES=drive— the client loses not just drive's UI contributions but drive's class definitions. Other subsystems still hold references to those classes, and resolving one throws out ofHierarchy.getClass/getDomain:DocNotifyContexton every exportdrive:class:Driveanddrive:class:FolderThe result is that disabling one feature breaks three unrelated ones, with a hierarchy exception rather than a graceful absence.
Fix
Give drive a config tuple whose
classFilternames only what drive contributes to the shared UI surfaces — one workbenchApplicationand twoObjectSearchCategorydocs:Disabling drive now hides the app and its search categories, and leaves the class definitions in place, so the three consumers above keep resolving.
The default import is the merged model plugin (as
chunterdoes in the same file) because the base@hcengineering/drivenamespace has no config strings of its own.Two things I want to flag rather than bury
1.
hiddenis deliberately not set, and that has a visible consequence. The builder computes:Setting
hidden: trueto preserve today's value would makeenabledcompute tofalseand disable drive for every deployment, flag or no flag. Sohiddenis left unset — which moves drive'shiddenfromtruetoundefined, andConfigure.svelte:47,62filters onit.hidden !== true.Net effect: drive starts appearing in Settings → Configure, where it does not today. I think that is the right outcome — Configure is the list of plugins you can turn on and off, drive is a real user-facing app, and every app with a config tuple is already listed there — but it is a user-visible change that falls out of the fix rather than being asked for, and you should decide it rather than inherit it. If you would rather keep drive out of that list, the builder's
hidden/enabledcoupling needs untangling first, which is a bigger change than this one.2. Drive is not the only two-element tuple.
coreModel,activityModel,taskModel,inboxModel,recorderModeland roughly forty others are registered the same way, so they have the sameclassFilter: undefinedproperty. They are not all broken by it — it only bites when the plugin is actually excluded and something outside it still references its classes — but the general question ("should a missingclassFiltermean exclude everything, including class definitions?") is worth asking separately, and a safer default inpluginFilterTxwould fix the whole family at once. This PR fixes the one case where we hit real breakage; I did not want to imply it is the only one.Verification
Verified against
develop@1be6047c8:[driveModel, driveId]is still the bare tuple at:416,pluginFilterTx'selse { totalExcluded.add(...) }is still at:857-859, and the builder'shidden/enabledcomputation is still as quoted.git applyis clean.Manual check: set
DISABLED_FEATURES=drive, then open Inbox, save a screen recording, and open a document containing a drive-file embed. Before the change each throws out of the hierarchy; after it, drive is simply absent from the app list and search.No automated test —
models/allhas no jest project, and the behaviour needs a built client model plus the feature flag.Provenance
Found on a self-hosted deployment that sets
DISABLED_FEATURES=drive: Inbox began throwing hierarchy errors, and the trail led back to the missingclassFilterrather than to Inbox.