Skip to content

fix(ttl-reaper): log unparseable ttl-deadline only when it fails to parse (#1524) - #1545

Merged
scttfrdmn merged 1 commit into
mainfrom
fix/1524-reaper-deadline-log
Nov 6, 2026
Merged

scttfrdmn merged 1 commit into
mainfrom
fix/1524-reaper-deadline-log

Conversation

@scttfrdmn

Copy link
Copy Markdown
Contributor

Fixes #1524

What

lambda/ttl-reaper evaluate logged instance <id>: unparseable ttl-deadline "<value>", falling back to spawn:ttl, then max-age for every instance whose spawn:ttl-deadline parsed and was still in the future. The log.Printf sat after the if deadline, err := time.Parse(...); err == nil { ... } block instead of in its else. It now sits in the else, so it fires only for a value that does not parse.

Root cause, and is the decision affected?

The slip came in with #824 (e167ed4). That PR replaced the within-deadline return candidate{}, false with a fall-through to the max-age ceiling, but left the log line where it was. Before #824 the return made the line unreachable for a valid deadline. After it, every valid future deadline reached the line.

No reap decision changes. haveDeadline was already set inside the parse block, so a valid deadline skipped the spawn:ttl fallback, and the max-age ceiling applied either way. Only the log line was misplaced. The decision logic around it is correct. The FSx path (evaluateFSx) has the same shape but returns inside the parse block, so it never had the bug.

Test

lambda/ttl-reaper/deadline_log_test.go captures the log with the existing captureLogs helper. For each case it asserts both whether the line appears and the decision (expired, reason):

case log line decision
valid future deadline absent spared
valid past deadline absent reaped, ttl-deadline
valid future deadline, past max-age absent reaped, max-age
garbage, young present spared
garbage, past max-age present reaped, max-age
garbage, with an expired spawn:ttl present reaped, ttl (the fallback still runs)

Revert gate: with main.go reverted and the test kept, the test fails:

--- FAIL: TestEvaluate_UnparseableDeadlineLogOnlyForGarbage/valid_future_deadline
    deadline_log_test.go:50: log contains "unparseable ttl-deadline" = true, want false
--- FAIL: TestEvaluate_UnparseableDeadlineLogOnlyForGarbage/valid_future_deadline_past_max-age
    deadline_log_test.go:50: log contains "unparseable ttl-deadline" = true, want false

All decision assertions pass on both sides of the revert, which shows the decision did not change.

Deploy

The ttl-reaper is a deployed Lambda. The fix takes effect only when it is redeployed. On the release's deploy checklist it should appear as code-only: no template, parameter or IAM change.

Checks (hermetic: AWS env stripped)

  • lambda/ttl-reaper: go test ./... passes, plus gofmt and go vet
  • make check: passes
  • root go test ./...: passes
  • make test-e2e-tier0: passes
  • semgrep scan --config=auto --error lambda/ttl-reaper: clean
  • make gen-docs / make api-snapshot: not affected (no CLI or pkg/ API change)

🤖 Generated with Claude Code

@codecov

codecov Bot commented Nov 6, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

…arse (#1524)

The log line sat after the parse block instead of in its else, so every
instance with a valid future deadline (which falls through to the max-age
ceiling since #824) logged it on every cycle. Decisions are unchanged.

Co-Authored-By: Claude <[email protected]>
@scttfrdmn
scttfrdmn force-pushed the fix/1524-reaper-deadline-log branch from a4076bd to 2e54b15 Compare November 6, 2026 17:38
@scttfrdmn
scttfrdmn merged commit 44f7dad into main Nov 6, 2026
9 checks passed
@scttfrdmn
scttfrdmn deleted the fix/1524-reaper-deadline-log branch November 6, 2026 18:02
@scttfrdmn scttfrdmn mentioned this pull request Nov 6, 2026
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ttl-reaper: logs "unparseable ttl-deadline" for every instance with a valid future deadline

1 participant