diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 0000000..0b752eb --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,39 @@ +name: CI + +on: + push: + branches: [main] + pull_request: + +concurrency: + group: ci-${{ github.ref }} + cancel-in-progress: true + +jobs: + ci: + runs-on: ubuntu-24.04 + timeout-minutes: 10 + + steps: + - name: Check out source + uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 + + - name: Set up Bun + uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2 + with: + bun-version: latest + + - name: Install dependencies + run: bun install --frozen-lockfile + + - name: Check (lint + format) + run: bun run check + + - name: Type check + run: bun run typecheck + + - name: Test + run: bun run test + + - name: Build + run: bun run build diff --git a/src/client.ts b/src/client.ts index 07c0fb2..42dcf72 100644 --- a/src/client.ts +++ b/src/client.ts @@ -154,7 +154,7 @@ export function loadConfig(pluginConfig?: PluginConfig): BraintrustConfig { let queueSize = defaults.queueSize if (process.env.BRAINTRUST_QUEUE_SIZE) { const parsed = parseInt(process.env.BRAINTRUST_QUEUE_SIZE, 10) - if (!isNaN(parsed) && parsed > 0) { + if (!Number.isNaN(parsed) && parsed > 0) { queueSize = parsed } } diff --git a/src/event-processor.ts b/src/event-processor.ts index 4fff721..a56dc4b 100644 --- a/src/event-processor.ts +++ b/src/event-processor.ts @@ -412,10 +412,9 @@ export class EventProcessor { // Guard: skip if state already exists (lazy-initialized when chat.message arrived // before session.created for API-created sessions). if (this.sessionStates.has(sessionKey)) { - this.log( - "Session state already exists (lazy-initialized), skipping session.created init", - { sessionKey }, - ) + this.log("Session state already exists (lazy-initialized), skipping session.created init", { + sessionKey, + }) return } diff --git a/src/span-queue.ts b/src/span-queue.ts index 59e1307..5e3ba17 100644 --- a/src/span-queue.ts +++ b/src/span-queue.ts @@ -20,6 +20,7 @@ export class SpanQueue { private sink: SpanSink private log: LogFn private running = false + // biome-ignore lint/correctness/noUnusedPrivateClassMembers: intentionally held to prevent GC of background worker promise private workerPromise: Promise | null = null // Notify the worker that a new item is available private notify: (() => void) | null = null diff --git a/src/tracing.ts b/src/tracing.ts index c9aecdc..237d19a 100644 --- a/src/tracing.ts +++ b/src/tracing.ts @@ -768,7 +768,9 @@ export function createTracingHooks( if (!state) { // session.created is not delivered to plugins for API-created sessions. // Initialize state lazily so API-created sessions are traced correctly. - log("No state found for session, initializing lazily (API-created session)", { sessionID }) + log("No state found for session, initializing lazily (API-created session)", { + sessionID, + }) const rootSpanId = generateUUID() const now = wallClock.now() state = {