Skip to content

fix: preserve completed usage and show initial scan progress - #317

Merged
majinghe merged 3 commits into
mainfrom
cxymds/fix/initial-usage-progress
Nov 23, 2026
Merged

majinghe merged 3 commits into
mainfrom
cxymds/fix/initial-usage-progress

Conversation

@cxymds

@cxymds cxymds commented Nov 23, 2026 •

Copy link
Copy Markdown
Member

Pull Request

Description

When a bucket has no completed usage measurement, show explicitly authorized first-scan progress with a concise “Initial statistics · Partial” state. Completed values take precedence during subsequent scans. Buckets without valid measurements retain the existing pending, loading, or unavailable states. Refresh visible bucket pages every 30 seconds without replacing retained values during background requests.

Type of Change

  • 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)
  • Documentation update
  • Code refactoring
  • Performance improvement
  • Test improvements
  • Security fix

Testing

  • Unit tests added/updated
  • Manual testing completed

Passed locally on the submitted changes: frozen lockfile installation, type check, ESLint, Prettier, and all 1,270 tests (zero failures or skips). Regression coverage exercises explicit initial authorization, completed-value precedence, malformed progress, and background refresh.

pnpm install --frozen-lockfile
pnpm type-check
pnpm lint
pnpm format:check
pnpm test:run

Production build passed at 05c1eb2. Independent correctness, tester, simplification, and UX checks completed; controlled browser previews cover initial progress, completed-value precedence, mixed coverage, pending/loading/error/empty, Chinese/English, light/dark themes, and 390px mobile layouts. Background transient errors and out-of-order responses have deterministic regressions; confirmed denials remain fail-closed.

Checklist

  • Code follows the project's style guidelines
  • Self-review completed
  • TypeScript types are properly defined
  • All commit messages are in English (Conventional Commits)
  • All existing tests pass
  • No new dependencies added, or they are justified

Related Issues

User-reported scanner snapshot behavior on RustFS release/1.0.7 at 3dbcae5128fadb9e9ab10101dcebe83d162cb10e. Companions: rustfs/rustfs#9592 and rustfs/cli#433.

Screenshots (if applicable)

Controlled component previews, not live-cluster evidence. The before view uses the main-branch component; the after view uses this PR's actual overview and table cell implementations.

State Before After
Initial statistics Before initial After initial
Completed values with progress Before complete After complete

Other checked states: pending, loading, error, empty, mixed coverage, and mobile dark.

Additional Notes

Requests the optional accountinfo?view=snapshot view. Only initial_scan=true authorizes partial measurements. No new dependencies. The concise status and Next.js 16.4.6 upgrade from #316 are already on the base branch; this PR builds on that change. No live VM or production validation has been performed.

Use the explicit server snapshot view so first measurements can be shown without replacing completed statistics during later scans.
Keep account statistics, permissions, ownership, and loading state bound to the newest request so polling cannot overwrite a newer completed measurement.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

A transient polling failure clears cached usage and policy state, discarding displayed measurements and incorrectly redirecting non-admin users to /403/ without a permission change.

1 open issue
What changed in this PR

This PR extends #316’s bucket statistics states with explicitly authorized initial-scan measurements, while prioritizing completed usage and adding periodic refreshes.

Changes:

  • Request account snapshots and distinguish initial progress from completed measurements.
  • Display localized partial-statistics labels in bucket lists and the overview.
  • Refresh visible bucket pages every 30 seconds and extend parser tests and request fixtures.
File Description
tests/​lib/​bucket-usage-source.test.js Update the expected display-usage helper.
tests/​lib/​bucket-scan-progress.test.ts Cover initial authorization and completed-value precedence.
tests/​hooks/​use-permissions-refresh.test.ts Update the snapshot request fixture.
tests/​hooks/​effective-permissions.test.ts Update the permissions snapshot fixture.
lib/​account-bucket-usage.js Separate completed, initial, and display usage.
i18n/​locales/​zh-TW.json Add Traditional Chinese scan labels.
i18n/​locales/​zh-CN.json Add Simplified Chinese scan labels.
i18n/​locales/​vi-VN.json Add Vietnamese scan labels.
i18n/​locales/​tr-TR.json Add Turkish scan labels.
i18n/​locales/​ru-RU.json Add Russian scan labels.
i18n/​locales/​pt-BR.json Add Brazilian Portuguese scan labels.
i18n/​locales/​ko-KR.json Add Korean scan labels.
i18n/​locales/​ja-JP.json Add Japanese scan labels.
i18n/​locales/​it-IT.json Add Italian scan labels.
i18n/​locales/​id-ID.json Add Indonesian scan labels.
i18n/​locales/​fr-FR.json Add French scan labels.
i18n/​locales/​es-ES.json Add Spanish scan labels.
i18n/​locales/​en-US.json Add English scan labels.
i18n/​locales/​de-DE.json Add German scan labels.
i18n/​locales/​ar-MA.json Add Arabic scan labels.
hooks/​use-permissions.tsx Request the account snapshot view.
components/​buckets/​usage-overview.tsx Show initial subtotals when completed measurements are absent.
components/​buckets/​list.tsx Label initial usage and schedule visible-page refreshes.
app/​(dashboard)/​browser/​page.tsx Integrate initial usage and retain overview values during account requests.

Review effort: Balanced

Comment thread app/(dashboard)/browser/page.tsx Resolved
Keep the last successful account snapshot on network and server failures while confirmed denials, malformed policy, and identity changes continue to invalidate it.
@majinghe
majinghe merged commit 69cba07 into main Nov 23, 2026
10 checks passed
@majinghe
majinghe deleted the cxymds/fix/initial-usage-progress branch November 23, 2026 23:45
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.

3 participants