Centralize deployment-mode gating behind a capability definition#155
Open
CarsonDavis wants to merge 1 commit into
Open
Centralize deployment-mode gating behind a capability definition#155CarsonDavis wants to merge 1 commit into
CarsonDavis wants to merge 1 commit into
Conversation
Replace scattered isFull()/isLean() checks with a single capability definition (API/Backend/Utils/capabilities.js) that every gate reads. - Backend modules declare `capability`; the discovery seam (API/setups.js) decides what to wire. onceInit/onceStarted are gated; onceSynced runs unconditionally so gated-off tables still exist in both modes. - Partial gates (Missions mount, utils routes, mmgis-stac, WITH_* flags, adjacent-servers spawn/proxy) ask the definition by capability name. - localSidecars collapses the sidecar cluster; localMissions kept separate. - updateTools reads each tool's declared capability (Draw declares "draw"). - Configure twin extended; Panel/SaveBar/DeploymentsWatcher migrated off raw mode-string checks. - Upload storage fork left as a direct mode check; staticHandlers untouched. Unit suite: 674/674 green.
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.
Closes #152.
What this does
Replaces the ~30 scattered
isFull()/isLean()deployment-mode checks with one capability definition that every gate reads, so "what does lean turn off?" is answered in one place and adding a mode is a one-table edit. Pure restructuring — no behavior change in either mode.API/Backend/Utils/capabilities.js): acapability → enabling mode(s)map resolved through one accessor; throws on an unknown capability so a typo fails at boot.API/setups.js): each gatedsetup.jsdeclarescapability: "<name>"and the seam decides.onceInit/onceStartedare gated;onceSyncedruns unconditionally, so every gated-off feature still creates its DB tables in both modes (a later mode flip needs no migration).mmgis-staccreation, theWITH_*Configure flags, the adjacent-servers spawn/proxy) ask the definition by capability name.localSidecarscollapses the sidecar cluster;localMissionsis its own capability.updateToolsreads each tool's declaredcapability(Draw declares"draw") instead of a hardcoded name.configure/src/core/capabilities.js) is extended andPanel/SaveBar/DeploymentsWatchermigrated off raw mode-string checks. The twin uses the same list shape as the backend (warns + hides on unknown, rather than throwing — a render-time gate fails safe).Deliberately left as direct mode checks: the upload S3-vs-disk storage fork (
uploadRouter.js) anddeploymentMode.jsitself.staticHandlers.jsis untouched (a call's static disposition isn't a pure function of its capability).Verification
isLeanModeexport removed and the Configure twin DRY'd as part of review.Merge order
Stacked on #154 (base
tests-both-modes-ci). Merge after the test chain: #150 → #153 → #154 → this. The both-modes coverage from #154 is what gates this refactor in CI.