Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import {
afterEach,
vi,
} from 'vite-plus/test';
import { computeAssetHash } from '../../src/assets.ts';
import { cancelDeployment } from '../../src/db.ts';
import app from '../../src/index.ts';
import * as projectIngress from '../../src/project-ingress.ts';
Expand Down
1 change: 0 additions & 1 deletion platform/packages/dispatch/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ import {
SHARED_CACHE_POLICY_HEADER,
markSharedCachePolicy,
resolveRevalidateTtl,
resolvePathTtl,
resolvePageTtl,
matchesLiteralPage,
isDottedPathIsrEligible,
Expand Down
6 changes: 0 additions & 6 deletions platform/packages/dispatch/src/isr.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,10 @@
import { isrCacheKey, isrCacheVariantPrefix, isrEdgeCacheUrl } from '@void/isr';
import {
decodeIsrCacheEntry,
extractPageDataFromHtml,
isrCacheResponse,
isStale,
normalizePageDataForJsonCache,
packIsrValue,
resolvePathTtl,
resolveRevalidateTtl,
SHARED_CACHE_POLICY_VERSION,
serializeHeaders,
shouldBypassIsr,
type IsrCacheEntry,
type IsrCacheMetadata,
} from '@void/isr/core';
Expand Down
2 changes: 0 additions & 2 deletions platform/packages/dispatch/test/unit/fallback-rules.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,6 @@ type WorkerRoutingEntry = {
queryAllowlist?: Record<string, Array<string>>;
};

type RoutingEntry = StaticRoutingEntry | WorkerRoutingEntry;

/**
* Build an Env for static-deployment tests. Assets are identified by their path;
* the KV store keys off `assets/{projectId}/{path}` → an ArrayBuffer of the body.
Expand Down
2 changes: 1 addition & 1 deletion platform/packages/dispatch/test/unit/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -797,7 +797,7 @@ describe('ISR (stale-while-revalidate)', () => {
// → 0 (per-path opt-out, rendered live, never cached). This proves the
// pathRevalidate field is threaded through the ISR ladder end-to-end — the
// per-path fidelity that build-time baking (one TTL per page) cannot give.
const { env, workerFetch, kvStore } = createEnv({
const { env, kvStore } = createEnv({
routing: {
workerName: 'user-app',
projectId: 'proj_1',
Expand Down
1 change: 0 additions & 1 deletion platform/packages/email-gateway/src/router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,6 @@ export async function routeRelayed(
) {
return { reject: true };
}
const slug = authoritative.slug;
const workerName = authoritative.workerName;

// Built before dispatch so the dispatch-failure paths can log the
Expand Down
7 changes: 1 addition & 6 deletions platform/packages/email-gateway/test/unit/router.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,7 @@ vi.mock('../../src/tenant-dispatch.ts', () => ({
},
}));
import type { Env } from '../../../proxy/src/types.ts';
import {
MAX_INBOUND_BYTES,
MAX_INBOUND_HEADERS,
routeInbound as routeInboundWithRoute,
routeRelayed,
} from '../../src/router.ts';
import { routeInbound as routeInboundWithRoute, routeRelayed } from '../../src/router.ts';

const ROUTE_FENCE = {
routeId: 'route-1',
Expand Down
1 change: 0 additions & 1 deletion platform/packages/proxy/src/email.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import {
import { leaseBearer, leaseEmailDomainCredential } from './email-lease.ts';
import {
EMAIL_PROVIDER_DEADLINE_MS,
EmailProviderTimeoutError,
createEmailProviderDeadline,
type EmailProviderDeadline,
} from './email-provider-deadline.ts';
Expand Down
2 changes: 1 addition & 1 deletion platform/packages/proxy/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { r2 } from './r2.ts';
import { readRequestJson, requestBodyMaxBytes, RequestBodyError } from './request-body.ts';
import { verifyPrerenderAuthority, verifyProjectDeployAccess } from './resolve.ts';
import { revalidate } from './revalidate.ts';
import type { Env, JwtPayload, ProxyBody, ProxyEnv } from './types.ts';
import type { JwtPayload, ProxyBody, ProxyEnv } from './types.ts';

const app = new Hono<ProxyEnv>();

Expand Down
48 changes: 0 additions & 48 deletions platform/packages/proxy/test/unit/email.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -219,50 +219,6 @@ function nonAuthKvReads(kv: MockKv): Array<string> {
// The floor cache lives for the whole isolate; start every test cold.
beforeEach(clearProxyTokenStateCache);

// --- Inbound helpers ---

function streamOf(bytes: Uint8Array): ReadableStream<Uint8Array> {
return new ReadableStream<Uint8Array>({
start(controller) {
controller.enqueue(bytes);
controller.close();
},
});
}

function createInboundMessage(to: string, from = 'sender@example.com') {
const bytes = new TextEncoder().encode('Subject: hi\r\n\r\nhello\r\n');
return {
from,
to,
rawSize: bytes.byteLength,
raw: streamOf(bytes),
headers: new Headers({ Subject: 'hi' }),
setReject: vi.fn(),
forward: vi.fn(async () => {}),
reply: vi.fn(async () => {}),
};
}

function createCtx() {
const pending: Array<Promise<unknown>> = [];
return {
ctx: { waitUntil: (p: Promise<unknown>) => pending.push(p), passThroughOnException: () => {} },
settle: () => Promise.allSettled(pending),
};
}

type InboundMessage = ReturnType<typeof createInboundMessage>;

async function routeInboundMessage(
env: Record<string, unknown>,
message: InboundMessage,
): Promise<void> {
const { ctx, settle } = createCtx();
await (worker.email as (m: unknown, e: unknown, c: unknown) => Promise<void>)(message, env, ctx);
await settle();
}

// --- wrangler.jsonc ---

/**
Expand Down Expand Up @@ -565,10 +521,6 @@ function monthKeyFor(projectId: string): string {
return `email-sent:${projectId}:${now.getUTCFullYear()}-${String(now.getUTCMonth() + 1).padStart(2, '0')}`;
}

function putsWithPrefix(kv: MockKv, prefix: string): Array<Array<unknown>> {
return kv.put.mock.calls.filter((call) => String(call[0]).startsWith(prefix));
}

interface SendResponseBody {
ok: boolean;
error?: { code: string; message: string };
Expand Down
10 changes: 9 additions & 1 deletion vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,8 @@ export default defineConfig({
'.pnpm-store/**',
'playground-local/**',
'.worktrees/**',
// Generated by @nkzw/fate, which can import helpers the client does not use.
'platform/packages/api/src/admin/fate/client.generated.ts',
],
overrides: [
{
Expand Down Expand Up @@ -284,6 +286,8 @@ export default defineConfig({
'@typescript-eslint/no-duplicate-enum-values': 'error',
'@typescript-eslint/no-explicit-any': 'error',
'@typescript-eslint/no-extra-non-null-assertion': 'error',
// Type-aware: enforced by `vp run lint:platform`; plain `vp lint` skips it.
'@typescript-eslint/no-floating-promises': 'error',
'@typescript-eslint/no-misused-new': 'error',
'@typescript-eslint/no-non-null-asserted-optional-chain': 'error',
'@typescript-eslint/no-require-imports': 'error',
Expand All @@ -298,7 +302,6 @@ export default defineConfig({
'getter-return': 'error',
'import/default': 'error',
'import/namespace': 'error',
'jest/no-focused-tests': 'error',
'no-array-constructor': 'error',
'no-async-promise-executor': 'error',
'no-case-declarations': 'error',
Expand Down Expand Up @@ -366,6 +369,9 @@ export default defineConfig({
'no-unused-expressions': 'error',
'no-unused-labels': 'error',
'no-unused-private-class-members': 'error',
// Also covers packages without TypeScript's `noUnusedLocals` and plain JS scripts.
// An options object drops oxlint's default `^_` ignore pattern, so restate it.
'no-unused-vars': ['error', { args: 'none', varsIgnorePattern: '^_' }],
'no-useless-backreference': 'error',
'no-useless-catch': 'error',
'no-useless-escape': 'error',
Expand Down Expand Up @@ -412,6 +418,8 @@ export default defineConfig({
'valid-typeof': 'error',
// Import test APIs from `vite-plus/test`, not `vitest`.
'vite-plus/prefer-vite-plus-imports': 'error',
// Vitest rejects `.only` only in CI; catch it locally and in pre-commit too.
'vitest/no-focused-tests': 'error',
},
options: {
typeAware: false,
Expand Down
Loading