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:
@@ -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");
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user