Skip to content

⚠️ remove AllowSystemDeleteAfter from the database#1720

Merged
MagnusHAa merged 9 commits intomainfrom
feat/remove-systemdeleteafter-from-db
Feb 17, 2026
Merged

⚠️ remove AllowSystemDeleteAfter from the database#1720
MagnusHAa merged 9 commits intomainfrom
feat/remove-systemdeleteafter-from-db

Conversation

@MagnusHAa
Copy link
Collaborator

@MagnusHAa MagnusHAa commented Feb 4, 2026

Description

Database migration to remove the allowSystemDeleteAfter column.

Related Issue(s)

Verification

  • Your code builds clean without any errors or warnings
  • Manual testing done (required)
  • Relevant automated test added (if you find this hard, leave it and we'll help out)
  • All tests run green
  • If pre- or post-deploy actions (including database migrations) are needed, add a description, include a "Pre/Post-deploy actions" section below, and mark the PR title with ⚠️

Documentation

  • User documentation is updated with a separate linked PR in altinn-studio-docs. (if applicable)

Pre-deploy

Wait for #1718 to be in production.

Summary by CodeRabbit

  • Bug Fixes

    • Improved correspondence cleanup and removed an obsolete delete-timestamp field from the data model to streamline dialog expiration handling.
  • Documentation

    • Simplified maintenance controller documentation to reflect the updated cleanup behavior.
  • Tests

    • Updated tests and test data generation to match the revised data schema and retrieval logic.
  • Chores

    • Added a database migration to remove the deprecated column and updated model snapshot.

@MagnusHAa MagnusHAa self-assigned this Feb 4, 2026
@MagnusHAa MagnusHAa added the kind/chore changes that do not relate to a fix or feature and don't modify src or test files label Feb 4, 2026
@MagnusHAa MagnusHAa linked an issue Feb 4, 2026 that may be closed by this pull request
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 4, 2026

📝 Walkthrough

Walkthrough

Removes the AllowSystemDeleteAfter column/property across the codebase: entity property removed, DB migration dropping the column added, repository method renamed, handlers/tests updated to the new method and to stop producing the removed column, and test SQL/data generation adjusted.

Changes

Cohort / File(s) Summary
Database Migration & Model Snapshot
src/Altinn.Correspondence.Persistence/Migrations/20260204125820_RemoveAllowSystemDeleteAfter.cs, src/Altinn.Correspondence.Persistence/Migrations/20260204125820_RemoveAllowSystemDeleteAfter.Designer.cs, src/Altinn.Correspondence.Persistence/Migrations/ApplicationDbContextModelSnapshot.cs
Adds EF Core migration that drops AllowSystemDeleteAfter from correspondence.Correspondences; updates model snapshot and navigation naming.
Entity & Repository Interface
src/Altinn.Correspondence.Core/Models/Entities/CorrespondenceEntity.cs, src/Altinn.Correspondence.Core/Repositories/ICorrespondenceRepostitory.cs
Removes AllowSystemDeleteAfter property from CorrespondenceEntity; renames repository method GetCorrespondencesByIdsWithExternalReferenceAndAllowSystemDeleteAfterGetCorrespondencesByIdsWithExternalReference.
Repository Implementation
src/Altinn.Correspondence.Persistence/Repositories/CorrespondenceRepository.cs
Renamed method to match interface change; implementation preserved.
Application Handler & Controller
src/Altinn.Correspondence.Application/CleanupPerishingDialogs/CleanupPerishingDialogsHandler.cs, src/Altinn.Correspondence.API/Controllers/MaintenanceController.cs
Handler now calls renamed repository method; controller XML docstring shortened (no behavior change).
Tests & Test Data Generation
Test/Altinn.Correspondence.Tests/TestingHandler/CleanupPerishingDialogsHandlerTests.cs, Test/Altinn.Correspondence.LoadTests.DatabasePopulater/DatabasePopulator.cs, Test/Altinn.Correspondence.LoadTests.DatabasePopulater/generate_test_data_function.sql
Test mocks and data generators updated to remove AllowSystemDeleteAfter from inserted columns/lines and to use the renamed repository method.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • Ceredron
🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 28.57% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically identifies the main change: removing the AllowSystemDeleteAfter column from the database, which aligns with the primary objective and changes throughout the PR.
Description check ✅ Passed The description addresses all required sections: provides a clear summary of changes, references the related issue (#1693), completes the verification checklist, and includes pre-deploy instructions as indicated by the ⚠️ marker.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/remove-systemdeleteafter-from-db

No actionable comments were generated in the recent review. 🎉


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@Test/Altinn.Correspondence.LoadTests.DatabasePopulater/DatabasePopulator.cs`:
- Around line 117-121: The COPY column list for
"correspondence"."Correspondences" has 14 columns but CreateCorrespondenceLine
still produces 15 values; remove the stale AllowSystemDeleteAfter value (the
DateTimeOffset.Now.AddMonths(6) entry) from the CreateCorrespondenceLine method
so the number and order of values match the column list, and verify any trailing
commas or value separators are adjusted accordingly to avoid a COPY column count
mismatch.

@MagnusHAa MagnusHAa merged commit ba76f23 into main Feb 17, 2026
9 checks passed
@MagnusHAa MagnusHAa deleted the feat/remove-systemdeleteafter-from-db branch February 17, 2026 14:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/chore changes that do not relate to a fix or feature and don't modify src or test files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants