From c43a6588f9d455d4442eb254aab90813687be675 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sat, 7 Nov 2026 07:48:06 +0000 Subject: [PATCH 1/6] chore(deps): update dependency @solidjs/vite-plugin to v3.0.0-next.57 --- desktop/package.json | 2 +- pnpm-lock.yaml | 67 ++++++++++++++------------------------------ 2 files changed, 22 insertions(+), 47 deletions(-) diff --git a/desktop/package.json b/desktop/package.json index 2774b50a..fc467ef5 100644 --- a/desktop/package.json +++ b/desktop/package.json @@ -24,7 +24,7 @@ "solid-js": "2.0.0-rc.21" }, "devDependencies": { - "@solidjs/vite-plugin": "3.0.0-next.56", + "@solidjs/vite-plugin": "3.0.0-next.57", "mygo-cli": "0.1.22", "playwright": "1.59.1", "typescript": "^7", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index d7b7866f..f227343a 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -216,8 +216,8 @@ importers: version: 2.0.0-rc.21 devDependencies: '@solidjs/vite-plugin': - specifier: 3.0.0-next.56 - version: 3.0.0-next.56(@solidjs/web@2.0.0-rc.21(solid-js@2.0.0-rc.21))(solid-js@2.0.0-rc.21)(vite@8.3.0(@types/node@24.19.2)(esbuild@0.28.2)(jiti@2.7.0)(tsx@4.23.15)(yaml@2.9.1)) + specifier: 3.0.0-next.57 + version: 3.0.0-next.57(@babel/core@7.29.7)(@solidjs/babel-plugin@2.0.0-rc.21(@babel/core@7.29.7))(@solidjs/web@2.0.0-rc.21(solid-js@2.0.0-rc.21))(solid-js@2.0.0-rc.21)(vite@8.3.0(@types/node@24.19.2)(esbuild@0.28.2)(jiti@2.7.0)(tsx@4.23.15)(yaml@2.9.1)) '@types/node': specifier: ^24 version: 24.19.2 @@ -1835,16 +1835,22 @@ packages: resolution: {integrity: sha512-F1TUMO/nd1XC//+tcaWxibOOgXBHQGmNQnAeiDnpLh+1smnlwIgKF6pc20evlyfQwqf0gP6rH4sNEqCPBNcpgg==} engines: {node: '>=22.12.0'} - '@solidjs/vite-plugin@3.0.0-next.56': - resolution: {integrity: sha512-ox+Y0+UTC38/n7ky3z11jp9nDGMk/yjX8DbSIKri2S4SzE8fA7RA65z3yFQNd+Cs17fGTVnN4wpKgkItHlg2sw==} + '@solidjs/vite-plugin@3.0.0-next.57': + resolution: {integrity: sha512-z05CuXxtHUSYfKBw8PirIpXkjSmqevUiygbqIMxCmc+ZCW4x2d+1zHw7nd98NdQsNAUIXJir3GmM7n3f/j0jZg==} engines: {node: '>=22.12.0'} peerDependencies: + '@babel/core': ^7.23.3 || ^8.0.0 + '@solidjs/babel-plugin': ^2.0.0-rc.19 '@solidjs/start-devtools': ^1.0.0-next.2 '@solidjs/web': ^2.0.0-rc.19 '@testing-library/jest-dom': ^5.16.6 || ^5.17.0 || ^6.0.0 || ^7.0.0 solid-js: ^2.0.0-rc.19 vite: ^8.0.0 || ^9.0.0 peerDependenciesMeta: + '@babel/core': + optional: true + '@solidjs/babel-plugin': + optional: true '@solidjs/start-devtools': optional: true '@testing-library/jest-dom': @@ -2184,18 +2190,6 @@ packages: '@tybys/wasm-util@0.10.4': resolution: {integrity: sha512-W3c4gRigFS0T/Ma4qIYF3GDAc5AQdHb1yL5znJT1Zv1YaD9Kitx656wBjvr19qbiosmZT8lWDM5BEMynUqX65A==} - '@types/babel__core@7.20.5': - resolution: {integrity: sha512-qoQprZvz5wQFJwMDqeseRXWv3rqMvhgpbXFfVyWhbx9X47POIA6i/+dXefEmZKoAgOaTdaIgNSMqMIU61yRyzA==} - - '@types/babel__generator@7.27.0': - resolution: {integrity: sha512-ufFd2Xi92OAVPYsy+P4n7/U7e68fex0+Ee8gSG9KX7eo084CWiQ4sdxktvdl0bOPupXtVJPY19zk6EwWqUQ8lg==} - - '@types/babel__template@7.4.4': - resolution: {integrity: sha512-h/NUaSyG5EyxBIp8YRxo4RMe2/qQgvyowRwVMzhYhBCONbW8PUsg4lkFMrhgZhUe5z3L3MiLDuvyJ/CaPa2A8A==} - - '@types/babel__traverse@7.28.0': - resolution: {integrity: sha512-8PvcXf70gTDZBgt9ptxJ8elBeBjcLOAcOtoO/mPJjtji1+CdGbHgm77om1GrsPxsiE+uXIpNSK64UYaIwQXd4Q==} - '@types/chai@5.2.3': resolution: {integrity: sha512-Mw558oeA9fFbv65/y4mHtXDs9bPnFMZAL/jxdPFUpOHHIXX91mcgEHbS5Lahr+pwZFR8A7GQleRWeI6cGFC2UA==} @@ -4127,6 +4121,7 @@ snapshots: '@babel/helper-module-imports@7.18.6': dependencies: '@babel/types': 7.29.8 + optional: true '@babel/helper-module-imports@7.29.7': dependencies: @@ -4144,7 +4139,8 @@ snapshots: transitivePeerDependencies: - supports-color - '@babel/helper-plugin-utils@7.29.7': {} + '@babel/helper-plugin-utils@7.29.7': + optional: true '@babel/helper-string-parser@7.29.7': {} @@ -4165,6 +4161,7 @@ snapshots: dependencies: '@babel/core': 7.29.7 '@babel/helper-plugin-utils': 7.29.7 + optional: true '@babel/runtime@7.29.7': {} @@ -5377,6 +5374,7 @@ snapshots: '@babel/types': 7.29.8 html-entities: 2.3.3 parse5: 7.3.0 + optional: true '@solidjs/compiler-darwin-arm64@2.0.0-rc.21': optional: true @@ -5416,22 +5414,19 @@ snapshots: '@solidjs/signals@2.0.0-rc.21': {} - '@solidjs/vite-plugin@3.0.0-next.56(@solidjs/web@2.0.0-rc.21(solid-js@2.0.0-rc.21))(solid-js@2.0.0-rc.21)(vite@8.3.0(@types/node@24.19.2)(esbuild@0.28.2)(jiti@2.7.0)(tsx@4.23.15)(yaml@2.9.1))': + '@solidjs/vite-plugin@3.0.0-next.57(@babel/core@7.29.7)(@solidjs/babel-plugin@2.0.0-rc.21(@babel/core@7.29.7))(@solidjs/web@2.0.0-rc.21(solid-js@2.0.0-rc.21))(solid-js@2.0.0-rc.21)(vite@8.3.0(@types/node@24.19.2)(esbuild@0.28.2)(jiti@2.7.0)(tsx@4.23.15)(yaml@2.9.1))': dependencies: '@ampproject/remapping': 2.3.0 - '@babel/core': 7.29.7 - '@solidjs/babel-plugin': 2.0.0-rc.21(@babel/core@7.29.7) '@solidjs/compiler': 2.0.0-rc.21 '@solidjs/web': 2.0.0-rc.21(solid-js@2.0.0-rc.21) - '@types/babel__core': 7.20.5 magic-string: 0.30.21 merge-anything: 5.1.7 solid-js: 2.0.0-rc.21 vite: 8.3.0(@types/node@24.19.2)(esbuild@0.28.2)(jiti@2.7.0)(tsx@4.23.15)(yaml@2.9.1) vitefu: 1.1.3(vite@8.3.0(@types/node@24.19.2)(esbuild@0.28.2)(jiti@2.7.0)(tsx@4.23.15)(yaml@2.9.1)) - transitivePeerDependencies: - - '@tsrx/core' - - supports-color + optionalDependencies: + '@babel/core': 7.29.7 + '@solidjs/babel-plugin': 2.0.0-rc.21(@babel/core@7.29.7) '@solidjs/web@2.0.0-rc.21(solid-js@2.0.0-rc.21)': dependencies: @@ -5873,27 +5868,6 @@ snapshots: tslib: 2.8.1 optional: true - '@types/babel__core@7.20.5': - dependencies: - '@babel/parser': 7.29.8 - '@babel/types': 7.29.8 - '@types/babel__generator': 7.27.0 - '@types/babel__template': 7.4.4 - '@types/babel__traverse': 7.28.0 - - '@types/babel__generator@7.27.0': - dependencies: - '@babel/types': 7.29.8 - - '@types/babel__template@7.4.4': - dependencies: - '@babel/parser': 7.29.8 - '@babel/types': 7.29.8 - - '@types/babel__traverse@7.28.0': - dependencies: - '@babel/types': 7.29.8 - '@types/chai@5.2.3': dependencies: '@types/deep-eql': 4.0.2 @@ -6575,7 +6549,8 @@ snapshots: hookable@6.1.2: {} - html-entities@2.3.3: {} + html-entities@2.3.3: + optional: true html-parse-stringify@4.0.1: {} From e33bb821a403a4ddae95f0b5931e2356d44d88e5 Mon Sep 17 00:00:00 2001 From: Heitor Ramon Ribeiro Date: Sat, 7 Nov 2026 13:41:03 -0300 Subject: [PATCH 2/6] fix(build): exclude @solidjs/vite-plugin from pnpm minimum release age check --- pnpm-workspace.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml index 505967d5..47d53847 100644 --- a/pnpm-workspace.yaml +++ b/pnpm-workspace.yaml @@ -6,3 +6,5 @@ allowBuilds: lightningcss: true sharp: true workerd: true +minimumReleaseAgeExclude: + - '@solidjs/vite-plugin' From 1ee0c35d16b0339891ede467f49079882339fa48 Mon Sep 17 00:00:00 2001 From: Heitor Ramon Ribeiro Date: Sat, 7 Nov 2026 13:45:53 -0300 Subject: [PATCH 3/6] fix(workspace): pin @solidjs/vite-plugin minimum release age exemption to v3.0.0-next.57 --- pnpm-workspace.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml index 47d53847..8ceac781 100644 --- a/pnpm-workspace.yaml +++ b/pnpm-workspace.yaml @@ -7,4 +7,4 @@ allowBuilds: sharp: true workerd: true minimumReleaseAgeExclude: - - '@solidjs/vite-plugin' + - '@solidjs/vite-plugin@3.0.0-next.57' From 7aa80b2c2bfa67a25eea1f5e1f8c491283c3d793 Mon Sep 17 00:00:00 2001 From: Heitor Ramon Ribeiro Date: Sat, 7 Nov 2026 14:21:20 -0300 Subject: [PATCH 4/6] fix(web): normalize Vercel ignore Git errors to build --- docs/architecture/website.md | 8 ++---- scripts/test_vercel_ignore.py | 54 +++++++++++++++++++++++++++++++++++ web/vercel-ignore.sh | 2 ++ web/vercel.json | 3 +- 4 files changed, 60 insertions(+), 7 deletions(-) create mode 100644 scripts/test_vercel_ignore.py create mode 100644 web/vercel-ignore.sh diff --git a/docs/architecture/website.md b/docs/architecture/website.md index a0d39bdd..8b5ef517 100644 --- a/docs/architecture/website.md +++ b/docs/architecture/website.md @@ -8,13 +8,9 @@ The Windows download resolves both the staged `Beans Setup .exe` name a The Vercel project `hr-teconologia/beans` connects to `bloodf/beans` on GitHub. Pushes to `main` target production at `usebeans.app`; other branches create previews. Its root directory is `web`, with source files outside that directory enabled. Installation runs `cd .. && pnpm install --frozen-lockfile`, and the build runs `pnpm run build`. -The project's Ignored Build Step compares `VERCEL_GIT_PREVIOUS_SHA` with `HEAD` for `web/`, `desktop/`, the root `package.json` and `bun.lock`, `crates/models/catalog.json`, `crates/cli/marketplace/index.json`, and `.vercelignore`. These paths cover the site, embedded desktop demo, workspace dependencies and served catalogs. An unchanged diff skips the build. A missing previous deployment SHA or unavailable Git history allows the build. Vercel's automatic affected-project detection is disabled so it cannot skip changes to the served catalogs outside the JavaScript workspaces. +The Ignored Build Step in `web/vercel.json` runs `sh ./vercel-ignore.sh` within the 256-character configuration limit. The script compares `VERCEL_GIT_PREVIOUS_SHA` with `HEAD` for the site, embedded desktop demo, root package and pnpm lock/workspace settings, Blobatar package, served catalogs and `.vercelignore`. Only a successful unchanged diff skips the build. Missing previous deployment SHA or unavailable Git history returns exit 1 to run the build instead of failing deployment with Git's error status. Vercel's automatic affected-project detection is disabled so it cannot skip changes to served catalogs outside the JavaScript workspaces. -`.vercelignore` retains Git metadata so the Ignored Build Step can compare commits. This filter is stored in the Vercel project settings and runs from `web`: - -```sh -test -n "$VERCEL_GIT_PREVIOUS_SHA" && git diff --quiet "$VERCEL_GIT_PREVIOUS_SHA" HEAD -- . ../desktop ../package.json ../bun.lock ../crates/models/catalog.json ../crates/cli/marketplace/index.json ../.vercelignore -``` +`.vercelignore` retains Git metadata for this comparison. The repository configuration overrides the project's Ignored Build Step and runs from `web`. `python3 scripts/test_vercel_ignore.py` verifies unchanged, changed, empty and unavailable previous revisions using real temporary Git commits. ## Landing-page motion diff --git a/scripts/test_vercel_ignore.py b/scripts/test_vercel_ignore.py new file mode 100644 index 00000000..fb228a9d --- /dev/null +++ b/scripts/test_vercel_ignore.py @@ -0,0 +1,54 @@ +import json +import os +from pathlib import Path +import subprocess +import tempfile +import unittest + + +COMMAND = json.loads((Path(__file__).resolve().parents[1] / "web/vercel.json").read_text())["ignoreCommand"] + + +class IgnoreBuildTest(unittest.TestCase): + def test_real_git_inputs(self): + with tempfile.TemporaryDirectory(prefix="beans-vercel-ignore-") as directory: + root = Path(directory) + web = root / "web" + web.mkdir() + self.assertLessEqual(len(COMMAND), 256) + (web / "vercel-ignore.sh").write_bytes((Path(__file__).resolve().parents[1] / "web/vercel-ignore.sh").read_bytes()) + + def git(*args): + return subprocess.run(["git", *args], cwd=root, check=True, capture_output=True, text=True).stdout.strip() + + def ignored(previous): + env = {**os.environ, "VERCEL_GIT_PREVIOUS_SHA": previous} + return subprocess.run(["sh", "-c", COMMAND], cwd=web, env=env, capture_output=True).returncode + + git("init", "-q") + git("config", "user.name", "Beans test") + git("config", "user.email", "test@example.invalid") + (web / "page.txt").write_text("initial") + (root / "pnpm-lock.yaml").write_text("initial") + git("add", ".") + git("commit", "-qm", "initial") + initial = git("rev-parse", "HEAD") + self.assertEqual(ignored(initial), 0) + self.assertEqual(ignored(""), 1) + self.assertEqual(ignored("f" * 40), 1) + (web / "page.txt").write_text("changed") + git("commit", "-qam", "website change") + self.assertEqual(ignored(initial), 1) + website = git("rev-parse", "HEAD") + (root / "pnpm-lock.yaml").write_text("changed") + git("commit", "-qam", "dependency change") + self.assertEqual(ignored(website), 1) + dependency = git("rev-parse", "HEAD") + (root / "Cargo.lock").write_text("Rust-only change") + git("add", ".") + git("commit", "-qm", "unrelated Rust change") + self.assertEqual(ignored(dependency), 0) + + +if __name__ == "__main__": + unittest.main() diff --git a/web/vercel-ignore.sh b/web/vercel-ignore.sh new file mode 100644 index 00000000..766c377f --- /dev/null +++ b/web/vercel-ignore.sh @@ -0,0 +1,2 @@ +#!/bin/sh +test -n "$VERCEL_GIT_PREVIOUS_SHA" && git diff --quiet "$VERCEL_GIT_PREVIOUS_SHA" HEAD -- . ../desktop ../package.json ../pnpm-lock.yaml ../pnpm-workspace.yaml ../.npmrc ../packages/beans-blobatar ../crates/models/catalog.json ../crates/cli/marketplace/index.json ../.vercelignore; result=$?; test "$result" -eq 0 diff --git a/web/vercel.json b/web/vercel.json index cecc1936..4a90457a 100644 --- a/web/vercel.json +++ b/web/vercel.json @@ -21,5 +21,6 @@ ] } ], - "installCommand": "pnpm install --frozen-lockfile" + "installCommand": "pnpm install --frozen-lockfile", + "ignoreCommand": "sh ./vercel-ignore.sh" } From 8f060677b1dc6f63fb2e5adba1775024054c32af Mon Sep 17 00:00:00 2001 From: Heitor Ramon Ribeiro Date: Sat, 7 Nov 2026 17:21:41 -0300 Subject: [PATCH 5/6] docs: move phone rebuild commands into their subject --- ARCHITECTURE.md | 2 +- docs/architecture/phone-app.md | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/ARCHITECTURE.md b/ARCHITECTURE.md index 88f70826..fadfbd41 100644 --- a/ARCHITECTURE.md +++ b/ARCHITECTURE.md @@ -127,7 +127,7 @@ beans/ .github/workflows/ # release.yml: manual signed Beans releases; test.yml: full PR/manual test matrix; docs.yml: PR/manual doc check; catalog.yml: PR/manual catalog/index check ``` -`pnpm run android` rebuilds the Rust core for Android, then builds and runs the Expo dev client on the Android emulator. `cd mobile && pnpm run core` rebuilds the Rust core for both phone platforms; `pnpm run mobile:dev` is the iOS development loop described below. +See [Phone development](docs/architecture/phone-app.md#development-loop) for phone rebuild commands. `pnpm run dev` runs the macOS Beans Dev loop; `pnpm run build` produces the Beans release bundle. See [macOS development and builds](docs/architecture/macos-app.md#development-and-builds) for rebuild, launch and SDK-stamping mechanisms. `pnpm run relay` runs a local relay. The [phone development loop](docs/architecture/phone-app.md#development-loop) fingerprints native inputs, rebuilds stale pieces and leaves production Beans processes alone. diff --git a/docs/architecture/phone-app.md b/docs/architecture/phone-app.md index 845e91bf..a7d349c9 100644 --- a/docs/architecture/phone-app.md +++ b/docs/architecture/phone-app.md @@ -56,4 +56,6 @@ The production app icon uses the coral Beans mark. Editable SVG masters in `desi ## Development loop +`pnpm run android` rebuilds the Rust core for Android, then builds and runs the Expo dev client on the Android emulator. `cd mobile && pnpm run core` rebuilds the Rust core for both phone platforms; `pnpm run mobile:dev` is the iOS development loop described here. + `pnpm run mobile:dev` (`scripts/mobile.ts`) is the Beans Dev phone loop on the iOS Simulator, or on `--device `: it fingerprints the crates the phone links, the prebuild inputs (Expo config, assets, `package.json`, plugins, targets), the pod inputs with the checkout's path, and the native module sources (stamps in `mobile/.expo/dev-stamps.json`), rebuilds what is stale (`pnpm run core ios`, a clean `expo prebuild`, `pod install`, `expo run:ios`), starts Metro, and opens the dev client on it. A Rust save while it runs rebuilds the core and installs the app again. The Mac and phone loops leave production Beans processes alone, so all builds run side by side. From 17e5898800fd7274605a0adf1af2e803f0b2b93a Mon Sep 17 00:00:00 2001 From: Heitor Ramon Ribeiro Date: Sat, 7 Nov 2026 17:34:18 -0300 Subject: [PATCH 6/6] fix(web): validate previous deployment commit before diff --- docs/architecture/website.md | 2 +- scripts/test_vercel_ignore.py | 33 +++++++++++++++++++++++++++++++++ web/vercel-ignore.sh | 10 +++++++++- 3 files changed, 43 insertions(+), 2 deletions(-) diff --git a/docs/architecture/website.md b/docs/architecture/website.md index 8b5ef517..63b33e4d 100644 --- a/docs/architecture/website.md +++ b/docs/architecture/website.md @@ -8,7 +8,7 @@ The Windows download resolves both the staged `Beans Setup .exe` name a The Vercel project `hr-teconologia/beans` connects to `bloodf/beans` on GitHub. Pushes to `main` target production at `usebeans.app`; other branches create previews. Its root directory is `web`, with source files outside that directory enabled. Installation runs `cd .. && pnpm install --frozen-lockfile`, and the build runs `pnpm run build`. -The Ignored Build Step in `web/vercel.json` runs `sh ./vercel-ignore.sh` within the 256-character configuration limit. The script compares `VERCEL_GIT_PREVIOUS_SHA` with `HEAD` for the site, embedded desktop demo, root package and pnpm lock/workspace settings, Blobatar package, served catalogs and `.vercelignore`. Only a successful unchanged diff skips the build. Missing previous deployment SHA or unavailable Git history returns exit 1 to run the build instead of failing deployment with Git's error status. Vercel's automatic affected-project detection is disabled so it cannot skip changes to served catalogs outside the JavaScript workspaces. +The Ignored Build Step in `web/vercel.json` runs `sh ./vercel-ignore.sh` within the 256-character configuration limit. The script requires `VERCEL_GIT_PREVIOUS_SHA` to be a full 40- or 64-character hexadecimal ID of an available Git commit before comparing it with `HEAD` for the site, embedded desktop demo, root package and pnpm lock/workspace settings, Blobatar package, served catalogs and `.vercelignore`. Only a successful unchanged diff skips the build. Missing previous deployment SHA or unavailable Git history returns exit 1 to run the build instead of failing deployment with Git's error status. Vercel's automatic affected-project detection is disabled so it cannot skip changes to served catalogs outside the JavaScript workspaces. `.vercelignore` retains Git metadata for this comparison. The repository configuration overrides the project's Ignored Build Step and runs from `web`. `python3 scripts/test_vercel_ignore.py` verifies unchanged, changed, empty and unavailable previous revisions using real temporary Git commits. diff --git a/scripts/test_vercel_ignore.py b/scripts/test_vercel_ignore.py index fb228a9d..eaee479d 100644 --- a/scripts/test_vercel_ignore.py +++ b/scripts/test_vercel_ignore.py @@ -10,6 +10,24 @@ class IgnoreBuildTest(unittest.TestCase): + def test_sha256_commit(self): + with tempfile.TemporaryDirectory(prefix="beans-vercel-sha256-") as directory: + root = Path(directory) + web = root / "web" + web.mkdir() + (web / "vercel-ignore.sh").write_bytes((Path(__file__).resolve().parents[1] / "web/vercel-ignore.sh").read_bytes()) + subprocess.run(["git", "init", "-q", "--object-format=sha256"], cwd=root, check=True, capture_output=True) + subprocess.run(["git", "add", "."], cwd=root, check=True, capture_output=True) + subprocess.run(["git", "-c", "user.name=Beans test", "-c", "user.email=test@example.invalid", "commit", "-qm", "initial"], cwd=root, check=True, capture_output=True) + previous = subprocess.check_output(["git", "rev-parse", "HEAD"], cwd=root, text=True).strip() + self.assertEqual(len(previous), 64) + env = {**os.environ, "VERCEL_GIT_PREVIOUS_SHA": previous} + self.assertEqual(subprocess.run(["sh", "-c", COMMAND], cwd=web, env=env, capture_output=True).returncode, 0) + (web / "page.txt").write_text("changed") + subprocess.run(["git", "add", "."], cwd=root, check=True, capture_output=True) + subprocess.run(["git", "-c", "user.name=Beans test", "-c", "user.email=test@example.invalid", "commit", "-qm", "changed"], cwd=root, check=True, capture_output=True) + self.assertEqual(subprocess.run(["sh", "-c", COMMAND], cwd=web, env=env, capture_output=True).returncode, 1) + def test_real_git_inputs(self): with tempfile.TemporaryDirectory(prefix="beans-vercel-ignore-") as directory: root = Path(directory) @@ -36,6 +54,21 @@ def ignored(previous): self.assertEqual(ignored(initial), 0) self.assertEqual(ignored(""), 1) self.assertEqual(ignored("f" * 40), 1) + for invalid in ("--cached", "--quiet", "HEAD", "refs/heads/main", "g" * 40, "a" * 39, "a" * 41, "a" * 63, "a" * 65, "f" * 64): + with self.subTest(previous=invalid): + self.assertEqual(ignored(invalid), 1) + missing_env = dict(os.environ) + missing_env.pop("VERCEL_GIT_PREVIOUS_SHA", None) + self.assertEqual(subprocess.run(["sh", "-c", COMMAND], cwd=web, env=missing_env, capture_output=True).returncode, 1) + blob = git("rev-parse", "HEAD:web/page.txt") + tree = git("rev-parse", "HEAD^{tree}") + self.assertEqual(ignored(blob), 1) + self.assertEqual(ignored(tree), 1) + (root / ".git").rename(root / "git-unavailable") + try: + self.assertEqual(ignored(initial), 1) + finally: + (root / "git-unavailable").rename(root / ".git") (web / "page.txt").write_text("changed") git("commit", "-qam", "website change") self.assertEqual(ignored(initial), 1) diff --git a/web/vercel-ignore.sh b/web/vercel-ignore.sh index 766c377f..ba0baf20 100644 --- a/web/vercel-ignore.sh +++ b/web/vercel-ignore.sh @@ -1,2 +1,10 @@ #!/bin/sh -test -n "$VERCEL_GIT_PREVIOUS_SHA" && git diff --quiet "$VERCEL_GIT_PREVIOUS_SHA" HEAD -- . ../desktop ../package.json ../pnpm-lock.yaml ../pnpm-workspace.yaml ../.npmrc ../packages/beans-blobatar ../crates/models/catalog.json ../crates/cli/marketplace/index.json ../.vercelignore; result=$?; test "$result" -eq 0 +case "$VERCEL_GIT_PREVIOUS_SHA" in + ''|*[!0123456789abcdefABCDEF]*) exit 1 ;; +esac +case "${#VERCEL_GIT_PREVIOUS_SHA}" in + 40|64) ;; + *) exit 1 ;; +esac +test "$(git cat-file -t "$VERCEL_GIT_PREVIOUS_SHA")" = commit || exit 1 +git diff --quiet "$VERCEL_GIT_PREVIOUS_SHA" HEAD -- . ../desktop ../package.json ../pnpm-lock.yaml ../pnpm-workspace.yaml ../.npmrc ../packages/beans-blobatar ../crates/models/catalog.json ../crates/cli/marketplace/index.json ../.vercelignore; result=$?; test "$result" -eq 0