Repository navigation
ONE-167 nav v1 返工:表前缀三态 + D1 组织级接线(ONE-196:TABLE_PREFIX 三态 v1.4) - #4
Merged
Merged
Conversation
mapxn
force-pushed
the
agent/daniel/440c27cfbf00
branch
from
October 24, 2026 16:20
3e7f9ed to
fed2c7b
Compare
mapxn
force-pushed
the
agent/daniel/440c27cfbf00
branch
from
October 24, 2026 16:21
fed2c7b to
544c375
Compare
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.
范围(v1.4,三条)
TABLE_PREFIX,不改名)worker/src/types.ts:getTablePrefix(env)改三态——undefined → DEFAULT_TABLE_PREFIX("nav_")、"" → 空串(无前缀)、其他 → 校验后原值(非法即抛错);新增DEFAULT_TABLE_PREFIX常量与isValidTablePrefix(小写字母/数字/下划线)。worker/wrangler.toml:不再提交[vars] TABLE_PREFIX = "";无TABLE_PREFIX绑定时 Worker 默认nav_(零配置隔离)。POST /api/auth/setup解析前缀、非法自定义前缀拒绝初始化(500 明确报错)、首次 setup 前先跑幂等迁移(生效前缀落库)、完成响应新增tablePrefix字段。GET /api/system/info新增tablePrefix字段(可查生效前缀)。scripts/materialize-secrets.mjs):注入TABLE_PREFIX时——vars 未设/空 →nav_;none→ 空串;其他原样注入。同时 patchwrangler.toml的CLOUDFLARE_ACCOUNT_ID_PLACEHOLDER/D1_DATABASE_NAME_PLACEHOLDER/D1_DATABASE_ID_PLACEHOLDER,真实值不进 wrangler.toml,缺任一组织变量即失败退出。deploy.yml的 Materialize 步骤注入CLOUDFLARE_ACCOUNT_ID/D1_DATABASE_NAME/D1_DATABASE_ID/TABLE_PREFIX(均来自vars.*)。未建库、未建仓库级同名 secret/variable。说明
ACCOUNT_ID→vars改动;合并前请先合 ONE-167 nav v1 返工:后端部署工作流修复(ONE-195:Deploy 前 codegen + ACCOUNT_ID 改 vars) #3。tablePrefix字段为纯增量。{prefix}占位,未改任何查询/表结构;DEFAULT_TABLE_PREFIX = "nav_"是唯一写死前缀常量。自测
pnpm lint✓(46 files, No fixes applied)pnpm format:check✓(45 files)pnpm typecheck✓pnpm build✓pnpm test✓(4 files / 27 tests passed,含新增 7 条三态/迁移测试)materialize-secrets.mjs:空→nav_、none→空串、自定义→原样;缺组织变量→退出 1。