diff --git a/packages/context/skills/_shared/identifier-verification.md b/packages/context/skills/_shared/identifier-verification.md index 775203bd..1741d880 100644 --- a/packages/context/skills/_shared/identifier-verification.md +++ b/packages/context/skills/_shared/identifier-verification.md @@ -8,16 +8,16 @@ Before writing a wiki page or SL source on any topic: Before emitting any `schema.table` or `schema.table.column` into a wiki body, SL source, `tables:` frontmatter, `sl_refs`, or `emit_unmapped_fallback`: -2. `entity_details({connectionName, targets: [{display: ""}]})` - +2. `entity_details({connectionId, targets: [{display: ""}]})` - confirm the identifier resolves; inspect native types, FK/PK, and sampleValues. 3. For literal values from the source, such as status codes or plan tiers, check whether they appear in `entity_details` sampleValues for the relevant column. If sampleValues is short or the sample may have missed real values, - run a `sql_execution` probe with the same warehouse connection name: - `sql_execution({connectionName, sql: "SELECT DISTINCT FROM LIMIT 50"})`. + run a `sql_execution` probe with the same warehouse connection id: + `sql_execution({connectionId, sql: "SELECT DISTINCT FROM LIMIT 50"})`. 4. If the candidate identifier still does not resolve, do one of: - - Use `sql_execution({connectionName, sql: "SELECT 1 FROM LIMIT 0"})`. + - Use `sql_execution({connectionId, sql: "SELECT 1 FROM LIMIT 0"})`. If it errors, the identifier is fictional. - Wrap the identifier in `[unverified - from ]` in the wiki body, citing the exact raw path that mentioned it. diff --git a/packages/context/skills/dbt_ingest/SKILL.md b/packages/context/skills/dbt_ingest/SKILL.md index 6b332d8e..247d3c79 100644 --- a/packages/context/skills/dbt_ingest/SKILL.md +++ b/packages/context/skills/dbt_ingest/SKILL.md @@ -41,16 +41,16 @@ Before writing a wiki page or SL source on any topic: Before emitting any `schema.table` or `schema.table.column` into a wiki body, SL source, `tables:` frontmatter, `sl_refs`, or `emit_unmapped_fallback`: -2. `entity_details({connectionName, targets: [{display: ""}]})` - +2. `entity_details({connectionId, targets: [{display: ""}]})` - confirm the identifier resolves; inspect native types, FK/PK, and sampleValues. 3. For literal values from the source, such as status codes or plan tiers, check whether they appear in `entity_details` sampleValues for the relevant column. If sampleValues is short or the sample may have missed real values, - run a `sql_execution` probe with the same warehouse connection name: - `sql_execution({connectionName, sql: "SELECT DISTINCT FROM LIMIT 50"})`. + run a `sql_execution` probe with the same warehouse connection id: + `sql_execution({connectionId, sql: "SELECT DISTINCT FROM LIMIT 50"})`. 4. If the candidate identifier still does not resolve, do one of: - - Use `sql_execution({connectionName, sql: "SELECT 1 FROM LIMIT 0"})`. + - Use `sql_execution({connectionId, sql: "SELECT 1 FROM LIMIT 0"})`. If it errors, the identifier is fictional. - Wrap the identifier in `[unverified - from ]` in the wiki body, citing the exact raw path that mentioned it. diff --git a/packages/context/skills/historic_sql_patterns/SKILL.md b/packages/context/skills/historic_sql_patterns/SKILL.md index 5e898c47..057a7c78 100644 --- a/packages/context/skills/historic_sql_patterns/SKILL.md +++ b/packages/context/skills/historic_sql_patterns/SKILL.md @@ -31,16 +31,16 @@ Before writing a wiki page or SL source on any topic: Before emitting any `schema.table` or `schema.table.column` into a wiki body, SL source, `tables:` frontmatter, `sl_refs`, or `emit_unmapped_fallback`: -2. `entity_details({connectionName, targets: [{display: ""}]})` - +2. `entity_details({connectionId, targets: [{display: ""}]})` - confirm the identifier resolves; inspect native types, FK/PK, and sampleValues. 3. For literal values from the source, such as status codes or plan tiers, check whether they appear in `entity_details` sampleValues for the relevant column. If sampleValues is short or the sample may have missed real values, - run a `sql_execution` probe with the same warehouse connection name: - `sql_execution({connectionName, sql: "SELECT DISTINCT FROM LIMIT 50"})`. + run a `sql_execution` probe with the same warehouse connection id: + `sql_execution({connectionId, sql: "SELECT DISTINCT FROM LIMIT 50"})`. 4. If the candidate identifier still does not resolve, do one of: - - Use `sql_execution({connectionName, sql: "SELECT 1 FROM LIMIT 0"})`. + - Use `sql_execution({connectionId, sql: "SELECT 1 FROM LIMIT 0"})`. If it errors, the identifier is fictional. - Wrap the identifier in `[unverified - from ]` in the wiki body, citing the exact raw path that mentioned it. diff --git a/packages/context/skills/historic_sql_table_digest/SKILL.md b/packages/context/skills/historic_sql_table_digest/SKILL.md index 0815e3dc..99cf6936 100644 --- a/packages/context/skills/historic_sql_table_digest/SKILL.md +++ b/packages/context/skills/historic_sql_table_digest/SKILL.md @@ -27,16 +27,16 @@ Before writing a wiki page or SL source on any topic: Before emitting any `schema.table` or `schema.table.column` into a wiki body, SL source, `tables:` frontmatter, `sl_refs`, or `emit_unmapped_fallback`: -2. `entity_details({connectionName, targets: [{display: ""}]})` - +2. `entity_details({connectionId, targets: [{display: ""}]})` - confirm the identifier resolves; inspect native types, FK/PK, and sampleValues. 3. For literal values from the source, such as status codes or plan tiers, check whether they appear in `entity_details` sampleValues for the relevant column. If sampleValues is short or the sample may have missed real values, - run a `sql_execution` probe with the same warehouse connection name: - `sql_execution({connectionName, sql: "SELECT DISTINCT FROM LIMIT 50"})`. + run a `sql_execution` probe with the same warehouse connection id: + `sql_execution({connectionId, sql: "SELECT DISTINCT FROM LIMIT 50"})`. 4. If the candidate identifier still does not resolve, do one of: - - Use `sql_execution({connectionName, sql: "SELECT 1 FROM LIMIT 0"})`. + - Use `sql_execution({connectionId, sql: "SELECT 1 FROM LIMIT 0"})`. If it errors, the identifier is fictional. - Wrap the identifier in `[unverified - from ]` in the wiki body, citing the exact raw path that mentioned it. diff --git a/packages/context/skills/live_database_ingest/SKILL.md b/packages/context/skills/live_database_ingest/SKILL.md index 2b9cb6d8..48a476ef 100644 --- a/packages/context/skills/live_database_ingest/SKILL.md +++ b/packages/context/skills/live_database_ingest/SKILL.md @@ -37,16 +37,16 @@ Before writing a wiki page or SL source on any topic: Before emitting any `schema.table` or `schema.table.column` into a wiki body, SL source, `tables:` frontmatter, `sl_refs`, or `emit_unmapped_fallback`: -2. `entity_details({connectionName, targets: [{display: ""}]})` - +2. `entity_details({connectionId, targets: [{display: ""}]})` - confirm the identifier resolves; inspect native types, FK/PK, and sampleValues. 3. For literal values from the source, such as status codes or plan tiers, check whether they appear in `entity_details` sampleValues for the relevant column. If sampleValues is short or the sample may have missed real values, - run a `sql_execution` probe with the same warehouse connection name: - `sql_execution({connectionName, sql: "SELECT DISTINCT FROM LIMIT 50"})`. + run a `sql_execution` probe with the same warehouse connection id: + `sql_execution({connectionId, sql: "SELECT DISTINCT FROM LIMIT 50"})`. 4. If the candidate identifier still does not resolve, do one of: - - Use `sql_execution({connectionName, sql: "SELECT 1 FROM LIMIT 0"})`. + - Use `sql_execution({connectionId, sql: "SELECT 1 FROM LIMIT 0"})`. If it errors, the identifier is fictional. - Wrap the identifier in `[unverified - from ]` in the wiki body, citing the exact raw path that mentioned it. diff --git a/packages/context/skills/looker_ingest/SKILL.md b/packages/context/skills/looker_ingest/SKILL.md index 7a41fa6e..45e0f906 100644 --- a/packages/context/skills/looker_ingest/SKILL.md +++ b/packages/context/skills/looker_ingest/SKILL.md @@ -34,16 +34,16 @@ Before writing a wiki page or SL source on any topic: Before emitting any `schema.table` or `schema.table.column` into a wiki body, SL source, `tables:` frontmatter, `sl_refs`, or `emit_unmapped_fallback`: -2. `entity_details({connectionName, targets: [{display: ""}]})` - +2. `entity_details({connectionId, targets: [{display: ""}]})` - confirm the identifier resolves; inspect native types, FK/PK, and sampleValues. 3. For literal values from the source, such as status codes or plan tiers, check whether they appear in `entity_details` sampleValues for the relevant column. If sampleValues is short or the sample may have missed real values, - run a `sql_execution` probe with the same warehouse connection name: - `sql_execution({connectionName, sql: "SELECT DISTINCT FROM LIMIT 50"})`. + run a `sql_execution` probe with the same warehouse connection id: + `sql_execution({connectionId, sql: "SELECT DISTINCT FROM LIMIT 50"})`. 4. If the candidate identifier still does not resolve, do one of: - - Use `sql_execution({connectionName, sql: "SELECT 1 FROM LIMIT 0"})`. + - Use `sql_execution({connectionId, sql: "SELECT 1 FROM LIMIT 0"})`. If it errors, the identifier is fictional. - Wrap the identifier in `[unverified - from ]` in the wiki body, citing the exact raw path that mentioned it. diff --git a/packages/context/skills/lookml_ingest/SKILL.md b/packages/context/skills/lookml_ingest/SKILL.md index 6a01a355..6cd0c937 100644 --- a/packages/context/skills/lookml_ingest/SKILL.md +++ b/packages/context/skills/lookml_ingest/SKILL.md @@ -64,16 +64,16 @@ Before writing a wiki page or SL source on any topic: Before emitting any `schema.table` or `schema.table.column` into a wiki body, SL source, `tables:` frontmatter, `sl_refs`, or `emit_unmapped_fallback`: -2. `entity_details({connectionName, targets: [{display: ""}]})` - +2. `entity_details({connectionId, targets: [{display: ""}]})` - confirm the identifier resolves; inspect native types, FK/PK, and sampleValues. 3. For literal values from the source, such as status codes or plan tiers, check whether they appear in `entity_details` sampleValues for the relevant column. If sampleValues is short or the sample may have missed real values, - run a `sql_execution` probe with the same warehouse connection name: - `sql_execution({connectionName, sql: "SELECT DISTINCT FROM LIMIT 50"})`. + run a `sql_execution` probe with the same warehouse connection id: + `sql_execution({connectionId, sql: "SELECT DISTINCT FROM LIMIT 50"})`. 4. If the candidate identifier still does not resolve, do one of: - - Use `sql_execution({connectionName, sql: "SELECT 1 FROM LIMIT 0"})`. + - Use `sql_execution({connectionId, sql: "SELECT 1 FROM LIMIT 0"})`. If it errors, the identifier is fictional. - Wrap the identifier in `[unverified - from ]` in the wiki body, citing the exact raw path that mentioned it. @@ -85,11 +85,11 @@ SL source, `tables:` frontmatter, `sl_refs`, or `emit_unmapped_fallback`: **Required flow before writing any overlay or standalone**: 1. Call `sl_discover({ query: "" })` for each base table you're about to touch. That returns the real columns. -2. If the table isn't in the manifest, use the warehouse `connectionName` +2. If the table isn't in the manifest, use the warehouse `connectionId` returned by `discover_data` or the target connection chosen from `sl_discover`, then call a dialect-appropriate SQL probe with that - connection name, for example: - `sql_execution({connectionName: "warehouse", sql: "SELECT 1 FROM analytics.orders LIMIT 0"})`. + connection id, for example: + `sql_execution({connectionId: "warehouse", sql: "SELECT 1 FROM analytics.orders LIMIT 0"})`. Replace `warehouse`, `analytics`, and `orders` with the verified connection, schema or dataset, and table from the WorkUnit evidence. 3. Use only those names in `sql:`, `columns:`, and `grain:`. Map each `dimension_group` to ONE `{ name: , type: time, role: time }` entry — never one per timeframe. diff --git a/packages/context/skills/metabase_ingest/SKILL.md b/packages/context/skills/metabase_ingest/SKILL.md index d35166dc..852312b1 100644 --- a/packages/context/skills/metabase_ingest/SKILL.md +++ b/packages/context/skills/metabase_ingest/SKILL.md @@ -57,16 +57,16 @@ Before writing a wiki page or SL source on any topic: Before emitting any `schema.table` or `schema.table.column` into a wiki body, SL source, `tables:` frontmatter, `sl_refs`, or `emit_unmapped_fallback`: -2. `entity_details({connectionName, targets: [{display: ""}]})` - +2. `entity_details({connectionId, targets: [{display: ""}]})` - confirm the identifier resolves; inspect native types, FK/PK, and sampleValues. 3. For literal values from the source, such as status codes or plan tiers, check whether they appear in `entity_details` sampleValues for the relevant column. If sampleValues is short or the sample may have missed real values, - run a `sql_execution` probe with the same warehouse connection name: - `sql_execution({connectionName, sql: "SELECT DISTINCT FROM LIMIT 50"})`. + run a `sql_execution` probe with the same warehouse connection id: + `sql_execution({connectionId, sql: "SELECT DISTINCT FROM LIMIT 50"})`. 4. If the candidate identifier still does not resolve, do one of: - - Use `sql_execution({connectionName, sql: "SELECT 1 FROM LIMIT 0"})`. + - Use `sql_execution({connectionId, sql: "SELECT 1 FROM LIMIT 0"})`. If it errors, the identifier is fictional. - Wrap the identifier in `[unverified - from ]` in the wiki body, citing the exact raw path that mentioned it. diff --git a/packages/context/skills/metricflow_ingest/SKILL.md b/packages/context/skills/metricflow_ingest/SKILL.md index 67743892..5a673db5 100644 --- a/packages/context/skills/metricflow_ingest/SKILL.md +++ b/packages/context/skills/metricflow_ingest/SKILL.md @@ -42,16 +42,16 @@ Before writing a wiki page or SL source on any topic: Before emitting any `schema.table` or `schema.table.column` into a wiki body, SL source, `tables:` frontmatter, `sl_refs`, or `emit_unmapped_fallback`: -2. `entity_details({connectionName, targets: [{display: ""}]})` - +2. `entity_details({connectionId, targets: [{display: ""}]})` - confirm the identifier resolves; inspect native types, FK/PK, and sampleValues. 3. For literal values from the source, such as status codes or plan tiers, check whether they appear in `entity_details` sampleValues for the relevant column. If sampleValues is short or the sample may have missed real values, - run a `sql_execution` probe with the same warehouse connection name: - `sql_execution({connectionName, sql: "SELECT DISTINCT FROM LIMIT 50"})`. + run a `sql_execution` probe with the same warehouse connection id: + `sql_execution({connectionId, sql: "SELECT DISTINCT FROM LIMIT 50"})`. 4. If the candidate identifier still does not resolve, do one of: - - Use `sql_execution({connectionName, sql: "SELECT 1 FROM LIMIT 0"})`. + - Use `sql_execution({connectionId, sql: "SELECT 1 FROM LIMIT 0"})`. If it errors, the identifier is fictional. - Wrap the identifier in `[unverified - from ]` in the wiki body, citing the exact raw path that mentioned it. @@ -82,8 +82,8 @@ The `model:` field on a semantic_model is a string like `ref('table_name')`, `so If `sl_discover` errors because no such table exists, use `discover_data` and `entity_details` to find the warehouse target. If a SQL probe is still needed, -call `sql_execution` with the same warehouse connection name, for example: -`sql_execution({connectionName: "warehouse", sql: "SELECT 1 FROM analytics.orders LIMIT 0"})`. +call `sql_execution` with the same warehouse connection id, for example: +`sql_execution({connectionId: "warehouse", sql: "SELECT 1 FROM analytics.orders LIMIT 0"})`. **Never invent column names** - every column in `columns:`, `grain:`, and `sql:` must be sourced from raw files, `entity_details`, or a successful SQL probe. diff --git a/packages/context/skills/notion_synthesize/SKILL.md b/packages/context/skills/notion_synthesize/SKILL.md index 1b5417e3..d3edfebd 100644 --- a/packages/context/skills/notion_synthesize/SKILL.md +++ b/packages/context/skills/notion_synthesize/SKILL.md @@ -79,16 +79,16 @@ Before writing a wiki page or SL source on any topic: Before emitting any `schema.table` or `schema.table.column` into a wiki body, SL source, `tables:` frontmatter, `sl_refs`, or `emit_unmapped_fallback`: -2. `entity_details({connectionName, targets: [{display: ""}]})` - +2. `entity_details({connectionId, targets: [{display: ""}]})` - confirm the identifier resolves; inspect native types, FK/PK, and sampleValues. 3. For literal values from the source, such as status codes or plan tiers, check whether they appear in `entity_details` sampleValues for the relevant column. If sampleValues is short or the sample may have missed real values, - run a `sql_execution` probe with the same warehouse connection name: - `sql_execution({connectionName, sql: "SELECT DISTINCT FROM LIMIT 50"})`. + run a `sql_execution` probe with the same warehouse connection id: + `sql_execution({connectionId, sql: "SELECT DISTINCT FROM LIMIT 50"})`. 4. If the candidate identifier still does not resolve, do one of: - - Use `sql_execution({connectionName, sql: "SELECT 1 FROM LIMIT 0"})`. + - Use `sql_execution({connectionId, sql: "SELECT 1 FROM LIMIT 0"})`. If it errors, the identifier is fictional. - Wrap the identifier in `[unverified - from ]` in the wiki body, citing the exact raw path that mentioned it. diff --git a/packages/context/skills/sl_capture/SKILL.md b/packages/context/skills/sl_capture/SKILL.md index 4ec21545..3cf58a52 100644 --- a/packages/context/skills/sl_capture/SKILL.md +++ b/packages/context/skills/sl_capture/SKILL.md @@ -188,16 +188,16 @@ Before writing a wiki page or SL source on any topic: Before emitting any `schema.table` or `schema.table.column` into a wiki body, SL source, `tables:` frontmatter, `sl_refs`, or `emit_unmapped_fallback`: -2. `entity_details({connectionName, targets: [{display: ""}]})` - +2. `entity_details({connectionId, targets: [{display: ""}]})` - confirm the identifier resolves; inspect native types, FK/PK, and sampleValues. 3. For literal values from the source, such as status codes or plan tiers, check whether they appear in `entity_details` sampleValues for the relevant column. If sampleValues is short or the sample may have missed real values, - run a `sql_execution` probe with the same warehouse connection name: - `sql_execution({connectionName, sql: "SELECT DISTINCT FROM LIMIT 50"})`. + run a `sql_execution` probe with the same warehouse connection id: + `sql_execution({connectionId, sql: "SELECT DISTINCT FROM LIMIT 50"})`. 4. If the candidate identifier still does not resolve, do one of: - - Use `sql_execution({connectionName, sql: "SELECT 1 FROM LIMIT 0"})`. + - Use `sql_execution({connectionId, sql: "SELECT 1 FROM LIMIT 0"})`. If it errors, the identifier is fictional. - Wrap the identifier in `[unverified - from ]` in the wiki body, citing the exact raw path that mentioned it. @@ -213,7 +213,7 @@ SL source, `tables:` frontmatter, `sl_refs`, or `emit_unmapped_fallback`: 3. `sl_read_source({ connectionId, sourceName })` — read the raw YAML before editing. 4. For modifications: `sl_edit_source({ connectionId, sourceName, yaml_edits: [{ oldText, newText, reason }] })` with exact-string replacements. `oldText` must match exactly and be unique in the file. 5. For new sources or full rewrites: `sl_write_source({ connectionId, sourceName, source })` with the full structured source definition. -6. For join discovery: use `sql_execution({connectionName: "warehouse", sql: "SELECT count(*) FROM public.orders o JOIN public.customers c ON c.id = o.customer_id LIMIT 20"})` with the target warehouse connection name and dialect-correct table names to verify the join key exists in both tables and assess cardinality before declaring the join. +6. For join discovery: use `sql_execution({connectionId: "warehouse", sql: "SELECT count(*) FROM public.orders o JOIN public.customers c ON c.id = o.customer_id LIMIT 20"})` with the target warehouse connection id and dialect-correct table names to verify the join key exists in both tables and assess cardinality before declaring the join. 7. Cross-reference knowledge: author the edge once on the **wiki** side via `sl_refs: [source_name]` in the page's front-matter. The reverse edge (wiki pages that cite an SL source) is derived automatically by the reconciler — do not add a `knowledge_refs:` field to SL YAMLs. 8. `sl_validate` — run after writing or editing to surface schema issues, duplicate measure names, and cross-source validation errors. Read-only; the writes are already committed (the squash-at-end flow will collapse them into one commit). @@ -289,7 +289,7 @@ Prior turn: user asked to correlate LTV with protocol count; assistant joined `f sl_read_source({ connectionId: "warehouse", sourceName: "fct_orders" }) → no joins section yet sql_execution({ - connectionName: "warehouse", + connectionId: "warehouse", sql: "SELECT COUNT(*), COUNT(DISTINCT a.admin_user_id) FROM public.fct_orders a JOIN public.fct_mau_multiprotocol b ON a.admin_user_id = b.admin_user_id LIMIT 1" }) → confirms cardinality (many orders per MAU row = many_to_one) diff --git a/packages/context/skills/wiki_capture/SKILL.md b/packages/context/skills/wiki_capture/SKILL.md index d57a39ad..b4628707 100644 --- a/packages/context/skills/wiki_capture/SKILL.md +++ b/packages/context/skills/wiki_capture/SKILL.md @@ -60,16 +60,16 @@ Before writing a wiki page or SL source on any topic: Before emitting any `schema.table` or `schema.table.column` into a wiki body, SL source, `tables:` frontmatter, `sl_refs`, or `emit_unmapped_fallback`: -2. `entity_details({connectionName, targets: [{display: ""}]})` - +2. `entity_details({connectionId, targets: [{display: ""}]})` - confirm the identifier resolves; inspect native types, FK/PK, and sampleValues. 3. For literal values from the source, such as status codes or plan tiers, check whether they appear in `entity_details` sampleValues for the relevant column. If sampleValues is short or the sample may have missed real values, - run a `sql_execution` probe with the same warehouse connection name: - `sql_execution({connectionName, sql: "SELECT DISTINCT FROM LIMIT 50"})`. + run a `sql_execution` probe with the same warehouse connection id: + `sql_execution({connectionId, sql: "SELECT DISTINCT FROM LIMIT 50"})`. 4. If the candidate identifier still does not resolve, do one of: - - Use `sql_execution({connectionName, sql: "SELECT 1 FROM LIMIT 0"})`. + - Use `sql_execution({connectionId, sql: "SELECT 1 FROM LIMIT 0"})`. If it errors, the identifier is fictional. - Wrap the identifier in `[unverified - from ]` in the wiki body, citing the exact raw path that mentioned it. diff --git a/packages/context/src/ingest/ingest-runtime-assets.test.ts b/packages/context/src/ingest/ingest-runtime-assets.test.ts index c77bee11..6b9d83ba 100644 --- a/packages/context/src/ingest/ingest-runtime-assets.test.ts +++ b/packages/context/src/ingest/ingest-runtime-assets.test.ts @@ -94,11 +94,15 @@ describe('ingest runtime assets', () => { it('packages identifier verification prompt assets', async () => { const shared = await readFile(join(skillsDir, '_shared', 'identifier-verification.md'), 'utf-8'); + const legacyConnectionPrefix = ['connection', 'Name'].join(''); + expect(shared).toContain('## Identifier Verification Protocol'); expect(shared).toContain('discover_data'); expect(shared).toContain('entity_details'); expect(shared).toContain('sql_execution'); - expect(shared).toContain('sql_execution({connectionName, sql: "SELECT DISTINCT'); - expect(shared).toContain('sql_execution({connectionName, sql: "SELECT 1 FROM'); + expect(shared).toContain('sql_execution({connectionId, sql: "SELECT DISTINCT'); + expect(shared).toContain('sql_execution({connectionId, sql: "SELECT 1 FROM'); + expect(shared).not.toContain(`entity_details({${legacyConnectionPrefix}`); + expect(shared).not.toContain(`sql_execution({${legacyConnectionPrefix}`); }); });