Skip to content

AI-native knowledge base & Evernote/Obsidian alternative with instant sync & native MCP. Free on Cloudflare or self-hosted via Docker.

fix: prevent broken releases from blocking forks

tianma-if8697af7a7d6f
diff --git a/.github/workflows/mobile-build.yml b/.github/workflows/mobile-build.yml
index 310ca0f0..bd7f2de3 100644
--- a/.github/workflows/mobile-build.yml
+++ b/.github/workflows/mobile-build.yml
@@ -64,6 +64,17 @@ jobs:
target_commitish="$(gh release view "$RELEASE_TAG" --repo "$GITHUB_REPOSITORY" --json targetCommitish --jq '.targetCommitish')"
test "$(git rev-parse "${target_commitish}^{commit}")" = "$(git rev-parse "${GITHUB_SHA}^{commit}")"
+ - name: Set up Bun for release validation
+ uses: oven-sh/setup-bun@v2
+ with:
+ bun-version: latest
+
+ - name: Install release validation dependencies
+ run: bun install --frozen-lockfile
+
+ - name: Run full project regression tests
+ run: bun run test
+
- name: Compare with previous formal release
id: plan
env:
diff --git a/.github/workflows/sync-edgeever-upstream.yml b/.github/workflows/sync-edgeever-upstream.yml
index c40353af..ea9fbd7a 100644
--- a/.github/workflows/sync-edgeever-upstream.yml
+++ b/.github/workflows/sync-edgeever-upstream.yml
@@ -243,7 +243,7 @@ jobs:
set -euo pipefail
bun install --frozen-lockfile
bun run db:migrate:local
- bun test --path-ignore-patterns='tests/e2e/**'
+ bun run test
bun run typecheck
bun run build
diff --git a/apps/mobile/src/lib/mobile-locale.test.mjs b/apps/mobile/src/lib/mobile-locale.test.mjs
index 0316b571..5be3299a 100644
--- a/apps/mobile/src/lib/mobile-locale.test.mjs
+++ b/apps/mobile/src/lib/mobile-locale.test.mjs
@@ -11,8 +11,13 @@ describe("mobile locale translation", () => {
expect(translateMobileText("从相册选择", "en-US")).toBe("Choose from library");
});
- test("interpolates mobile-only template copy", () => {
+ test("prefers specific mobile-only templates over broader templates", () => {
expect(translateMobileText("已加载 12 / 40 条笔记", "en-US")).toBe("Loaded 12 of 40 notes");
expect(translateMobileText("筛选:Pinned · 3 条", "en-US")).toBe("Filter: Pinned · 3 notes");
});
+
+ test("prefers specific shared templates over broader mobile-only templates", () => {
+ expect(translateMobileText("永久删除 3 条笔记", "en-US")).toBe("Delete 3 notes permanently");
+ expect(translateMobileText("当前:Inbox,3 条笔记", "en-US")).toBe("Current: Inbox, 3 notes");
+ });
});
diff --git a/apps/mobile/src/lib/mobile-locale.tsx b/apps/mobile/src/lib/mobile-locale.tsx
index a5cae552..de5c2eb5 100644
--- a/apps/mobile/src/lib/mobile-locale.tsx
+++ b/apps/mobile/src/lib/mobile-locale.tsx
@@ -176,6 +176,19 @@ const flattenStrings = (value: unknown, prefix = "", output = new Map<string, st
};
const escapeRegExp = (value: string) => value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
+const createTranslationPair = (source: string, target: string): TranslationPair => {
+ const placeholders: string[] = [];
+ const patternSource = escapeRegExp(source).replace(/\\\{\\\{(\w+)\\\}\\\}/g, (_match, placeholder: string) => {
+ placeholders.push(placeholder);
+ return "(.+?)";
+ });
+ return {
+ source,
+ target,
+ pattern: placeholders.length > 0 ? new RegExp(`^${patternSource}$`) : undefined,
+ placeholders,
+ };
+};
const zhStrings = flattenStrings(zhCN);
const enStrings = flattenStrings(enUS);
const translationPairs: TranslationPair[] = Array.from(zhStrings.entries())
@@ -184,26 +197,16 @@ const translationPairs: TranslationPair[] = Array.from(zhStrings.entries())
if (!target || source === target) {
return [];
}
- const placeholders: string[] = [];
- const patternSource = escapeRegExp(source).replace(/\\\{\\\{(\w+)\\\}\\\}/g, (_match, placeholder: string) => {
- placeholders.push(placeholder);
- return "(.+?)";
- });
- return [{ source, target, pattern: placeholders.length > 0 ? new RegExp(`^${patternSource}$`) : undefined, placeholders }];
- })
- .sort((left, right) => right.source.length - left.source.length);
+ return [createTranslationPair(source, target)];
+ });
const exactTranslations = new Map(translationPairs.filter((pair) => !pair.pattern).map((pair) => [pair.source, pair.target]));
-const templateTranslations = translationPairs.filter((pair) => pair.pattern);
const mobileTemplateTranslations: TranslationPair[] = Array.from(mobileOnlyTranslations.entries())
.filter(([source]) => source.includes("{{"))
- .map(([source, target]) => {
- const placeholders: string[] = [];
- const patternSource = escapeRegExp(source).replace(/\\\{\\\{(\w+)\\\}\\\}/g, (_match, placeholder: string) => {
- placeholders.push(placeholder);
- return "(.+?)";
- });
- return { source, target, pattern: new RegExp(`^${patternSource}$`), placeholders };
- });
+ .map(([source, target]) => createTranslationPair(source, target));
+const templateTranslations = [
+ ...mobileTemplateTranslations,
+ ...translationPairs.filter((pair) => pair.pattern),
+].sort((left, right) => right.source.length - left.source.length);
const resolveSystemLocale = (): SupportedMobileLocale =>
(Intl.DateTimeFormat().resolvedOptions().locale || "zh-CN").toLowerCase().startsWith("en") ? "en-US" : "zh-CN";
@@ -216,7 +219,7 @@ export const translateMobileText = (value: string, locale: SupportedMobileLocale
if (exact) {
return exact;
}
- for (const pair of [...mobileTemplateTranslations, ...templateTranslations]) {
+ for (const pair of templateTranslations) {
const match = pair.pattern?.exec(value);
if (!match) {
continue;
diff --git a/docs/cloudflare-workers-builds.md b/docs/cloudflare-workers-builds.md
index 8e83cf5d..c0025492 100644
--- a/docs/cloudflare-workers-builds.md
+++ b/docs/cloudflare-workers-builds.md
@@ -18,7 +18,9 @@ Configure `EDGE_EVER_AUTH_PASSWORD` under the Worker's **Settings -> Variables a
- **Update deployed EdgeEver** keeps a deployment Fork as an upstream **deploy mirror**:
- Default channel `stable` tracks the latest formal Release tag.
- Set the GitHub Repository Variable `EDGE_EVER_UPDATE_CHANNEL=edge` to follow upstream `main`.
- - Read-only forks (no app code changes) apply the target's product snapshot in a new linear commit; customized forks merge product changes and fail closed on conflicts.
+ - Read-only forks (no app code changes) apply the target's product snapshot in a new linear commit without installing dependencies or running the project test suite.
+ - Only forks that explicitly set `EDGE_EVER_PRESERVE_FORK_CHANGES=true` merge product changes. A customized merge runs local migrations, the complete non-E2E test suite, type checks, and the production build before pushing; any failure leaves `main` and production unchanged.
+ - Formal Releases run the same complete non-E2E suite on an official Ubuntu job before Draft assets are prepared. This keeps the stable channel's upstream baseline green, so customized-fork failures indicate an integration problem rather than a test already broken by the Release itself.
- The complete downstream `.github/workflows/**` directory and two updater helper scripts form a stable local bootstrap layer. Official packaging, signing, testing, and Release workflows are not part of automatic product updates, so `GITHUB_TOKEN` never needs permission to rewrite Actions workflows.
- Every run writes a job **Summary** with channel, target version, decision reason, and whether a push happened. A green run that says *Already on upstream target* is success, not a silent failure.
- Prefer this workflow over GitHub **Sync fork**. Sync fork follows upstream `main` history and can make the next stable run a deliberate no-op.
diff --git a/docs/cloudflare-workers-builds.zh-CN.md b/docs/cloudflare-workers-builds.zh-CN.md
index f83349f2..104768b5 100644
--- a/docs/cloudflare-workers-builds.zh-CN.md
+++ b/docs/cloudflare-workers-builds.zh-CN.md
@@ -18,7 +18,9 @@
- **Update deployed EdgeEver** 把部署用 Fork 当作上游的 **部署镜像** 来维护:
- 默认 `stable` 通道跟随最新正式 Release tag。
- 设置 GitHub Repository Variable `EDGE_EVER_UPDATE_CHANNEL=edge` 后跟随上游 `main`。
- - 只读 Fork(未改应用代码)会用一个新的线性提交应用目标版本的产品代码快照;有本地业务改动的 Fork 合并产品代码,冲突则失败并保持线上不变。
+ - 只读 Fork(未改应用代码)会用一个新的线性提交应用目标版本的产品代码快照,不安装依赖,也不执行项目测试套件。
+ - 只有显式设置 `EDGE_EVER_PRESERVE_FORK_CHANGES=true` 的 Fork 才会合并产品代码。定制合并会在 push 前执行本地 migration、完整非 E2E 测试、类型检查和生产构建;任一步失败都会保持 `main` 与线上版本不变。
+ - 正式 Release 会在准备 Draft 资产前,由官方 Ubuntu Job 执行同一套完整非 E2E 测试,确保 stable 通道的上游基线本身为绿色;定制 Fork 若失败,应代表合并集成问题,而不是 Release 自带的测试已经失败。
- 下游完整的 `.github/workflows/**` 目录和两个更新辅助脚本会作为稳定的本地引导层原样保留。官方打包、签名、测试与 Release 工作流不参与产品代码自动更新,因此 `GITHUB_TOKEN` 无需取得改写 Actions 工作流的权限。
- 每次运行都会写 Job **Summary**:通道、目标版本、判定原因、是否 push。若 Summary 写明 *Already on upstream target* / 已对齐,绿色成功表示「已是目标版本」,不是静默故障。
- 请优先用本工作流,而不是 GitHub **Sync fork**。Sync fork 跟的是上游 `main` 历史,可能让下一次 stable 运行合理变为 no-op。
diff --git a/scripts/desktop-build-workflow.test.mjs b/scripts/desktop-build-workflow.test.mjs
index 0afa06c7..561db6c3 100644
--- a/scripts/desktop-build-workflow.test.mjs
+++ b/scripts/desktop-build-workflow.test.mjs
@@ -12,6 +12,15 @@ function step(name) {
}
describe("desktop release workflow", () => {
+ test("gates Draft release assets on the full project suite in Ubuntu", () => {
+ expect(mobileWorkflow).toContain("github.repository == 'tianma-if/edgeever'");
+ expect(mobileWorkflow).toContain("name: Plan Android release asset\n runs-on: ubuntu-latest");
+ const regressionTests = mobileWorkflow.indexOf(" - name: Run full project regression tests\n run: bun run test");
+ const releasePlan = mobileWorkflow.indexOf(" - name: Compare with previous formal release");
+ expect(regressionTests).toBeGreaterThanOrEqual(0);
+ expect(regressionTests).toBeLessThan(releasePlan);
+ });
+
test("assigns shared validation only to the arm64 matrix job", () => {
expect(workflow).toContain([
" - arch: arm64",
diff --git a/scripts/release.mjs b/scripts/release.mjs
index 5f15704a..b4c7ad74 100644
--- a/scripts/release.mjs
+++ b/scripts/release.mjs
@@ -28,6 +28,7 @@ const RELEASE_WORKFLOWS = {
};
export const RELEASE_VALIDATIONS = [
+ { label: "Project regression tests", args: ["run", "test"] },
{ label: "Web typecheck", args: ["run", "typecheck"] },
{ label: "Mobile typecheck", args: ["run", "typecheck:mobile"] },
{ label: "Web build", args: ["run", "build:web"] },
diff --git a/scripts/release.test.mjs b/scripts/release.test.mjs
index 30f9c7ed..1d7756a3 100644
--- a/scripts/release.test.mjs
+++ b/scripts/release.test.mjs
@@ -6,12 +6,20 @@ import {
buildReleaseTitle,
nextVersion,
parseReleaseArgs,
+ RELEASE_VALIDATIONS,
resolveReleaseVersion,
reusedAssetMatches,
selectPublishedDmg,
} from "./release.mjs";
describe("release automation", () => {
+ test("runs the complete project regression suite before release", () => {
+ expect(RELEASE_VALIDATIONS).toContainEqual({
+ label: "Project regression tests",
+ args: ["run", "test"],
+ });
+ });
+
test("parses paired bilingual changes and labels", () => {
expect(
parseReleaseArgs([
diff --git a/tests/app-review-login.test.ts b/tests/app-review-login.test.ts
index 156c9c45..07b70009 100644
--- a/tests/app-review-login.test.ts
+++ b/tests/app-review-login.test.ts
@@ -22,15 +22,15 @@ describe("App Review login", () => {
}
});
- test("wires login screens to the public demo instance", () => {
+ test("uses the public demo instance as the login placeholder", () => {
expect(read("packages/shared/src/public-demo.ts")).toContain('export const PUBLIC_DEMO_INSTANCE_URL = "https://demo.edgeever.org"');
expect(read("apps/ios/EdgeEver/Supporting/URL+Normalize.swift")).toContain('static let instanceURLString = "https://demo.edgeever.org"');
expect(read("apps/ios/EdgeEver/Features/Auth/LoginView.swift")).toContain("EdgeEverPublicDemo.instanceURLString");
- expect(read("apps/ios/EdgeEver/Features/Auth/LoginView.swift")).toContain("Use public demo instance");
expect(read("apps/mobile/src/screens/LoginScreen.tsx")).toContain("PUBLIC_DEMO_INSTANCE_URL");
- expect(read("apps/mobile/src/screens/LoginScreen.tsx")).toContain("填入公开演示实例");
- expect(read("apps/web/src/components/LoginScreen.tsx")).toContain("PUBLIC_DEMO_INSTANCE_URL");
- expect(read("apps/web/src/components/LoginScreen.tsx")).toContain("login.usePublicDemo");
+ expect(read("apps/mobile/src/screens/LoginScreen.tsx")).toContain("placeholder={PUBLIC_DEMO_INSTANCE_URL}");
+ expect(read("packages/shared/src/i18n/en-US.ts")).toContain('instanceUrlPlaceholder: "https://demo.edgeever.org"');
+ expect(read("packages/shared/src/i18n/zh-CN.ts")).toContain('instanceUrlPlaceholder: "https://demo.edgeever.org"');
+ expect(read("apps/web/src/components/LoginScreen.tsx")).toContain('placeholder={t("login.instanceUrlPlaceholder")}');
});
test("puts the public demo URL and credentials in App Review notes", () => {
diff --git a/tests/deployment-entrypoints.test.ts b/tests/deployment-entrypoints.test.ts
index fe03107c..b3aeeae8 100644
--- a/tests/deployment-entrypoints.test.ts
+++ b/tests/deployment-entrypoints.test.ts
@@ -320,7 +320,7 @@ describe("Cloudflare deployment entrypoints", () => {
expect(workflow).toContain("bun run db:migrate:local");
expect(bunConfig).toContain('pathIgnorePatterns = ["tests/e2e/**"]');
expect(scripts.test).toBe("bun test --path-ignore-patterns='tests/e2e/**'");
- expect(workflow).toContain(scripts.test);
+ expect(workflow).toContain("bun run test");
expect(workflow.match(/if: steps\.upstream\.outputs\.align_mode == 'merge'/g)).toHaveLength(2);
expect(workflow).toContain("git push origin HEAD:main");
expect(workflow).not.toContain("git push --force-with-lease origin HEAD:main");