Implements a new effectful LLM module that enables caching of OpenAI API
calls for golden tests while making real API calls in production.
Changes:
- Add Data.Effectful.LLM module with runLLMReal and runLLMGolden interpreters
- Update Pkg.AI to add effectful version (callOpenAIAPIEff)
- Update Models.Apis.Issues.Enhancement to use LLM effect
- Add LLM to ATBackgroundCtx effect stack
- Wire runLLMReal in production runner (System.Types)
- Wire runLLMGolden in test runner (Pkg.TestUtils)
- Update BackgroundJobs to call effectful Enhancement functions
- Load OPENAI_API_KEY from environment for tests
The LLM effect caches API responses in ./tests/golden/ directory during
tests, preventing unnecessary API calls and making tests deterministic.
- Add dynamic CPU detection to Makefile for optimal parallel execution
- Make background job concurrency configurable (default: 4)
- Implement concurrent job processing in tests using Ki structured concurrency
- Fix race condition in insertIssue by using correct ON CONFLICT constraint
This reduces test execution time while ensuring thread-safe database operations.
- Replace O(n²) nubBy with O(n) HashMap-based deduplication for endpoints, shapes, fields, and formats
- Batch UUID generation upfront to avoid repeated IO operations per span
- Make entity extraction pure computation by pre-generating all UUIDs
- Add OpenTelemetry tracing spans for pubsub and kafka batch processing with error tracking
- Add hashable dependency for HashMap-based deduplication
- Remove unnecessary threadDelay in test utilities
- Add strictness annotations to improve memory usage
These changes significantly reduce the algorithmic complexity and IO overhead of span processing while improving observability.
The hashes column in otel_logs_and_spans is text[] but was being updated
with jsonb arrays, causing type errors. Use LATERAL JOIN with
jsonb_array_elements_text to properly convert variable-length JSONB arrays
to PostgreSQL text[] arrays, avoiding multidimensional array constraints.
Replace sequential per-span UPDATE queries with a single batched update
using PostgreSQL UNNEST. This reduces processing time from ~150ms per span
to a single bulk operation, improving throughput from 30+ seconds for 200
spans to under 1 second.
Changes:
- Batch span hash updates using UNNEST with uuid[] and jsonb[] arrays
- Filter spans with empty hashes before batching
- Maintain same safety guarantees with timestamp and project_id filters
* checkpoint
* span overview checkpoint
* reports checkpoint, slow queries
* empty state
* auto load first report
* format
* fetch and save neccesary chart data for report
* feat: issues breakdown
* touches
* issues id
* format