chore: retire remaining convex infrastructure

- move self-hosted Convex infra and root placeholder into recycle

- update architecture docs to remove active infra/convex deployment guidance

- extend local-first Convex guard to block retired infra regressions
This commit is contained in:
lix-2026
2026-05-22 19:31:20 +08:00
parent 47e224d419
commit 42fb58310c
13 changed files with 61 additions and 21 deletions
+41
View File
@@ -69,6 +69,17 @@ const RETIRED_ROOT_CONVEX_PATHS = [
},
];
const RETIRED_CONVEX_INFRA_PATHS = [
{
name: "Convex 自托管 infra",
pattern: /^infra\/convex(?:\/|$)/,
},
{
name: "根 storage-convex-bridge 占位文件",
pattern: /^storage-convex-bridge$/,
},
];
// ─── SQLite 迁移期 forbid ───────────────────────────────────
// 在 SQLite 控制面迁移阶段(Phase 1-5),新增 Convex 控制面代码
// users/workspaces/sessions/policies/audit/outbox/share 等)
@@ -122,6 +133,7 @@ function usage() {
"",
`如需保留明确的 cloud/compat 直连,请在同一新增行加入 ${WAIVER}`,
"根 convex/ functions 源码已退役;如确需新增显式 cloud/compat Convex functions,应先放到明确的辅助目录并更新 guard。",
"infra/convex 自托管基础设施已退役到 recycle;不要重新引回 active 路径。",
`SQLite 迁移期中新增 Convex 控制面代码(users/workspaces/grants/share 等)需加 ${MIGRATION_PERIOD_WAIVER} 标注迁移例外。`,
].join("\n");
}
@@ -179,6 +191,10 @@ function isRetiredRootConvexPath(filePath) {
return RETIRED_ROOT_CONVEX_PATHS.some((entry) => entry.pattern.test(filePath));
}
function isRetiredConvexInfraPath(filePath) {
return RETIRED_CONVEX_INFRA_PATHS.some((entry) => entry.pattern.test(filePath));
}
function isAllowedRuntimeAdapter(filePath) {
return (
filePath === "rust/crates/mnote-web/src/transport/convex.rs" ||
@@ -280,6 +296,15 @@ function checkLine(row) {
];
}
if (isRetiredConvexInfraPath(row.filePath)) {
return [
{
...row,
reason: `${RETIRED_CONVEX_INFRA_PATHS.find((entry) => entry.pattern.test(row.filePath)).name} 已软删除到 recycle;不要重新引回 active 路径或默认启动链路。`,
},
];
}
if (!isRuntimePath(row.filePath) || isAllowedRuntimeAdapter(row.filePath)) {
if (!isActiveConvexPath(row.filePath)) {
return [];
@@ -347,6 +372,16 @@ function runSelfTest() {
lineNumber: 1,
text: " workspaces: defineTable({",
},
{
filePath: "infra/convex/docker-compose.yml",
lineNumber: 1,
text: "services:",
},
{
filePath: "storage-convex-bridge",
lineNumber: 1,
text: "",
},
];
const violations = rows.flatMap(checkLine);
const labels = violations.map((item) => item.filePath);
@@ -374,6 +409,12 @@ function runSelfTest() {
if (!labels.includes("convex/workspaces_migration.ts")) {
throw new Error("self-test 失败:未拦截迁移期新增 Convex 控制面 workspaces 代码");
}
if (!labels.includes("infra/convex/docker-compose.yml")) {
throw new Error("self-test 失败:未拦截退役的 Convex infra 回流");
}
if (!labels.includes("storage-convex-bridge")) {
throw new Error("self-test 失败:未拦截根 storage-convex-bridge 占位文件回流");
}
console.log(JSON.stringify({ ok: true, guard: "local-first-convex", selfTest: true }, null, 2));
}