@futdevpro/nts-dynamo 1.15.107 → 1.15.110
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.dynamo/logs/cicd-pipeline/output.log +1815 -1805
- package/.dynamo/logs/cicd-pipeline/status.json +37 -23
- package/build/_modules/ai/_collections/ai-provider-error.util.d.ts +9 -0
- package/build/_modules/ai/_collections/ai-provider-error.util.d.ts.map +1 -1
- package/build/_modules/ai/_collections/ai-provider-error.util.js +42 -3
- package/build/_modules/ai/_collections/ai-provider-error.util.js.map +1 -1
- package/build/_modules/ai/_modules/open-ai/_services/oai-llm.service-base.d.ts +13 -3
- package/build/_modules/ai/_modules/open-ai/_services/oai-llm.service-base.d.ts.map +1 -1
- package/build/_modules/ai/_modules/open-ai/_services/oai-llm.service-base.js +13 -3
- package/build/_modules/ai/_modules/open-ai/_services/oai-llm.service-base.js.map +1 -1
- package/build/_modules/server/server-status/server-status.control-service.d.ts +10 -0
- package/build/_modules/server/server-status/server-status.control-service.d.ts.map +1 -1
- package/build/_modules/server/server-status/server-status.control-service.js +21 -0
- package/build/_modules/server/server-status/server-status.control-service.js.map +1 -1
- package/package.json +2 -2
- package/src/_modules/ai/_collections/ai-provider-error.util.ts +49 -3
- package/src/_modules/ai/_modules/open-ai/_services/oai-llm.service-base.ts +13 -3
- package/src/_modules/server/server-status/server-status.control-service.spec.ts +40 -0
- package/src/_modules/server/server-status/server-status.control-service.ts +40 -0
|
@@ -529,6 +529,46 @@ describe('| DyNTS_ServerStatus_ControlService', () => {
|
|
|
529
529
|
expect(result.dbPingOk).toBe(false);
|
|
530
530
|
});
|
|
531
531
|
|
|
532
|
+
// DIAGNOSZTIKA (2026-07-22) — a "readiness 503, de az app kiszolgál" flotta-lelet miatt.
|
|
533
|
+
// A lényeg: a diag-mezők akkor is kitöltődnek, amikor a probe NEM-ready-t jelent — épp AKKOR
|
|
534
|
+
// kellenek, hogy a következő mérés eldöntse, a probe mér-e rosszul vagy a DB halott-e.
|
|
535
|
+
it('| should populate diagnostics fields EVEN when not ready (this is when they matter)', async () => {
|
|
536
|
+
const fakeConnection = {
|
|
537
|
+
readyState: 0,
|
|
538
|
+
db: undefined,
|
|
539
|
+
host: 'mongodb',
|
|
540
|
+
name: 'adventor',
|
|
541
|
+
models: { user: {}, preset: {} },
|
|
542
|
+
};
|
|
543
|
+
spyOn(service as any, 'getMongooseConnection').and.returnValue(fakeConnection);
|
|
544
|
+
|
|
545
|
+
const result = await service.checkDbReadiness();
|
|
546
|
+
|
|
547
|
+
expect(result.ready).toBe(false);
|
|
548
|
+
expect(result.dbHost).toBe('mongodb');
|
|
549
|
+
expect(result.dbName).toBe('adventor');
|
|
550
|
+
// 0 model a default connectionön = a data-layer NEM ezt a handle-t használja (a fő gyanú)
|
|
551
|
+
expect(result.dbModelCount).toBe(2);
|
|
552
|
+
expect(result.dbConnectionCount).toEqual(jasmine.any(Number));
|
|
553
|
+
expect(result.dbOtherReadyStates).toEqual(jasmine.any(Array));
|
|
554
|
+
});
|
|
555
|
+
|
|
556
|
+
it('| should stay ready even if diagnostics collection throws (probe must never fail)', async () => {
|
|
557
|
+
// a diag-gyűjtés SAJÁT try-ban van → a getter-robbanás nem ronthatja el a readiness-választ
|
|
558
|
+
const fakeConnection = {
|
|
559
|
+
readyState: 1,
|
|
560
|
+
db: { admin: () => ({ ping: async () => ({ ok: 1 }) }) },
|
|
561
|
+
get host(): string { throw new Error('diag boom'); },
|
|
562
|
+
};
|
|
563
|
+
spyOn(service as any, 'getMongooseConnection').and.returnValue(fakeConnection);
|
|
564
|
+
|
|
565
|
+
const result = await service.checkDbReadiness();
|
|
566
|
+
|
|
567
|
+
expect(result.ready).toBe(true);
|
|
568
|
+
expect(result.dbReadyState).toBe(1);
|
|
569
|
+
expect(result.dbPingOk).toBe(true);
|
|
570
|
+
});
|
|
571
|
+
|
|
532
572
|
it('| should NOT be ready when connected but ping fails (DB unresponsive)', async () => {
|
|
533
573
|
const fakeConnection = {
|
|
534
574
|
readyState: 1,
|
|
@@ -44,6 +44,24 @@ export interface DyNTS_DbReadiness {
|
|
|
44
44
|
serverVersion: string;
|
|
45
45
|
/** AZ APP saját verziója (`DyNTS_global_settings.systemVersion`) — deploy-verifikációhoz. */
|
|
46
46
|
appVersion?: string;
|
|
47
|
+
|
|
48
|
+
// --- DIAGNOSZTIKA (2026-07-22) — a flotta-szintű "readiness 503, de az app kiszolgál" lelet miatt ---
|
|
49
|
+
// Élesben mérve: az adventor / token-service / master-prompter MIND `dbReadyState:0`-t adott, miközben
|
|
50
|
+
// kiszolgáltak, a Mongo bizonyítottan élt, és a reconnect-guard (amely UGYANEZT a readyState-et olvassa)
|
|
51
|
+
// egyetlen warningot sem logolt. Öt hipotézist zártunk ki méréssel (több replika · két mongoose-példány ·
|
|
52
|
+
// esModule default-export · leszármazott-override · halott DB) — a gyökér-ok NEM dőlt el. Ezek a mezők
|
|
53
|
+
// teszik a KÖVETKEZŐ mérést döntővé, találgatás nélkül. Mind ADDITÍV + opcionális → nem törnek meg semmit.
|
|
54
|
+
|
|
55
|
+
/** Hány mongoose-connection létezik ebben a process-ben (`mongoose.connections.length`). >1 → nem a default-on megy a data-layer. */
|
|
56
|
+
dbConnectionCount?: number;
|
|
57
|
+
/** A default connection cél-hosztja (`connection.host`) — üres/undefined, ha a connect sosem futott le rajta. */
|
|
58
|
+
dbHost?: string;
|
|
59
|
+
/** A default connection adatbázis-neve (`connection.name`). */
|
|
60
|
+
dbName?: string;
|
|
61
|
+
/** Hány model van a default connectionre regisztrálva. 0 → a data-layer NEM ezt a connectiont használja. */
|
|
62
|
+
dbModelCount?: number;
|
|
63
|
+
/** A NEM-default connectionök readyState-jei — ha itt van 1-es, a probe rossz handle-t mér. */
|
|
64
|
+
dbOtherReadyStates?: number[];
|
|
47
65
|
}
|
|
48
66
|
|
|
49
67
|
export abstract class DyNTS_ServerStatus_ControlService<
|
|
@@ -232,6 +250,27 @@ export abstract class DyNTS_ServerStatus_ControlService<
|
|
|
232
250
|
dbPingOk = false;
|
|
233
251
|
}
|
|
234
252
|
|
|
253
|
+
// DIAGNOSZTIKA (2026-07-22): sosem dobhat — a probe-nak determinisztikusan kell válaszolnia,
|
|
254
|
+
// ezért a diag-gyűjtés SAJÁT try-ban van (ha bármelyik mező kiolvasása elszáll, a readiness
|
|
255
|
+
// válasz attól még ép marad).
|
|
256
|
+
let diagnostics: Partial<DyNTS_DbReadiness> = {};
|
|
257
|
+
try {
|
|
258
|
+
const conn: mongoose.Connection = this.getMongooseConnection();
|
|
259
|
+
const all: mongoose.Connection[] = mongoose.connections ?? [];
|
|
260
|
+
|
|
261
|
+
diagnostics = {
|
|
262
|
+
dbConnectionCount: all.length,
|
|
263
|
+
dbHost: conn?.host,
|
|
264
|
+
dbName: conn?.name,
|
|
265
|
+
dbModelCount: Object.keys(conn?.models ?? {}).length,
|
|
266
|
+
// a default connectiont kihagyjuk — csak a "van-e MÁSIK, élő handle" kérdés érdekes
|
|
267
|
+
dbOtherReadyStates: all.filter((c: mongoose.Connection): boolean => c !== conn)
|
|
268
|
+
.map((c: mongoose.Connection): number => c?.readyState ?? -1),
|
|
269
|
+
};
|
|
270
|
+
} catch (error) {
|
|
271
|
+
DyFM_Log.warn('(checkDbReadiness) diagnostics collection failed (non-fatal)', error);
|
|
272
|
+
}
|
|
273
|
+
|
|
235
274
|
return {
|
|
236
275
|
ready: dbReadyState === 1 && dbPingOk,
|
|
237
276
|
dbReadyState: dbReadyState,
|
|
@@ -239,6 +278,7 @@ export abstract class DyNTS_ServerStatus_ControlService<
|
|
|
239
278
|
uptime: +new Date() - +this.up,
|
|
240
279
|
serverVersion: this.serverVersion,
|
|
241
280
|
appVersion: this.appVersion,
|
|
281
|
+
...diagnostics,
|
|
242
282
|
};
|
|
243
283
|
}
|
|
244
284
|
|