Skip to content

feat: apply media attachment decay settings retroactively - #1182

Open
SudhanshuMatrix wants to merge 1 commit into
fluxerapp:mainfrom
SudhanshuMatrix:fix/media-expiry-retroactive
Open

feat: apply media attachment decay settings retroactively#1182
SudhanshuMatrix wants to merge 1 commit into
fluxerapp:mainfrom
SudhanshuMatrix:fix/media-expiry-retroactive

Conversation

@SudhanshuMatrix

Copy link
Copy Markdown

Summary

  • What changed:

    • Added a new background task recalculateAttachmentDecay that scans all attachment decay entries in ScyllaDB/Cassandra and retroactively applies the latest instance retention rules (or clears expiries if disabled).
    • Integrated the background task to run asynchronously whenever the media configuration is updated in InstanceConfigAdminController.
    • Updated the NATS/Rust microservice message mapping (fluxer_messages) to respect whether attachment decay is currently enabled when constructing message responses.
  • Why it is correct:

    • Previously, media expiry was calculated statically only at the time of upload, meaning admin panel changes did not affect pre-existing attachments. The new background task ensures that settings are retroactively applied to all historical attachments.
  • Risk:

    • Low. The background task queries ScyllaDB/Cassandra using pagination (100 records per page) to prevent query load issues.

Verification

  • Tests run:

    • Created a new integration test suite AttachmentDecayRetroactive.test.ts verifying:
      • Scenario 1: Disabling decay retroactively clears expiries.
      • Scenario 2: Enabling decay retroactively applies the lifetime rules to pre-existing files.
    • Ran the test suite via Vitest:
      npx vitest run src/api/channel/tests/AttachmentDecayRetroactive.test.ts
      (Result: Both scenarios passed successfully).
  • Manual checks:

    • Ran pnpm --filter fluxer_api typecheck and Biome format/lint checks successfully.
  • Screenshots or recordings:

    • None.

Checklist

  • I understand every change in this PR.
  • I can explain what it does and why it is correct.
  • I disclosed any LLM coding help below.

LLM Disclosure

  • Only tests were generated with AI.

@jreoka

jreoka commented Jul 7, 2026

Copy link
Copy Markdown

Yes this is an awesome feature for selfhosters!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants