Admin setting for the new-space limit; directory first-sighting rule (#800) #814

Merged
Cordy merged 2 commits from feat-800 into main 2026-09-28 17:29:40 +00:00
Owner

Closes #800; implements mockup-800-new-space-default.html with the decisions in the #800 comment.

Server

  • settings.SpaceDefaultQuotaBytes *int64: nil = 1 GiB, so upgrades change nothing; 0 = none; negative rejected. Settings.SpaceDefaultQuota() returns the effective value. It's a pointer so an explicit 0 survives JSON.
  • POST /spaces uses SpacesAPI.DefaultQuota (the setting) instead of the constant; 0 means no cap.
  • spaceids.SetOnRegister: the hook runs outside the lock, once per newly registered identity.
  • SpacesAPI.OnSpaceRegistered handles directory kind only:
    • skips when the default is 0 or the space already has a cap;
    • if the space already holds more than the default (SpaceBytes → quotaDrv.TreeBytes), it stays unlimited and space-default-quota-skipped is audited (verb registered);
    • otherwise the default is set.
  • main.go sweeps /spaces at boot and registers every existing folder before installing the hook. Spaces that exist today (including ones an older install never registered) are never capped by it; only genuinely new ones are.

Web

  • New Limits row "New spaces start with" (#set-spacedef, fractional GB, unset reads 1), saved with the other settings. The input also seeds itself from serverSettings when the row is built, so a row built after loadSettingsValues can't save an empty value (= 0) by accident.
  • qdPerUser copy updated.
  • Spaces › "What a new space inherits" › Quota now states the current default with a link to Storage & quotas › Limits (spcInhQuotaNode); the kv rows accept a node for this one row.
  • i18n ×4.

Docs: spaces-quota.md gains "The default for new spaces".

Tests: RED 22144fb1 → green. go test ./... passes (settings, spaceids hook-once, create uses the setting / 0 = none, first sighting small → capped, over → skipped, app-owned ignored). Web 303/303 and node --check pass.

Noticed, not changed: the existing "Warn people at" input has the same load-order gap the new field guards against. If the admin view opens on another topic first, it can save as empty (= off). That's worth its own small issue.

Closes #800; implements `mockup-800-new-space-default.html` with the decisions in the #800 comment. **Server** - `settings.SpaceDefaultQuotaBytes *int64`: nil = 1 GiB, so upgrades change nothing; 0 = none; negative rejected. `Settings.SpaceDefaultQuota()` returns the effective value. It's a pointer so an explicit 0 survives JSON. - `POST /spaces` uses `SpacesAPI.DefaultQuota` (the setting) instead of the constant; 0 means no cap. - `spaceids.SetOnRegister`: the hook runs outside the lock, once per newly registered identity. - `SpacesAPI.OnSpaceRegistered` handles directory kind only: - skips when the default is 0 or the space already has a cap; - if the space already holds more than the default (`SpaceBytes` → `quotaDrv.TreeBytes`), it stays unlimited and `space-default-quota-skipped` is audited (verb registered); - otherwise the default is set. - `main.go` sweeps `/spaces` at boot and registers every existing folder **before** installing the hook. Spaces that exist today (including ones an older install never registered) are never capped by it; only genuinely new ones are. **Web** - New Limits row "New spaces start with" (`#set-spacedef`, fractional GB, unset reads 1), saved with the other settings. The input also seeds itself from `serverSettings` when the row is built, so a row built after `loadSettingsValues` can't save an empty value (= 0) by accident. - `qdPerUser` copy updated. - Spaces › "What a new space inherits" › Quota now states the current default with a link to Storage & quotas › Limits (`spcInhQuotaNode`); the kv rows accept a node for this one row. - i18n ×4. **Docs:** `spaces-quota.md` gains "The default for new spaces". **Tests:** RED 22144fb1 → green. `go test ./...` passes (settings, spaceids hook-once, create uses the setting / 0 = none, first sighting small → capped, over → skipped, app-owned ignored). Web 303/303 and `node --check` pass. **Noticed, not changed:** the existing "Warn people at" input has the same load-order gap the new field guards against. If the admin view opens on another topic first, it can save as empty (= off). That's worth its own small issue.
Cordy merged commit f973985418 into main 2026-09-28 17:29:40 +00:00
Cordy deleted branch feat-800 2026-09-28 17:29:44 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: Cordy/Cairn#814
No description provided.