@futdevpro/nts-dynamo 1.15.111 → 1.15.113

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.
Files changed (23) hide show
  1. package/.dynamo/logs/cicd-pipeline/output.log +1906 -1892
  2. package/.dynamo/logs/cicd-pipeline/status.json +34 -34
  3. package/build/_modules/ai/_modules/ai-mock/_enums/aim-modality.enum.d.ts +21 -9
  4. package/build/_modules/ai/_modules/ai-mock/_enums/aim-modality.enum.d.ts.map +1 -1
  5. package/build/_modules/ai/_modules/ai-mock/_enums/aim-modality.enum.js +19 -10
  6. package/build/_modules/ai/_modules/ai-mock/_enums/aim-modality.enum.js.map +1 -1
  7. package/build/_modules/ai/_modules/ai-mock/fixtures/aim-text.fixtures.d.ts +9 -0
  8. package/build/_modules/ai/_modules/ai-mock/fixtures/aim-text.fixtures.d.ts.map +1 -0
  9. package/build/_modules/ai/_modules/ai-mock/fixtures/aim-text.fixtures.js +163 -0
  10. package/build/_modules/ai/_modules/ai-mock/fixtures/aim-text.fixtures.js.map +1 -0
  11. package/build/_modules/ai/_modules/ai-mock/index.d.ts +1 -0
  12. package/build/_modules/ai/_modules/ai-mock/index.d.ts.map +1 -1
  13. package/build/_modules/ai/_modules/ai-mock/index.js +2 -0
  14. package/build/_modules/ai/_modules/ai-mock/index.js.map +1 -1
  15. package/build/_modules/server/server-status/server-status.control-service.d.ts.map +1 -1
  16. package/build/_modules/server/server-status/server-status.control-service.js +16 -1
  17. package/build/_modules/server/server-status/server-status.control-service.js.map +1 -1
  18. package/package.json +2 -2
  19. package/src/_modules/ai/_modules/ai-mock/_enums/aim-modality.enum.ts +22 -9
  20. package/src/_modules/ai/_modules/ai-mock/fixtures/aim-text.fixtures.ts +161 -0
  21. package/src/_modules/ai/_modules/ai-mock/index.ts +3 -0
  22. package/src/_modules/server/server-status/server-status.control-service.spec.ts +48 -0
  23. package/src/_modules/server/server-status/server-status.control-service.ts +18 -1
