Skip to content

feat: /savings, a Databricks savings check beside the chat (1.9.0) - #35

Open
shreyastelkar wants to merge 104 commits into
mainfrom
feat/savings-via-altimate-code
Open

shreyastelkar wants to merge 104 commits into
mainfrom
feat/savings-via-altimate-code

Conversation

@shreyastelkar

@shreyastelkar shreyastelkar commented Nov 18, 2026 •

Copy link
Copy Markdown

Summary (for people)

Why: this gives a Databricks user a reason to try Altimate from inside Claude Code. It shows what their workspace could save, on their own machine, with nothing sent to Altimate.

Before → after:

  • Before (plugin 1.8.2, current main): /savings is not a command. Claude Code answers "No commands match /savings".
  • After (plugin 1.9.0): /savings [connection] runs altimate-code's finops_databricks_savings tool and opens a pane beside the chat with each finding, its evidence, a monthly range at list price and a Draft the fix button.

Who is affected: only people who type /savings. It needs an altimate-code release that has the tool and assessment mode (see Depends on). With an older CLI the pane says to update, and nothing runs on the warehouse.

Also changed for everyone with the plugin: the shell reader the git push check uses moves unchanged to its own module, hooks/shell.ts, so /savings can share it. The push check still reads a shell's -c script exactly as on main.

Not tracked: main now sends anonymous plugin usage events, one per session start and one each time a panel or command opens. /savings sends none: neither the command, its buttons nor its pane is counted, so its "Nothing was sent to Altimate" line stays exactly true. README and PRIVACY say so.

Details (for agents/reviewers)

What the pane does

  • The result. Each finding shows what it rests on, and a monthly range at list price. The total counts each resource once.
  • Every workspace. One connection covers every workspace the account's system tables show. The pane counts every workspace the CLI read facts from, through its workspaces_checked field: a workspace with only clusters or jobs and no finding counts too. It names each finding's workspace when there are several. With a CLI that does not report the count, it counts the workspaces of the warehouses and findings.
  • Draft the fix. Each finding has a button that puts the change in the prompt box: serverless, a smaller cluster_size, auto-termination, or a job cluster. The request asks Claude to edit the repository's bundle or Terraform. If there is none, Claude writes the JSON for a CLI command that changes only that setting: warehouses edit, clusters update with an update mask, or jobs update. Nothing is sent until the user presses Enter, and nothing is applied.
  • What if. For each flagged warehouse, the user can press serverless or any smaller size. The pane shows its monthly cost and whether its cores still cover what its queries need. A choice that would cost more says so. A pressed choice is kept with its workspace and warehouse id, so one id in two workspaces opens only the row pressed, and with several workspaces each heading names its own.
  • Spend since a change. The first run that flags a warehouse remembers its size and cost on this machine, in $.store, keyed by connection, workspace and warehouse id, with the length of the window its cost covers. A later run that finds it resized shows its observed spend a month before and after the change. The two amounts are billed in different weeks, so one note under the lines says a change in workload moves them too, and the pane never calls the difference saved. Across several workspaces, each line names its workspace, and a warehouse without a workspace id is not compared. The baseline is one run's read of each setting the CLI lists (size, type), each known or unknown, with that run's cost and date. A later run that reads every setting it knew, finds none changed and reads one more replaces it whole, so a setting is never paired with another week's spend. Only a setting read both times can have changed, and the line names only those. A warehouse row without a cost draws no line.
  • At the right moment. A line appears above the prompt when the session edits a Databricks bundle or Terraform file, or runs a databricks warehouses, clusters, bundle or jobs command. The Bash line is read with the shell reader the push check uses (hooks/shell.ts). Quoted text, comments and heredoc bodies are data, a shell's -c script is read, and the program is found past the same leaders (sudo -u x, nice -n 10, assignments) and past xargs with its options. So a line that only names the CLI (echo databricks bundle deploy, a commit message, a heredoc that writes a script) offers nothing. A Terraform file that is not Databricks config offers nothing either. It names the flagged resource's saving if the file mentions it, with its workspace when several were read. A name flagged in several workspaces is not pinned on one of them (the file does not say which it deploys to), and after a run that failed the line quotes no finding. Otherwise it offers /savings once a session.
  • What it does not check is named. When a check could not run, the pane names it with the reason: a refused read, the time limit, or core refusing its facts. When none could run, it says nothing was checked, not that nothing was found. A figure the answer lacks reads "?", never "NaN", "undefined" or 0. A null core sends reads as core means it: a cluster with no auto-termination setting reads "off", and a warehouse with no size leaves the size out. A total missing its amounts still lists its findings, and a finding without a title reads "Savings opportunity".
  • When it fails, it says why. A missing connection, an altimate-code too old for the tool, a source or preview build, a version that cannot be read, and a refused query each get their own message and recovery step, also shown as a notice.

Cost

/savings runs three queries on the connection's SQL warehouse, which Databricks starts if it is stopped and bills while it runs. The command says so. The tool refuses to run without confirm: true, and the plugin passes it only when the person ran the command. A plugin, the SDK or a schedule gets a refusal and no run. The CLI stops its own check after nine minutes and cancels any query still on the warehouse.

Privacy

