🪪 fix: Resolve Group-Scoped Config Overrides (#13176)
Some checks are pending
Docker Dev Branch Images Build / build (Dockerfile, lc-dev, node) (push) Waiting to run
Docker Dev Branch Images Build / build (Dockerfile.multi, lc-dev-api, api-build) (push) Waiting to run
GitNexus Index / index (push) Waiting to run
GitNexus Index / post-index (push) Blocked by required conditions

* fix: resolve group-scoped config overrides

* test: fix endpoint config request mock typing

* fix: keep remote agent preauth config tenant-scoped

* test: align config scoping expectations

* test: reproduce group endpoint override resolution
This commit is contained in:
Danny Avila 2026-05-18 10:16:20 -04:00 committed by GitHub
parent ac163c2212
commit c342e2345b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
19 changed files with 311 additions and 40 deletions

View file

@ -93,6 +93,41 @@ describe('loadConfigModels', () => {
expect(result).toEqual({});
});
it('passes userId when resolving scoped model config', async () => {
getAppConfig.mockResolvedValue({});
await loadConfigModels({
user: { id: 'testUserId', role: 'USER', tenantId: 'tenant-a' },
});
expect(getAppConfig).toHaveBeenCalledWith({
role: 'USER',
userId: 'testUserId',
tenantId: 'tenant-a',
});
});
it('uses req.config when available instead of calling getAppConfig', async () => {
const result = await loadConfigModels({
user: { id: 'testUserId' },
config: {
endpoints: {
custom: [
{
name: 'LocalOnly',
apiKey: 'local-key',
baseURL: 'https://example.com/v1',
models: { default: ['local-model'], fetch: false },
},
],
},
},
});
expect(getAppConfig).not.toHaveBeenCalled();
expect(result.LocalOnly).toEqual(['local-model']);
});
it('handles azure models and endpoint correctly', async () => {
getAppConfig.mockResolvedValue({
endpoints: {