π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Require approval for Swift lint suppressions
Manav Rathicc03c711f023
diff --git a/.github/checks/change-approval/check.mjs b/.github/checks/change-approval/check.mjsindex ce4e607aa4..3bec5e2ad0 100644--- a/.github/checks/change-approval/check.mjs+++ b/.github/checks/change-approval/check.mjs@@ -3,6 +3,7 @@ import { checkDependencies } from "./dependencies.mjs";import { checkFiles } from "./files.mjs";import { writeReport } from "./report.mjs";import { checkRust } from "./rust.mjs";+import { checkSwift } from "./swift.mjs";import { checkWeb } from "./web.mjs";const [base = "origin/main"] = process.argv.slice(2);@@ -12,5 +13,6 @@ writeReport({files: checkFiles(changes),dependencies: checkDependencies(changes),rust: checkRust(changes),+ swift: checkSwift(changes),web: checkWeb(changes),});diff --git a/.github/checks/change-approval/report.mjs b/.github/checks/change-approval/report.mjsindex c0a0031d73..7395238203 100644--- a/.github/checks/change-approval/report.mjs+++ b/.github/checks/change-approval/report.mjs@@ -4,6 +4,7 @@ export function writeReport({files: { binaries, large, guardrails, configs },dependencies,rust,+ swift,web,}) {const categories = [@@ -44,6 +45,11 @@ export function writeReport({plural: "Rust lint policy files",count: rust.length,},+ {+ singular: "Swift lint policy file",+ plural: "Swift lint policy files",+ count: swift.length,+ },{singular: "Web lint policy file",plural: "Web lint policy files",@@ -84,6 +90,8 @@ export function writeReport({sections.push(`## Rust lint declarations and files containing unsafe\n\n${list(rust.map(({ path, reasons }) => `${code(path)}: ${reasons.map(code).join("; ")}`))}`,);+ if (swift.length)+ sections.push(`## Swift lint directives\n\n${list(swift.map(code))}`);if (web.length)sections.push(`## Web lint directives\n\n${list(web.map(code))}`);const detail = sections.join("\n\n");diff --git a/.github/checks/change-approval/swift.mjs b/.github/checks/change-approval/swift.mjsnew file mode 100644index 0000000000..a616891e14--- /dev/null+++ b/.github/checks/change-approval/swift.mjs@@ -0,0 +1,13 @@+export function checkSwift({ files, readAddedLines }) {+ return files+ .filter(+ ({ path, binary, deleted }) =>+ !binary && !deleted && /^apple\/.*\.swift$/.test(path),+ )+ .filter(({ path }) =>+ /\b(?:swiftlint\s*:|swift-format-ignore\b)/.test(+ readAddedLines(path),+ ),+ )+ .map(({ path }) => path);+}diff --git a/.github/checks/change-approval/test.mjs b/.github/checks/change-approval/test.mjsindex 4b088eb5f4..fa61965387 100644--- a/.github/checks/change-approval/test.mjs+++ b/.github/checks/change-approval/test.mjs@@ -1052,6 +1052,42 @@ test("new Web directives are checked in uncommitted and untracked files", (t) =>);});+test("Swift lint directives in added lines need approval", (t) => {+ const file = "apple/apps/cast/Example.swift";+ for (const directive of [+ "// swift-format-ignore",+ "// swift-format-ignore: NeverForceUnwrap",+ "// swift-format-ignore-file",+ "// swiftlint:disable:next empty_count",+ "// swiftlint:enable empty_count",+ ]) {+ const { output, summary } = scan(+ t,+ { [file]: "first()\n" },+ { [file]: `${directive}\nfirst()\n` },+ { ci: true },+ );+ assert.equal(output, 'categories=["Swift lint policy files"]\n');+ assert.match(summary, /## Swift lint directives/);+ assert.ok(summary.includes(`\`${file}\``));+ }+});++test("Swift directive edits need approval; ordinary edits and removals do not", (t) => {+ const file = "apple/apps/cast/Example.swift";+ const before = "// swift-format-ignore: NeverForceUnwrap\nfirst()\n";+ assert.match(+ scan(+ t,+ { [file]: before },+ { [file]: before.replace(": NeverForceUnwrap", "") },+ ),+ /^1 Swift lint policy file\n/,+ );+ for (const after of [before.replace("first", "second"), "first()\n", null])+ assert.equal(scan(t, { [file]: before }, { [file]: after }), "");+});+test("checks started in a subdirectory inspect repository-wide changes", (t) => {const summary ="1 binary file, 1 new dependency\n\n## Binary files\n\n- `new.bin` (16 bytes)\n\n## New dependencies\n\n`rust/Cargo.lock`\n\n- b 2.0.0\n";diff --git a/apple/packages/EnteOnnxRuntime/Package.swift b/apple/packages/EnteOnnxRuntime/Package.swiftindex e2f11f63d4..d1333d33d4 100644--- a/apple/packages/EnteOnnxRuntime/Package.swift+++ b/apple/packages/EnteOnnxRuntime/Package.swift@@ -1,4 +1,4 @@-// swift-tools-version: 5.9+// swift-tools-version: 6.0// Ente's pinned custom ONNX Runtime static-library XCFramework for iOS// (CoreML and CPU; device and ARM64 Simulator). SPM downloads the release ZIP, verifies