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
39 changes: 39 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
Expand Down
7 changes: 3 additions & 4 deletions src/event-processor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
1 change: 1 addition & 0 deletions src/span-queue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<void> | null = null
// Notify the worker that a new item is available
private notify: (() => void) | null = null
Expand Down
4 changes: 3 additions & 1 deletion src/tracing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down
Loading