Repository navigation
Soft delete and restore media assets - #2555
Merged
Merged
Conversation
# Conflicts: # CONTRIBUTING.md # src/FluentCMS.Infrastructure/Persistence/Migrations/PostgreSql/PostgreSqlFluentCmsDbContextModelSnapshot.cs # src/FluentCMS.Infrastructure/Persistence/Migrations/Sqlite/SqliteFluentCmsDbContextModelSnapshot.cs
# Conflicts: # tests/FluentCMS.IntegrationTests/Mcp/McpAgents.cs
# Conflicts: # tests/FluentCMS.IntegrationTests/Mcp/McpAgents.cs
# Conflicts: # CONTRIBUTING.md
# Conflicts: # CONTRIBUTING.md # src/FluentCMS.Core/Builtin/Tools/ToolJson.cs # src/FluentCMS.Core/Media/IMediaLibrary.cs # src/FluentCMS.Core/Tools/ToolArgumentsReader.cs # src/FluentCMS.Infrastructure/Media/MediaAssetRows.cs # src/FluentCMS.Infrastructure/Media/MediaLibrary.cs # tests/FluentCMS.IntegrationTests/Mcp/ConnectedAgent.cs # tests/FluentCMS.IntegrationTests/Mcp/McpAgents.cs # tests/FluentCMS.Tests/Tools/McpCoverageTests.cs # tests/FluentCMS.Tests/Tools/ToolProviderConformanceTests.cs
# Conflicts: # src/FluentCMS.Core/Builtin/Tools/MediaTools.cs # tests/FluentCMS.IntegrationTests/Mcp/MediaToolsTests.cs
# Conflicts: # CONTRIBUTING.md
…that is neither published nor in the set
# Conflicts: # CONTRIBUTING.md
# Conflicts: # src/FluentCMS.Core/Builtin/Checks/AltTextCheckType.cs # src/FluentCMS.Core/Builtin/Tools/CheckTools.cs # src/FluentCMS.Core/Checks/ChangeSetChecks.cs # src/FluentCMS.Core/Checks/CheckInput.cs # tests/FluentCMS.IntegrationTests/Mcp/MediaToolsTests.cs # tests/FluentCMS.IntegrationTests/Media/AltTextCheckTests.cs
This was referenced Oct 26, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #2553
Built on media storage (#2543), media in change sets (#2546) and the alt text check (#2549), all merged.
What
The last slice of F-MED (#2427): assets are soft deleted and can be restored within the retention window, as entries are (#2502, CNT-06, REL-03).
IMediaLibrary):DeleteAsync(id, baseVersion)andRestoreAsync(id).ListDeletedAsync(), which returns eachDeletedAssetwith when it was deleted and until when it can be restored, most recent first.asset_not_deletedandretention_expired.reference_not_found. A change set operation pointing at it cannot be added, and a set that already holds one fails to publish until the asset is restored, as for deleted entries.DeletedAt + Content__DeletedRetentionis still in the future. Versions, bytes and the published pointer are never touched, so the asset comes back exactly as it was.MediaAssets.DeletedAt.version_conflictorasset_not_deletedinstead of both succeeding.media.deleted(with the latest version's row as previous version) andmedia.restored, appended in the same unit of work.Why
CNT-06 and REL-03 require that nothing is hard-deleted inside the window. Media follows the entry design so that a person restores both the same way.
Choices worth a look:
delete_entryand media delete operations in change sets only unpublish.where_usedtool still lists the pages that show a deleted asset, so an agent can say what the delete affects. The admin asset page shows a deleted asset as not found, like every other read.Tests
Integration tests, each on SQLite and PostgreSQL:
reference_not_found.media.deletednames it and its version row.media.restored.retention_expiredand appends nothing.The full suite ran locally against a
postgres:17container as well as SQLite. The migration was regenerated on top ofProposedMediaVersions(#2549). The migration tests apply and revert it on SQLite and PostgreSQL. No new package and no new project reference.Review
An independent review gave MERGE, with Low findings:
Checklist
v2