feat(licensing): merge live WCP license into FeatureFlags, refreshed pre-register - #5537
Draft
adrians5j wants to merge 3 commits into
Draft
feat(licensing): merge live WCP license into FeatureFlags, refreshed pre-register#5537adrians5j wants to merge 3 commits into
adrians5j wants to merge 3 commits into
Conversation
…pre-register Phase 3 (tracer) of the licensing/feature-flags redesign. Makes register-time feature-flag gating valid by loading the WCP license BEFORE the per-request register phase, and folding it into FeatureFlags so api-* read only flags. - loadWcpLicense: add single-flight (coalesce concurrent WCP fetches) + a sync getCachedWcpLicense() read. - WcpLicenseRefreshDecorator (api-event-handler-core): a ChildContainerFactory pre-register decorator that awaits loadWcpLicense() before the child's register phase. Wired via the new `app` hook on createLambdaHandler/createServerHandler, registered by both createWebinyApiHandler (aws + server). - FeatureFlagsWithLicenseDecorator (api-core): FeatureFlags.get() now returns the EFFECTIVE flags (userFlag && license.canUseX()) — the runtime counterpart of @webiny/project's build-time GetFeatureFlagsWithLicense. - api-file-manager AssetDeliveryFeature: private-files gate now reads FeatureFlags.get().isPrivateFilesEnabled() (register-time, license-merged) instead of WcpContext.canUsePrivateFiles(). WcpLicenseInitializer / WcpContext stay for the not-yet-migrated canUse* sites; RequestInitializer removal + the featureFlags gql query are follow slices. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Rg3MRCToopzWSTPWqU9Lga
…terApiHandlerApp The pre-register license-refresh 'app' hook was duplicated in both createWebinyApiHandler (aws + server). Extract to registerApiHandlerApp in api-event-handler-core (sibling of registerApiRequestStack) — both handlers now pass 'app: registerApiHandlerApp'. WcpLicenseRefreshDecorator becomes internal. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Rg3MRCToopzWSTPWqU9Lga
…hook) Drop the ChildContainerFactory app-decorator + registerApiHandlerApp helper — they forced both createWebinyApiHandler (aws + server) to wire `app:`. Instead `registerApiRequestStack` (the shared request stack both hosting types already call) does `await loadWcpLicense()` before any feature registers, so the license is fresh for register()-time flag checks with zero per-handler wiring. The `app` prop on createLambdaHandler/createServerHandler/HandlerApp stays for future transport-specific decoration. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Rg3MRCToopzWSTPWqU9Lga
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.
What (Phase 3 — licensing tracer)
Makes register-time feature-flag gating valid by loading the WCP license before the per-request register phase and folding it into
FeatureFlags, soapi-*read only flags — neverWcpContext.Changes
loadWcpLicense— single-flight (coalesce concurrent WCP fetches — no two at once, the self-hosted concern) + a syncgetCachedWcpLicense().WcpLicenseRefreshDecorator(api-event-handler-core) — aChildContainerFactorypre-register decorator:await loadWcpLicense()before the child's register phase. Wired via a newapphook oncreateLambdaHandler/createServerHandler, registered by bothcreateWebinyApiHandler(aws + server). This is the pre-child-container lifecycle hook the whole redesign was built around.FeatureFlagsWithLicenseDecorator(api-core) —FeatureFlags.get()now returns the effective flags (userFlag && license.canUseX()). Runtime counterpart of@webiny/project's build-timeGetFeatureFlagsWithLicense.AssetDeliveryFeature(api-file-manager) — private-files gate now readsFeatureFlags.get().isPrivateFilesEnabled()(register-time, license-merged) instead ofWcpContext.canUsePrivateFiles().Why it's correct now (was the #5523 bug)
Register runs per-request in the child; the license is refreshed pre-register (module cache), so
FeatureFlags.get()at register time is fresh. A license change takes effect on the next request (5-min TTL) — no redeploy — because the child re-registers each request.Not in this slice (follow-ups)
WcpLicenseInitializer+ theRequestInitializerabstraction (pairs withWcpContextdeletion once allcanUse*sites migrate).featureFlagsgql query (admin) + a merge unit test.WcpContextsites (Phase 4).Verification
🤖 Generated with Claude Code
https://claude.ai/code/session_01Rg3MRCToopzWSTPWqU9Lga