fix(antigravity): claim no window length, the feed only gives a reset time
epochToWindowLabel printed the time left until reset, so a fixed 5h window read 3h, then 2h, then 1h as the day went on. The feed never states a window, so the limit keeps its resetsAt and drops windowLabel.
207 unmodified linesExpand all208209210211212212213214215216217396 unmodified linesExpand all207 unmodified linesExpand all try std.testing.expect(std.mem.indexOf(u8, rep_text, "\"id\":\"gemini\",\"label\":\"Gemini\"") != null); try std.testing.expect(std.mem.indexOf(u8, rep_text, "\"scope\":\"Gemini\"") != null); try std.testing.expect(std.mem.indexOf(u8, rep_text, "\"usedPercent\":83.4") != null); try std.testing.expect(std.mem.indexOf(u8, rep_text, "\"detail\":\"17% free\"") != null); // The feed gives a reset time, not a window length, so no window is claimed. try std.testing.expect(std.mem.indexOf(u8, rep_text, "\"windowLabel\":\"1h window\"") != null); try std.testing.expect(std.mem.indexOf(u8, rep_text, "\"windowLabel\"") == null); try std.testing.expect(std.mem.indexOf(u8, rep_text, "\"notes\":[\"Project: test-proj\"]") != null);}
test "antigravity HTTP error message unwrapping" {396 unmodified linesExpand all25 unmodified lines26272829303132333447 unmodified lines8283848585868788899091925 unmodified lines98991001019910210310410579 unmodified lines25 unmodified lines return null;}
pub fn parseAntigravityUsage(alloc: std.mem.Allocator, payload: ?std.json.Value, now_ms: i64) ![]const usage.UsageLimit { _ = now_ms; const root = usage.asObject(payload); const buckets = if (root) |r| usage.asArray(r.get("buckets")) else null;
var gemini = FamilyInfo{};47 unmodified lines else null;
const resets_at: ?i64 = if (f.info.reset_time) |rt| iso8601.parseIso8601(rt) else null; const window_label = try usage.epochToWindowLabel(alloc, resets_at, now_ms); // The feed states when a family resets, never how long its window is, so there is // no honest label: `epochToWindowLabel` would print the time left, which reads as // "3h window" and then "1h window" for one fixed five-hour window.
const detail: ?[]const u8 = if (rem) |r| blk: { const free_pct = usage.roundToInt(i64, r * 100.0) orelse break :blk null; break :blk try std.fmt.allocPrint(alloc, "{d}% free", .{free_pct});5 unmodified lines try limits.append(alloc, .{ .id = f.id, .label = f.label, .usedPercent = used_percent, .windowLabel = window_label, .resetsAt = resets_at, .scope = f.label, .detail = detail, .status = status,79 unmodified lines