📬 feat: Persist Channel Events and Delivery Receipts (#17595)

* 📬 feat: Persist Channel Events and Delivery Receipts

* fix: enforce channel run identity and fenced recovery

* fix: fence and erase channel state during account deletion

* refactor: share channel owner admission with private persistence

* refactor: name channel account-erasure boundary explicitly

* fix: prove channel identity and delivery authority at storage boundaries

* refactor: enforce channel delivery protocol and terminal lifecycle

* fix: enforce channel tenant and operation boundaries

* fix: initialize channel config from its composition owner

* test: verify config installs channel storage reader

* test: complete config initializer contract in model mocks

* test: include channel config reader in migration fixture

* test: await SSE subscription before advancing keepalive time

* test: Observe and Drain Concurrent Fixture Work
This commit is contained in:
Dustin Healy 2026-11-10 21:03:57 -08:00 • committed by GitHub
parent 1458e841e4
commit 7dd4fafdf3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
48 changed files with 3816 additions and 54 deletions

View file

@ -17,6 +17,7 @@ jest.mock('~/server/services/start/tools', () => ({
jest.mock('~/models', () => ({
initializeMessageBudget: jest.fn(),
initializeChannelStorageConfig: jest.fn(),
getApplicableConfigs: jest.fn().mockResolvedValue([]),
getUserPrincipals: jest.fn().mockResolvedValue([]),
}));

View file

@ -22,6 +22,7 @@ jest.mock('@librechat/data-schemas', () => {
jest.mock('~/models', () => ({
initializeMessageBudget: jest.fn(),
initializeChannelStorageConfig: jest.fn(),
getApplicableConfigs: jest.fn().mockResolvedValue([]),
getUserPrincipals: jest.fn().mockResolvedValue([]),
}));
@ -61,14 +62,16 @@ jest.mock('@librechat/api', () => ({
// ── Tests ──────────────────────────────────────────────────────────────
const { getAppConfig, invalidateConfigCaches } = require('../app');
const { initializeMessageBudget } = require('~/models');
const { initializeMessageBudget, initializeChannelStorageConfig } = require('~/models');
// Capture module-composition calls before clearMocks resets the spy history.
const budgetInitializations = [...initializeMessageBudget.mock.calls];
const channelInitializations = [...initializeChannelStorageConfig.mock.calls];
const invalidationOptions = mockCreateConfigCacheInvalidation.mock.calls[0][0];
const pubSubOptions = mockCreateRedisPubSub.mock.calls[0][0];
test('Config supplies its actual reader exactly once during composition', () => {
expect(budgetInitializations).toEqual([[getAppConfig]]);
expect(channelInitializations).toEqual([[getAppConfig]]);
});
describe('invalidateConfigCaches', () => {

View file

@ -88,6 +88,7 @@ const {
// Config owns the reader; models never import this module to obtain it.
db.initializeMessageBudget(getAppConfig);
db.initializeChannelStorageConfig(getAppConfig);
/**
* Admin config writes clear the per-principal override caches, the MCP config-source servers

View file

@ -3,7 +3,11 @@ jest.mock('@librechat/api', () => ({
fetchModels: jest.fn(),
}));
jest.mock('./app');
jest.mock('~/models', () => ({ getUserKeyValues: jest.fn(), initializeMessageBudget: jest.fn() }));
jest.mock('~/models', () => ({
getUserKeyValues: jest.fn(),
initializeMessageBudget: jest.fn(),
initializeChannelStorageConfig: jest.fn(),
}));
jest.mock('@librechat/data-schemas', () => ({
...jest.requireActual('@librechat/data-schemas'),
logger: { debug: jest.fn(), error: jest.fn(), warn: jest.fn(), info: jest.fn() },

View file

@ -14,6 +14,7 @@ jest.mock('@librechat/data-schemas', () => ({
jest.mock('~/models', () => ({
getUserKeyValues: jest.fn(),
initializeMessageBudget: jest.fn(),
initializeChannelStorageConfig: jest.fn(),
}));
const exampleConfig = {