Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
15 commits
Select commit Hold shift + click to select a range
dd02dbb
fix: /clear keeps comments and health, plugin dbt runs keep the proje…
hkaltai Nov 19, 2026
82cff5a
fix: review round 1 — replays drop --target-path, health parses in it…
hkaltai Nov 19, 2026
782a979
Merge remote-tracking branch 'origin/main' into fix/plugin-demo-bugs
hkaltai Nov 19, 2026
bddefe5
fix: review round 2 — check manifest read inside the dbt queue, /clea…
hkaltai Nov 19, 2026
e83245a
fix: review round 3 — callers wait for a running /clear restore, cove…
hkaltai Nov 19, 2026
0e64040
fix: review round 4 — the /clear restore counts inside the push gate'…
hkaltai Nov 19, 2026
c2ceebb
fix: only the integrations and altimate-code status parts are kept ac…
hkaltai Nov 19, 2026
d83f1a9
fix: review round 5 — a /clear while the previous restore is writing …
hkaltai Nov 19, 2026
5b0d7d2
test: /clear drops a feature's status part whose state it empties
hkaltai Nov 19, 2026
47187ac
fix: review round 6 — a caller that joins a running /clear restore ru…
hkaltai Nov 19, 2026
4c8f2fe
fix: review round 7 — the first read after /clear waits for the new c…
hkaltai Nov 19, 2026
73a117b
fix: review round 8 — one health CLI call at a time across /clear; a …
hkaltai Nov 19, 2026
d50a1eb
fix: review round 9 — health CLI calls take a queue place before any …
hkaltai Nov 19, 2026
4c6f857
fix: review round 10 — the flags line is told only when the command t…
hkaltai Nov 19, 2026
a09a411
Merge remote-tracking branch 'origin/main' into fix/plugin-demo-bugs
hkaltai Nov 20, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions plugins/altimate-code/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,17 @@

All notable changes to this plugin will be documented in this file.

## [Unreleased]

### Fixed
- After `/clear`, the new conversation loads the team comments again (the band, and the threads Claude gets when it reads a commented model) instead of waiting for `/comments` or the next poll, and project health keeps its baseline, the changes not yet checked and the issues found (`/health` no longer says the session has no project; a check the `/clear` cut short runs again). The status line keeps the integrations and altimate-code parts; health draws its own again.
- The dbt runs the plugin starts by itself (compile and validate's `dbt show` and `dbt ls`, `/dbt-show` and Re-run, and the project health check's parse) write their artifacts to `target/.altimate-plugin/` instead of `target/`, so they no longer replace the project's `manifest.json` (with every model's compiled SQL) or `run_results.json`. The health check runs its CLI call in its own process for that, with the project's `catalog.json` copied beside its manifest. The doctor's **Run dbt parse** still refreshes the project's own manifest.
- After Claude edits a model's SQL that dbt has not compiled since, its documentation coverage says it is from before the edit, and once the edit's compile-and-validate check has run the model, `/propagate` shows the coverage of the model as it is now.
- The end-of-task summary for a model the task created says its columns are new with an unknown reach, not "update altimate-code".
- When the Query results or lineage pane sits above the prompt (a terminal under 110 columns, or not fullscreen), Claude Code gives it the same height whatever size it asks for, so the Min / Default / Max row, which did nothing there, is replaced by a line saying so.
- `--defer --state …`, `--favor-state` and `--target …` that `/defer` and `/target` add to Claude's dbt commands are no longer invisible: Claude's result says what the command ran as, and a line above the prompt shows it until the next prompt.
- **Resolve** on a thread the lagging comment list still shows after it was resolved elsewhere is done (the thread is hidden) instead of answering "not an open thread"; a reply to such a thread says it is no longer open and reads the list again.

## [1.8.3] — 2026-11-19

### Fixed
Expand Down
10 changes: 6 additions & 4 deletions plugins/altimate-code/hooks/altimate-cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ export const NOT_FOUND = /ENOENT|not found|no such file/i
export const MISSING_BINARY = new RegExp(`${NOT_FOUND.source}|(cannot|could not|failed to) (start|spawn|run)`, 'i')

