feat(spaces): per-space sizes on a day-old cache, member counts, and the page to show them #354
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "spaces-page"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The Spaces page looked empty for two unrelated reasons: the instance had no app-owned spaces and
loadSpacesreturned early with no zero state, and the renderer had been readingsp.membersandsp.sizesince it was built while the backend never sent either. Those two columns have shown a permanent—.Sizes
storage.PrefixSizeris a new optional capability, feature-detected likeUsager: total bytes per immediate child of a prefix, in one pass.The cost is asymmetric and worth recording. On S3 this is the same flat bucket listing
Usage()already performs — per-space totals cost what the global total already costs, once bucketed by key. On POSIXUsage()is astatfscosting nothing, and this is a genuine tree walk. That asymmetry is why the result is cached.api.SpaceSizescaches for 24h and refreshes in the background, shaped afterUpdateCheckdeliberately — its comment records that opening Administration once blocked on an outbound call, and a size sweep would reintroduce that while growing with the customer's data. SoGetnever blocks: a cold cache returns nothing and the page says sizes are being measured.Two properties are pinned by tests because they are silent when wrong:
computedAt, or an empty result would look authoritative for a day;Sizes read from the undecorated driver. The decorator stack does not forward the capability, and the raw number is the honest one anyway — it is what the backend actually stores, ciphertext included.
Page
Header tally, a real zero state, the deactivated-bytes figure the old code computed and then discarded, an as-of line for the cache, and the table of what a new space inherits.
A directory-managed space shows its group instead of an owner — it belongs to the group, and "Owned by" there would name someone who does not hold that role.
Who may create: Any signed-in usercarries no "Deployment setting" badge: that is the current behaviour but not a configurable one, and the badge would claim a control that does not exist.spacesTallyis pure, in a marked block, and tested — an unmeasured space must not count as zero bytes, or a fresh instance reports "0 B across all spaces" with total confidence. Second user of theweb/test/harness from #353.Still missing, deliberately
IdP-group spaces are not listed.
listenumerates the app-owned store only, so directory-managed spaces remain invisible here. Fixing it needs a Keycloak group enumeration that does not exist yet (filtering by owner attribute, excluding the read-only suffix groups). The renderer already handlessp.groupfor when it lands.SegmentOf's original test was self-contradictory — it wanted a bare child to resolve to itself and a sibling file to resolve to nothing, which are the same shape as paths. The test was corrected, not the code.Verification
go build,go vet,go test ./internal/...,node --check, and both web suites pass.