Refuse uploads that don't fit up front; plain quota messages; banner dismiss; handbook (#804) #812

Merged
Cordy merged 3 commits from feat-804 into main 2026-09-28 16:20:14 +00:00
Owner

Closes #804; implements mockup-804-quota-refusals.html rev2 as greenlit.

Server

  • quota.Driver.Room(ctx, dir) returns the tightest cap at a backend folder (space / user / instance) and the room left. Space trash is uncapped (#806).
  • GET /api/v1/quota/room?path=: authenticated, returns {scope, limit, free}; limit 0 = uncapped.
  • tus create refuses with 507 when Upload-Length exceeds the room, before anything is spooled.
  • Wiring: roomAt resolves virtual → backend through scope.Resolve. It reports nothing when enforcement is off, so the web app never refuses what the server would accept.
  • Deviation from the issue text: no Cairn-Quota response header. The web app asks the room endpoint when it gets a refusal and builds the same message, which keeps the error paths unchanged.

Web

  • uploadFiles checks the whole batch against the room before the loop, all or nothing. Overwrites count net of the replaced file.
  • A late server refusal (race), recognised by isQuotaErr: tus-create 507, or the server's quota text from a small upload. It gets the same plain message and stops the rest of the batch.
  • quotaRefusal builds the rev2 sentences (no dashes); i18n ×4.
  • Error banner: text span + dismiss × (.ebx, width pinned: an app rule collapsed it in the mockup). The 7 s auto-hide is kept. display:flex lives only in #errbanner:not([hidden]), because an inline display would defeat [hidden].

Docs: docs/handbook/spaces-quota.md + index row.

Tests: RED dc350041 (Go: Room, tus create, endpoint; node: qa804) → green. go test ./... passes, web 296/296, the extracted JS passes node --check, and a behavioural check of the four message variants passes.

Closes #804; implements `mockup-804-quota-refusals.html` rev2 as greenlit. **Server** - `quota.Driver.Room(ctx, dir)` returns the tightest cap at a backend folder (space / user / instance) and the room left. Space trash is uncapped (#806). - `GET /api/v1/quota/room?path=`: authenticated, returns `{scope, limit, free}`; limit 0 = uncapped. - tus create refuses with **507** when `Upload-Length` exceeds the room, before anything is spooled. - Wiring: `roomAt` resolves virtual → backend through `scope.Resolve`. It reports nothing when enforcement is off, so the web app never refuses what the server would accept. - **Deviation from the issue text:** no `Cairn-Quota` response header. The web app asks the room endpoint when it gets a refusal and builds the same message, which keeps the error paths unchanged. **Web** - `uploadFiles` checks the whole batch against the room before the loop, all or nothing. Overwrites count net of the replaced file. - A late server refusal (race), recognised by `isQuotaErr`: tus-create 507, or the server's quota text from a small upload. It gets the same plain message and stops the rest of the batch. - `quotaRefusal` builds the rev2 sentences (no dashes); i18n ×4. - Error banner: text span + dismiss × (`.ebx`, width pinned: an app rule collapsed it in the mockup). The 7 s auto-hide is kept. `display:flex` lives only in `#errbanner:not([hidden])`, because an inline display would defeat `[hidden]`. **Docs:** `docs/handbook/spaces-quota.md` + index row. **Tests:** RED dc350041 (Go: Room, tus create, endpoint; node: qa804) → green. `go test ./...` passes, web 296/296, the extracted JS passes `node --check`, and a behavioural check of the four message variants passes.
Cordy merged commit ca48f8c900 into main 2026-09-28 16:20:14 +00:00
Cordy deleted branch feat-804 2026-09-28 16:20:17 +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#812
No description provided.