fix(deploy): unstick nitro Json typecheck and wipe poisoned .next cache
Local Build and Deploy / deploy (push) Failing after 1m21s

Host next build still saw Json on nitro while tsc passed; use any helpers, verify blob hash, and delete .next entirely before build.

Co-authored-by: Cursor <[email protected]>
This commit is contained in:
SimoandCursor committed 2026-07-18 20:14:50 +02:00
1 parent 1abbf3fde7
commit 968f6ff7db
3 files changed
+57 -78

No files matched your search

+17 -2
View File
@@ -66,12 +66,27 @@ jobs:
git diff --exit-code -- src
fi
# Prove critical sources match the git object (not just index timestamps).
NITRO_SRC="src/app/admin/import/furni/nitro-editor-dialog.tsx"
NITRO_EXPECTED="$(git rev-parse "HEAD:${NITRO_SRC}")"
NITRO_ACTUAL="$(git hash-object "${NITRO_SRC}")"
echo "nitro-editor-dialog blob expected=${NITRO_EXPECTED} actual=${NITRO_ACTUAL}"
if [ "${NITRO_EXPECTED}" != "${NITRO_ACTUAL}" ]; then
echo "ERROR: ${NITRO_SRC} content hash mismatch after checkout" >&2
exit 1
fi
if grep -nE '(^|[[:space:]])type Json\b|:\s*Json\b' "${NITRO_SRC}"; then
echo "ERROR: ${NITRO_SRC} still has a Json type annotation after checkout" >&2
exit 1
fi
# Drop incremental TS caches that can hide real type errors.
rm -f tsconfig.tsbuildinfo .tsbuildinfo
find . -maxdepth 3 -name '*.tsbuildinfo' -delete 2>/dev/null || true
# Preserve .next/cache so Next.js can reuse its incremental build cache.
rm -rf .output dist .next/types .next/dev
# Wipe .next entirely — partial cache has caused next build TS to disagree
# with a clean `tsc` on the same sources (stale nitro/rooms typings).
rm -rf .output dist .next
# Release tag for Sentry / logs (short git sha)
export APP_VERSION="$(git rev-parse --short HEAD)"
File diff suppressed because it is too large. Load diff
+5 -4
View File
@@ -8,9 +8,8 @@ describe("production deploy workflow", () => {
"utf8",
);
it("preserves the Next.js incremental build cache", () => {
// May clear .next/types or .next/dev, but must not wipe the whole .next tree.
expect(workflow).not.toMatch(/rm\s+-rf\s+\.next(?:\s|$)/);
it("wipes .next before build to avoid stale Next typecheck caches", () => {
expect(workflow).toContain("rm -rf .output dist .next");
expect(workflow).toContain("pnpm install --frozen-lockfile");
expect(workflow).toContain("SKIP_ENV_VALIDATION=1");
});
@@ -25,8 +24,10 @@ describe("production deploy workflow", () => {
expect(resetAt).toBeGreaterThan(reclaimAt);
});
it("verifies src/ matches HEAD and clears tsbuildinfo before typecheck", () => {
it("verifies src/ and nitro blob match HEAD before typecheck", () => {
expect(workflow).toContain("git diff --exit-code -- src");
expect(workflow).toContain("git hash-object");
expect(workflow).toContain("nitro-editor-dialog.tsx");
expect(workflow).toContain("*.tsbuildinfo");
expect(workflow).toContain("pnpm typecheck");
});