/** Runs the altimate CLI under the first name that is installed; 90 s unless the caller says otherwise. */
export async function runAltimate($: EngineInterface, args: string[], timeoutMs = 90_000) {
export async function runAltimate($: EngineInterface, args: string[], timeoutMs = 90_000, env?: Record<string, string>) {
let lastError: unknown = null
for (const bin of CLI_NAMES) {
try {
return await $.process.run([bin, ...args], { timeoutMs })
return await $.process.run([bin, ...args], { timeoutMs, ...(env && { env }) })
} catch (error) {
if (!MISSING_BINARY.test(String(error))) throw error
lastError = error
Expand Down Expand Up @@ -191,6 +191,8 @@ export type RunToolOptions = {
* item 4), as the skill does before it adds `--allow-write`.
*/
write?: boolean
/** Variables set for the CLI process (CLI route only, so a call that sets them never goes over MCP). */
env?: Record<string, string>
}

/**
Expand All @@ -201,7 +203,7 @@ export type RunToolOptions = {
*/
export async function runTool($: EngineInterface, name: string, args: Record<string, unknown>, options: RunToolOptions = {}) {
const { until, write = false } = options
const cliOnly = options.cliOnly === true || write
const cliOnly = options.cliOnly === true || write || options.env !== undefined
// With a deadline, nothing starts once it has passed, and the CLI is stopped at it.
const left = async () => {
const ms = until === undefined ? TOOL_TIMEOUT_MS : until - (await $.clock.now())
Expand Down Expand Up @@ -241,7 +243,7 @@ export async function runTool($: EngineInterface, name: string, args: Record<str
}
}
const argv = ['tool', 'run', name, '--args', JSON.stringify(args), '--json', ...(write ? ['--allow-write'] : [])]
const result = await runAltimate($, argv, await left())
const result = await runAltimate($, argv, await left(), options.env)
if ((result as { isStdoutTruncated?: boolean }).isStdoutTruncated) {
return { metadata: null as any, text: `${name}'s answer was larger than the 4 MiB a plugin can read`, ok: false }
}
Expand Down
45 changes: 45 additions & 0 deletions plugins/altimate-code/hooks/clear-state.testkit.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
// For tests: the engine's /clear, which the test kit does not play. A /clear ends the conversation and the next
// one runs under a new session id, so every `$.state` value reads as never written until it is written again,
// and no `session.start` comes.

type Address = { plugin: string; key: string; id?: string }

/**
* Registers the state and session id hooks (before the test's first call on `$`); the function it returns plays
* the /clear: the session's end, then the new id with its empty state. `holdWriteOf` holds the new conversation's
* first write of one value until released; `idLagsUntil` keeps the old id readable until it settles.
*/
export function playsClear($: any, on: any, options: { holdWriteOf?: { key: string; until: Promise<void> }; idLagsUntil?: Promise<void> } = {}): () => Promise<void> {
let cleared = false
let held = false
const written = new Set<string>()
const name = (e: Address) => `${e.plugin}\u0000${e.key}\u0000${e.id ?? ''}`
// A $-call's hook answers `{ value }`: here the value is the read, `{ value, version }`. The version stays, so a write still lands.
on('state.get', async (_: unknown, e: Address, next: (e: Address) => Promise<{ value?: { value: unknown; version: number } }>) => {
const stored = await next(e)
return cleared && !written.has(name(e)) && stored.value ? { ...stored, value: { ...stored.value, value: undefined } } : stored
})
on('state.set', async (_: unknown, e: Address, next: (e: Address) => Promise<unknown>) => {
const asked = clears
// The new conversation's first write of that value waits, so a test can act while it is under way.
if (cleared && !held && options.holdWriteOf?.key === e.key) {
held = true
await options.holdWriteOf.until
}
const done = await next(e)
// Read as written only once it is, and only in the conversation it was written in.
if (cleared && asked === clears) written.add(name(e))
return done
})
let clears = 0
// The engine's id read can lag the /clear: until `idLagsUntil` settles it still names the session that ended.
let lagging = !!options.idLagsUntil
options.idLagsUntil?.then(() => (lagging = false))
on('session.id', () => ({ value: `session-${lagging ? Math.max(0, clears - 1) : clears}` }))
return async () => {
await $.session.end({ reason: 'clear', sessionId: `session-${clears}` })
clears++
cleared = true
written.clear()
}
}
91 changes: 88 additions & 3 deletions plugins/altimate-code/hooks/comments.test.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { expect, mock, test } from 'claude-code/testing'

import { playsClear } from './clear-state.testkit'
import { PHASE_TIMEOUT_MS } from './tool-chain'
import { FIRST_READ_WAIT_MS, contextBlock, groupByModel, placeThread, projectName, readOptions, sameText, relativePath, threadsOnFile, toThread } from './features/comments'

Expand Down Expand Up @@ -795,14 +796,98 @@ test('a folder without a project of its own is looked up again from another proj
expect(cli.filter(c => c.args.action === 'list').map(c => c.args.project)).toEqual(['jaffle_shop', 'other_shop', 'jaffle_shop', 'other_shop'])
})

test('a post to a thread a teammate already resolved says nothing was sent and does not lock the other threads', async ($, on) => {
const { clock, cli } = await start($, on, { failPost: true, failPostCode: 'unknown_thread' })
test('resolving a thread a teammate already resolved, which the lagging list still shows, is done: it leaves the pane and the list is read again', async ($, on) => {
const second = { ...RAW, group_id: 12, file_path: 'models/customers.sql' }
const { clock, cli } = await start($, on, { failPost: true, failPostCode: 'unknown_thread', threads: [RAW, second] })
const ui = await $.ui.mount({ ...PANE, surface: 'terminal' })
await clock.settle()
await ui.press({ key: '7:11-resolve' })
for (let i = 0; i < 3; i++) await clock.settle()
await ui.press({ key: '7:11-resolve' })
expect(await ui.find({ type: 'Text', text: /Already resolved: the list was behind/ })).toBeDefined()
expect(await ui.find({ type: 'Button', key: '7:11-resolve' })).toBeUndefined()
expect(await ui.find({ type: 'Text', text: /Thread 11 is not an open thread/ })).toBeUndefined()
expect(cli.filter(c => c.args.action === 'list')).toHaveLength(2)
// The other thread is not locked.
await ui.press({ key: '7:12-resolve' })
for (let i = 0; i < 3; i++) await clock.settle()
expect(cli.filter(c => c.args.action === 'resolve')).toHaveLength(2)
await ui.unmount()
})

test('a reply to a thread that is no longer open says so plainly and reads the list again', async ($, on) => {
const { clock, cli } = await start($, on, { failPost: true, failPostCode: 'unknown_thread' })
const ui = await $.ui.mount({ ...PANE, surface: 'terminal' })
await clock.settle()
await ui.input({ key: '7:11-reply', text: 'Yes' })
for (let i = 0; i < 3; i++) await clock.settle()
expect(cli.filter(c => c.args.action === 'reply')).toHaveLength(1)
expect(await ui.find({ type: 'Text', text: /That thread is no longer open \(it was resolved, or the list was behind\): nothing was sent/ })).toBeDefined()
expect(cli.filter(c => c.args.action === 'list')).toHaveLength(2)
await ui.unmount()
})

test('after /clear the new conversation loads the threads again: the pane lists them and a read of the model gets them', async ($, on) => {
const clear = playsClear($, on)
const { clock, cli } = await start($, on)
await clear()
await clock.settle()
expect(cli.filter(c => c.args.action === 'list')).toHaveLength(2)
const ui = await $.ui.mount({ ...PANE, surface: 'terminal' })
expect(await ui.find({ type: 'Text', text: 'models/orders.sql' })).toBeDefined()
await ui.unmount()
const result: any = await $.tool.call({ tool: 'Read', file_path: FILE })
expect(result.context?.[0]).toContain('Grace Hopper: No, gross.')
})

test('after /clear the first read of a model waits for the new conversation\'s list, as a session\'s first read does', async ($, on) => {
const clear = playsClear($, on)
let release!: () => void
const held = new Promise<void>(resolve => (release = resolve))
const { clock } = await start($, on, { holdListCall: { n: 1, until: held } })
await clear()
const reading = $.tool.call({ tool: 'Read', file_path: FILE })
await clock.advance(10)
release()
await clock.advance(10)
const result: any = await reading
expect(result.context?.[0]).toContain('line 3, model, on “sum(amount)”')
})

test('a read right after /clear, before the new conversation\'s comments are loaded, waits for them even when the last conversation spent its first-read wait', async ($, on) => {
let newId!: () => void
const clear = playsClear($, on, { idLagsUntil: new Promise<void>(resolve => (newId = resolve)) })
let first!: () => void
let second!: () => void
const holdLists = { 0: new Promise<void>(resolve => (first = resolve)), 1: new Promise<void>(resolve => (second = resolve)) }
const { clock } = await start($, on, { settle: false, holdLists })
// The last conversation's first read comes before its list: it spends its wait.
const early = $.tool.call({ tool: 'Read', file_path: FILE })
await clock.advance(FIRST_READ_WAIT_MS + 10)
await early
first()
await clock.settle()
await clear()
// No settling: the read comes before the session id watcher has seen the new id.
const reading = $.tool.call({ tool: 'Read', file_path: FILE })
await clock.advance(10)
second()
await clock.advance(10)
const result: any = await reading
newId()
expect(result.context?.[0]).toContain('Grace Hopper: No, gross.')
})

test('a read of another project right after /clear, before the new conversation\'s comments are loaded, keeps that project', async ($, on) => {
let newId!: () => void
const clear = playsClear($, on, { idLagsUntil: new Promise<void>(resolve => (newId = resolve)) })
const other = '/other'
const { clock, cli } = await start($, on, { otherProject: other, files: { [FILE]: SQL, [`${other}/models/orders.sql`]: SQL } })
await clear()
await $.tool.call({ tool: 'Read', file_path: `${other}/models/orders.sql` })
newId()
await clock.settle()
const ui = await $.ui.mount({ ...PANE, surface: 'terminal' })
expect(await ui.find({ type: 'Text', text: /Team comments · other_shop/ })).toBeDefined()
await ui.unmount()
expect(cli.filter(c => c.args.action === 'list').at(-1)?.args.project).toBe('other_shop')
})
15 changes: 13 additions & 2 deletions plugins/altimate-code/hooks/dbt-mods-core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -250,8 +250,9 @@ const CONTEXT_FLAGS: Record<string, string> = { '--target': '--target', '-t': '-
const SELECT_FLAGS: Record<string, string> = { '--select': '--select', '-s': '--select', '--models': '--select', '-m': '--select', '--exclude': '--exclude', '--selector': '--selector' }
// Flags that change how dbt reports or how fast it runs, never what it runs.
const DISPLAY_FLAGS = new Set(['--log-format', '--log-format-file', '--log-level', '--log-level-file', '--log-path', '--quiet', '-q', '--debug', '-d', '--no-print', '--print', '--use-colors', '--no-use-colors', '--printer-width', '--threads', '--no-version-check', '--version-check', '--write-json', '--no-write-json', '--send-anonymous-usage-stats', '--no-send-anonymous-usage-stats', '--log-cache-events', '--record-timing-info'])
// Flags a re-run of Claude's dbt show replaces: the pane reads JSON, and keeps the limit itself.
const OUTPUT_FLAGS = new Set(['--output', '-o', '--log-format', '--limit', '--log-level'])
// Flags a re-run of Claude's dbt show replaces: the pane reads JSON, and keeps the limit itself. Its artifact
// folder is the plugin's own (SCRATCH_TARGET), so a folder Claude named is dropped too.
const OUTPUT_FLAGS = new Set(['--output', '-o', '--log-format', '--limit', '--log-level', '--target-path'])
const BARE_OUTPUT_FLAGS = new Set(['--quiet', '-q'])

/** The last value given to `--flag value` or `--flag=value` in an argv; null when none, or when it holds an expansion the shell would make. */
Expand Down Expand Up @@ -472,6 +473,16 @@ export function targetPath(yml: string): string {
return value && !value.includes('{{') ? value : 'target'
}

/**
* The folder, inside the project's artifact folder, where the dbt runs the plugin starts by itself (a check's
* `dbt show`, a health check's parse) write their artifacts. dbt rewrites manifest.json on every run with the
* compiled SQL of only the nodes that run compiled: in the project's own folder that would drop every other
* model's compiled SQL (and replace run_results.json), so those runs go here and are read from here.
*/
export const SCRATCH_TARGET = '.altimate-plugin'
/** The health check's own folder inside SCRATCH_TARGET: its parse runs outside the plugin's dbt queue, so it never writes the manifest a check is reading. */
export const HEALTH_SCRATCH = 'health'

/**
* The folders a project's files live in, from dbt_project.yml: its model, seed, snapshot, macro, test
* and analysis paths (dbt's defaults when a key is absent). `''` is the project folder itself.
Expand Down
Loading
Loading