docs(web): document disk-quota UI as a hosted trust-front hook (#262) - #267
Merged
Conversation
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>
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #262.
Context — scope reversed
Issue #262 originally asked to remove the disk-quota UI. That was reversed: the hosting layer consumes
@brainpilot/webas an unpatched npm artifact, socomponents/quota/*are the only way a managed deployment can surface quota inside/app. Removing them would leave hosted deployments with no in-/appquota 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)
SandboxStats.disk(contracts/backend.ts) markingquotaBytes/percentOfQuotaas hosted-only (default0single-user, dialogs inert). Newcomponents/quota/README.mdexplains the hook, its/statsdata contract, and why it can't be deleted. Header comments on the three components point at the README.DiskQuotaHostedHook.test.tsxasserts: absent quota fields normalize to0; the>= 90/>= 100gates stay closed at the default; closed dialogs render empty markup; and the hook still lights up when a hosting layer supplies real quota fields.disk.workspaceUsedBytes— plain usage (the SandboxStatus disk meter), untouched.Verification
npx tsc -b packages/web— cleannpx vitest run(web) — 178 passed / 23 files, including the 4 new tests🤖 Generated with Claude Code