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
1 change: 1 addition & 0 deletions test/continuous-test-agents-live.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
*/

import { execFileSync } from "child_process";
import "./helpers/requireFreshDistCli.js";
import { NeuroLink } from "../dist/index.js";

/**
Expand Down
1 change: 1 addition & 0 deletions test/continuous-test-suite-anthropic-streaming-retry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ import "dotenv/config";

import { createServer } from "node:http";
import { defineSuite, assert } from "./helpers/harness.js";
import "./helpers/requireFreshDist.js";

const { test, runSuite, section } = defineSuite(
"Anthropic streaming retry parity",
Expand Down
1 change: 1 addition & 0 deletions test/continuous-test-suite-archive-security.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ import {
startMockChatServer,
mockOpenAICredentials,
} from "./helpers/mockChatServer.js";
import "./helpers/requireFreshDist.js";
import { NeuroLink } from "../dist/index.js";

const { test, runSuite } = defineSuite("Archive delivery");
Expand Down
1 change: 1 addition & 0 deletions test/continuous-test-suite-audio-transcription.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ import {
makeWavFile,
} from "./helpers/mediaFixtures.js";
import { installMockFetch } from "./utils/mockFetch.js";
import "./helpers/requireFreshDist.js";
import { logger, NeuroLink } from "../dist/index.js";
// The shipped `@juspay/neurolink/processors` entry. dist is emitted per module,
// so this resolves to the same AudioProcessor module dist/index.js loads — one
Expand Down
1 change: 1 addition & 0 deletions test/continuous-test-suite-avatar-unit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ import {
assertEqual,
assertIncludes,
} from "./helpers/harness.js";
import "./helpers/requireFreshDist.js";
import {
NeuroLink,
AvatarProcessor,
Expand Down
1 change: 1 addition & 0 deletions test/continuous-test-suite-catalog-auth-header-style.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import "dotenv/config";

import { createServer, type IncomingMessage } from "node:http";
import { defineSuite, assert } from "./helpers/harness.js";
import "./helpers/requireFreshDist.js";

const { test, runSuite, section } = defineSuite(
"catalog authHeaderStyle quirk (Reka X-Api-Key)",
Expand Down
1 change: 1 addition & 0 deletions test/continuous-test-suite-download-body-deadline.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import assert from "node:assert/strict";
import dnsPromises from "node:dns/promises";
import { syncBuiltinESMExports } from "node:module";
import { randomUUID } from "node:crypto";
import "./helpers/requireFreshDist.js";
import { NeuroLink } from "../dist/index.js";
import {
IDEOGRAM_FIXTURE_HOST,
Expand Down
1 change: 1 addition & 0 deletions test/continuous-test-suite-error-classification-e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import http from "node:http";
import http2 from "node:http2";
import type { AddressInfo } from "node:net";
import { z } from "zod";
import "./helpers/requireFreshDist.js";
import { tool } from "../dist/index.js";

/**
Expand Down
1 change: 1 addition & 0 deletions test/continuous-test-suite-file-formats.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ import {
makeTokenFixture,
type FixtureModality,
} from "./helpers/formatFixtures.js";
import "./helpers/requireFreshDist.js";
import { NeuroLink } from "../dist/index.js";
/**
* Mirror of `REALISTIC_FIXTURE_FLOOR_BYTES`. Restated here rather than imported
Expand Down
1 change: 1 addition & 0 deletions test/continuous-test-suite-file-intake-validation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import {
assertIncludes,
} from "./helpers/harness.js";
import { installMockFetch } from "./utils/mockFetch.js";
import "./helpers/requireFreshDist.js";
import { NeuroLink } from "../dist/index.js";

const { test, runSuite } = defineSuite(
Expand Down
1 change: 1 addition & 0 deletions test/continuous-test-suite-image-exif.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ import {
startMockChatServer,
mockOpenAICredentials,
} from "./helpers/mockChatServer.js";
import "./helpers/requireFreshDist.js";
import { NeuroLink } from "../dist/index.js";
// Type-only, so it is erased and asserts nothing about which copy runs — the
// `e2e-tests-only` rule ignores these for exactly that reason.
Expand Down
1 change: 1 addition & 0 deletions test/continuous-test-suite-local-usage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import * as fs from "fs";
import * as os from "os";
import * as path from "path";
import { defineSuite, log } from "./helpers/harness.js";
import "./helpers/requireFreshDistCli.js";
import type { LocalUsageScanResult } from "../src/lib/types/index.js";

const { test, runSuite } = defineSuite("Local Usage", {
Expand Down
1 change: 1 addition & 0 deletions test/continuous-test-suite-logger-instance-routing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
* Run: npx tsx test/continuous-test-suite-logger-instance-routing.ts
*/
import { defineSuite, assert } from "./helpers/harness.js";
import "./helpers/requireFreshDist.js";
import { NeuroLink, logger } from "../dist/index.js";

const { test, runSuite } = defineSuite("Per-instance logger routing (#1236)", {
Expand Down
1 change: 1 addition & 0 deletions test/continuous-test-suite-mcp-result-cache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
* Run with: npx tsx test/continuous-test-suite-mcp-result-cache.ts
*/

import "./helpers/requireFreshDist.js";
import { NeuroLink } from "../dist/index.js";
import { assert, assertEqual, defineSuite } from "./helpers/harness.js";
import { observe, stub, withStubs } from "./helpers/stubs.js";
Expand Down
1 change: 1 addition & 0 deletions test/continuous-test-suite-model-not-found-retryable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
*/

import "dotenv/config";
import "./helpers/requireFreshDist.js";
import { NeuroLink } from "../dist/index.js";
import type { ModelPoolMember } from "../src/lib/types/index.js";
import { assert, defineSuite, Skip } from "./helpers/harness.js";
Expand Down
1 change: 1 addition & 0 deletions test/continuous-test-suite-model-pool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import { defineSuite, assert, assertEqual } from "./helpers/harness.js";
// `AIProviderFactory.createProvider` stub below effective; split the two and
// the stub silently patches a different copy and the tests start making real
// network calls.
import "./helpers/requireFreshDist.js";
import {
ModelPool,
classifyProviderError,
Expand Down
1 change: 1 addition & 0 deletions test/continuous-test-suite-multimodal-sdk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ import {
makeVideoFile,
} from "./helpers/mediaFixtures.js";
import { hasPackage, makeDocx, makeXlsx } from "./helpers/officeFixtures.js";
import "./helpers/requireFreshDist.js";
import { NeuroLink } from "../dist/index.js";
import type { GenerateOptions } from "../src/lib/types/index.js";
/**
Expand Down
1 change: 1 addition & 0 deletions test/continuous-test-suite-multimodal-text-content-fold.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import "dotenv/config";

import { createServer, type IncomingMessage } from "node:http";
import { defineSuite, assert } from "./helpers/harness.js";
import "./helpers/requireFreshDist.js";

const { test, runSuite, section } = defineSuite(
"multimodal text-content-fold (input.content TextContent items on the text-only path)",
Expand Down
1 change: 1 addition & 0 deletions test/continuous-test-suite-music-unit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ import {
assertEqual,
assertIncludes,
} from "./helpers/harness.js";
import "./helpers/requireFreshDist.js";
import {
NeuroLink,
MusicProcessor,
Expand Down
1 change: 1 addition & 0 deletions test/continuous-test-suite-office-security.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ import {
startMockChatServer,
mockOpenAICredentials,
} from "./helpers/mockChatServer.js";
import "./helpers/requireFreshDist.js";
import { NeuroLink, logger } from "../dist/index.js";

/** Rejects if `promise` has not settled within `ms`, as a defensive backstop. */
Expand Down
1 change: 1 addition & 0 deletions test/continuous-test-suite-openai-compat-catalog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ import { fileURLToPath } from "node:url";
* (Runs against dist/ — `pnpm run build` first.)
*/

import "./helpers/requireFreshDist.js";
import {
NeuroLink,
AuthenticationError,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ import "dotenv/config";

import { createServer } from "node:http";
import { defineSuite, assert } from "./helpers/harness.js";
import "./helpers/requireFreshDist.js";

const { test, runSuite, section } = defineSuite(
"OpenAI-compat streaming retry parity",
Expand Down
1 change: 1 addition & 0 deletions test/continuous-test-suite-pdf-image-streaming.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
import { readFileSync } from "node:fs";
import { defineSuite, assert, assertEqual } from "./helpers/harness.js";
import { installMockFetch } from "./utils/mockFetch.js";
import "./helpers/requireFreshDist.js";
import { NeuroLink } from "../dist/index.js";

const { test, runSuite } = defineSuite("PDF image streaming (#302)", {
Expand Down
1 change: 1 addition & 0 deletions test/continuous-test-suite-provider-fallback-latency.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
*/
import { defineSuite, assert, assertEqual } from "./helpers/harness.js";
import { installMockFetch } from "./utils/mockFetch.js";
import "./helpers/requireFreshDist.js";
import { NeuroLink } from "../dist/index.js";
import type { GenerateOptions } from "../src/lib/types/index.js";

Expand Down
1 change: 1 addition & 0 deletions test/continuous-test-suite-provider-fallback.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
* Run: npx tsx test/continuous-test-suite-provider-fallback.ts
*/
import { defineSuite, assert, assertEqual } from "./helpers/harness.js";
import "./helpers/requireFreshDist.js";
import { NeuroLink } from "../dist/index.js";

const { test, runSuite } = defineSuite(
Expand Down
1 change: 1 addition & 0 deletions test/continuous-test-suite-provider-model-resolution.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import {
assertIncludes,
} from "./helpers/harness.js";
import { installMockFetch } from "./utils/mockFetch.js";
import "./helpers/requireFreshDist.js";
import {
AIProviderFactory,
NeuroLink,
Expand Down
1 change: 1 addition & 0 deletions test/continuous-test-suite-providers-mocked.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/usr/bin/env tsx
import "dotenv/config";
import "./helpers/requireFreshDist.js";
import { jsonSchema } from "../dist/index.js";
import type {
DecisionOptions,
Expand Down
1 change: 1 addition & 0 deletions test/continuous-test-suite-proxy-restart.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import {
runCLI,
delay,
} from "./helpers/harness.js";
import "./helpers/requireFreshDistProxy.js";
import { startRollingProxyServer } from "../dist/proxy/rollingProxyServer.js";
import { spawnProxySocketWorker } from "../dist/proxy/rollingWorkerProcess.js";
import {
Expand Down
1 change: 1 addition & 0 deletions test/continuous-test-suite-rag.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ import type {
VectorQueryResult,
} from "../src/lib/types/index.js";
import type { z } from "zod";
import "./helpers/requireFreshDistCli.js";
import { NeuroLink } from "../dist/index.js";
// RAG components.
//
Expand Down
1 change: 1 addition & 0 deletions test/continuous-test-suite-realtime-unit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ import {
assertEqual,
assertIncludes,
} from "./helpers/harness.js";
import "./helpers/requireFreshDist.js";
import {
RealtimeProcessor,
RealtimeError,
Expand Down
1 change: 1 addition & 0 deletions test/continuous-test-suite-sixtydb.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import { createServer } from "node:http";
import { once } from "node:events";
import { strict as assert } from "node:assert";
import "./helpers/requireFreshDist.js";
import {
NeuroLink,
SixtyDBTTS,
Expand Down
1 change: 1 addition & 0 deletions test/continuous-test-suite-stt-unit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ import {
assertIncludes,
} from "./helpers/harness.js";
import { installMockFetch } from "./utils/mockFetch.js";
import "./helpers/requireFreshDist.js";
import {
ElevenLabsSTT,
isSTTResult,
Expand Down
1 change: 1 addition & 0 deletions test/continuous-test-suite-tasks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
import { rmSync } from "node:fs";

// Source imports — tsx resolves TypeScript directly
import "./helpers/requireFreshDist.js";
import { NeuroLink } from "../dist/index.js";
import type { Task, TaskDefinition } from "../src/lib/types/index.js";

Expand Down
1 change: 1 addition & 0 deletions test/continuous-test-suite-tool-reliability.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import {
SimpleSpanProcessor,
} from "@opentelemetry/sdk-trace-base";
import { NodeTracerProvider } from "@opentelemetry/sdk-trace-node";
import "./helpers/requireFreshDist.js";

const spanExporter = new InMemorySpanExporter();
const traceProvider = new NodeTracerProvider({
Expand Down
1 change: 1 addition & 0 deletions test/continuous-test-suite-tool-resolution.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import "dotenv/config";
*/

import { z } from "zod";
import "./helpers/requireFreshDist.js";
import { tool } from "../dist/index.js";
import { MCPToolRegistry, NeuroLink } from "../dist/index.js";
import type {
Expand Down
1 change: 1 addition & 0 deletions test/continuous-test-suite-transcribe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ import {
Skip,
tempDir,
} from "./helpers/harness.js";
import "./helpers/requireFreshDistCli.js";
import {
NeuroLink,
STTError,
Expand Down
1 change: 1 addition & 0 deletions test/continuous-test-suite-tts-unit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ import {
assertIncludes,
assertNotNull,
} from "./helpers/harness.js";
import "./helpers/requireFreshDist.js";
import {
AIProviderFactory,
ElevenLabsTTS,
Expand Down
1 change: 1 addition & 0 deletions test/continuous-test-suite-vector-chroma.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
*/
import "dotenv/config";

import "./helpers/requireFreshDist.js";
import { ChromaVectorStore } from "../dist/index.js";
// `translateMetadataFilter` is not exported from the package. It is imported
// here under the determinism exception to CLAUDE.md rule 15: filter-dialect
Expand Down
1 change: 1 addition & 0 deletions test/continuous-test-suite-vector-pgvector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import "dotenv/config";
import { PGlite } from "@electric-sql/pglite";
import { vector } from "@electric-sql/pglite/vector";
import { defineSuite, assert, assertEqual } from "./helpers/harness.js";
import "./helpers/requireFreshDist.js";
import { PgVectorStore } from "../dist/index.js";
import type { PgClientLike } from "../src/lib/types/index.js";

Expand Down
1 change: 1 addition & 0 deletions test/continuous-test-suite-vector-pinecone.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
*/

import { defineSuite, assert, assertEqual } from "./helpers/harness.js";
import "./helpers/requireFreshDist.js";
import { PineconeVectorStore } from "../dist/index.js";
// See the note in continuous-test-suite-vector-chroma.ts — `translatePineconeFilter`
// is internal and kept under the determinism exception to CLAUDE.md rule 15.
Expand Down
1 change: 1 addition & 0 deletions test/continuous-test-suite-video-generation-unit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ import {
assertEqual,
assertIncludes,
} from "./helpers/harness.js";
import "./helpers/requireFreshDist.js";
import { NeuroLink, VideoProcessor } from "../dist/index.js";
import type { VideoGenerationResult, VideoHandler } from "../dist/index.js";

Expand Down
1 change: 1 addition & 0 deletions test/continuous-test-suite-video-native.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ import {
runCLI,
Skip,
} from "./helpers/harness.js";
import "./helpers/requireFreshDist.js";
import {
canDeliverVideoNatively,
estimateVideoTokens,
Expand Down
1 change: 1 addition & 0 deletions test/continuous-test-suite-vision-image-format.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ import {
mockOpenAICredentials,
type MockChatServer,
} from "./helpers/mockChatServer.js";
import "./helpers/requireFreshDist.js";
import { NeuroLink } from "../dist/index.js";

// Offline: every request goes to a loopback mock chat server, never a provider.
Expand Down
1 change: 1 addition & 0 deletions test/continuous-test-suite-websocket-agent-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import "dotenv/config";

import { createServer } from "node:http";
import { defineSuite, assert } from "./helpers/harness.js";
import "./helpers/requireFreshDist.js";

const { test, runSuite, section } = defineSuite("WebSocket Agent Handler", {
offline: true,
Expand Down
21 changes: 21 additions & 0 deletions test/helpers/requireFreshDist.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/**
* Side-effect module: import it BEFORE the first `../dist/...` import.
*
* Module bodies run in source order, so this check runs before the dist
* modules below it are evaluated. Unlike a call placed after a static import,
* it never lets a suite start against a stale `dist/` (see distFreshness.ts
* for the staleness rule and the `NEUROLINK_SKIP_DIST_FRESHNESS_CHECK` escape).
*
* It names `dist/index.js` as an entrypoint, so a partial build that rewrote
* some other file under `dist/` (say `pnpm run build:cli`) cannot satisfy the
* directory-wide check while the bundle the suite imports is still old. Suites
* that also drive other bundles import `requireFreshDistCli.js` or
* `requireFreshDistProxy.js` instead of this module.
*
* A wholly missing `dist/` is still reported by Node's own link step as
* ERR_MODULE_NOT_FOUND, because linking resolves every static import before
* any module body runs.
*/
import { assertDistFresh } from "./distFreshness.js";

assertDistFresh({ entrypoints: ["dist/index.js"] });
11 changes: 11 additions & 0 deletions test/helpers/requireFreshDistCli.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/**
* Side-effect module for suites that load `dist/index.js` and spawns `dist/cli/index.js`.
* Same ordering contract as requireFreshDist.ts: import it BEFORE the first
* `../dist/...` import. The directory-wide baseline still applies; the named
* bundles are additionally checked against their own mtime.
*/
import { assertDistFresh } from "./distFreshness.js";

assertDistFresh({
entrypoints: ["dist/index.js", "dist/cli/index.js"],
});
14 changes: 14 additions & 0 deletions test/helpers/requireFreshDistProxy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/**
* Side-effect module for suites that load the `dist/proxy/` and `dist/cli/commands/proxy.js` modules directly.
* Same ordering contract as requireFreshDist.ts: import it BEFORE the first
* `../dist/...` import. The directory-wide baseline still applies; the named
* bundles are additionally checked against their own mtime.
*/
import { assertDistFresh } from "./distFreshness.js";

assertDistFresh({
entrypoints: [
"dist/proxy/rollingProxyServer.js",
"dist/cli/commands/proxy.js",
],
});
Loading