Skip to content

Commit 8c08484

Browse files
committed
fix(ui): move repo-stats Observed timeago under physical bytes
It belongs to the kopia-reported inspection figures, not the bucket figure. The bucket-bytes tooltip now carries its own CloudWatch measurement time and notes the once-a-day cadence.
1 parent 8b7fbcd commit 8c08484

2 files changed

Lines changed: 24 additions & 2 deletions

File tree

private-web/e2e/backups.spec.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,18 @@ test.describe("backups ready: stats + backup-now", () => {
289289
await expect(page.getByText("42")).toBeVisible();
290290
// bucket_bytes NULL → "unknown" shown, per the indicators rule.
291291
await expect(page.getByText(/bucket bytes:\s*unknown/i)).toBeVisible();
292+
// The "Observed" timestamp belongs to the kopia-reported repo stats, so
293+
// it sits under "Physical bytes", above the bucket figure.
294+
const statsPanel = page
295+
.getByRole("heading", { name: /repository stats/i })
296+
.locator("..");
297+
const panelText = await statsPanel.innerText();
298+
expect(panelText.indexOf("Observed")).toBeGreaterThan(
299+
panelText.indexOf("Physical bytes"),
300+
);
301+
expect(panelText.indexOf("Observed")).toBeLessThan(
302+
panelText.indexOf("Bucket bytes"),
303+
);
292304
await expect(page.getByText(/recent runs/i)).toBeVisible();
293305
await expect(page.getByText("success")).toBeVisible();
294306
// The run carries a server_id, so the table names which server it's from.
@@ -436,6 +448,7 @@ test.describe("backups ready: stats + backup-now", () => {
436448
await seedBackupRepoStats(sql, {
437449
groupId: group.id,
438450
bucketBytes: 107374182400, // 100 GiB
451+
bucketBytesObservedAt: new Date(Date.now() - 86_400_000).toISOString(),
439452
});
440453

441454
await page.goto(`/groups/${group.id}/backups`);
@@ -445,6 +458,12 @@ test.describe("backups ready: stats + backup-now", () => {
445458
const tooltip = page.getByRole("tooltip");
446459
await expect(tooltip).toContainText("$2.50/month");
447460
await expect(tooltip).toContainText("ap-southeast-2");
461+
// The bucket figure comes from CloudWatch on its own daily cadence, so
462+
// the tooltip carries its measurement time and says it updates less
463+
// often than the kopia-reported stats.
464+
await expect(tooltip).toContainText("From CloudWatch storage metrics");
465+
await expect(tooltip).toContainText("measured");
466+
await expect(tooltip).toContainText("about once a day");
448467
});
449468

450469
test("recent run shows a truncated, copyable snapshot id", async ({

private-web/e2e/seed.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -562,19 +562,22 @@ export async function seedBackupRepoStats(
562562
logicalBytes?: number | null;
563563
physicalBytes?: number | null;
564564
bucketBytes?: number | null;
565+
/** ISO timestamp of the bucket-bytes measurement. */
566+
bucketBytesObservedAt?: string | null;
565567
},
566568
): Promise<void> {
567569
await sql.query(
568570
`INSERT INTO backup_repo_stats
569-
(group_id, snapshot_count, source_count, logical_bytes, physical_bytes, bucket_bytes)
570-
VALUES ($1, $2, $3, $4, $5, $6)`,
571+
(group_id, snapshot_count, source_count, logical_bytes, physical_bytes, bucket_bytes, bucket_bytes_observed_at)
572+
VALUES ($1, $2, $3, $4, $5, $6, $7)`,
571573
[
572574
opts.groupId,
573575
opts.snapshotCount ?? null,
574576
opts.sourceCount ?? null,
575577
opts.logicalBytes ?? null,
576578
opts.physicalBytes ?? null,
577579
opts.bucketBytes ?? null,
580+
opts.bucketBytesObservedAt ?? null,
578581
],
579582
);
580583
}

0 commit comments

Comments
 (0)