The tool runs with ALTIMATE_TELEMETRY_DISABLED=true, ALTIMATE_ASSESSMENT_MODE=true and --no-daemon, always through the CLI (the MCP server would drop both). Assessment mode (AltimateAI/altimate-code#1762) also stops the CLI's own startup contacts: the one-time telemetry opt-out event, the model catalog and the ripgrep download. The warehouse is then the only host the run reaches. A reused tool daemon would not see the opt-out, which is why the run uses --no-daemon. The plugin adds no usage event for /savings, and its skill tells Claude to ask the user to type /savings rather than call the tool itself, so the tool is not run through a path without these switches. The findings stay in the pane until the user sends a Draft the fix request. PRIVACY.md has a section for the check, a line under Plugin usage events saying /savings sends none, and a change-log entry.

Merge with main

main is merged in up to 1.8.3 and its unreleased fixes, keeping its content and versions: the dbt helpers, the plugin usage events and the /clear and health fixes. /savings ships as 1.9.0 on top, and the changelog keeps main's Unreleased section above it. The savings feature runs before the dbt helpers in every phase, each in its own try.

The shell reader (simpleCommands, leaderEnd and their helpers) moves from hooks/features/health.tsx to hooks/shell.ts, taken from main's latest version. health.tsx now differs from main only by importing it from there, so the push check and its written-files reader keep main's -c rule (any -c after the shell). One new helper, shellScript, serves only the /savings offer. It reads the script from the shell's own options (bash -cx, -o pipefail -c, -euo pipefail -c), and any word it does not take for one of them ends the scan, so the line shows no note. That covers a redirection, an option it does not know, and -oc pipefail. A missed note is the safe outcome, and each wider reading drew new mismatches. health.test.tsx passes, with a new case showing the push check still holds bash 2>/dev/null -c 'git push' and zsh --emulate sh -c 'git push'.

Validation (at 31b536a)

  • claude plugin test . in plugins/altimate-code: 1470 of 1470 pass at 31b536a, in two runs in a row. main's dbt artifact-race test in runs.test.tsx now waits for each call's read to begin instead of two 20 ms pauses, which stopped being enough once the suite grew.
  • Core's own answer as a fixture. hooks/features/savings-core.testkit.ts holds what core's compiled savings binding returned for synthetic facts: every Databricks finding kind, a cluster with no auto-termination setting and a warehouse with no size (core sends null for both), and what-if rows for one warehouse id in two workspaces. A test draws it and finds no "?", "undefined" or "NaN" in the pane, the fix drafts, each what-if, the notices or the band. Every evidence and report field the plugin reads matches core's types.
  • Kept settings: a table over each setting × known or unknown before × known or unknown after × same or different, with the other setting known throughout or read only in that run, asserts what the baseline keeps (the whole new read or the old one, with its date), whether a change line is drawn and its text. A baseline an older version kept with string fields loads with every setting unknown.
  • The other /savings tests use the real --json output of a full run, with ids replaced. They cover the pane, each kind of evidence and fix request, what-if (including one id in two workspaces), the observed spend after a resize (both directions, never "saved", one-sided sizes), the workspace count, the skipped-check note, the band (a name in two workspaces, after a failed run) and the failure messages. hooks/usage.test.tsx asserts /savings sends no usage event. Tests also cover the version probe, the shell-line reader, answers missing a field, per-workspace baselines, /clear at each await point of a run, and a press, a prompt-box fill or a band line that straddles a /clear (none writes into the new conversation; a run starting does not drop them). Each new test was checked to fail with its fix removed. The conversation check inside a write is tested by holding the plugin's state read while a /clear and the new conversation's offer land.
  • bash tests/*.sh: all 8 pass.
  • One check at a time. /savings and the Run buttons start a check from one claim held in the plugin, taken with no await between the decision and the claim, and held until that run ends or a /clear drops it. It used to be decided from the running flag in $.state, which a hook can read as it was when the hook started; three review rounds each found a race from that ("the conversation was cleared" with no /clear, "already running" after the run had ended, and a typed /savings <connection> dropped when a press's run started first). Tests hold the plugin's state reads and writes to land a press, a typed /savings, a run's end and a /clear between each step; each fails with its guard removed.
  • Local review script (fresh Claude reviewer, whole diff from main) after each round of fixes. The last, at 6894cb3, found nothing above P3; every earlier P1 and P2 is fixed. Left as they are: a check dropped by /clear keeps querying its warehouse until it ends (up to 9 minutes), because its CLI process is not stopped; a state write that fails is not reachable in the test kit, so the claim release on that path is checked by reading; and bundle YAML written in flow style or with anchors gets no band line (the band stays quiet rather than guess).
  • claude plugin validate --strict . passes. tsc --noEmit against the generated plugin types shows 5 errors, all in code from main (cost.test.tsx, health.test.tsx, lineage-graph.ts, usage.test.tsx), and none in this PR's code.
  • Real session. A captioned recording (3 min) of an earlier head of this branch in Claude Code, from one clean run, is attached to the internal core PR https://github.com/AltimateAI/altimate-core-internal/pull/785. It covers the first run with no connection, connecting a workspace, the result and what-if, Draft the fix, a six-workspace account and an altimate-code too old for the tool. It was not re-recorded for the later wording changes. Not recorded: Claude writing the change after Draft the fix, and the band above the prompt. Both need a model turn; tests cover the plugin's side.

Depends on

The tool and assessment mode from AltimateAI/altimate-code#1762, in a released altimate-code. That PR also adds the workspaces_checked count. /savings runs altimate --version first, which starts no telemetry. It does not start a CLI older than SAVINGS_MIN_ALTIMATE_CODE (hooks/features/savings.tsx) for the check, and says to update instead. Measured on 0.12.11 against a local telemetry listener: --version sent nothing, while tool run sent the one-time opt-out event.

The constant is 0.12.12 for now, the first version after the latest release. It is a provisional placeholder. Before this PR merges, it is set to the published release that carries the tool and assessment mode, so no release without them passes the check. Until then the PR is held.

🤖 Generated with Claude Code

shreyastelkar and others added 10 commits November 17, 2026 15:25
- `hooks/features/savings.tsx`: `/savings [connection]` runs altimate-code's
  `finops_databricks_savings` tool through `runTool` with
  `ALTIMATE_TELEMETRY_DISABLED=true` and draws the findings, evidence and
  monthly ranges in a pane beside the chat; nothing enters the conversation
- the plugin holds no detector logic: altimate-code measures the facts and
  altimate-core decides the savings
- refusals are explained with the step that fixes them: no altimate-code,
  an altimate-code without the tool, no Databricks connection, a connection
  that is not a SQL warehouse, a refused system-table query
- `runTool`/`runAltimate` take an optional environment for one CLI run
- registered in `features/index.ts` like the other features; README,
  PRIVACY, SKILL tool table, CHANGELOG, version 1.8.0

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…iew fixes

- each finding gets "Draft the fix": it fills the prompt box with the
  change to make (serverless, or the smaller `cluster_size`) for Claude to
  draft against the repo's bundle or Terraform, or as `databricks warehouses
  edit` JSON; nothing is sent until the person presses Enter
- editing a bundle, `resources/*.yml` or Terraform file, or running a
  `databricks` warehouses/clusters/bundle/jobs command, shows a band: the
  flagged warehouse's saving when the file names it, else a once-a-session
  offer of /savings; Run /savings and Hide buttons; nothing runs by itself
- the savings run uses `--no-daemon`: a reused tool daemon keeps the
  environment it started with, so the telemetry opt-out could be lost
- a non-Databricks connection and a warehouse not yet in
  `system.compute.warehouses` get their own recovery steps
- PRIVACY: change-log entry and revision date

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… saved

- reads altimate-code's combined report: idle all-purpose clusters and
  jobs on all-purpose compute beside the two warehouse checks, each with
  its own evidence lines and Draft the fix request (auto-termination, a job
  cluster), and names any check the connection could not read
- what if: each flagged warehouse gets a row of buttons (serverless and every
  smaller size, marked when too small); pressing one says what it would
  cost a month and whether its cores cover what its queries need
- saved since: the first run that flags a warehouse keeps its size, type and
  weekly cost in the local plugin store; a later run that finds it resized
  says what it cost a month then and now
- README, CHANGELOG and PRIVACY describe the four checks and the local store

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…rite

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ength

- No findings with a check skipped says which checks ran, in the pane and the toast.
- Draft the fix with no prompt box says what to ask Claude, instead of pointing at text the
  pane does not show.
- The band offers /savings for any `databricks` warehouses/clusters/bundle/jobs command, also
  after `cd … &&` or an environment assignment; its Run button never starts a second run.
- A finding is named in a file only as a whole word (`dev` is not in `devices`).
- Days come from the report's window, not a fixed seven; the refused-query advice names
  `system.lakeflow`; a query cut at 10,000 rows is named in the pane (view shape bumped).
- Tests for each, including that a second run keeps the first baseline.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…fers

- A what-if choice that costs more than now says how much more, in the warning colour.
- The band offers the check for Terraform only when it names a `databricks_` resource, and names a
  flagged job by its name, not its numeric id.
- The running pane says Databricks starts the SQL warehouse if it is stopped.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- The pane counts the workspaces it read, names each finding's workspace when there are several,
  and the fix request names it.
- A failed run also comes as a notice, for a terminal too narrow for the pane.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…no answer"

- `runTool` hands back the CLI's raw output as `raw` when it is not the answer object.
- /savings reads an old CLI's usage banner as "this altimate-code has no Databricks savings check".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kilo-code-bot

kilo-code-bot Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Incremental review of 6894cb3..31b536a (1 commit, 1 file, 12 insertions / 3 deletions). The only change replaces the two fixed setTimeout(…, 20) pauses in the artifact-race test with promises resolved from duringRead (plugins/altimate-code/hooks/features/runs.test.tsx:859). I verified the synchronization is sound rather than racy: each dbt build call passes through exactly one tool process.run (one artifact folder, readRun in plugins/altimate-code/hooks/features/runs.tsx:438), so reached[0]/reached[1] map deterministically to the first and second calls, and the shared gate still holds both reads open until release(). Other feature reads return before duringRead (runs.test.tsx:75), and start performs no tool read, so no read can consume a slot early. A third read would no-op safely via reading[reads++]?.(); the unbounded counter is harmless after the two awaited reads. The test semantics and all three assertions are unchanged, so the change removes the timing flake without weakening coverage. No correctness, redundancy, or simplification issue was found in the changed lines; no other file was touched, so there was nothing to re-verify from the previous review.

Files Reviewed (1 file)
  • plugins/altimate-code/hooks/features/runs.test.tsx - no issues

Tests were not executed in this read-only review.

Previous Review Summaries (11 snapshots, latest commit 6894cb3)

Current summary above is authoritative. Previous snapshots are kept for context only.

Previous review (commit 6894cb3)

Status: No Issues Found | Recommendation: Merge

Incremental review of f2f9802..6894cb3 (1 commit, 1 file, 15 insertions / 13 deletions). The single commit resolves the previous review's only finding: the claim-release guard now lives in one letGo(mine) helper (plugins/altimate-code/hooks/features/savings.tsx:98), used by runCheck's nested finally (line 740), the command handler's failed busy-flag write (line 843) and pressRun's equivalent (line 1064). The three copies can no longer drift, and the only remaining unconditional claim = null is sessionEnd (line 1015), which intentionally drops any claim. Behavior is unchanged on every path: the catch callbacks still rethrow, so the failure still propagates, and letGo matches by identity, so a claim taken by a later /savings or press is untouched. No other copies of the rule remain, and no new correctness, edge-case or redundancy issue was found in the changed lines.

Files Reviewed (1 file)
  • plugins/altimate-code/hooks/features/savings.tsx - no issues

Tests were not executed in this read-only review.

Previous review (commit f2f9802)

Status: 1 Issue Found | Recommendation: Address before merge

Incremental review of de3e39b..f2f9802 (3 commits, 2 files). The status branch at 824-828 closes the previous finding: it captures the conversation before openPane, returns the "cleared" message when a /clear moved it, and reports "just finished" when the run ended, so the pane is no longer left saying "already running" in a new, empty conversation. Claim release is now robust on the remaining paths too: runCheck's nested try/finally and the command handler's release let the claim go even when the busy-flag write rejects, and pressRun mirrors it. sessionStart keeping a still-held claim's running flag is consistent, because sessionEnd (the only other place claim is dropped) nulls both synchronously, and claim can only be module-fresh on a reload. The only remaining note is duplication of the release guard.

Overview

Severity Count
CRITICAL 0
WARNING 0
SUGGESTION 1
Issue Details (click to expand)

SUGGESTION

File Line Issue
plugins/altimate-code/hooks/features/savings.tsx 1059 The claim-release guard (if (claim === mine) claim = null) now exists in three places: here, in release at 836-839, and in runCheck's finally at 730-734. Hoist one helper so the copies cannot drift.
Files Reviewed (2 files)
  • plugins/altimate-code/hooks/features/savings.tsx - 1 suggestion
  • plugins/altimate-code/hooks/features/savings.test.tsx - none

Tests were not executed in this read-only review.

Fix these issues in Kilo Cloud

Previous review (commit de3e39b)

Status: 1 Issue Found | Recommendation: Address before merge

Incremental review of bf27d26..de3e39b (5 commits, 2 files). The module-level claim closes the previous finding: it is set synchronously before any await in both the command and the press path, so a stale in-process read can neither start a second check nor adopt a press's run, and runCheck's early guard plus the finally ordering keep a dropped run from clearing a newer claim or its running flag (live() is false exactly when the claim moved, so the two can never disagree). The remaining gap is the status branch, which still awaits openPane after reading the claim. The .tf block-comment rule is now stated in the doc at 111-112, so the earlier carried note is a documented tradeoff rather than a new finding and is not carried.

Overview

Severity Count
CRITICAL 0
WARNING 0
SUGGESTION 1
Issue Details (click to expand)

SUGGESTION

File Line Issue
plugins/altimate-code/hooks/features/savings.tsx 818 The "already running" branch reads claim before awaiting openPane, but never re-checks it. A /clear landing during that await nulls the claim (and moves the conversation), so the handler still returns "already running" and leaves the pane it opened in the new, empty conversation although nothing runs there — the same defect the start path guards with if (claim !== mine) return cleared. Re-check claim === going after the await.
Files Reviewed (2 files)
  • plugins/altimate-code/hooks/features/savings.tsx - 1 suggestion
  • plugins/altimate-code/hooks/features/savings.test.tsx - none

Tests were not executed in this read-only review.

Fix these issues in Kilo Cloud

Previous review (commit bf27d26)

Status: 2 Issues Found | Recommendation: Address before merge

Incremental review of 6be4309..bf27d26 (3 commits, 2 files). The Hide press now re-checks the conversation inside its write, and the new held-read tests discriminate: the state.get hook answers after the /clear and the new offer land, so the old updater would blank that offer. checking is a sound in-process complement to the running flag: it is set synchronously with the generation bump, cleared only by the run that set it (so a dropped run cannot clear a newer one), and reset in sessionEnd. One asymmetry remains in the command's status path, and the carried Terraform finding still stands.

Overview

Severity Count
CRITICAL 0
WARNING 0
SUGGESTION 2
Issue Details (click to expand)

SUGGESTION

File Line Issue
plugins/altimate-code/hooks/features/savings.tsx 820 The busy read is trusted as-is, so a stale true taken before a /clear (or before a press's run that has since finished) still opens the pane in the new conversation and says the check is already running, although nothing runs there. Route it through the same at/inConversation/checking discrimination as stopped().
plugins/altimate-code/hooks/features/savings.tsx 124 Carried: the .tf check still tests the raw text, so a resource "databricks_…" line inside a /* … */ block counts as a declaration (and COMPUTE_WORDS matches comment words), which can spend the once-a-session offer on a file with no live Databricks config. The doc at 109-110 covers only #/// comments.
Files Reviewed (2 files)
  • plugins/altimate-code/hooks/features/savings.tsx - 2 suggestions (820 inline, 124 carried)
  • plugins/altimate-code/hooks/features/savings.test.tsx - none

Tests were not executed in this read-only review.

Previous review (commit 6be4309)

Status: 2 Issues Found | Recommendation: Address before merge

Incremental review of 138a666..6be4309 (1 commit, 3 files, 4 lines). The README wording and the reworded Hide-before-clear test comment now match the code, but the latest commit also dropped the inside-write conversation check the Hide press had kept since af5c137. The carried Terraform finding from the previous review still stands.

Overview

Severity Count
CRITICAL 0
WARNING 0
SUGGESTION 2
Issue Details (click to expand)

SUGGESTION

File Line Issue
plugins/altimate-code/hooks/features/savings.tsx 1012 Hide's updater no longer re-checks the conversation. whenPressed checks only before the work runs, while update awaits its read before applying () => null, so a /clear landing in that await can blank the band the new conversation just drew; showBand already set offered = true, so the once-a-session offer is lost. Lines 646-647 state the inside-write rule, and 794/927/1007 still keep it.
plugins/altimate-code/hooks/features/savings.tsx 121 The .tf check still tests the raw text, so a resource "databricks_…"/provider "databricks" line inside a /* … */ block counts as a declaration and can spend the session's offer on a file with no live Databricks config. The infra/old.tf / infra/after-code.tf / infra/line-comments.tf cases that pinned this were removed from the test table in bed357a.
Files Reviewed (3 files)
  • plugins/altimate-code/hooks/features/savings.tsx - 2 suggestions (1012 inline, 121 carried)
  • plugins/altimate-code/hooks/features/savings.test.tsx - none
  • plugins/altimate-code/README.md - none (typo fixed)

Tests were not executed in this read-only review.

Fix these issues in Kilo Cloud

Previous review (commit 138a666)

Status: 3 Issues Found | Recommendation: Address before merge

Incremental review of 65b868b..138a666 (2 commits, 3 files). The two earlier suggestions on the Terraform reader go away with the reader: terraformCode is deleted, so there is no second full character pass and no quoted-string scan to break. The Hide-before-clear test still does not discriminate, though: whenPressed drops the press before its work runs, so the inner pressedIn === conversation check is never reached by the test.

Overview

Severity Count
CRITICAL 0
WARNING 0
SUGGESTION 3
Issue Details (click to expand)

SUGGESTION

File Line Issue
plugins/altimate-code/hooks/features/savings.tsx 121 The .tf check runs on raw text, so a resource "databricks_…" line inside a block comment or heredoc counts as a declaration, and comment words can draw the band (which consumes the once-a-session offer). The tests that pinned the old behaviour were deleted.
plugins/altimate-code/hooks/features/savings.test.tsx 577 The test still passes with the inner Hide guard removed, because whenPressed (savings.tsx:730-733) never calls the work once the conversation moved on.
plugins/altimate-code/README.md 166 a line that starts a databricks provider should read starts with; the source comment at savings.tsx:105 says so.
Files Reviewed (3 files)
  • plugins/altimate-code/hooks/features/savings.tsx - 1 suggestion
  • plugins/altimate-code/hooks/features/savings.test.tsx - 1 suggestion
  • plugins/altimate-code/README.md - 1 suggestion

Tests were not executed in this read-only review.

Fix these issues in Kilo Cloud

Previous review (commit 65b868b)

Status: 3 Issues Found | Recommendation: Address before merge

Incremental review of 2f1e9c17..65b868b (4 commits, 2 files). Both earlier findings on the Terraform reader are fixed: the baseline literal is now typed inside the windowCost !== null guard, and a block comment that opens after code (or after a BOM) no longer leaves a commented-out resource "databricks_..." in play. The new terraformCode pass also gives the band the file's code rather than its comments, and the added cases (block comment before a resource, BOM, dashed heredoc delimiter, comment-only compute words) discriminate in both directions.

Three suggestions remain, all in the new reader or its tests. The one that can lose a real file: the string scan ends at the first unescaped ", so a template interpolation whose argument is itself a string ("${format("%s/logs/*", var.prefix)}") drops out of string mode, and the /* left in the remainder opens a block comment that swallows the rest of the file — including a real databricks_ declaration, so the file gets no band at all. The other two are the second full terraformCode pass per .tf edit, and the Hide-press test that is already satisfied by whenPressed's outer guard.

Overview

Severity Count
CRITICAL 0
WARNING 0
SUGGESTION 3
Issue Details (click to expand)

SUGGESTION

File Line Issue
plugins/altimate-code/hooks/features/savings.tsx 118 A template string's inner quotes end the scan, so a /* later in the string opens a block comment that hides the rest of the file (a real databricks_ resource included) and the file gets no band line.
plugins/altimate-code/hooks/features/savings.tsx 1094 isDatabricksConfig already calls terraformCode(text), so this is a second full character-by-character pass over up to 200,000 chars for every .tf edit.
plugins/altimate-code/hooks/features/savings.test.tsx 577 sessionEnd bumps conversation and clears the band, and whenPressed re-checks before calling the work, so the test passes with the inner Hide guard removed.
Files Reviewed (2 files)
  • plugins/altimate-code/hooks/features/savings.tsx - 2 suggestions
  • plugins/altimate-code/hooks/features/savings.test.tsx - 1 suggestion

Tests were not executed in this read-only review.

Fix these issues in Kilo Cloud

Previous review (commit 2f1e9c1)

Status: 3 Issues Found | Recommendation: Address before merge

Incremental review of 56647c74..2f1e9c17 (4 commits, 4 files). The CLI-error path is now correct: an object's reason/message reaches the pane, an empty-string error falls back to the CLI's own text, and errorText degrades to JSON rather than [object Object]. The /clear guards on the band, the Hide press and the what-if press all re-check the conversation inside the mutator, and the README now states the "mentions warehouses or clusters" rule the code already applied.

One new WARNING: the de-duplicated baseline literal was hoisted above the windowCost !== null guard, so its windowCost property is inferred number | null and no longer satisfies Baseline. The two suggestions are the residual false positive in the new line-anchored Terraform comment strip, and a new test whose ordering is already handled by whenPressed, so it does not exercise the guard it names.

Overview

Severity Count
CRITICAL 0
WARNING 1
SUGGESTION 2
Issue Details (click to expand)

WARNING

File Line Issue
plugins/altimate-code/hooks/features/savings.tsx 548 The baseline literal now sits above the windowCost !== null guard, so baseline.windowCost is `number

SUGGESTION

File Line Issue
plugins/altimate-code/hooks/features/savings.tsx 120 A multi-line block comment that opens after code (or after a BOM) is no longer stripped, so a commented-out resource "databricks_..." line still marks the file as Databricks config.
plugins/altimate-code/hooks/features/savings.test.tsx 577 The "Hide pressed just before a /clear" test clears only after the press is queued, so the outer whenPressed check already drops it; the test passes with the new inner guard removed.
Files Reviewed (4 files)
  • plugins/altimate-code/README.md
  • plugins/altimate-code/hooks/features/savings.tsx - 1 warning, 1 suggestion
  • plugins/altimate-code/hooks/features/savings.test.tsx - 1 suggestion
  • plugins/altimate-code/types/index.d.ts

Tests were not executed in this read-only review.

Fix these issues in Kilo Cloud

Previous review (commit 56647c7)

Status: 5 Issues Found | Recommendation: Address before merge

Incremental review of a474758..56647c74 (4 commits, 7 files). The new baseline rule (learns && covers with a cost) is sound: a run that saw a change or lost a setting leaves the stored read alone, while a run that only learned a setting replaces the whole baseline (config, date, cost, days), so a setting is never paired with another week's spend. isDatabricksConfig correctly handles CRLF, a BOM, nested resources/ paths, comments, top-level resets, quoted/unquoted Terraform labels and block comments, and rejects the Helm/Kubernetes shapes in the new tests. The numeric-string lookback and the missing-window-end rendering check out, and known still rejects NaN, Infinity, blank and non-numeric values. No CRITICAL or WARNING issue was found.

The five suggestions are maintainability and test-coverage points: the duplicated path match, the repeated baseline literal, a stacked type doc, the /clear guard sitting outside the awaited band/what-if writes, and the new "everywhere" test not asserting the evidence lines.

Overview

Severity Count
CRITICAL 0
WARNING 0
SUGGESTION 5
Issue Details (click to expand)

SUGGESTION

File Line Issue
plugins/altimate-code/types/index.d.ts 643 Two stacked JSDoc blocks above window; merge them into one block and note that toView always sets days.
plugins/altimate-code/hooks/features/savings.tsx 113 isDatabricksConfig re-tests the path shapes in DATABRICKS_CONFIG and re-normalizes backslashes; extract one path predicate.
plugins/altimate-code/hooks/features/savings.tsx 551 The replacement write repeats the first-run baseline object literal from line 545; build the baseline once.
plugins/altimate-code/hooks/features/savings.tsx 772 The conversation check is outside the awaited update, so a /clear during the write can still land the band (same shape at the what-if press, line 905); guard inside the mutator.
plugins/altimate-code/hooks/features/savings.test.tsx 2223 The "everywhere" test does not assert the evidence lines or the fix request, the other consumers of days.
Files Reviewed (7 files)
  • plugins/altimate-code/CHANGELOG.md
  • plugins/altimate-code/README.md
  • plugins/altimate-code/hooks/features/savings.tsx - 3 suggestions
  • plugins/altimate-code/hooks/features/savings.test.tsx - 1 suggestion
  • plugins/altimate-code/hooks/savings-config.ts
  • plugins/altimate-code/hooks/savings-config.test.ts
  • plugins/altimate-code/types/index.d.ts - 1 suggestion

Tests were not executed in this read-only review.

Fix these issues in Kilo Cloud

Previous review (commit a474758)

Status: No Issues Found | Recommendation: Merge

Incremental review of ab0faec..a474758 (1 commit, 2 files). The one remaining suggestion from the previous round is fixed at this HEAD: trackChanges now derives the cost through the shared known helper (known(warehouse.window_cost) ? Number(warehouse.window_cost) : null), so a window_cost sent as a numeric string is accepted exactly as money/fixed/toView accept it, instead of silently skipping the change line and the first baseline.

Checked the new guard's edges against known and the change-tracking flow: a number is still gated on Number.isFinite; a blank or whitespace-only string, a non-numeric string, a float-parseable Infinity, null, and an absent field all still read as no cost, so no $NaN line and no baseline are produced for them; a numeric string such as "27.544375" yields the same rounding the number path gave. windowCost stays number | null for Baseline.windowCost and the monthly arithmetic at savings.tsx:493-494. The two added tests cover the two affected branches (a resized warehouse whose cost arrives as a string draws the line; a newly flagged one keeps a numeric baseline), and their expected amounts match the 7-day window arithmetic. No duplicated helper or redundant branch was introduced by the one-line change.

Tests were not executed in this read-only review.

Files Reviewed (2 files)
  • plugins/altimate-code/hooks/features/savings.tsx
  • plugins/altimate-code/hooks/features/savings.test.tsx

Previous review (commit ab0faec)

Status: 1 Issue Found | Recommendation: Address before merge

Incremental review of 9332ff8..ab0faec (1 commit, 5 files). The previous round's three findings are fixed at this HEAD: the per-setting fill now runs whenever another setting changed (learns no longer sits behind changed.length === 0), so an unknown setting no longer stays unknown for the entry's life; settingsNoun is gone along with its only test assertion; and the pane-safety cleaning rule now lives once in hooks/savings-text.ts, imported by both savings.tsx and savings-config.ts. The new cost guard keeps a missing window_cost out of both the change line and a first baseline write, and the three added tests cover the fill-with-a-change case, a resized warehouse with no cost, and a newly flagged warehouse with no cost.

One consistency gap remains in that new guard: it accepts only a number, while every other figure helper in the module (and the tested numeric-string handling) accepts a numeric string. Tests were not executed in this read-only review.

Overview

Severity Count
CRITICAL 0
WARNING 0
SUGGESTION 1
Issue Details (click to expand)

SUGGESTION

File Line Issue
plugins/altimate-code/hooks/features/savings.tsx 482 The new windowCost guard rejects a window_cost sent as a numeric string, which known/money/toView accept, so change tracking and the first baseline are silently skipped for such an answer. Use known(warehouse.window_cost) ? Number(warehouse.window_cost) : null.
Files Reviewed (5 files)
  • plugins/altimate-code/hooks/features/savings.tsx - 1 issue
  • plugins/altimate-code/hooks/savings-config.ts
  • plugins/altimate-code/hooks/savings-text.ts
  • plugins/altimate-code/hooks/savings-config.test.ts
  • plugins/altimate-code/hooks/features/savings.test.tsx

Fix these issues in Kilo Cloud

Additional previous summary content was truncated to keep this comment within platform limits.


Reviewed by deepseek-v4.1-flash-1017 · Input: 54.2K · Output: 5.2K · Cached: 339.2K

shreyastelkar and others added 5 commits November 17, 2026 19:00
`/savings` set only `ALTIMATE_TELEMETRY_DISABLED`, which still lets the CLI send its one-time
telemetry opt-out event and fetch the model catalog and ripgrep. The run now also sets
`ALTIMATE_ASSESSMENT_MODE=true`, so the Databricks warehouse is the only host it reaches.
An altimate-code without assessment mode ignores the variable. PRIVACY.md and the changelog
state this, the window the cost covers, and what is not assessed.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…they show

Each amount was rounded on its own: whole dollars from $100, cents below. A line
comparing $125.50 with $19.05 read "$19.05 a month instead of $126, $106 less".
`compared()` formats both amounts and their gap at one precision, to the cent when
either is under $100, and takes the gap from the amounts it shows.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…lagged setting

The cluster request named `databricks clusters edit <id> --json`, which the CLI
rejects (cluster_id and spark_version go in the JSON) and which replaces the whole
configuration. The job request named `databricks jobs reset <id> --json`: `reset`
takes no id and overwrites every job setting. They now name `clusters update --json`
with an update mask, and `jobs update --json` with job_id and the whole tasks list.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…wording

`compared()` used whole dollars whenever both amounts were $100 or more, so
$300.40 against $300.20 read "$300 instead of $300, $0 less". It now keeps cents
when the gap itself is under $100. The jobs draft no longer says `jobs update`
replaces each field it names: it changes only the settings it is given.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…nged task whole

A task given to `jobs update` replaces that whole task, so a draft holding only
the new cluster would drop the task's notebook, libraries and retries. The draft
now asks Claude to start from `databricks jobs get <id>` and give each changed
task whole, with only its cluster changed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
shreyastelkar and others added 2 commits November 17, 2026 23:49
`runTool` keeps main's first-line text for a failure with no answer object and
this branch's `raw` (the whole output); main's test now expects `raw` too.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…first line

Since `runTool` returns only the first line of a failure's output as text, an
altimate-code too old for `tool run` (exit 1, its banner and usage on stderr) read
as a generic failure. The pane now checks the whole output (`raw`) for the usage
and shows "has no Databricks savings check". The test feeds the old CLI's real
output through the CLI helper.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@ichandann ichandann left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed bbe331096e24fc79e672fa39a91bf1722bdd95ca. Requesting changes for the unmet assessment-mode compatibility boundary below, which is also identified as a pre-merge dependency in the PR body.

The new savings flow correctly passes both environment switches, uses the CLI directly with --no-daemon, rejects connection-name flag injection, keeps findings in the pane, and fills rather than submits Draft the fix. I read the full changed source and tests, the integration wiring, privacy text and prior review responses. The documented CLI commands preserve fields for cluster/job changes; the cosmetic/unused-field and band-matching suggestions are non-blocking. Cross-workspace baseline-key scoping remains a follow-up.

Validation: the complete plugin test run finished with 506 passes and one failure in the unchanged 500-node lineage timing assertion (368 ms against a 300 ms limit), 70.55 s wall. An isolated actual-base run of that unchanged file passed all 30 tests, with that case at 75 ms; this is not evidence that the full base suite passes or that no regression exists. Both strict plugin validators and both shell suites pass. A separate focused copy passed all 39 existing savings tests and two new controls, with one expected negative failure: an unsupported CLI is invoked before the compatibility refusal (11.98 s wall on repeat). The probe mocks process creation; the old release's opt-out path was confirmed by source inspection, not a live telemetry request. The engine also logs missing ui.status implementations in the reused test helper; the negative assertion itself is the observed invocation count (expected 0, actual 1).

Current GitHub shell/security/review checks report success; no required contexts are reported. I did not connect to Databricks, replay the private recording, install/run an old CLI, validate production savings, send telemetry, or test a live Claude model turn. The dependency on code #1762/core #785 and a compatible released CLI remains material. No author source edit, commit, push, merge or deployment was performed.

Reviewed by Codex on behalf of @ichandann.

…altimate-code

Up to 0.12.11 altimate-code has neither the savings tool nor assessment mode, so
its `tool run` sent the one-time telemetry opt-out event before failing, while
the pane says nothing is sent. `/savings` now runs `altimate --version` first
(measured on 0.12.11 against a local telemetry listener: `--version` sends
nothing; `tool run` sends the opt-out event) and starts the check only on
0.12.12 or later, or a source build (`local`). A version it cannot read is
refused. README, CHANGELOG and PRIVACY.md say so.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@shreyastelkar

Copy link
Copy Markdown
Author

@ichandann Thanks for the review. The compatibility boundary is now enforced before launch, in 38066b2 (details on the inline thread):

  • /savings asks altimate --version first, which I measured as sending nothing on 0.12.11.
  • It never starts an older CLI for the check.

The remaining dependency is unchanged. The minimum gets set to the published altimate-code release that carries the tool and assessment mode before this merges, and the PR is held until then.

I did not change the cross-workspace baseline key or the non-blocking suggestions in this round.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@ichandann ichandann left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-reviewed 5f52bdb2ac70bfb3dd46e7303406d7c40efd5efa against the previous reviewed head bbe331096e24fc79e672fa39a91bf1722bdd95ca. The numbered-release preflight now addresses the original normal-install launch path: 0.12.11 is refused before tool run, with both environment switches on the version probe. The serverless scope wording also now matches the implementation. Requesting changes for the remaining unknown-source-build bypass below.

Independent validation: all 509 plugin tests passed (37.72 s wall), and both strict validators passed. An isolated exact-head overlay ran the 41 savings tests plus three independent controls: 43 passed, one expected negative failed because local launches the unsupported tool (9.61 s). A separate copy changing only the unknown-local guard passed all three independent controls (1.00 s). Earlier tests' ui.status-helper logs are retained; the negative result is the observed process count, not a UI-helper exception. The old source's version fallback and opt-out path were inspected; no actual old CLI or telemetry sink was run by this review.

All current GitHub checks are successful; no required contexts are reported. The published assessment-compatible CLI dependency and minimum-version pin remain an explicit owner hold. This review does not clear code #1762's missing-core-export/cost-gate findings, core #785's owner/spec gate, actual savings accuracy, a private recording, model turns or live Databricks/telemetry. No author source edits, commits, pushes, merges or deployments were made.

Reviewed by Codex on behalf of @ichandann.

…t mode

A source build prints `local` for `--version` whatever its age, so an old checkout
without assessment mode passed the check and its `tool run` could still send the
one-time telemetry opt-out event. `local` is now refused like an unreadable
version, with a message to use a released altimate-code; a build made with the
release script carries its version. README, CHANGELOG and PRIVACY.md say so.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ichandann
ichandann dismissed their stale review November 20, 2026 19:09

The older compatibility and spend-label findings are fixed at 56647c7. The version gate stops unsupported, preview and unknown source builds before tool run. The tracker calls the comparison observed spend, and the what-if selection passed a repeated-ID workspace check. Shell CI is green on this commit. Clearing my stale requests. The author's release hold remains until the compatible CLI ships and the minimum is pinned to it.

shreyastelkar and others added 2 commits November 20, 2026 11:11
…on; README states when the offer shows

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…ffer

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
shreyastelkar and others added 4 commits November 20, 2026 11:40
…ode, not by a comment pattern

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…the Terraform comment tests discriminate

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…mpute words and names

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…m test discriminate

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
shreyastelkar and others added 2 commits November 20, 2026 12:29
…ar test reach its guard

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
… matches the line check

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Comment thread plugins/altimate-code/README.md Resolved
…aches; README wording

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
shreyastelkar and others added 3 commits November 20, 2026 13:22
… during its write

`update` reads the line above the prompt, applies the change, and writes with a
version check that retries on a miss. A `/clear` landing during that read made
the retry blank the new conversation's offer, which then never came back that
session. The updater checks the conversation again, as every other press in
this file does, and a new test holds the press's read while the `/clear` and
the new offer land: it fails without that check.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… going, not that the conversation was cleared

The command told a /clear from any run start by the check's generation, which
also moves when a press starts a run. Typed while the band's Run /savings was
starting, it answered "The conversation was cleared" with no /clear and a check
running. It now tells the two apart by the conversation, and names the run in
progress (or the one that just ended). The run in flight is kept in a module
variable: the command's own read of the running flag can answer as it was when
the command started. The Hide test waits on the clock instead of a promise that
resolved on the /clear's write.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…s the check just ran

Pins the answer for a run that started and ended while the command read the
running flag, and the reset of the run-in-flight marker when a run ends: without
that reset the command says "already running" with nothing running.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
shreyastelkar and others added 5 commits November 20, 2026 14:02
…ane in the new conversation

The command took a "running" answer as it was, so one read before a /clear
opened the pane in the new conversation and said the check was running there.
That answer now goes through the same conversation and run checks as the
generation-moved path. The Terraform rule's doc says a declaration line in a
block comment or heredoc still counts.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…rom the running flag

Starting a run was decided from the running flag in `$.state`, which a hook can
read as it was when the hook started. Three review rounds each found a race
from that: "the conversation was cleared" with no /clear, "already running"
after the run ended, and a typed `/savings <connection>` dropped when a press's
run started first. A module-level claim now decides it, set with no await
between the check and the claim, and held until the run ends or a /clear drops
it; the flag only draws the pane. A typed connection that a running check is not
reading is told to run again when it finishes. The run clears the flag inside
its write before it lets the claim go, so it never clears a newer run's flag.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ing a run on another connection is told to ask again

- `sessionStart` drops the claim as well as the running flag: a run from the
  last session can never finish, so neither may block this one.
- `/savings` with no connection, while a check reads a named one, is told to
  run again when it finishes, as a typed connection already was.
- A test presses the band's Run /savings while a typed check holds the claim,
  with no press queued: it fails if the press does not check the claim.
- The press's run token is named apart from the press guard.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…he new conversation's check

Fails if a run lets go of whatever claim is held when it ends, instead of only
its own: the old run would free the new conversation's claim and let a second
check start on the same warehouse.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ts afresh only on its own reload

`session.start` also comes when the plugin is enabled or another module reloads,
while this module's check may still be running; letting go of its claim there
would let a second check start on the same warehouse.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
shreyastelkar and others added 3 commits November 20, 2026 15:03
…ns; a session start keeps a running check's flag

- The "already running" answer is checked again once the pane has opened: a
  /clear meanwhile says the conversation was cleared, and a check that ended
  meanwhile says it just finished.
- `sessionStart` clears the running flag only when no claim is held: a claim
  still held is a run that is still going, so the pane keeps showing it.
- Tests for both, and for a session start mid-run with no /clear before it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…nished" only when no check holds the claim

- `runCheck` lets go of its claim in a `finally` around its running-flag write,
  and `/savings` lets go of its claim when that write fails before any run was
  scheduled: a failed write no longer leaves every later /savings answering
  "already running".
- The already-running answer says "just finished" only when no check holds the
  claim once the pane has opened; one that started meanwhile is still running.
- Its /clear answer says the conversation was cleared while the check ran.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… /savings does

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
shreyastelkar and others added 2 commits November 20, 2026 15:34
…step that fails before it starts

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…instead of a fixed 20 ms pause

The two 20 ms pauses stopped being enough once the suite grew: the test failed
in most full runs while passing alone. It now goes on when each call's
artifact read has begun, so the order it tests no longer depends on load.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants