DRAFT: ProjectData storage safety firebreak - #1875
Merged
Merged
Conversation
Contributor
|
9 tasks
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.



Classification
External References
Official documentation consulted before implementation:
databaseSize): https://developers.cloudflare.com/durable-objects/api/sqlite-storage-api/databaseSize: https://github.com/cloudflare/workerd/blob/main/src/workerd/api/sql.c%2B%2BCodebase Impact Analysis
Changed
apps/api/src/durable-objects/project-data/*for measurement/alarm/purge/metadata cap,apps/api/src/services/project-data*for storage-full classification and admin service calls,apps/api/src/routes/admin.tsplus schemas for superadmin diagnostics,apps/api/src/db/*for additive D1 telemetry, andapps/api/wrangler.toml/docs/reference files for config visibility.Documentation & Specs
Updated
.env.example,apps/www/src/content/docs/docs/reference/configuration.md,.claude/skills/api-reference/SKILL.md,.claude/skills/env-reference/SKILL.md, and task evidence intasks/active/2026-08-21-projectdata-storage-safety-firebreak.md.Constitution & Risk Check
Checked Principle XI/no hardcoded values: limits, thresholds, intervals, and purge bounds are environment-backed defaults. Security-sensitive recovery endpoints use existing auth/approval/superadmin middleware and the purge deletes only bounded low-value event logs.
Summary
Adds the narrow ProjectData storage-safety firebreak requested from current
main:ctx.storage.sql.databaseSizemeasurement from ProjectData Durable Objects;SQLITE_FULL/ storage-full classification as non-transient, surfaced asPROJECT_DATA_STORAGE_FULL;activity_eventsandacp_session_eventsrows;tool_metadata, preserving valid JSON and useful identity/status fields.This does not implement session sharding and does not modify, supersede, close, merge, or otherwise disturb PR #1873 (
DO NOT MERGE: ProjectData DO sharding infrastructure).Local validation
pnpm --filter @simple-agent-manager/api typecheckpnpm --filter @simple-agent-manager/api lintpnpm --filter @simple-agent-manager/api test -- tests/unit/durable-objects/project-data-messages.test.ts tests/unit/services/durable-object-retry.test.tspnpm vitest run --config vitest.workers.config.ts tests/workers/project-data-storage-safety.test.ts --reporter verbosepnpm vitest run --config vitest.workers.config.ts tests/workers/project-data-service.test.tspnpm tsx scripts/quality/ast-checks.ts --file apps/api/src/durable-objects/project-data/storage-safety.ts --rule sql-injectiongit diff --check main...HEADMiniflare/workerd experiment evidence
Recorded in
tasks/active/2026-08-21-projectdata-storage-safety-firebreak.md:databaseSizeincreases on inserts and drops after deletes in SQLite-backed Durable Object runtime;SQLITE_FULLcould not be locally forced becausePRAGMA page_countis rejected andsetMaxPageCountForTestis not exposed to JS Worker tests;Deployment/staging
No staging deploy or staging mutation has been performed. Keep this PR draft until the parent grants the single staging slot.