You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Proposal: Add lifecycle_type column to apps, droplets, and builds #5067
Lifecycle type (buildpack, docker, cnb) is not stored directly on apps, droplets, or builds. It is derived at runtime by checking for the existence of associated lifecycle data records:
Expensive list queries - GET /v3/apps?lifecycle_type=docker requires excluding apps from bothbuildpack_lifecycle_data and cnb_lifecycle_data tables via subqueries
Unnecessary eager loading - Presenters load lifecycle data associations just to determine the type string, even when the full lifecycle data is not needed
Implicit semantics - "docker" is the absence of other types, not an explicit value
Proposed Solution
Add a lifecycle_type VARCHAR column (with index) to apps, droplets, and builds tables.
Populate for new records via AppCreate, V2::AppCreate, and before_create hooks on droplets/builds
Fallback to association lookup for existing records
Model validation ensures only valid lifecycle types (buildpack, cnb, docker)
Deploy 2:
Backfill existing records based on lifecycle data tables
Make columns non-nullable
Remove fallback logic
Optimize AppListFetcher: subqueries → simple WHERE clause
Optimize presenters: skip eager-loading lifecycle data for type determination
Impact After Deploy 2
Area
Before
After
AppListFetcher lifecycle_type filter
3 subqueries on lifecycle data tables
1 simple WHERE lifecycle_type = ?
Presenters (App, Build, Droplet, Process)
Eager-load lifecycle data associations to determine type
Read column value directly
Lifecycle type checks in controllers
Association lookups
O(1) column read
Docker type semantics
Implicit (absence of other types)
Explicit column value
Endpoints That Benefit
Critical:GET /v3/apps with lifecycle_type filter (subquery elimination)
High: All list and detail endpoints for apps, droplets, builds, and processes (presenter eager-load avoidance)
Medium:POST /v3/apps, POST /v3/builds, POST /v3/apps/:guid/actions/start, POST /v3/apps/:guid/actions/restage, POST /v3/spaces/:guid/actions/apply_manifest, POST /v3/droplets/:guid/copy, staging completion (controller-level type checks)
Activity
philippthun commentedon Jun 19, 2026
Periodic backfill job to be run between "Deploy 1" and "Deploy 2": #5196