From 003fd844f0ae8852c81df42d89631d62aa43640e Mon Sep 17 00:00:00 2001 From: Ben Apprederisse Date: Mon, 1 Jun 2026 16:34:49 -0700 Subject: [PATCH] Fix Lambda actionable EOL status Co-authored-by: Amp Amp-Thread-ID: https://ampcode.com/threads/T-019e8526-3375-7673-9279-3f1527b4b2bb --- pkg/config/defaults/resources.yaml | 5 +++-- pkg/config/loader_test.go | 17 +++++++++++++++++ pkg/eol/endoflife/ADAPTERS.md | 7 ++++--- pkg/eol/endoflife/adapters_test.go | 16 ++++++++++------ 4 files changed, 34 insertions(+), 11 deletions(-) diff --git a/pkg/config/defaults/resources.yaml b/pkg/config/defaults/resources.yaml index 9aab2c5..2ea1d71 100644 --- a/pkg/config/defaults/resources.yaml +++ b/pkg/config/defaults/resources.yaml @@ -320,7 +320,8 @@ resources: product: aws-lambda # Lambda's `support` date is the first/actionable runtime EOL date. # The upstream `eol` date is AWS's later terminal deprecated-support - # date. Keep both in the finding's eol block, but warn on the first date. + # date. Keep both in the finding's eol block, but use the actionable + # date as the status-driving EOLDate so past-support runtimes are RED. schema: declarative lifecycle: deprecation_date: @@ -329,7 +330,7 @@ resources: field: eol deprecated_window: deprecated_support eol_date: - field: eol + field: support # To add a new resource type, follow skills/add-version-guard-resource. # Standalone copy-paste templates live in skills/add-version-guard-resource/examples/. diff --git a/pkg/config/loader_test.go b/pkg/config/loader_test.go index 1a72a34..a36d7a9 100644 --- a/pkg/config/loader_test.go +++ b/pkg/config/loader_test.go @@ -158,6 +158,23 @@ func TestLoadResourcesConfig_EmbeddedDefault(t *testing.T) { assert.NotEmpty(t, r.Inventory.RequiredMappings["resource_id"], "resource %q missing required_mappings.resource_id", r.ID) } + + byID := make(map[string]ResourceConfig, len(cfg.Resources)) + for _, r := range cfg.Resources { + byID[r.ID] = r + } + + eks := byID["eks"] + require.NotNil(t, eks.EOL.Lifecycle) + assert.Equal(t, "extendedSupport", eks.EOL.Lifecycle.EOLDate.Field, + "EKS eol_date must stay on extendedSupport so the terminal EOL is end of extended support") + + lambda := byID["lambda"] + require.NotNil(t, lambda.EOL.Lifecycle) + assert.Equal(t, "support", lambda.EOL.Lifecycle.EOLDate.Field, + "Lambda eol_date must stay on support so the actionable runtime EOL drives RED status") + assert.Equal(t, "eol", lambda.EOL.Lifecycle.DeprecatedSupportEnd.Field, + "Lambda deprecated_support_end should preserve AWS's later terminal date") } // TestLoadResourcesConfig_OverridePath asserts the override semantic: diff --git a/pkg/eol/endoflife/ADAPTERS.md b/pkg/eol/endoflife/ADAPTERS.md index 8f7047c..4b46d42 100644 --- a/pkg/eol/endoflife/ADAPTERS.md +++ b/pkg/eol/endoflife/ADAPTERS.md @@ -139,15 +139,16 @@ eol: lifecycle: deprecation_date: field: support - extended_support_end: + deprecated_support_end: field: eol + deprecated_window: deprecated_support eol_date: field: support ``` For `python3.8` (`support: 2024-10-14`, `eol: 2027-03-03`), the emitted -`EOLDate` is `2024-10-14`, while `ExtendedSupportEnd` preserves the later -AWS terminal date for downstream consumers that need it. Dates after +`EOLDate` is `2024-10-14`, while `DeprecatedSupportEnd` preserves the +later AWS terminal date for downstream consumers that need it. Dates after `support` become true EOL / RED. --- diff --git a/pkg/eol/endoflife/adapters_test.go b/pkg/eol/endoflife/adapters_test.go index 7f80da6..b4faa1e 100644 --- a/pkg/eol/endoflife/adapters_test.go +++ b/pkg/eol/endoflife/adapters_test.go @@ -300,7 +300,7 @@ func lambdaActionableEOLAdapter(t *testing.T) *DeclarativeSchemaAdapter { adapter, err := NewDeclarativeSchemaAdapter(&DeclarativeLifecycleConfig{ DeprecationDate: LifecycleDateSource{Field: lifecycleFieldSupport}, DeprecatedSupportEnd: LifecycleDateSource{Field: lifecycleFieldEOL}, - EOLDate: LifecycleDateSource{Field: lifecycleFieldEOL}, + EOLDate: LifecycleDateSource{Field: lifecycleFieldSupport}, DeprecatedWindow: lifecycleActionDeprecatedSupport, }) require.NoError(t, err) @@ -394,7 +394,7 @@ func TestDeclarativeSchemaAdapter_LambdaPreservesActionableAndTerminalDates(t *t require.NotNil(t, lifecycle.DeprecationDate) require.NotNil(t, lifecycle.DeprecatedSupportEnd) assert.Nil(t, lifecycle.ExtendedSupportEnd) - assert.Equal(t, terminal.Format("2006-01-02"), lifecycle.EOLDate.Format("2006-01-02")) + assert.Equal(t, support.Format("2006-01-02"), lifecycle.EOLDate.Format("2006-01-02")) assert.Equal(t, support.Format("2006-01-02"), lifecycle.DeprecationDate.Format("2006-01-02")) assert.Equal(t, terminal.Format("2006-01-02"), lifecycle.DeprecatedSupportEnd.Format("2006-01-02")) assert.True(t, lifecycle.IsSupported) @@ -402,7 +402,7 @@ func TestDeclarativeSchemaAdapter_LambdaPreservesActionableAndTerminalDates(t *t assert.False(t, lifecycle.IsEOL) } -func TestDeclarativeSchemaAdapter_LambdaPastActionableDateIsDeprecatedSupport(t *testing.T) { +func TestDeclarativeSchemaAdapter_LambdaPastActionableDateIsEOL(t *testing.T) { adapter := lambdaActionableEOLAdapter(t) cycle := &ProductCycle{ @@ -415,11 +415,15 @@ func TestDeclarativeSchemaAdapter_LambdaPastActionableDateIsDeprecatedSupport(t lifecycle, err := adapter.AdaptCycle(cycle) require.NoError(t, err) - assert.True(t, lifecycle.IsSupported) + assert.False(t, lifecycle.IsSupported) assert.True(t, lifecycle.IsDeprecated) - assert.False(t, lifecycle.IsEOL) - assert.True(t, lifecycle.IsDeprecatedSupport) + assert.True(t, lifecycle.IsEOL) + assert.False(t, lifecycle.IsDeprecatedSupport) assert.False(t, lifecycle.IsExtendedSupport) + require.NotNil(t, lifecycle.EOLDate) + require.NotNil(t, lifecycle.DeprecatedSupportEnd) + assert.Equal(t, cycle.Support, lifecycle.EOLDate.Format("2006-01-02")) + assert.Equal(t, cycle.EOL, lifecycle.DeprecatedSupportEnd.Format("2006-01-02")) } func TestDeclarativeSchemaAdapter_EKSCurrentVersion(t *testing.T) {