@@ -0,0 +1,161 @@
1
+ import { DyNTS_AIMock_Fixture } from '../_models/interfaces/aim-fixture.interface';
2
+
3
+ /**
4
+ * Valodi AI-generalasbol beegetve (live capture 2026-07-21). Kezzel NE szerkeszd.
5
+ *
6
+ * Determinisztikus sorrend (match-kulcs szerint) + rendezett objektum-kulcsok, hogy az ujra-generalas
7
+ * ne okozzon zajos diff-et. Forras: `DyNTS_AIMock_FixtureSerializer_Util`.
8
+ */
9
+ export const DyNTS_AIMock_TextFixtures: DyNTS_AIMock_Fixture[] = [
10
+ {
11
+ "capturedAt": "2026-07-22T00:58:38.792Z",
12
+ "config": {
13
+ "temperature": 0
14
+ },
15
+ "input": "Reply with exactly: PONG",
16
+ "inputHash": "0fb5aed1b51b28b04409b7963b2453fe1597d198c3b8396fc8ebd072104511de",
17
+ "modality": "text",
18
+ "model": "gpt-4o-mini",
19
+ "output": {
20
+ "content": "PONG",
21
+ "finish_reason": "stop",
22
+ "usage": {
23
+ "completion_tokens": 2,
24
+ "completion_tokens_details": {
25
+ "accepted_prediction_tokens": 0,
26
+ "audio_tokens": 0,
27
+ "reasoning_tokens": 0,
28
+ "rejected_prediction_tokens": 0
29
+ },
30
+ "prompt_tokens": 13,
31
+ "prompt_tokens_details": {
32
+ "audio_tokens": 0,
33
+ "cached_tokens": 0
34
+ },
35
+ "total_tokens": 15
36
+ }
37
+ },
38
+ "provider": "open-ai",
39
+ "sourceModel": "gpt-4o-mini"
40
+ },
41
+ {
42
+ "capturedAt": "2026-07-22T00:58:37.828Z",
43
+ "config": {
44
+ "temperature": 0
45
+ },
46
+ "input": "Reply with exactly: PONG",
47
+ "inputHash": "0fb5aed1b51b28b04409b7963b2453fe1597d198c3b8396fc8ebd072104511de",
48
+ "modality": "text",
49
+ "model": "gpt-5.4-nano",
50
+ "output": {
51
+ "content": "PONG",
52
+ "finish_reason": "stop",
53
+ "usage": {
54
+ "completion_tokens": 5,
55
+ "completion_tokens_details": {
56
+ "accepted_prediction_tokens": 0,
57
+ "audio_tokens": 0,
58
+ "reasoning_tokens": 0,
59
+ "rejected_prediction_tokens": 0
60
+ },
61
+ "prompt_tokens": 12,
62
+ "prompt_tokens_details": {
63
+ "audio_tokens": 0,
64
+ "cached_tokens": 0
65
+ },
66
+ "total_tokens": 17
67
+ }
68
+ },
69
+ "provider": "open-ai",
70
+ "sourceModel": "gpt-5.4-nano"
71
+ },
72
+ {
73
+ "capturedAt": "2026-07-22T00:58:38.316Z",
74
+ "config": {
75
+ "temperature": 0
76
+ },
77
+ "input": "What is the capital of Hungary? One word.",
78
+ "inputHash": "85c5b3ea12c8e34d97a18cb75ae55936aeb2ef0af90eb2f395a44ace6ce997e8",
79
+ "modality": "text",
80
+ "model": "gpt-5.4-nano",
81
+ "output": {
82
+ "content": "Budapest",
83
+ "finish_reason": "stop",
84
+ "usage": {
85
+ "completion_tokens": 5,
86
+ "completion_tokens_details": {
87
+ "accepted_prediction_tokens": 0,
88
+ "audio_tokens": 0,
89
+ "reasoning_tokens": 0,
90
+ "rejected_prediction_tokens": 0
91
+ },
92
+ "prompt_tokens": 16,
93
+ "prompt_tokens_details": {
94
+ "audio_tokens": 0,
95
+ "cached_tokens": 0
96
+ },
97
+ "total_tokens": 21
98
+ }
99
+ },
100
+ "provider": "open-ai",
101
+ "sourceModel": "gpt-5.4-nano"
102
+ },
103
+ {
104
+ "capturedAt": "2026-07-22T00:58:39.151Z",
105
+ "config": {},
106
+ "input": "artificial intelligence",
107
+ "inputHash": "803b3eb2b6af027151950019f2d5ede506a6636a9eafd262b27c23e3f834056f",
108
+ "modality": "embedding",
109
+ "model": "text-embedding-3-small",
110
+ "output": {
111
+ "dimensions": 1536,
112
+ "embeddingHead": [
113
+ 0.0005774497985839844,
114
+ -0.012481689453125,
115
+ -0.01143646240234375,
116
+ -0.0247344970703125,
117
+ 0.011383056640625,
118
+ -0.006069183349609375,
119
+ -0.0209503173828125,
120
+ 0.03741455078125
121
+ ],
122
+ "model": "text-embedding-3-small",
123
+ "object": "list",
124
+ "usage": {
125
+ "prompt_tokens": 3,
126
+ "total_tokens": 3
127
+ }
128
+ },
129
+ "provider": "open-ai",
130
+ "sourceModel": "text-embedding-3-small"
131
+ },
132
+ {
133
+ "capturedAt": "2026-07-22T00:58:39.020Z",
134
+ "config": {},
135
+ "input": "the quick brown fox",
136
+ "inputHash": "9ecb36561341d18eb65484e833efea61edc74b84cf5e6ae1b81c63533e25fc8f",
137
+ "modality": "embedding",
138
+ "model": "text-embedding-3-small",
139
+ "output": {
140
+ "dimensions": 1536,
141
+ "embeddingHead": [
142
+ -0.033355712890625,
143
+ -0.00183868408203125,
144
+ 0.005237579345703125,
145
+ -0.06304931640625,
146
+ -0.04779052734375,
147
+ 0.0018625259399414062,
148
+ 0.016876220703125,
149
+ 0.034820556640625
150
+ ],
151
+ "model": "text-embedding-3-small",
152
+ "object": "list",
153
+ "usage": {
154
+ "prompt_tokens": 4,
155
+ "total_tokens": 4
156
+ }
157
+ },
158
+ "provider": "open-ai",
159
+ "sourceModel": "text-embedding-3-small"
160
+ }
161
+ ];
@@ -19,6 +19,9 @@ export * from './_services/ai-embedding-mock.service';
19
19
  // ENUMS
20
20
  export * from './_enums/aim-modality.enum';
21
21
 
22
+ // FIXTURES — valódi AI-generálásból beégetve (live capture 2026-07-21). Git-tracked, determinisztikus (D6).
23
+ export * from './fixtures/aim-text.fixtures';
24
+
22
25
  // MODELS / INTERFACES — fixture-shape (MP-3 SP-3.1)
23
26
  export * from './_models/interfaces/aim-request.interface';
24
27
  export * from './_models/interfaces/aim-error.interface';
@@ -529,6 +529,54 @@ describe('| DyNTS_ServerStatus_ControlService', () => {
529
529
  expect(result.dbPingOk).toBe(false);
530
530
  });
531
531
 
