feat(gateway,storage): mosaic gateway doctor with tier health JSON (FED-M1-06)
Adds `mosaic gateway doctor [--json] [--config <path>]` for tier-aware health reporting (postgres, valkey, pgvector). JSON mode emits a single parseable TierHealthReport for CI consumption; exit 1 on red. Refactors gateway-internal tier probes into @mosaicstack/storage so the same probe logic is reused by both the gateway boot path (detectAndAssertTier — fail-fast on first failure) and the doctor command (probeServiceHealth — non-throwing, runs all probes, returns report). Old apps/gateway/src/bootstrap/tier-detector.* files removed. A local TierConfig interface in tier-detection.ts captures the minimal structural shape from MosaicConfig without importing @mosaicstack/config (would create a cycle since config already depends on storage for StorageConfig). Tests: - packages/storage/src/tier-detection.spec.ts — 22 tests (11 ported from gateway tier-detector, 11 new for probeServiceHealth + timing + branch coverage) - packages/mosaic/src/commands/gateway-doctor.spec.ts — 12 tests for JSON contract, exit codes, output format, --config override Refs #460
This commit is contained in:
@@ -25,7 +25,7 @@ import { AppModule } from './app.module.js';
|
||||
import { mountAuthHandler } from './auth/auth.controller.js';
|
||||
import { mountMcpHandler } from './mcp/mcp.controller.js';
|
||||
import { McpService } from './mcp/mcp.service.js';
|
||||
import { detectAndAssertTier, TierDetectionError } from './bootstrap/tier-detector.js';
|
||||
import { detectAndAssertTier, TierDetectionError } from '@mosaicstack/storage';
|
||||
|
||||
async function bootstrap(): Promise<void> {
|
||||
const logger = new Logger('Bootstrap');
|
||||
|
||||
Reference in New Issue
Block a user