<#7056 Add ARCHIVED state to LaunchPlanState enum>...
# flyte-github
a
#7056 Add ARCHIVED state to LaunchPlanState enum Pull request opened by blaketastic2 Tracking issue N/A — this addresses a common operational pain point with no existing tracking issue. Why are the changes needed? Every
pyflyte register
creates new launch plan versions, and nothing cleans up old ones. Over time this leads to heavier list queries, more data to page through, and increased memory pressure on Admin. Today the only cleanup mechanism is
UpdateLaunchPlan
to set state
INACTIVE
, but
INACTIVE
has meaning in the active/inactive schedule lifecycle — conflating "old cruft" with "intentionally deactivated" makes filtering unreliable. Users who discover downstream launch plans via
ListLaunchPlans
(e.g. filtering on
workflow.short_description
) get back all versions across all deploys when they only care about the latest. Adding
ARCHIVED
(value
2
) gives operators a distinct state they can set on old versions and filter out (
ne(state,2)
), enabling a scheduled cleanup pattern: keep the most recent N versions per named entity, archive the rest, never touch the active one. What changes were proposed in this pull request? flyteidl (proto + generated code): • Add
ARCHIVED = 2
to the
LaunchPlanState
enum in
launch_plan.proto
• Regenerate bindings for Go, Python, Rust, TypeScript, and JavaScript • Update both swagger JSON files (gateway + client assets) flyteadmin: • Add
archiveLaunchPlan
method to
LaunchPlanManager
— same behavior as
disableLaunchPlan
(disables any active schedule, updates the DB) but sets state to
ARCHIVED
instead of
INACTIVE
• Add
case admin.LaunchPlanState_ARCHIVED
to the
UpdateLaunchPlan
switch flytectl: • Repurpose the
--archive
flag to set
LaunchPlanState_ARCHIVED
instead of mapping to
INACTIVE
. This flag was previously deprecated in #449 as an alias for
--deactivate
because "archive" was misleading when no
ARCHIVED
state existed. Now that the state exists,
--archive
does what the name implies. • Update mutual exclusion logic to handle three flags (
--activate
,
--deactivate
,
--archive
) • Remove the now-unused
deprecatedCommandWarning
function • Update help text and flag descriptions Note on
--archive
behavioral change:
Prior to this PR,
--archive
was a deprecated alias for
--deactivate
(set state to `INACTIVE`/`0`). After this PR,
--archive
sets state to `ARCHIVED`/`2`. Anyone relying on the deprecated
--archive
flag to deactivate launch plans should switch to
--deactivate
. How was this patch tested? • Updated
TestLaunchPlanCanBeArchived
in flytectl to verify
--archive
now sets
ARCHIVED
state • All existing flyteadmin manager impl tests pass (launch plan manager, transformers, utils, validation) • All existing flytectl update tests pass • Both
flyteadmin
and
flytectl
compile cleanly Labels • added: New
ARCHIVED
launch plan state Check all the applicable boxes • I updated the documentation accordingly. • All new and existing tests passed. • All commits are signed-off. flyteorg/flyte