532
+ // FIX-REGRESSZIO (2026-07-22) — a `getMongooseConnection()` a KAPCSOLODOTT handle-t valassza.
533
+ // Elesben mert kiindulas: `mongoose.connection` disconnected (0) + 0 model, miközben a
534
+ // `mongoose.connections`-ban VOLT egy readyState=1 connection -> hamis 503 az egesz flottan.
535
+ // Ezek a tesztek NEM spy-olnak a getMongooseConnection-re (kulonben epp a javitott logikat
536
+ // kerulnenk meg), hanem a `mongoose.connections` tombot cserelik ki.
537
+ it('| should pick the CONNECTED connection when mongoose.connection is a stale/disconnected handle', async () => {
538
+ // eslint-disable-next-line @typescript-eslint/no-var-requires
539
+ const mongooseModule: any = require('mongoose'); // ccap-review-disable-line no-any-type
540
+ const originalConnections: any[] = mongooseModule.connections; // ccap-review-disable-line no-any-type
541
+ const liveConnection: any = { // ccap-review-disable-line no-any-type
542
+ readyState: 1,
543
+ host: 'mongodb',
544
+ name: 'adventor',
545
+ models: { user: {} },
546
+ db: { admin: () => ({ ping: async () => ({ ok: 1 }) }) },
547
+ };
548
+
549
+ try {
550
+ mongooseModule.connections = [ liveConnection ];
551
+
552
+ const result = await service.checkDbReadiness();
553
+
554
+ expect(result.ready).toBe(true);
555
+ expect(result.dbReadyState).toBe(1);
556
+ expect(result.dbPingOk).toBe(true);
557
+ expect(result.dbHost).toBe('mongodb');
558
+ } finally {
559
+ mongooseModule.connections = originalConnections;
560
+ }
561
+ });
562
+
563
+ it('| should still report NOT ready when NO connection is live (a real DB outage is not masked)', async () => {
564
+ // eslint-disable-next-line @typescript-eslint/no-var-requires
565
+ const mongooseModule: any = require('mongoose'); // ccap-review-disable-line no-any-type
566
+ const originalConnections: any[] = mongooseModule.connections; // ccap-review-disable-line no-any-type
567
+
568
+ try {
569
+ mongooseModule.connections = [ { readyState: 0, db: undefined } ];
570
+
571
+ const result = await service.checkDbReadiness();
572
+
573
+ expect(result.ready).toBe(false);
574
+ expect(result.dbPingOk).toBe(false);
575
+ } finally {
576
+ mongooseModule.connections = originalConnections;
577
+ }
578
+ });
579
+
532
580
  // DIAGNOSZTIKA (2026-07-22) — a "readiness 503, de az app kiszolgál" flotta-lelet miatt.
533
581
  // A lényeg: a diag-mezők akkor is kitöltődnek, amikor a probe NEM-ready-t jelent — épp AKKOR
534
582
  // kellenek, hogy a következő mérés eldöntse, a probe mér-e rosszul vagy a DB halott-e.
@@ -222,7 +222,24 @@ export abstract class DyNTS_ServerStatus_ControlService<
222
222
  * {@link checkDbReadiness} DB nélkül is tesztelhető legyen).
223
223
  */
224
224
  protected getMongooseConnection(): mongoose.Connection {
225
- return mongoose.connection;
225
+ // FIX (2026-07-22) — a `mongoose.connection` NEM feltetlenul az a handle, amit a data-layer hasznal.
226
+ //
227
+ // ELESBEN MERVE (adventor, a diagnosztikai mezokkel): `dbConnectionCount: 1`, `dbModelCount: 0`,
228
+ // `dbOtherReadyStates: [1]` — azaz letezik EGY KAPCSOLODOTT (readyState=1) connection, de a
229
+ // `mongoose.connection` **nem az**: az disconnected (0), NULLA modellel, `host`/`name` nelkul
230
+ // (sosem csatlakozott). Emiatt a readiness flotta-szinten **hamis 503**-at adott (adventor,
231
+ // token-service, master-prompter), mikozben a DB vegig egeszseges volt es az appok kiszolgaltak.
232
+ //
233
+ // Ezert a valos, KAPCSOLODOTT connectiont keressuk meg a `mongoose.connections`-bol, es csak
234
+ // fallbackkent hasznaljuk a `mongoose.connection`-t. Ez minden esetben helyes:
235
+ // - ha van elo connection -> azt merjuk (readyState=1 + valos ping) -> a readiness igazat mond,
236
+ // - ha a DB tenyleg halott -> egyik sem 1 -> fallback -> tovabbra is helyesen NEM-ready.
237
+ // Vagyis a valodi DB-kiesest NEM maszkolja el, csak a hamis-negativot szunteti meg.
238
+ const all: mongoose.Connection[] = mongoose.connections ?? [];
239
+ const live: mongoose.Connection | undefined =
240
+ all.find((c: mongoose.Connection): boolean => c?.readyState === 1);
241
+
242
+ return live ?? mongoose.connection;
226
243
  }
227
244
 
228
245
  /**