feat(license): surface execution/log/metric retention days on Environment

Adds three int fields to the Environment record + repository row mapper,
matching the columns added in V5. Default value is 1 per the V5 NOT NULL
DEFAULT 1. Read DTO surfaces the fields via Jackson record serialization;
setter endpoint deferred to a follow-up that wires the corresponding
license cap checks.

The canonical constructor enforces >= 1 for each retention field — V5
guarantees this at the DB level, but the runtime guard catches in-memory
construction errors (e.g., test sites that pass 0).

Test sites updated to the 12-arg signature with retention defaults of 1.
EnvironmentAdminControllerIT gains a regression test asserting the wire
shape exposes all three fields.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
hsiegeln
2026-04-26 15:22:40 +02:00
parent 046f08fe87
commit cc5d88d708
9 changed files with 51 additions and 10 deletions

View File

@@ -13,5 +13,23 @@ public record Environment(
Map<String, Object> defaultContainerConfig,
Integer jarRetentionCount,
String color,
Instant createdAt
) {}
Instant createdAt,
int executionRetentionDays,
int logRetentionDays,
int metricRetentionDays
) {
public Environment {
if (executionRetentionDays < 1) {
throw new IllegalArgumentException(
"executionRetentionDays must be >= 1 (got " + executionRetentionDays + ")");
}
if (logRetentionDays < 1) {
throw new IllegalArgumentException(
"logRetentionDays must be >= 1 (got " + logRetentionDays + ")");
}
if (metricRetentionDays < 1) {
throw new IllegalArgumentException(
"metricRetentionDays must be >= 1 (got " + metricRetentionDays + ")");
}
}
}