Skip to content

Commit 33d751d

Browse files
sahrizviclaude
andauthored
chore(release): v0.12.2 (#1354)
* chore(release): v0.12.2 Promotes v0.12.2-beta.1 to `latest`, with the fixes from this release's five-persona review and its adversarial test file: - validate: fold SQL tokens only for names the schema itself folded — the beta validated a wrong quoted `"SHIPPED_DATE"` against lowercase Postgres metadata (review P0, reproduced); the quoted-lowercase collision on Snowflake is pinned as a known limitation - run: the "answered" step counter skips compaction steps, as the turn budget does; the silent-turn directive bounds the tool name it interpolates - tui: New in the skills browser is ctrl+o (ctrl+e is line-end in the filter box); the adapter's `standalone: true` widening is explained in place - finops: the BigQuery note names `datamate_bigquery_list_database_connections` - CHANGELOG: the [0.12.2] entry, with the heads-ups every user needs (documented env name now wins when both spellings are set, incl. `ALTIMATE_CLI_DB`; headless `run` exits 1 where it exited 0); the FinOps bullet labelled pilot-only - test/skill/release-v0.12.2-adversarial.test.ts: hostile-input coverage for the env rule, the lexer, unfold, the directive and the FinOps note Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012Q51zFUmPg1WwtS5CrGJE6 * chore(release): v0.12.2 — fold only what the schema fold changed Bot review on #1354: `foldedNames` listed a name as folded even when `foldSchemaCase` kept it for a collision (`ORDERS` beside `orders`), and it registered dotted segments of column names. It is derived from the original and the folded definition now: a table key or column counts only if it was stored folded and its original spelling is gone; segments are added for table keys only. Tests for both. Changelog binding list corrected to ctrl+a / ctrl+o / ctrl+g; the Postgres test asserts the error kind; the directive labels the tool name as data. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012Q51zFUmPg1WwtS5CrGJE6 * chore(release): v0.12.2 — no tool name in the synthetic prompt; heads-up covers the successful-tool case Bot review on #1354. The silent-turn directive no longer carries the tool's name (tool-controlled text in a user turn; the model has the failing result in history) — the UI and stdout lines keep it. The changelog heads-up says the exit-code change also applies after a tool that succeeded. Adversarial file: control bytes escaped, timing limits relaxed. The schema_path branch reuses the fold `loadSchemaFile` already computed. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012Q51zFUmPg1WwtS5CrGJE6 * chore(release): v0.12.2 — no cross-table fold, no unfold inside literals Consensus review of #1354 (6 models, two findings reproduced): - CRITICAL: `foldedNames` pooled every table's folded columns, so `"ID"` against table `a` (whose `id` was never folded) was rewritten because unrelated table `b` had an uppercase `ID` — a validated query Postgres rejects. A column name any table holds as written in lowercase is now never folded for any table; mutation-checked test. The cost (a quoted `"ID"` against `b` reported missing, as before 0.12.2) is documented in the changelog - MAJOR: `unfoldText` rewrote quoted spans inside string literals, changing a value; it steps over literals, dollar strings and comments as the fold does - The adversarial file skips its fold cases where the native binding cannot load; the hostile-tool-name test asserts the payload is absent (it was vacuous after the name left the directive); the BigQuery note says the listing tool is to be used where available Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012Q51zFUmPg1WwtS5CrGJE6 --------- Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
1 parent 9943393 commit 33d751d

12 files changed

Lines changed: 421 additions & 55 deletions

File tree

‎CHANGELOG.md‎

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,26 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [0.12.2] - 2026-09-22
9+
10+
Promotes [0.12.2-beta.1] to `latest` — the six bug fixes below — plus four small fixes from this release's review. No new features. The beta was published earlier the same day and did not soak before promotion; the review below is what stood in for that.
11+
12+
**Heads-up before upgrading (every user, not only the pilot):**
13+
14+
- **Environment variables: the documented `ALTIMATE_CLI_*` name now wins when both spellings are set.** Before 0.12.2 most `ALTIMATE_CLI_*` names were silently ignored, so anything you set under one and forgot is live now. Two to check for in particular: `ALTIMATE_CLI_DB` (now redirects the session database — "my history is gone" after an upgrade means this), and `ALTIMATE_CLI_DISABLE_AUTOUPDATE=false` next to `OPENCODE_DISABLE_AUTOUPDATE=true` (the documented `false` now wins; before, either `true` disabled updates). `env | grep ALTIMATE_CLI_` before upgrading.
15+
- **Headless `run` exits 1 in one case that used to exit 0:** a turn whose last step produces no text — typically after a tool failed or was auto-rejected, but also after a tool that succeeded — and that stays silent when asked once more. A CI job gating on `run`'s exit code can go red with no change on your side — read the printed "No answer was produced" line; that run never had an answer, it just used to say nothing. (#1345)
16+
17+
### Fixed (since the beta)
18+
19+
- **`altimate_core_validate` no longer validates a wrong quoted reference on a lowercase-metadata warehouse.** The beta folded a quoted all-uppercase reference (`"SHIPPED_DATE"`) whenever the schema held the name in lowercase — right for Snowflake, where the metadata is uppercase and was folded, wrong for Postgres and DuckDB, where `shipped_date` held as written means `"SHIPPED_DATE"` is a different identifier and the query fails. The SQL is folded only for names the schema itself folded; lowercase metadata leaves the SQL exactly as written. Found and reproduced in this release's review.
20+
- **Headless `run` does not ask for a reply after a compaction step.** The "did the last step answer" counter now skips compaction steps, as the turn budget already did, so context management running after the final answer cannot trigger a spurious follow-up. (#1345 follow-up)
21+
- **New skill in the skills browser is `ctrl+o`, not `ctrl+e`** — `ctrl+e` is line-end in the filter box. (#1342 follow-up)
22+
- **The FinOps BigQuery note names the tool that reveals a connection's location** (`datamate_bigquery_list_database_connections`). Pilot only. (#1346 follow-up)
23+
24+
### Known limitations
25+
26+
- `altimate_core_validate`'s identifier folding carries no quote identity and does not parse the SQL: a quoted reference that happens to match a folded name (`"order_month"` against uppercase-stored `ORDER_MONTH` on Snowflake) validates although the warehouse would reject it; on a lowercase-folding warehouse an all-uppercase quoted-created identifier is treated as unquoted; and a column name that some table holds in lowercase as written is never folded for any table, so a quoted `"ID"` against a table whose `ID` was folded is reported missing (the pre-0.12.2 behaviour) rather than bound to the wrong table's column. All pinned by tests; a dialect input on the tool is the fix and is a follow-up.
27+
828
## [0.12.2-beta.1] - 2026-09-22
929

1030
> **Beta channel release.** Publishes to the npm `beta` dist-tag; `latest` (0.12.1) is unaffected. Install: `npm i -g @altimateai/altimate-code@beta`.
@@ -14,11 +34,11 @@ Six bug fixes from the first headless triage of the workspace pilot and from the
1434
### Fixed
1535

1636
- **Every documented `ALTIMATE_CLI_*` environment variable is now read** — not only `YOLO` and `DISABLE_AUTOUPDATE`. `docs/docs/usage/cli.md` documents the flags under `ALTIMATE_CLI_*`, but most of the table (external-skill scanning, autocompact, default plugins, LSP download, models fetch, project config, prune, terminal title, Exa, the `EXPERIMENTAL*` family, `CONFIG`, `CONFIG_CONTENT`, `CONFIG_DIR`, `GIT_BASH_PATH`, `PERMISSION`, `SERVER_USERNAME`/`SERVER_PASSWORD`) was read under the `OPENCODE_*` spelling only, so the documented name silently did nothing. One rule now applies on every read path — the two flag modules, the Effect-config services skill discovery and server auth actually read, and the direct reads in config loading, `run --attach`, the legacy database path, the updater and the feature census. The documented name wins when both are set; an empty documented value counts as unset; the `OPENCODE_*` spellings keep working. (#1341, closes #1329)
17-
- **`/skills` opens the Altimate skills browser, and its actions work.** `/skills` used to open the plain core skill selector (two `/skills` rows in autocomplete; Enter took the wrong one), where ctrl+a did nothing because the plugin's global keybind was outranked by the open dialog. The browser's Actions / New / Install are dialog-level actions now — bound inside the dialog to ctrl+a / ctrl+e / ctrl+g, and rendered as footer buttons reachable with Tab, so no chord is required. Install moved off ctrl+i, which most terminals send as Tab. New and Install work with the list filtered to nothing (the create-from-filter flow), and the palette's "Skills" row and a configured `prompt_skills` keybind both open the browser. (#1342, closes #1328)
37+
- **`/skills` opens the Altimate skills browser, and its actions work.** `/skills` used to open the plain core skill selector (two `/skills` rows in autocomplete; Enter took the wrong one), where ctrl+a did nothing because the plugin's global keybind was outranked by the open dialog. The browser's Actions / New / Install are dialog-level actions now — bound inside the dialog to ctrl+a / ctrl+o / ctrl+g (the beta had New on ctrl+e, which is line-end in the filter box; 0.12.2 moved it), and rendered as footer buttons reachable with Tab, so no chord is required. Install moved off ctrl+i, which most terminals send as Tab. New and Install work with the list filtered to nothing (the create-from-filter flow), and the palette's "Skills" row and a configured `prompt_skills` keybind both open the browser. (#1342, closes #1328)
1838
- **`altimate_core_validate` no longer reports a correct query as `ColumnNotFound` against Snowflake metadata.** Warehouse metadata comes back uppercase; the engine compares unquoted identifiers in lowercase and quoted ones exactly. Metadata names are now folded to the engine's form, and quoted all-uppercase references in the SQL (dbt `quote_columns` style) are folded to meet them — only for names the schema actually holds, so a `"SHIPPED"` string literal is untouched. The same preparation applies to every operation that matches SQL against a schema (lint, explain, check, fix, rewrite, equivalence, lineage, and the `sql.*` handlers), generated SQL comes back in the caller's spelling, and a schema file in JSON/YAML is treated like an inline context. Without a schema — or with one that defines no tables — existence checks are skipped as the tool promises, instead of reporting every table missing or failing the call. Known limitation: the fold is dialect-blind; on a lowercase-folding warehouse an all-uppercase quoted-created identifier would be treated as unquoted. (#1343, closes #1333)
1939
- **"Remember this for the team" lands where teammates read it, and a one-shot `run` no longer loses the upload.** In a linked project the model reached for the engine's `datamate_*` memory store, which linked checkouts never read; the `## Altimate Workspace` section now names `altimate_memory_write` as the team's store once the workspace's memory is confirmed enabled (and not while the link is only "last known"), and the tool description says the same. `run` waits — bounded — for pending memory mirrors and archives before exiting, on a normal exit and, briefly, on Ctrl-C. Pilot only (`ALTIMATE_WORKSPACE=1`). (#1344, closes #1332)
2040
- **A headless `run` always ends with an answer.** When a tool call failed or was auto-rejected (nobody can approve in headless use) and the model stopped without text — or streamed a "Let me check…" preamble, called a tool, and then stopped — the process printed nothing and exited 0. `run` now asks for a reply once, naming the failed tool; if the model still says nothing, a synthesised line says so on stdout, in `--output` and as a `silent_turn` event in `--format json`, and the run exits 1. Tool diagnostics are not repeated into the follow-up prompt or the answer file. A follow-up that dies in transport reports the error instead of only an exit code. (#1345, closes #1334)
21-
- **FinOps tools in a linked project point at the workspace engine instead of failing bare.** `finops_warehouse_advice`, `finops_analyze_credits`, `finops_query_history`, `finops_expensive_queries` and the role tools resolve only local connections; in a project whose Snowflake connection lives in the workspace they failed four times before the model thought of the engine. The failure now says why and names the engine tool with the tables the operation reads (region-qualified for BigQuery), re-validated against the current link; in the end-to-end run the model pivoted after one failure. When the routing decision is unknown the failure says that too. Running the FinOps SQL through the engine itself is not in this release. (#1346, closes #1336)
41+
- **FinOps tools in a linked project point at the workspace engine instead of failing bare.** `finops_warehouse_advice`, `finops_analyze_credits`, `finops_query_history`, `finops_expensive_queries` and the role tools resolve only local connections; in a project whose Snowflake connection lives in the workspace they failed four times before the model thought of the engine. The failure now says why and names the engine tool with the tables the operation reads (region-qualified for BigQuery), re-validated against the current link; in the end-to-end run the model pivoted after one failure. When the routing decision is unknown the failure says that too. Pilot only (`ALTIMATE_WORKSPACE=1`): outside the pilot the failure text is unchanged. Running the FinOps SQL through the engine itself is not in this release. (#1346, closes #1336)
2242

2343
## [0.12.1] - 2026-09-21
2444

‎docs/docs/configure/skills.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -211,12 +211,12 @@ Open the skill browser by typing `/skills` in the prompt (or `<leader>k`):
211211
|-----|--------|
212212
| Enter | Use — inserts `/<skill-name>` into the prompt |
213213
| `ctrl+a` | Actions — show, edit, test, remove, or publish the selected skill to the linked workspace (the publish row appears only with `ALTIMATE_WORKSPACE=1`) |
214-
| `ctrl+e` | New — scaffold a new skill + CLI tool (`ctrl+n` moves down the list, as in every dialog) |
214+
| `ctrl+o` | New — scaffold a new skill + CLI tool (`ctrl+n` moves down the list and `ctrl+e` is line-end in the filter box, as in every dialog) |
215215
| `ctrl+g` | Install a skill from a GitHub repo, URL, or local path (`ctrl+i` is Tab in most terminals, so it cannot be the chord) |
216216
| Tab / Shift+Tab | Move between the **Actions · New · Install** buttons in the footer, then Enter — the same three without a chord |
217217
| Esc | Back — returns to previous screen |
218218

219-
**Create skill** (`ctrl+e`, or the **New** footer button):
219+
**Create skill** (`ctrl+o`, or the **New** footer button):
220220

221221
![Create Skill Dialog](../assets/images/skills/tui-skill-create.png)
222222

‎packages/opencode/src/altimate/native/schema-resolver.ts‎

Lines changed: 70 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -169,15 +169,47 @@ export function foldQuotedIdentifierCase(sql: string, names?: ReadonlySet<string
169169
)
170170
}
171171

172-
/** Every folded table key and column name in a definition, plus each dotted segment
173-
* of a table key, so `"DB"."SCHEMA"."ORDERS"` can meet a `db.schema.orders` key. */
174-
function schemaNames(def: { tables: Record<string, any> }): Set<string> {
172+
/** The names the schema fold actually changed — every table key and column name that
173+
* `foldSchemaCase` stored differently from how the caller wrote it, in folded form,
174+
* plus each dotted segment of a folded table key (so `"DB"."SCHEMA"."ORDERS"` can meet
175+
* `db.schema.orders`; a column name's dots are not qualifiers). Only these may be folded
176+
* in the SQL: a quoted `"SHIPPED_DATE"` against metadata that holds `shipped_date` as
177+
* written is, on a lowercase-folding warehouse, a reference to a different, quoted
178+
* identifier, and folding it would validate a query Postgres rejects.
179+
*
180+
* Two exclusions keep the set honest without parsing the SQL (which table a column
181+
* reference belongs to is not known here): a name the fold kept as written because its
182+
* folded form already existed in the same table (`ORDERS` beside `orders`, `ID` beside
183+
* `id`) is not folded in the SQL, so `"ORDERS"` cannot be bound to the sibling object;
184+
* and a column name that ANY table holds as written in lowercase is not folded either —
185+
* with `a.id` never folded and `b.ID` folded, `"ID"` against `a` would otherwise be
186+
* rewritten on the strength of a column in an unrelated table. The cost is a quoted
187+
* `"ID"` against `b` staying as written (reported missing, the pre-fold behaviour); the
188+
* alternative validated a query Postgres rejects. */
189+
function foldedNames(original: { tables: Record<string, any> }, folded: { tables: Record<string, any> }): Set<string> {
175190
const names = new Set<string>()
176-
for (const [table, value] of Object.entries(def.tables ?? {})) {
177-
names.add(table)
178-
for (const segment of table.split(".")) names.add(segment)
179-
if (Array.isArray(value?.columns)) for (const c of value.columns) if (typeof c?.name === "string") names.add(c.name)
191+
const heldAsWritten = new Set<string>()
192+
const candidates = new Set<string>()
193+
for (const [table, value] of Object.entries(original.tables ?? {})) {
194+
const key = foldIdentifierCase(table)
195+
if (key !== table && Object.hasOwn(folded.tables, key) && !Object.hasOwn(folded.tables, table)) {
196+
names.add(key)
197+
for (const segment of key.split(".")) names.add(segment)
198+
}
199+
const stored = folded.tables[Object.hasOwn(folded.tables, table) ? table : key]
200+
const storedNames = new Set<string>(
201+
Array.isArray(stored?.columns) ? stored.columns.map((c: any) => c?.name).filter((n: unknown) => typeof n === "string") : [],
202+
)
203+
if (Array.isArray(value?.columns)) {
204+
for (const c of value.columns) {
205+
if (typeof c?.name !== "string") continue
206+
const column = foldIdentifierCase(c.name)
207+
if (column === c.name) heldAsWritten.add(c.name)
208+
else if (storedNames.has(column) && !storedNames.has(c.name)) candidates.add(column)
209+
}
210+
}
180211
}
212+
for (const column of candidates) if (!heldAsWritten.has(column)) names.add(column)
181213
return names
182214
}
183215

@@ -259,21 +291,22 @@ export interface PreparedSql {
259291
export function prepareSql(sql: string, schemaPath?: string, schemaContext?: Record<string, any>): PreparedSql {
260292
const asIs = (other: string) => other
261293
const identity = <T>(value: T) => value
262-
const folding = (def: { tables: Record<string, any> }, schema: Schema): PreparedSql => {
263-
const names = schemaNames(def)
294+
const folding = (original: { tables: Record<string, any> }, def: { tables: Record<string, any> }, schema: Schema): PreparedSql => {
295+
const names = foldedNames(original, def)
264296
const folded = new Set<string>()
265297
const foldSql = (other: string) => foldQuotedIdentifierCase(other, names, folded)
266298
return { sql: foldSql(sql), schema, hasSchema: true, foldSql, unfold: (value) => unfoldValue(value, folded) }
267299
}
268300
if (schemaPath) {
269301
const loaded = loadSchemaFile(schemaPath)
270-
if (loaded.folded && loaded.schema) return folding(loaded.folded, loaded.schema)
302+
if (loaded.original && loaded.folded && loaded.schema) return folding(loaded.original, loaded.folded, loaded.schema)
271303
if (!loaded.schema) return { sql, schema: EMPTY_SCHEMA(), hasSchema: false, foldSql: asIs, unfold: identity }
272304
return { sql, schema: loaded.schema, hasSchema: true, foldSql: asIs, unfold: identity }
273305
}
274306
if (schemaProvided(undefined, schemaContext)) {
275-
const def = normalizedSchemaDefinition(schemaContext!, { fold: true })
276-
return folding(def, Schema.fromJson(JSON.stringify(def)))
307+
const original = normalizedSchemaDefinition(schemaContext!)
308+
const def = foldSchemaCase(original)
309+
return folding(original, def, Schema.fromJson(JSON.stringify(def)))
277310
}
278311
return { sql, schema: EMPTY_SCHEMA(), hasSchema: false, foldSql: asIs, unfold: identity }
279312
}
@@ -293,29 +326,39 @@ function unfoldValue<T>(value: T, folded: ReadonlySet<string>): T {
293326
/** Quoted tokens (`"…"` or `` `…` ``) whose content is one this preparation folded go
294327
* back to uppercase — the spelling the caller wrote, since the fold only ever took an
295328
* all-uppercase name down. A lowercase quoted name the caller wrote themselves was
296-
* never recorded and is left alone. */
329+
* never recorded and is left alone. The same spans the fold steps over (string
330+
* literals, dollar strings, comments) are stepped over here too, so a literal whose
331+
* value happens to read like a folded identifier is not changed. */
297332
function unfoldText(text: string, folded: ReadonlySet<string>): string {
298-
return text.replace(/"([^"]*)"|`([^`]*)`/g, (match, dq?: string, bq?: string) => {
299-
const quoted = dq ?? bq
300-
if (quoted === undefined || !folded.has(quoted)) return match
301-
const mark = match[0]
302-
return `${mark}${quoted.toUpperCase()}${mark}`
303-
})
333+
return text.replace(
334+
/(?<![A-Za-z0-9_$])\$([A-Za-z_][A-Za-z0-9_]*)?\$[\s\S]*?\$\1\$|[eE]'(?:[^'\\]|\\[\s\S]|'')*'|'(?:[^']|'')*'|--[^\n]*|\/\*[\s\S]*?\*\/|"((?:[^"]|"")*)"|`((?:[^`]|``)*)`/g,
335+
(match, _tag, dq?: string, bq?: string) => {
336+
const quoted = dq ?? bq
337+
if (quoted === undefined || !folded.has(quoted)) return match
338+
const mark = match[0]
339+
return `${mark}${quoted.toUpperCase()}${mark}`
340+
},
341+
)
304342
}
305343

306-
/** `folded` carries the folded definition when the file was normalised here; no
307-
* `schema` at all means the file parsed to zero tables — no schema, not an error
308-
* (the engine would refuse an empty definition outright). An unreadable or
309-
* malformed file still throws. */
310-
function loadSchemaFile(schemaPath: string): { schema?: Schema; folded?: { tables: Record<string, any> } } {
344+
/** `original` and `folded` carry the normalised definition, as written and as stored,
345+
* when the file was normalised here; no `schema` at all means the
346+
* file parsed to zero tables — no schema, not an error (the engine would refuse an
347+
* empty definition outright). An unreadable or malformed file still throws. */
348+
function loadSchemaFile(schemaPath: string): {
349+
schema?: Schema
350+
original?: { tables: Record<string, any> }
351+
folded?: { tables: Record<string, any> }
352+
} {
311353
const ext = path.extname(schemaPath).toLowerCase()
312354
if (ext === ".json" || ext === ".yaml" || ext === ".yml") {
313355
const text = fs.readFileSync(schemaPath, "utf8")
314356
const parsed = ext === ".json" ? JSON.parse(text) : YAML.parse(text)
315357
if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) {
316-
const folded = normalizedSchemaDefinition(parsed, { fold: true })
317-
if (Object.keys(folded.tables).length === 0) return {}
318-
return { schema: Schema.fromJson(JSON.stringify(folded)), folded }
358+
const original = normalizedSchemaDefinition(parsed)
359+
if (Object.keys(original.tables).length === 0) return {}
360+
const folded = foldSchemaCase(original)
361+
return { schema: Schema.fromJson(JSON.stringify(folded)), original, folded }
319362
}
320363
}
321364
return { schema: Schema.fromFile(schemaPath) }

0 commit comments

Comments
 (0)