feat(license): expand LicenseInfo with licenseId, tenantId, grace period

Required fields per spec §2.1. tenantId is non-blank; gracePeriodDays
defines the post-exp window during which limits keep applying.
isExpired() now honours the grace; isAfterRawExpiry() distinguishes
ACTIVE from GRACE for the state machine in Task 4.

Validator and gate use placeholder values temporarily; Task 3 wires
the validator to read the new fields, Task 5 rewrites the gate.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
hsiegeln
2026-04-26 10:33:16 +02:00
parent 551a7f12b5
commit 2ebe4989bb
6 changed files with 113 additions and 15 deletions

View File

@@ -20,9 +20,9 @@ class LicenseGateTest {
@Test
void loaded_exposesLimits() {
LicenseGate gate = new LicenseGate();
LicenseInfo info = new LicenseInfo("MID",
LicenseInfo info = new LicenseInfo(java.util.UUID.randomUUID(), "acme", "MID",
Map.of("max_agents", 10, "retention_days", 30),
Instant.now(), Instant.now().plus(365, ChronoUnit.DAYS));
Instant.now(), Instant.now().plus(365, ChronoUnit.DAYS), 0);
gate.load(info);
assertThat(gate.getTier()).isEqualTo("MID");

View File

@@ -40,7 +40,7 @@ class LicenseValidatorTest {
LicenseInfo info = validator.validate(token);
assertThat(info.tier()).isEqualTo("HIGH");
assertThat(info.label()).isEqualTo("HIGH");
assertThat(info.getLimit("max_agents", 0)).isEqualTo(50);
assertThat(info.isExpired()).isFalse();
}