From 186c06f3a682c2df073c7206dd495f1183987576 Mon Sep 17 00:00:00 2001 From: Duy Nguyen Date: Tue, 20 Oct 2026 09:35:28 +0700 Subject: [PATCH 1/2] feat(web): enable personal kits and collections APIs in production Both APIs shipped behind flags that defaulted to off. Migrations 0018 and 0019 are applied to production D1, so the flags can be enabled. Rollback for either API: set its flag back to "0" and redeploy. Co-Authored-By: Claude Opus 5.5 --- apps/web/wrangler.jsonc | 8 ++++---- docs/deployment-guide.md | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/apps/web/wrangler.jsonc b/apps/web/wrangler.jsonc index c8c2943..b21c2ca 100644 --- a/apps/web/wrangler.jsonc +++ b/apps/web/wrangler.jsonc @@ -68,9 +68,9 @@ // Subrequests (D1 + R2 calls) one release publish may spend; above it the upload is refused with 413 // before any R2 write. Workers Paid allows 10,000 per request; on a free account (1,000) set ~600. "SKILLX_RELEASE_SUBREQUEST_BUDGET": "5000", - // Personal kit API (/api/v1/kits/@handle/name/...). "0" = off (404 everywhere). - "SKILLX_PERSONAL_KITS_API": "0", - // Collections API (/api/v1/collections/...). "0" = off (404 everywhere). Needs migration 0018. - "SKILLX_COLLECTIONS_API": "0" + // Personal kit API (/api/v1/kits/@handle/name/...). "0" = off (404 everywhere); rollback = set "0" and redeploy. + "SKILLX_PERSONAL_KITS_API": "1", + // Collections API (/api/v1/collections/...). "0" = off (404 everywhere); rollback = set "0" and redeploy. Needs migration 0019. + "SKILLX_COLLECTIONS_API": "1" } } diff --git a/docs/deployment-guide.md b/docs/deployment-guide.md index 7cab0c2..f60adb1 100644 --- a/docs/deployment-guide.md +++ b/docs/deployment-guide.md @@ -473,8 +473,8 @@ document in R2 under `statuses/sha256/`. Rollback: the header SQL of and the `collection_revisions_immutable` trigger, which aborts every `UPDATE` of a stored revision. It is additive; apply it (`pnpm run db:migrate:remote`, after a backup) before deploying code with `SKILLX_COLLECTIONS_API` set to -`"1"`. The flag is `"0"` in `apps/web/wrangler.jsonc`, so `/api/v1/collections` -answers 404 until it is enabled. Revisions written before 0019 have no digest; +`"1"`. Production runs with the flag `"1"` in `apps/web/wrangler.jsonc`; +with `"0"`, `/api/v1/collections` answers 404. Revisions written before 0019 have no digest; the CLI then trusts the member list it recomputes. Rollback: set the flag back to `"0"`, redeploy, then run the header SQL of `0019_collection_revision_lineage.sql` (drops the trigger and both columns, From 71b5a22a1cd0674373f2bef4a8895636914e7f22 Mon Sep 17 00:00:00 2001 From: Duy Nguyen Date: Tue, 20 Oct 2026 09:38:32 +0700 Subject: [PATCH 2/2] docs(web): state migration prerequisites and rollback for both flags Co-Authored-By: Claude Opus 5.5 --- apps/web/wrangler.jsonc | 4 ++-- docs/deployment-guide.md | 8 ++++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/apps/web/wrangler.jsonc b/apps/web/wrangler.jsonc index b21c2ca..43bf79b 100644 --- a/apps/web/wrangler.jsonc +++ b/apps/web/wrangler.jsonc @@ -68,9 +68,9 @@ // Subrequests (D1 + R2 calls) one release publish may spend; above it the upload is refused with 413 // before any R2 write. Workers Paid allows 10,000 per request; on a free account (1,000) set ~600. "SKILLX_RELEASE_SUBREQUEST_BUDGET": "5000", - // Personal kit API (/api/v1/kits/@handle/name/...). "0" = off (404 everywhere); rollback = set "0" and redeploy. + // Personal kit API (/api/v1/kits/@handle/name/...). "0" = off (404 everywhere); rollback = set "0" and redeploy. Needs migrations 0015 and 0016. "SKILLX_PERSONAL_KITS_API": "1", - // Collections API (/api/v1/collections/...). "0" = off (404 everywhere); rollback = set "0" and redeploy. Needs migration 0019. + // Collections API (/api/v1/collections/...). "0" = off (404 everywhere); rollback = set "0" and redeploy. Needs migrations 0009 and 0019. "SKILLX_COLLECTIONS_API": "1" } } diff --git a/docs/deployment-guide.md b/docs/deployment-guide.md index f60adb1..91715f9 100644 --- a/docs/deployment-guide.md +++ b/docs/deployment-guide.md @@ -467,6 +467,14 @@ document in R2 under `statuses/sha256/`. Rollback: the header SQL of `0014_release_status_and_exec.sql` (drops both columns, clears the `d1_migrations` row); deploy the previous code first. +**Personal kits API.** `/api/v1/kits/...` needs migrations 0015 and 0016 +(personal kit tables and proposals) plus the release read stack +(`SKILLX_RELEASES_API`). Production runs with `SKILLX_PERSONAL_KITS_API` set to +`"1"` in `apps/web/wrangler.jsonc`. Before enabling it on another deployment, +confirm that `wrangler d1 migrations list skillx-db --remote` reports nothing +pending. Rollback: set the flag to `"0"` and redeploy; every route answers 404 +and stored kits stay untouched. + **Migration 0019 and the collections API.** `0019_collection_revision_lineage` adds two nullable columns (`collection_revisions.revision_digest`, `collections.cloned_from_revision_id`)