🧪 test: Restore Two Rotted Integration Suites and Run Every One in CI (#15866)

* 🧪 test: Restore Two Rotted packages/api Integration Suites

MCPReinitRecovery.integration.test.ts mocked @librechat/data-schemas down to
its logger, so all eight tests threw once MCPServersRegistry started calling
scopedCacheKey (#15028). The mock now spreads the real module under the logger
override; ServerConfigsDB stays mocked, so the suite still never touches Mongo.

secrets.integration.spec.ts drove langfuse.secretKey through the generic admin
config API, which has stripped the langfuse section since #14108 moved it to
the dedicated Langfuse connection API. The generic-write matrix drops that row,
and a langfuse block covers the current contract against a real Config
collection: the stored secret stays encrypted at rest, generic reads redact it,
generic patch, tombstone and field-delete writes leave it untouched, and a full
base-config replacement carries it forward.

* 👷 ci: Run Every packages/api Integration Suite in CI

test:ci excludes every path containing "integration.", but the jobs meant to
run those suites selected by folder: the cache workflow only
src/{cache,cluster,mcp,stream}, the agents workflow only
src/agents/*.integration.spec.ts. Thirteen suites ran in no job, including
every *.integration.test.ts.

test:integration selects *.integration.(spec|test).ts anywhere under src and
replaces test:agents-integration in the (renamed) Integration Tests workflow.
The cache scripts also accept .test.ts, stream selects by suffix alone, and
core picks up src/middleware. Every suite test:ci excludes is now selected by
exactly one CI script.

* 🧪 test: Read the Tool Snapshot in the Concurrent Reinit Simulation

The concurrent reinitialize test copied reinitMCPServer but still called
fetchTools(), which returns [] when tools/list fails. Concurrent reinspections
of a recovered server can each succeed, and a later write replaces the app
connection an earlier request was already handed, so that request's tools/list
fails. The test failed in 9 of 25 iterations on Linux, and in the first CI run
that included the suite. Since #14686 production reads the snapshot and keeps
cached tools when it is incomplete; the simulation now does the same, and still
requires every complete snapshot to list both tools and at least one to complete.

A deterministic test pins the property that tolerance relies on, without
depending on the race: a newer config write replaces the held app connection,
whose snapshot is then incomplete, while the replacement lists the real tools.
This commit is contained in:
Danny Avila 2026-09-12 16:20:22 -04:00 • committed by GitHub
parent 246e7e5de7
commit fb1322401d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 241 additions and 48 deletions

View file

@ -1,9 +1,12 @@
name: Agents Integration Tests
name: Integration Tests
# Runs the packages/api `src/agents/**` integration specs (e.g. the durable HITL
# checkpointer and cross-replica subagent delivery against real MongoDB and Redis). These
# are `*.integration.spec.ts`, which `test:ci` deliberately excludes — without this
# job they run nowhere and their regressions guard nothing.
# Runs every packages/api `*.integration.spec.ts` / `*.integration.test.ts` suite (e.g. the
# durable HITL checkpointer and cross-replica subagent delivery against real MongoDB and
# Redis, the admin config secret registry against a real Config collection, MCP flows
# against in-process servers). `test:ci` deliberately excludes them, and the Redis-backed
# `*.cache_integration` / `*.stream_integration` suites run in cache-integration-tests.yml —
# without this job they run nowhere and their regressions guard nothing. Selection is by
# suffix, not folder, so a suite added anywhere under src is picked up.
on:
pull_request:
branches:
@ -11,9 +14,9 @@ on:
- dev
- dev-staging
- release/*
# The suite builds and consumes data-provider and data-schemas and imports
# The suites build and consume data-provider and data-schemas and import
# across packages/api (the build-cache keys below hash all three src trees),
# so it must re-run on any of them — not just src/agents.
# so they must re-run on any of them.
paths:
- 'packages/api/src/**'
- 'packages/api/package.json'
@ -106,9 +109,9 @@ jobs:
if: steps.cache-api.outputs.cache-hit != 'true'
run: npm run build:api
- name: Run agents integration tests
- name: Run integration tests
working-directory: packages/api
env:
NODE_ENV: test
REDIS_URI: redis://127.0.0.1:6379
run: npm run test:agents-integration
run: npm run test:integration