Repository navigation
feat(web): per-account collection cap and admin moderation for collections - #115
Merged
Merged
Conversation
…tions An account may keep at most 100 collections (SKILLX_COLLECTIONS_MAX_PER_USER overrides it); a create or clone over the cap answers 409 collection.limit_reached. The cap is checked inside the insert, so concurrent creates cannot pass it. Operators hide or unhide a collection with POST /api/v1/collections/:id/moderation (admin secret only), an audited compare-and-set on the new collections.moderation_state column (migration 0020). A hidden collection answers 404 to everyone but its owner, whatever its visibility; the owner can neither clone nor delete it. GET on the same path returns the state, the latest revision and the audit history. Closes #114 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017CWq2UVSFw5KgH464tpw3b
This was referenced Oct 20, 2026
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 #114. No duplicate or related issues were found.
What changes
SKILLX_COLLECTIONS_MAX_PER_USERvar overrides this with a positive integer.409 collection.limit_reachedand writes nothing.INSERT … SELECT … WHERE count < cap. A refused parent row makes the revision insert fail its foreign key, so the whole D1 batch rolls back.POST /api/v1/collections/:id/moderationtakes{from, to, reason?}and moves a collection betweenactiveandhidden.X-Admin-Secretonly. Accounts get403 collection.admin_only.compareAndSetfrom releases, with the new subject kindcollectionrecorded inrelease_state_audit.fromanswers409 collection.moderation_conflict.GETon the same path returns the state, the latest revision and the audit history.collection.moderationand can keep editing.403 collection.hidden) or delete it (409 collection.hidden). Blocking delete stops the owner from re-posting the content unmoderated, and the hidden collection keeps its slot under the cap.0020_collection_moderation. It is additive:moderation_state NOT NULL DEFAULT 'active', plus the nullablemoderation_reasonandmoderated_at.active, and only the admin route needs the columns.docs/deployment-guide.md.collection-views.tsto keep files under 200 LOC. The test helper was split intocollections-harness.ts.docs/api-reference.md#collections,docs/deployment-guide.md, theCLAUDE.mdroutes table, and the Issue Workflow section, which gains theblockedlabel as requested for issue claiming.Verification
pnpm typecheck: clean.pnpm test: 116 files, 2315 passed and 2 skipped. This includes 6 new moderation and cap tests.pnpm build: OK.Deploy note
Run
pnpm run db:migrate:remote(after a backup) before or after deploying. Until it runs, only the moderation route answers 500.Generated by Claude Code