Skip to content

docs(web): document disk-quota UI as a hosted trust-front hook (#262) - #267

Merged
Fxde42 merged 1 commit into
mainfrom
docs/document-disk-quota-hosted-hook
Jul 7, 2026
Merged

docs(web): document disk-quota UI as a hosted trust-front hook (#262)#267
Fxde42 merged 1 commit into
mainfrom
docs/document-disk-quota-hosted-hook

Conversation

@Fxde42

@Fxde42 Fxde42 commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Closes #262.

Context — scope reversed

Issue #262 originally asked to remove the disk-quota UI. That was reversed: the hosting layer consumes @brainpilot/web as an unpatched npm artifact, so components/quota/* are the only way a managed deployment can surface quota inside /app. Removing them would leave hosted deployments with no in-/app quota surface (only raw 413s on over-quota upload). The correct framing is a hosted trust-front hook — same pattern as auth stripping (R-11) and subpath hosting (R-9): open-source ships the front, the hosted layer drives it.

So this PR keeps everything and instead documents + test-guards the hook. Pure additive — no deletions, no behavior change.

Changes (the three asks)

  1. Document the contract — comment on SandboxStats.disk (contracts/backend.ts) marking quotaBytes / percentOfQuota as hosted-only (default 0 single-user, dialogs inert). New components/quota/README.md explains the hook, its /stats data contract, and why it can't be deleted. Header comments on the three components point at the README.
  2. Lock in single-user inertnessDiskQuotaHostedHook.test.tsx asserts: absent quota fields normalize to 0; the >= 90 / >= 100 gates stay closed at the default; closed dialogs render empty markup; and the hook still lights up when a hosting layer supplies real quota fields.
  3. Keep disk.workspaceUsedBytes — plain usage (the SandboxStatus disk meter), untouched.

Verification

  • npx tsc -b packages/web — clean
  • npx vitest run (web) — 178 passed / 23 files, including the 4 new tests

🤖 Generated with Claude Code

The disk-quota UI (components/quota/*) is not dead code to remove — it's
the only way a managed deployment can surface quota inside /app, since the
hosting layer consumes @brainpilot/web unpatched. Reframe it as a hosted
hook (same pattern as auth stripping / subpath hosting) and lock in the
single-user contract.

- Document the hook on SandboxStats.disk (contracts/backend.ts): quotaBytes
  / percentOfQuota are hosted-only, default 0 single-user, dialogs stay inert.
- Add components/quota/README.md explaining the hook, its data contract, and
  why it must not be deleted.
- Add header comments on the three quota components pointing at the README.
- Add DiskQuotaHostedHook.test.tsx asserting single-user inertness: absent
  quota fields normalize to 0, the >= 90 / >= 100 gates stay closed, closed
  dialogs render nothing — and the hook still lights up when a hosting layer
  supplies quota fields.

No behavior change; keeps disk.workspaceUsedBytes (plain usage) untouched.

Co-Authored-By: Claude <noreply@anthropic.com>
@Fxde42
Fxde42 merged commit 98cad09 into main Jul 7, 2026
3 checks passed
@Fxde42
Fxde42 deleted the docs/document-disk-quota-hosted-hook branch July 7, 2026 18:23
@GTC2333 GTC2333 mentioned this pull request Jul 7, 2026
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.

web: document disk-quota UI as a hosted trust-front hook (keep, don't remove; guarantee single-user inertness)

1 participant