Skip to content

introduce soft-deletion of commitments#829

Open
wagnerd3 wants to merge 1 commit intomasterfrom
soft_delete_commitments
Open

introduce soft-deletion of commitments#829
wagnerd3 wants to merge 1 commit intomasterfrom
soft_delete_commitments

Conversation

@wagnerd3
Copy link
Contributor

@wagnerd3 wagnerd3 commented Feb 2, 2026

For debugging purposes, it is a little tedious to understand effects which involve hard-deletions of commitments. Therefore, we are introducing a soft-deletion + hard-deletion after grace period of 6 months (TBD).
Also, this aids future development in direction of an advanced billing process because we might need to consider deletion events of commitments with their specific timestamp (deleted_at).

@wagnerd3 wagnerd3 requested a review from a team as a code owner February 2, 2026 10:24
@wagnerd3 wagnerd3 force-pushed the soft_delete_commitments branch from ba99ed4 to 61091a2 Compare February 2, 2026 10:41
@github-actions
Copy link

github-actions bot commented Feb 2, 2026

Merging this branch changes the coverage (1 decrease, 1 increase)

Impacted Packages Coverage Δ 🤖
github.com/sapcc/limes/internal/api 78.09% (+0.02%) 👍
github.com/sapcc/limes/internal/collector 82.36% (-0.04%) 👎
github.com/sapcc/limes/internal/datamodel 85.92% (ø)
github.com/sapcc/limes/internal/db 81.03% (ø)
github.com/sapcc/limes/internal/util 83.52% (ø)

Coverage by file

Changed files (no unit tests)

Changed File Coverage Δ Total Covered Missed 🤖
github.com/sapcc/limes/internal/api/commitment.go 79.88% (+0.04%) 6234 (+12) 4980 (+12) 1254 👍
github.com/sapcc/limes/internal/collector/capacity_scrape.go 83.23% (ø) 930 774 156
github.com/sapcc/limes/internal/collector/commitment_cleanup.go 75.00% (-2.78%) 72 (+18) 54 (+12) 18 (+6) 👎
github.com/sapcc/limes/internal/collector/keystone.go 80.99% (ø) 726 588 138
github.com/sapcc/limes/internal/collector/metrics.go 85.86% (ø) 1824 1566 258
github.com/sapcc/limes/internal/datamodel/consume_transferable_commitments.go 89.26% (ø) 726 648 78
github.com/sapcc/limes/internal/db/builder.go 96.30% (ø) 135 130 5
github.com/sapcc/limes/internal/db/migrations.go 0.00% (ø) 0 0 0
github.com/sapcc/limes/internal/db/models.go 100.00% (ø) 60 60 0
github.com/sapcc/limes/internal/util/datatypes.go 90.00% (ø) 60 54 6

Please note that the "Total", "Covered", and "Missed" counts above refer to code statements instead of lines of code. The value in brackets refers to the test coverage of that file in the old version of the code.

Changed unit test files

  • github.com/sapcc/limes/internal/api/commitment_test.go
  • github.com/sapcc/limes/internal/collector/commitment_cleanup_test.go

if slices.Contains([]liquid.CommitmentStatus{liquid.CommitmentStatusSuperseded, liquid.CommitmentStatusExpired}, dbCommitment.Status) {
http.Error(w, "expired or superseded commitments cannot be transferred", http.StatusBadRequest)
if slices.Contains([]liquid.CommitmentStatus{liquid.CommitmentStatusSuperseded, liquid.CommitmentStatusExpired, util.CommitmentStatusDeleted}, dbCommitment.Status) {
http.Error(w, "expired, superseded and deleted commitments cannot be transferred", http.StatusBadRequest)
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
http.Error(w, "expired, superseded and deleted commitments cannot be transferred", http.StatusBadRequest)
http.Error(w, "expired, superseded or deleted commitments cannot be transferred", http.StatusBadRequest)


// This query updates `project_commitments.status` on all rows that have not
// reached one of the final statuses ("superseded" and "expired").
// reached one of the final statuses ("superseded", "expired" and "deleted").
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
// reached one of the final statuses ("superseded", "expired" and "deleted").
// reached one of the final statuses ("superseded", "expired" or "deleted").

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.

2 participants