Skip to content

fix(admin): show storage count window and 24h default label (#1322) - #1419

Open
avantikonde wants to merge 2 commits into
rewrite/mainfrom
fix/1322-storage-count-window
Open

avantikonde wants to merge 2 commits into
rewrite/mainfrom
fix/1322-storage-count-window

Conversation

@avantikonde

@avantikonde avantikonde commented Dec 6, 2026 •

Copy link
Copy Markdown
Collaborator

Description

Displays the query's actual since / until bounds beside each storage count row and clearly labels defaulted 24 h windows so a 24-hour slice cannot be misread as an all-time store total:

  • resources/admin/dashboard.html:
    • Updated the Storage counts description from "optional since/until unix seconds" to state that omitted since/until bounds default to the last 24 h.
    • Added a Window column (<th scope="col">Window</th>) beside Count and updated the initial empty row to colspan="3".
  • resources/admin/assets/admin-ops.js:
    • Added formatBound and formatStorageWindow to format payload.since / payload.until as UTC timestamps (supporting 0 timestamps) and label defaulted windows (last 24 h (...) when both bounds defaulted, default 24 h (...) when only since defaulted, and (... (until defaulted to now)) when only until defaulted).
    • Updated renderStorage and loadStorage to render the Window cell beside every row and update the empty-state colspan to 3.
  • crates/nostream-admin/tests/console_parity.rs:
    • Added the_storage_panel_renders_the_window_it_reports, checking the dashboard.html copy/columns and executing admin-ops.js under Node with mocked fetch responses for defaulted (last 24 h), explicit bounds, until-only (default 24 h), since = 0, and empty results (colspan="3").
  • .changeset/admin-storage-panel-window.md:
    • Added an empty-frontmatter changeset for rewrite/main.

Related Issue

Addresses #1322 (targeting rewrite/main).

Motivation and Context

crates/nostream-admin/src/utils/storage.rs defaults absent since / until query parameters to DEFAULT_WINDOW_SECONDS (86_400 s), and GET /admin/ops/storage/counts returns both since and until in the JSON payload. Previously renderStorage rendered only kinds and count while dashboard.html described bounds as "optional since/until unix seconds", making a 24-hour count look like a total count across the store.

How Has This Been Tested?

  • ./node_modules/.bin/biome lint resources/admin/assets/admin-ops.js — passed (0 errors).
  • cargo fmt --all --check — passed.
  • cargo clippy -p nostream-admin --all-targets --all-features -- -D warnings — passed.
  • cargo clippy --workspace --lib --bins --all-features -- -D warnings -D clippy::unwrap_used -D clippy::expect_used -D clippy::todo -D clippy::unimplemented -D clippy::panic — passed.
  • cargo check --workspace --all-features — passed.
  • cargo test -p nostream-admin --test console_parity -- the_parser_reads_the_capture_s_call_shapes a_missing_console_file_is_a_failure the_derivation_finds_every_console_route the_storage_panel_renders_the_window_it_reports — 4 passed, 0 failed (every_console_route_is_served filtered out locally because socket binding is restricted in the sandbox).
  • cargo test -p nostream-admin --lib — 61 passed, 0 failed.

Screenshots (if appropriate):

Types of changes

  • Non-functional change (docs, style, minor refactor)
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my code changes.
  • I added a changeset, or this is docs-only and I added an empty changeset.
  • All new and existing tests passed.

Summary by CodeRabbit

  • Bug Fixes
    • Storage counts now show the time window used, including when a time bound defaults to the last 24 hours. Invalid or missing bounds display as an em dash.
    • Leading and trailing spaces in storage time inputs are removed before querying.

@changeset-bot

changeset-bot Bot commented Dec 6, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 5afad25

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 0 packages

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@coderabbitai

coderabbitai Bot commented Dec 6, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The admin storage panel now shows the time window used for storage counts. It documents the 24-hour default for omitted bounds, formats returned bounds, and labels defaulted windows.

Changes: Storage count window display

Layer / File(s) Summary
Window input, rendering, and validation
.changeset/admin-storage-panel-window.md, crates/nostream-admin/tests/console_parity.rs, resources/admin/assets/admin-ops.js, resources/admin/dashboard.html
The dashboard documents the 24-hour default and adds a Window column. The script trims bound inputs, formats returned windows, and labels defaulted bounds. The parity test checks the displayed windows and empty states.

Possibly related issues

  • cameri/nostream issue 1322 — The storage-window column and 24-hour default labels match the described acceptance criteria.

Suggested reviewers: ferryx349, cameri

Change: Bug fix

Merge Risk: Minimal · up to 5afad

The admin storage panel now shows the time window behind each count and labels the 24-hour default. The change is low-risk and display-only. No merge-blocking issue remains.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title names the admin storage count window and the 24-hour default label, which matches the changeset. It adds the storage-panel window column, the dashboard help text change, and the test for the…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the admin storage count window and the 24-hour default label, which matches the changeset. It adds the storage-panel window column, the dashboard help text change, and the test for the window display. The title uses a conventional commit prefix and an issue reference, and it is specific enough for a reviewer scanning history. It is 67 characters, which is within a reasonable length.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 2fc08df and 5afad25.

Files selected for processing: 4

  • .changeset/admin-storage-panel-window.md
  • crates/nostream-admin/tests/console_parity.rs
  • resources/admin/assets/admin-ops.js
  • resources/admin/dashboard.html

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 2 remain after this review.

@greptile-apps

greptile-apps Bot commented Dec 6, 2026 •

Copy link
Copy Markdown

Confidence Score: 5/5RetriggerView in Greptile

[Medium impact] The PR appears safe to merge; the previous large-date crash is fixed.

Summary

Storage counts now show the server-reported time window and label omitted bounds.

  • Storage count rows now show the time window they cover.

Reviews (2) · Last reviewed commit: "fix(admin): handle out-of-range storage ..." · Reviewed by Greptile

Comment thread resources/admin/assets/admin-ops.js Resolved

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant