Blame
|
1 | --- |
||||||
| 2 | category: reference |
|||||||
| 3 | tags: [tasks, future, limits] |
|||||||
| 4 | last_updated: 2026-03-15 |
|||||||
| 5 | confidence: medium |
|||||||
| 6 | --- |
|||||||
| 7 | ||||||||
| 8 | # Disk Usage Cap Per Wiki |
|||||||
| 9 | ||||||||
| 10 | ## Problem |
|||||||
| 11 | There's no disk space limit per wiki. A user could fill the VPS disk by uploading large attachments or creating thousands of pages. The page count limit (500) doesn't account for attachment size. |
|||||||
| 12 | ||||||||
| 13 | ## Current limits |
|||||||
| 14 | - MAX_PAGES_PER_WIKI = 500 (enforced in ManagementMiddleware on wiki creation) |
|||||||
| 15 | - No disk space enforcement |
|||||||
| 16 | ||||||||
| 17 | ## Proposed cap |
|||||||
| 18 | 50MB per wiki. The dev wiki (65 pages, all markdown) is 1.4MB including git history. 50MB gives plenty of room for growth and moderate attachments. |
|||||||
| 19 | ||||||||
| 20 | ## Enforcement options |
|||||||
| 21 | ||||||||
| 22 | ### Option A: Per-write check |
|||||||
| 23 | Check `du -s` on the wiki repo before each page save or attachment upload. Reject writes that would exceed the cap. Accurate but expensive — `du` on a large git repo can take hundreds of milliseconds. |
|||||||
| 24 | ||||||||
| 25 | ### Option B: Tracked column |
|||||||
| 26 | Add a `disk_usage` column to the wikis table. Update it after each write (or periodically). Check the column value on writes — fast but can drift from reality. |
|||||||
| 27 | ||||||||
| 28 | ### Option C: Periodic cron |
|||||||
| 29 | A cron job checks `du` for all wikis. If over cap, sets a flag that the TenantResolver checks on write requests. Cheap per-request but enforcement is delayed. |
|||||||
| 30 | ||||||||
| 31 | ### Option D: Git hooks |
|||||||
| 32 | A git pre-receive hook that checks repo size before accepting a push. Only works for git-based writes, not web UI or MCP. |
|||||||
| 33 | ||||||||
| 34 | ## Decision needed |
|||||||
| 35 | Which option, or a combination. Option B (tracked column) with Option C (periodic correction) is probably the right balance — fast per-request check with eventual consistency. |
|||||||
| 36 | ||||||||
| 37 | ## Not urgent |
|||||||
| 38 | No external users yet. Can be deferred until pre-launch (V7-9). |
|||||||