Declare permissions on the plugin declaration - #475
Merged
Cooldude2606 merged 1 commit intoSep 12, 2026
Conversation
Clusterio #988 added a permissions array to PluginDeclaration and a type level Permissions registry, and made checkPermission and the web UI hasPermission helpers take PermissionName. Move the definePermission calls of exp_groups and exp_scenario into the declaration and add the names to the registry so the web pages type check. The browser tsconfigs include index.ts so the augmentation is visible to the web bundle, matching the in-repo plugins. The exp_scenario table keeps its tuple form and derives the name union from it, so a new row is still one line. Seed role permissions are typed as PermissionName, so a typo in seed.ts is now a compile error rather than a warning at seed time. The tests register the declared permissions through registerPluginPermissions instead of importing permissions.ts for its side effect. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Merged
Cooldude2606
approved these changes
Sep 12, 2026
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.
Clusterio merged clusterio/clusterio#988, which adds a
permissionsarray toPluginDeclarationand aPermissionstype registry.checkPermissionand the web UIhasPermissionhelpers now takePermissionName, so a TypeScript plugin has to add its names to the registry or its web pages stop compiling.exp_groups and exp_scenario now declare their permissions on the plugin declaration instead of calling
lib.definePermission()at import time. exp_scenario keeps its tuple table inpermissions.tsand derives the name union from it, so adding a permission is still one line. The three controller side permissions stay inindex.tsnext to the declaration.The augmentation for exp_groups lives in
messages.tsrather thanindex.ts. The browser project has to see it, and it cannot includeindex.tsbecause that file re-exports theControllerPlugintype fromcontroller.ts. exp_scenario includesindex.tsandpermissions.tsin its browser project, matching what clusterio did for its own plugins.Seed role permissions are typed as
lib.PermissionName, so a typo inseed.tsfails the build instead of logging a warning at seed time. The tests register the declared permissions withlib.registerPluginPermissions()instead of importingpermissions.tsfor its side effect.CI stays red on this PR by itself.
mainalready fails against clusteriomasterbecause clusterio moved to ES modules in clusterio/clusterio#984, and #476 stacked on this one fixes that. With both applied, all eight packages build, the isolated reference checks pass and the tap suites pass with 523 and 575 assertions.Changelog
🤖 Generated with Claude Code