Skip to content

Make site runtime a global feature flag - #3456

Merged
bcotrim merged 11 commits into
trunkfrom
rsm-1689-make-runtime-global-feature-flag
May 20, 2026
Merged

Make site runtime a global feature flag#3456
bcotrim merged 11 commits into
trunkfrom
rsm-1689-make-runtime-global-feature-flag

Conversation

@bcotrim

@bcotrim bcotrim commented May 12, 2026

Copy link
Copy Markdown
Contributor

Related issues

  • Fixes RSM-1689

How AI was used in this PR

AI helped trace the existing runtime storage and startup paths, implement the env-driven behavior, and update focused tests. I reviewed the changes and adjusted them based on review feedback so runtime is no longer treated as site data.

Proposed Changes

  • Add a nativePhpRuntime beta feature to the existing app menu beta-features flow.
  • Apply that beta feature to STUDIO_RUNTIME before Studio fetches sites or spawns CLI commands.
  • Make CLI site start, blueprint, WP-CLI, and browser-opening behavior resolve runtime from the global env var instead of per-site runtime.
  • Stop persisting or emitting runtime as site metadata.

Testing Instructions

  • Open the app menu and enable the Native PHP runtime beta feature.
  • Start an existing site that does not have a per-site runtime prop and confirm it uses the native PHP path.
  • Disable the beta feature, start a site again, and confirm it uses the Playground path.
  • Run CLI commands with STUDIO_RUNTIME=native-php and confirm existing sites use the native PHP runtime without requiring stored site metadata.
  • Run CLI commands without STUDIO_RUNTIME and confirm existing sites default to Playground.
  • Confirm site creation and site listing no longer persist or emit runtime.

Pre-merge Checklist

  • Have you checked for TypeScript, React or other console errors?
@bcotrim bcotrim self-assigned this May 12, 2026
@bcotrim
bcotrim marked this pull request as ready for review May 13, 2026 11:31
@bcotrim
bcotrim requested a review from fredrikekelund May 13, 2026 11:31
@wpmobilebot

wpmobilebot commented May 13, 2026

Copy link
Copy Markdown
Collaborator

📊 Performance Test Results

Comparing 5aa66fe vs trunk

app-size

Metric trunk 5aa66fe Diff Change
App Size (Mac) 1376.03 MB 1354.58 MB 21.46 MB 🟢 -1.6%

site-editor

Metric trunk 5aa66fe Diff Change
load 1481 ms 1487 ms +6 ms ⚪ 0.0%

site-startup

Metric trunk 5aa66fe Diff Change
siteCreation 8569 ms 8577 ms +8 ms ⚪ 0.0%
siteStartup 4943 ms 4933 ms 10 ms ⚪ 0.0%

Results are median values from multiple test runs.

Legend: 🟢 Improvement (faster) | 🔴 Regression (slower) | ⚪ No change (<50ms diff)

@fredrikekelund fredrikekelund left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can do away with SiteProcessDescription for a smaller diff, but functionally, this works great 👍 The logic is clear

Comment on lines -45 to -46
// @ts-expect-error If `BetaFeatures` is empty, `key` will be `never`, and we cannot use it to
// assign to`betaFeatures`.That's fine. Just rely on type checking when this function is called.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we keep this comment, but just remove the @ts-expect-error part? This will become troublesome again once we remove this beta feature.

Comment on lines +41 to +43
export type SiteProcessDescription = ProcessDescription & {
runtime: SiteRuntime;
};

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't believe we need this separate type. ProcessDescription is inferred from processDescriptionSchemaBase, which already has a runtime prop. Yes, that prop can be undefined, which this type doesn't allow, but that doesn't appear to be an issue.

@fredrikekelund fredrikekelund left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Splendid! Clean and understandable 👍

scriptPath: string;
args: string[];
env: NodeJS.ProcessEnv;
runtime: SiteRuntime;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could leave a comment to highlight that this is only needed to know where WP-CLI commands should be executed.

@bcotrim
bcotrim merged commit 1c8ed9d into trunk May 20, 2026
10 checks passed
@bcotrim
bcotrim deleted the rsm-1689-make-runtime-global-feature-flag branch May 20, 2026 13:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

3 participants