Commit 1a9c6fe
feat: shadow-mode SQL pre-validation telemetry (#643)
* fix: resolve all 5 Verdaccio sanity test failures
- altimate-core NAPI binding: set `NODE_PATH` to global npm root so
`require('@altimateai/altimate-core')` resolves after `npm install -g`
- upstream branding: replace "opencode" with "altimate-code" in user-facing
`describe` strings (uninstall, tui, pr commands, config, server API docs)
- driver resolvability: set `NODE_PATH` in driver check loop and install
`duckdb` alongside the main package so at least one peer dep is present
- hardcoded CI paths: restrict grep to JS/JSON files only — compiled Bun
binaries embed build-machine paths in debug info which is unavoidable
- NAPI module exports: already had correct `NODE_PATH` in extended test;
root cause was the base test (fix 1) which is now resolved
Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
* fix: pre-execution SQL validation, apply_patch retry, agent behavior rules, and error UX
- Wire datafusion validation into sql_execute — catches column/table errors
locally before hitting the warehouse (uses schema cache with 24h TTL)
- Add sql_pre_validation telemetry event to measure catch rate and latency
- Add apply_patch retry-with-re-read on verification failure — re-reads
the file and retries once before giving up, with actionable error messages
- Add file-not-found cache in read tool — prevents retry loops on missing
paths (capped at 500 entries)
- Add agent behavior rules to system prompt: act first/ask later, enforce
read-before-edit, limit retries to 2 per input
- Add actionable connection error guidance in warehouse_test — maps common
auth failures (wrong password, missing key, SSO timeout) to fix instructions
- Auto-pull schema cache in altimate_core_validate when no schema provided
Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
* refactor: ship SQL pre-validation in shadow mode, defer other fixes
Reduces PR scope to telemetry-only based on deep analysis: the broader
fixes (prompt rules, warehouse_test guidance, apply_patch retry, read
file-not-found cache, altimate_core_validate auto-pull) were speculative
against an 8-machine / 1-day telemetry sample.
This PR now ships only what's needed to measure whether pre-execution
SQL validation is worth it:
- Keep: sql_pre_validation telemetry event + preValidateSql function
- Change: pre-validation runs fire-and-forget (shadow mode) — emits
telemetry with outcome=skipped|passed|blocked|error but never blocks
sql_execute. Zero user-facing latency impact.
- Revert: read.ts, apply_patch.ts, warehouse-test.ts, altimate-core-validate.ts,
anthropic.txt system prompt changes — to be re-evaluated as separate
PRs once real telemetry data validates need.
After 2 weeks of shadow telemetry, we can decide whether the blocking
behavior is worth the latency and false-positive risk.
* fix: address cubic review feedback on SQL pre-validation
- P1: mask validator error via `Telemetry.maskString()` before emitting
`sql_pre_validation` telemetry. Raw schema identifiers (table/column
names, paths) no longer leak to App Insights.
- P2: resolve fallback warehouse via `Registry.list().warehouses[0]`
(same path `sql.execute` uses) instead of the cache's first warehouse.
Keeps shadow validation aligned with actual execution.
- P2: raise column-scan cap from 10k to 500k and add `schema_truncated`
boolean to the event. Avoids false structural errors on large
warehouses and lets analysis flag biased samples.
---------
Co-authored-by: Claude Opus 4.6 (1M context) <[email protected]>1 parent 56484c7 commit 1a9c6fe
File tree
2 files changed
+177
-0
lines changed- packages/opencode/src/altimate
- telemetry
- tools
2 files changed
+177
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
637 | 637 | | |
638 | 638 | | |
639 | 639 | | |
| 640 | + | |
| 641 | + | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
| 650 | + | |
| 651 | + | |
| 652 | + | |
| 653 | + | |
| 654 | + | |
| 655 | + | |
640 | 656 | | |
641 | 657 | | |
642 | 658 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
12 | 16 | | |
13 | 17 | | |
14 | 18 | | |
| |||
34 | 38 | | |
35 | 39 | | |
36 | 40 | | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
37 | 49 | | |
38 | 50 | | |
39 | 51 | | |
| |||
91 | 103 | | |
92 | 104 | | |
93 | 105 | | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
94 | 255 | | |
95 | 256 | | |
96 | 257 | | |
| |||
0 commit comments