fix(cli): clean up connection commands

This commit is contained in:
Andrey Avtomonov 2026-05-13 14:21:05 +02:00
parent c22248dabf
commit 2f41fd019d
32 changed files with 906 additions and 5230 deletions

View file

@ -276,7 +276,7 @@ describe('fetchMetabaseBundle', () => {
clientFactory,
sourceStateReader,
}),
).rejects.toThrow(/unhydrated.*ktx connection mapping refresh/);
).rejects.toThrow(/unhydrated.*ktx setup/);
});
it('skips cards whose getResolvedSql returns null and records them in unresolved-cards.json', async () => {

View file

@ -99,7 +99,7 @@ export async function fetchMetabaseBundle(params: FetchMetabaseBundleParams): Pr
}
if (mapping.metabaseDatabaseName === null) {
throw new IngestInputError(
`mapping for database ${pullConfig.metabaseDatabaseId} on Metabase connection ${pullConfig.metabaseConnectionId} is unhydrated; run \`ktx connection mapping refresh ${pullConfig.metabaseConnectionId}\` to populate metabaseDatabaseName before ingest.`,
`mapping for database ${pullConfig.metabaseDatabaseId} on Metabase connection ${pullConfig.metabaseConnectionId} is unhydrated; run \`ktx setup\` and reconfigure the Metabase source to populate metabaseDatabaseName before ingest.`,
);
}
const mappingDatabaseName: string = mapping.metabaseDatabaseName;

View file

@ -371,7 +371,7 @@ export async function runLocalMetabaseIngest(
const unhydrated = await sourceStateReader.getUnhydratedSyncEnabledMappingIds(metabaseConnectionId);
if (unhydrated.length > 0) {
throw new Error(
`Metabase mappings ${unhydrated.join(', ')} are not hydrated; run \`ktx connection mapping refresh ${metabaseConnectionId}\` before local Metabase ingest.`,
`Metabase mappings ${unhydrated.join(', ')} are not hydrated; run \`ktx setup\` and reconfigure ${metabaseConnectionId} before local Metabase ingest.`,
);
}

View file

@ -203,7 +203,7 @@ describe('runLocalMetabaseIngest', () => {
metabaseConnectionId: 'prod-metabase',
agentRunner: new TestAgentRunner(),
}),
).rejects.toThrow('run `ktx connection mapping refresh prod-metabase`');
).rejects.toThrow('run `ktx setup` and reconfigure prod-metabase');
});
it('seeds yaml-only Metabase mappings before the unhydrated fan-out preflight', async () => {
@ -230,7 +230,7 @@ describe('runLocalMetabaseIngest', () => {
adapters: [new FakeMetabaseSourceAdapter()],
metabaseConnectionId: 'prod-metabase',
}),
).rejects.toThrow('run `ktx connection mapping refresh prod-metabase`');
).rejects.toThrow('run `ktx setup` and reconfigure prod-metabase');
});
it('rejects source-dir uploads through the Metabase fan-out runner', async () => {

View file

@ -23,6 +23,6 @@ export function formatNotionAuthorizationExpiredDetail(unitKey: string): string
export function notionAuthorizationFixSuggestions(connectionId: string): string[] {
return [
`Refresh the Notion token referenced by auth_token_ref for ${connectionId}. If it uses env:NAME, export a fresh token in that variable; if it uses file:/path, replace that file.`,
`Run ktx connection notion pick ${connectionId} to confirm Notion access, then rerun ktx ingest ${connectionId}.`,
`Run ktx setup and reconfigure the Notion source to confirm page access, then rerun ktx ingest ${connectionId}.`,
];
}

View file

@ -85,7 +85,7 @@ describe('formatMemoryFlowFinalSummary', () => {
'- Refresh the Notion token referenced by auth_token_ref for notion-main. If it uses env:NAME, export a fresh token in that variable; if it uses file:/path, replace that file.',
);
expect(summary).toContain(
'- Run ktx connection notion pick notion-main to confirm Notion access, then rerun ktx ingest notion-main.',
'- Run ktx setup and reconfigure the Notion source to confirm page access, then rerun ktx ingest notion-main.',
);
expect(summary).not.toContain('error_uri');
});