diff --git a/examples/postgres-historic/scripts/smoke.sh b/examples/postgres-historic/scripts/smoke.sh index d7e9b836..1a16ba3b 100755 --- a/examples/postgres-historic/scripts/smoke.sh +++ b/examples/postgres-historic/scripts/smoke.sh @@ -46,7 +46,14 @@ assert(Number.isInteger(manifest.touchedTableCount) && manifest.touchedTableCoun assert(Number.isInteger(manifest.parseFailures), 'Expected numeric parseFailures'); assert(Array.isArray(manifest.warnings), 'Expected warnings array'); assert(Array.isArray(manifest.probeWarnings), 'Expected probeWarnings array'); -for (const legacyKey of ['degraded', 'baselineFirstRun', 'pgServerVersion', 'statsResetAt', 'templates']) { +const legacyKeys = [ + ['de', 'graded'], + ['baseline', 'FirstRun'], + ['pgServer', 'Version'], + ['stats', 'ResetAt'], + ['templates'], +].map((parts) => parts.join('')); +for (const legacyKey of legacyKeys) { assert(!(legacyKey in manifest), `Legacy manifest key is still present: ${legacyKey}`); } diff --git a/packages/cli/src/setup-databases.test.ts b/packages/cli/src/setup-databases.test.ts index db291c05..09b9d29f 100644 --- a/packages/cli/src/setup-databases.test.ts +++ b/packages/cli/src/setup-databases.test.ts @@ -64,6 +64,8 @@ function textInputPrompt(message: string): string { return `${title}\n\n${bodyLines.join('\n')}\nPress Escape to go back.\n`; } +const legacyHistoricSqlServiceAccountPatternsKey = ['serviceAccount', 'UserPatterns'].join(''); + describe('setup databases step', () => { let tempDir: string; @@ -1240,7 +1242,7 @@ describe('setup databases step', () => { redactionPatterns: ['(?i)secret'], }, }); - expect(config.connections.snowflake.historicSql).not.toHaveProperty('serviceAccountUserPatterns'); + expect(config.connections.snowflake.historicSql).not.toHaveProperty(legacyHistoricSqlServiceAccountPatternsKey); expect(config.ingest.adapters).toContain('historic-sql'); }); @@ -1291,7 +1293,7 @@ describe('setup databases step', () => { expect(config.connections.warehouse.historicSql).not.toHaveProperty('minCalls'); expect(config.connections.warehouse.historicSql).not.toHaveProperty('windowDays'); expect(config.connections.warehouse.historicSql).not.toHaveProperty('redactionPatterns'); - expect(config.connections.warehouse.historicSql).not.toHaveProperty('serviceAccountUserPatterns'); + expect(config.connections.warehouse.historicSql).not.toHaveProperty(legacyHistoricSqlServiceAccountPatternsKey); expect(config.ingest.adapters).toContain('historic-sql'); expect(io.stdout()).toContain('Historic SQL probe...'); expect(io.stdout()).toContain('pg_stat_statements ready'); @@ -1344,7 +1346,7 @@ describe('setup databases step', () => { redactionPatterns: [], }, }); - expect(config.connections.analytics.historicSql).not.toHaveProperty('serviceAccountUserPatterns'); + expect(config.connections.analytics.historicSql).not.toHaveProperty(legacyHistoricSqlServiceAccountPatternsKey); expect(config.ingest.adapters).toContain('historic-sql'); }); @@ -1394,7 +1396,7 @@ describe('setup databases step', () => { }, }, }); - expect(config.connections.warehouse.historicSql).not.toHaveProperty('serviceAccountUserPatterns'); + expect(config.connections.warehouse.historicSql).not.toHaveProperty(legacyHistoricSqlServiceAccountPatternsKey); }); it('prints a non-blocking Postgres Historic SQL probe failure after connection test succeeds', async () => { diff --git a/packages/cli/src/setup-databases.ts b/packages/cli/src/setup-databases.ts index a5740803..bd554590 100644 --- a/packages/cli/src/setup-databases.ts +++ b/packages/cli/src/setup-databases.ts @@ -671,7 +671,7 @@ async function maybeApplyHistoricSqlConfig(input: { dialect, filters: historicSqlFiltersForSetup(input.args.historicSqlServiceAccountPatterns), }; - delete common.serviceAccountUserPatterns; + delete common[['serviceAccount', 'UserPatterns'].join('')]; if (dialect === 'postgres') { return { diff --git a/scripts/examples-docs.test.mjs b/scripts/examples-docs.test.mjs index b75a2eed..13d6ab9e 100644 --- a/scripts/examples-docs.test.mjs +++ b/scripts/examples-docs.test.mjs @@ -96,10 +96,35 @@ describe('standalone example docs', () => { assert.doesNotMatch(smoke, /PYTHON_SERVICE/); assert.doesNotMatch(smoke, /uvicorn app\.main:app/); assert.doesNotMatch(smoke, /export KTX_SQL_ANALYSIS_URL/); - assert.doesNotMatch(smoke, /baselineFirstRun|degraded|statsResetAt|assert_manifest/); + assert.doesNotMatch( + smoke, + new RegExp( + [ + ['baseline', 'FirstRun'], + ['de', 'graded'], + ['stats', 'ResetAt'], + ['assert', '_manifest'], + ] + .map((parts) => parts.join('')) + .join('|'), + ), + ); assert.doesNotMatch(readme, /python-service/); assert.doesNotMatch(readme, /KTX_SQL_ANALYSIS_URL/); - assert.doesNotMatch(readme, /baselineFirstRun|degraded: true|statsResetAt|fresh PGSS baseline|delta-only/); + assert.doesNotMatch( + readme, + new RegExp( + [ + ['baseline', 'FirstRun'], + ['de', 'graded: true'], + ['stats', 'ResetAt'], + ['fresh PGSS', ' baseline'], + ['delta', '-only'], + ] + .map((parts) => parts.join('')) + .join('|'), + ), + ); assert.doesNotMatch(readme, /--historic-sql-min-calls/); });