Elie Habib
c072edc89f
fix(economy): GSCPI shape mismatch with ais-relay payload ( #3072 )
...
* fix(economy): GSCPI shape mismatch with ais-relay payload
`seed-economy.mjs` was reporting `[StressIndex] GSCPI not in Redis yet
(ais-relay lag or first run) — excluding` even when GSCPI was current
in Redis. The Stress Index then computed on 5/6 components instead
of 6/6 every run.
Root cause: shape mismatch.
- ais-relay.cjs (`seedGscpi()`) writes the FRED-compatible payload
`{ series: { series_id, title, units, frequency, observations: [...] } }`
- seed-economy.mjs `fetchGscpiFromRedis()` was reading the legacy
flat shape `{ observations: [...] }` (top-level), so
`Array.isArray(parsed.observations)` was always false → null returned
→ "not in Redis yet" log, even though 343 monthly observations were
sitting in `economic:fred:v1:GSCPI:0`
Fix: extract the parsing into `extractGscpiObservations()` which checks
both shapes (`parsed.series.observations` first, then top-level
`parsed.observations` for back-compat). The "not in Redis yet" message
will now correctly fire only when the relay is genuinely behind.
Verified against live Redis: returns `{ observations: 343 entries,
latest 2026-03-01 = 0.68 }` instead of null.
Tests added in tests/gscpi-shape-extraction.test.mjs (3 cases:
ais-relay shape, legacy flat shape, malformed payload).
* style(economy): single @type cast in extractGscpiObservations
PR #3072 review (P2): cast `parsed` to `any` once into a local instead
of repeating the inline `/** @type {any} */` annotation on every access.
Same behavior, less visual noise.
2026-04-13 22:03:27 +04:00
..
2026-04-12 15:09:54 +04:00
2026-04-13 19:44:25 +04:00
2026-04-12 09:56:35 +04:00
2026-04-13 21:53:21 +04:00
2026-02-28 17:43:56 +04:00
2026-04-10 11:50:32 +04:00
2026-04-02 08:17:32 +04:00
2026-03-23 16:10:49 +04:00
2026-04-04 15:38:02 +04:00
2026-04-11 09:39:27 +04:00
2026-03-29 11:09:26 +04:00
2026-04-13 13:00:14 +04:00
2026-03-28 15:03:54 +04:00
2026-03-16 08:40:14 +04:00
2026-04-02 08:17:32 +04:00
2026-03-14 21:29:21 +04:00
2026-04-05 08:01:27 +04:00
2026-03-19 00:24:47 +04:00
2026-04-12 21:29:37 +04:00
2026-03-31 07:54:23 +04:00
2026-03-28 19:51:29 +04:00
2026-04-11 08:21:08 +04:00
2026-03-14 21:29:21 +04:00
2026-04-13 21:53:21 +04:00
2026-03-31 13:09:21 +04:00
2026-04-13 21:57:11 +04:00
2026-04-13 20:35:16 +04:00
2026-04-04 15:38:02 +04:00
2026-03-14 21:29:21 +04:00
2026-03-12 06:50:30 +04:00
2026-03-05 10:16:43 +04:00
2026-03-19 10:31:37 +04:00
2026-03-14 21:29:21 +04:00
2026-03-23 23:59:21 +04:00
2026-02-26 20:52:44 +04:00
2026-03-15 15:57:22 +04:00
2026-03-24 18:52:02 +04:00
2026-03-15 15:57:22 +04:00
2026-03-19 02:40:05 +04:00
2026-03-17 06:35:12 +04:00
2026-03-01 11:53:20 +04:00
2026-03-01 11:53:20 +04:00
2026-03-14 21:29:21 +04:00
2026-03-28 23:59:47 +04:00
2026-04-04 15:38:02 +04:00
2026-03-01 15:59:53 +04:00
2026-04-03 23:25:08 +04:00
2026-04-08 11:21:40 +04:00
2026-04-11 17:55:39 +04:00
2026-03-14 21:29:21 +04:00
2026-03-01 11:53:20 +04:00
2026-03-15 11:20:51 +04:00
2026-04-13 21:53:21 +04:00
2026-04-12 11:46:04 +04:00
2026-04-12 11:46:04 +04:00
2026-04-10 15:34:52 +04:00
2026-04-05 09:03:34 +04:00
2026-04-05 09:03:34 +04:00
2026-03-15 15:57:22 +04:00
2026-03-23 23:59:21 +04:00
2026-03-01 11:53:20 +04:00
2026-04-03 10:27:37 +04:00
2026-04-10 15:54:30 +04:00
2026-04-11 17:05:39 +04:00
2026-03-17 16:12:05 +04:00
2026-03-30 14:07:52 +04:00
2026-03-21 18:41:04 +04:00
2026-03-26 06:54:18 +04:00
2026-04-13 15:05:44 +04:00
2026-03-29 17:26:51 +04:00
2026-04-10 11:50:32 +04:00
2026-04-11 17:55:39 +04:00
2026-04-10 11:50:32 +04:00
2026-04-12 15:09:54 +04:00
2026-04-10 11:50:32 +04:00
2026-04-13 12:51:35 +04:00
2026-04-13 15:05:44 +04:00
2026-04-13 08:19:53 +04:00
2026-04-10 11:50:32 +04:00
2026-04-12 11:46:04 +04:00
2026-04-10 11:50:32 +04:00
2026-04-12 22:32:49 +04:00
2026-04-13 08:05:59 +04:00
2026-04-10 11:50:32 +04:00
2026-04-10 14:23:48 +04:00
2026-04-07 12:43:54 +04:00
2026-04-07 22:51:16 +04:00
2026-04-02 08:17:32 +04:00
2026-04-07 07:50:56 +04:00
2026-04-10 16:40:04 +04:00
2026-04-04 08:11:49 +04:00
2026-04-02 08:17:32 +04:00
2026-04-02 08:17:32 +04:00
2026-04-12 22:53:32 +04:00
2026-04-12 18:55:43 +04:00
2026-04-04 15:38:02 +04:00
2026-03-22 11:46:40 +04:00
2026-04-04 15:38:02 +04:00
2026-04-12 22:53:32 +04:00
2026-04-04 23:55:09 +04:00
2026-03-22 22:55:06 +04:00
2026-03-20 10:34:20 +04:00
2026-03-15 12:02:37 +04:00
2026-03-26 17:50:37 +04:00
2026-04-12 20:40:17 +04:00
2026-03-29 00:33:26 +04:00
2026-03-15 12:02:37 +04:00
2026-03-26 19:21:50 +04:00
2026-03-27 22:33:45 +04:00
2026-03-27 11:48:02 +04:00
2026-03-27 11:48:02 +04:00
2026-04-10 21:35:41 +04:00
2026-04-13 22:03:27 +04:00
2026-04-07 22:24:17 +04:00
2026-04-08 22:28:30 +04:00
2026-04-12 15:09:54 +04:00
2026-04-05 14:18:38 +04:00
2026-04-09 22:16:24 +04:00
2026-03-31 07:54:23 +04:00
2026-03-27 23:29:55 +04:00
2026-04-13 13:00:14 +04:00
2026-04-13 13:00:14 +04:00
2026-04-13 13:00:14 +04:00
2026-04-04 17:33:54 +04:00
2026-03-30 09:27:22 +04:00
2026-04-09 09:01:56 +04:00
2026-04-11 16:51:35 +04:00
2026-04-01 08:53:13 +04:00
2026-03-27 11:07:17 +04:00
2026-04-10 21:35:41 +04:00
2026-03-21 18:41:04 +04:00
2026-04-13 21:57:11 +04:00
2026-04-05 12:32:13 +04:00
2026-04-11 20:47:03 +04:00
2026-03-27 10:50:20 +04:00
2026-04-13 08:19:53 +04:00
2026-04-13 08:04:22 +04:00
2026-03-27 01:28:30 +04:00
2026-03-31 07:54:23 +04:00
2026-04-03 10:27:37 +04:00
2026-03-26 13:58:24 +04:00
2026-04-12 21:34:38 +04:00
2026-04-06 16:28:04 +04:00
2026-04-13 12:51:35 +04:00
2026-04-13 12:51:35 +04:00
2026-04-13 12:51:35 +04:00
2026-04-13 12:51:35 +04:00
2026-03-22 19:59:42 +04:00
2026-03-23 16:32:34 +04:00
2026-04-12 20:38:08 +04:00
2026-04-05 07:44:32 +04:00
2026-04-06 16:27:34 +04:00
2026-04-06 13:58:54 +04:00
2026-04-11 17:54:26 +04:00
2026-03-31 07:54:23 +04:00
2026-03-15 15:57:22 +04:00
2026-04-05 08:33:03 +04:00
2026-03-22 19:59:42 +04:00
2026-04-13 08:35:38 +04:00
2026-03-20 12:36:34 +04:00
2026-04-05 23:40:58 +04:00
2026-04-07 23:09:33 +04:00
2026-04-13 14:13:18 +04:00
2026-04-09 22:09:42 +04:00
2026-04-09 12:40:13 +04:00
2026-03-20 12:19:01 +04:00
2026-03-17 09:18:06 +04:00
2026-04-12 13:35:02 +04:00
2026-04-12 21:29:37 +04:00
2026-04-12 11:39:48 +04:00
2026-04-12 22:32:49 +04:00
2026-04-12 13:35:02 +04:00
2026-04-12 11:46:04 +04:00
2026-04-12 11:46:04 +04:00
2026-04-04 23:19:33 +04:00
2026-03-18 19:53:57 +04:00
2026-04-13 09:21:13 +04:00
2026-04-13 18:56:30 +04:00
2026-04-13 13:00:58 +04:00
2026-03-29 17:41:42 +04:00
2026-04-04 15:38:02 +04:00
2026-03-22 19:59:42 +04:00
2026-04-09 22:16:24 +04:00
2026-03-22 22:55:06 +04:00
2026-03-15 12:02:37 +04:00
2026-04-11 20:47:13 +04:00
2026-03-26 07:09:33 +04:00
2026-03-22 22:55:06 +04:00
2026-03-26 16:53:46 +04:00
2026-03-17 17:45:13 +04:00
2026-03-20 14:04:21 +04:00
2026-03-22 22:55:06 +04:00
2026-03-27 22:47:24 +04:00
2026-03-17 16:12:05 +04:00
2026-03-15 12:02:37 +04:00
2026-03-14 10:23:20 +04:00
2026-03-27 10:58:29 +04:00
2026-03-19 01:57:27 +04:00
2026-04-13 21:53:21 +04:00
2026-04-13 21:53:21 +04:00
2026-02-19 07:53:15 +04:00
2026-04-12 10:18:42 +04:00
2026-04-12 10:18:42 +04:00
2026-04-12 10:22:21 +04:00
2026-03-14 21:29:21 +04:00
2026-04-02 08:55:22 +04:00
2026-03-26 13:47:22 +02:00