Skip to content

feat(leaving-soon): add duration property for explicit deletion dates#245

Merged
rfsbraz merged 2 commits intomainfrom
fix/leaving-soon-schedule
Mar 6, 2026
Merged

feat(leaving-soon): add duration property for explicit deletion dates#245
rfsbraz merged 2 commits intomainfrom
fix/leaving-soon-schedule

Conversation

@rfsbraz
Copy link
Copy Markdown
Owner

@rfsbraz rfsbraz commented Mar 1, 2026

Summary

  • Adds a duration property to leaving_soon config (e.g., 7d, 24h) that defines how long items stay before deletion
  • Displays the exact removal date in all notification providers (email, Discord, Slack, Telegram) and the Plex collection description
  • Falls back to schedule-derived date when duration is not set, preserving current behavior

Test plan

  • Unit tests for duration parsing (parse_leaving_soon_duration) — valid formats, invalid formats, edge cases
  • Unit tests for compute_deletion_date — duration priority, schedule fallback, neither set
  • Schema tests for LeavingSoonConfig.duration field
  • Regression config (tests/configs/0.3.0_leaving_soon_duration.yaml)
  • Verify notifications show date when duration is set
  • Verify current behavior preserved when duration is omitted

Allow users to configure how long items stay in the "Leaving Soon" state
before deletion, replacing vague "next cleanup cycle" text with a concrete
date in notifications and Plex collection descriptions.

The duration field accepts formats like "7d" (days) or "24h" (hours).
When set, all notification providers (email, Discord, Slack, Telegram)
and the Plex collection summary display the exact removal date.
Falls back to schedule-derived date if duration is not configured.
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 1, 2026

🐳 A Docker image for this PR will be available after the build completes:

docker run -e LOG_LEVEL=DEBUG --rm \
  -v ./config:/config \
  -v ./logs:/config/logs \
  ghcr.io/rfsbraz/deleterr:pr-245

Note: This image is built for linux/amd64 only. The image is pushed to GHCR (not Docker Hub) for PR testing.

Items added to the leaving soon collection were deleted on the very
next run regardless of the configured duration. The duration property
was display-only — used for notifications and collection summaries but
never checked before deleting.

Add a state file (/config/.deleterr_state.json) that records when each
item was tagged to the leaving soon collection. On each run, items are
only eligible for deletion once tagged_at + duration has elapsed.

Key behaviors:
- No duration configured: existing behavior (delete on next run)
- Duration not elapsed: skip deletion, log remaining time
- Duration elapsed: delete as normal
- State file missing/corrupt: treat items as newly tagged (conservative)
- Daily schedule with 7d duration: items wait the full 7 days across
  multiple runs, staying in the collection until eligible

Fixes #244
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud bot commented Mar 2, 2026

Quality Gate Failed Quality Gate failed

Failed conditions
4.6% Duplication on New Code (required ≤ 3%)

See analysis details on SonarQube Cloud

@rfsbraz rfsbraz self-assigned this Mar 6, 2026
@rfsbraz rfsbraz merged commit 747e6d0 into main Mar 6, 2026
8 of 9 checks passed
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.

1 participant