Skip to content

Fix bucket creation quota and retention numeric validation #73

Closed

Description

@Vonng

Problem

The bucket creation forms in Silo Console still had numeric conversion gaps after the existing-bucket quota and retention fixes:

  • parseInt(getBytes(...)) could turn an exponent-form byte value such as 1000 Ei into 1 byte.
  • A valid fractional scalar such as 0.5 Gi could be rejected because the scalar itself was passed through parseInt.
  • Changing the quota unit did not revalidate the current scalar.
  • Bucket creation retention validation did not require an integer or enforce the signed int32 upper bound.

These paths could send an incorrect quota or accept a value that the generated API model later rejected.

Scope

This issue tracks the minimum Console-side repair:

  • share quota byte conversion and retention boundary validation between create and edit forms;
  • reject unsupported quota values before the create request;
  • preserve the existing quota wire shape and retention compatibility;
  • add regression coverage for fractional units, exponent-range values, unit changes, non-integer retention, and the int32 boundary.

Server code, dependency pins, resync duration semantics (N04), and arbitrary int64 browser precision (N12) remain outside this issue.

Follow-up candidates are the three replication bandwidth forms and the remaining calculateBytes string conversion path.

Activity

  1. Vonng commented on Oct 29, 2026

    @Vonng
    MemberAuthor

    已完成并推送本轮 P1/P2 修复,分支为 codex/fix-numeric-units(暂不发布或部署):

    • d878dbf88 — fix: validate bucket creation quota inputs
      • 保留小数单位换算(例如 .5 Gi -> 536870912);
      • 拒绝超出浏览器安全整数范围的 quota,避免 1000 Ei 等输入被 parseInt 截断成错误值;
      • 单位切换后重新校验 quota;
      • 创建 thunk 增加防御性校验,并复用到已有桶 quota 编辑。
    • 5a34232e7 — fix: validate bucket creation retention
      • 创建桶和已有桶编辑统一要求正整数;
      • 限制在 1..2147483647,覆盖 Server 端 int32 约束;
      • 创建 thunk 增加防御性校验。

    验证已通过:

    • quota/retention/numeric 回归合计 43 passed;
    • TypeScript tsc --noEmit;
    • Prettier 检查;
    • git diff --check;
    • Vite production build;
    • go test -mod=readonly ./api(cached pass)。

    本轮未修改 Server、依赖 pin、N04、N12,也未改变现有未提交改动。N12 的任意 int64 精度方案、replication bandwidth 和 calculateBytes 仍保留在后续跟踪范围,待独立方案确认后处理。

  2. Vonng commented on Nov 4, 2026

    @Vonng
    MemberAuthor

    Fixed on main by #74, merged as 3d1dd56. Create/edit quota and retention validation now share conversion and boundary checks, including fractional units, unit changes, exponent-range input, integer retention, and the signed int32 limit. The same PR repairs numeric conversion and validation in all three replication bandwidth forms.

    Validation passed: Go tests, repository verifiers, 689 frontend unit/component browser tests, frontend build/audits, and both required CI checks. A real SILO + mcli + Console run also confirmed that creating a 0.5 GiB quota stores exactly 536870912 bytes.

    The remaining arbitrary int64 quota precision issue is tracked in #75, and the other calculateBytes paths in #76. This closes the bounded scope of this issue in source; no release, deployment, or SILO Server embedded-Console dependency update has been performed.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions