AltimateAI / AltimateAI/altimate-code

[bug] FinOps tools return zeroed/masked data despite valid ACCOUNT_USAGE access

未關閉
#203 1 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
bug from-cli user-feedback
主要語言
TypeScript
星號
811
分支
134
平均合併
3 天 2 小時
30 天內合併 PR
50

描述

### Problem
The FinOps tools (`finops_analyze_credits`, `finops_warehouse_advice`, `finops_expensive_queries`, `finops_unused_resources`) return masked/zeroed data (`unknown` warehouse names, `0.00` credits) even when the connected Snowflake role (ACCOUNTADMIN) has full access to `SNOWFLAKE.ACCOUNT_USAGE` views. The `finops_warehouse_advice` tool also fails with a SQL compilation error: `invalid identifier 'WAREHOUSE_SIZE'`.

### Steps to Reproduce
1. Configure a Snowflake warehouse connection (e.g., `snowflake_sample`) with a role that has ACCOUNT_USAGE access (tested with `ACCOUNTADMIN`).
2. Verify direct SQL access works:
```sql
SELECT COUNT(*) FROM SNOWFLAKE.ACCOUNT_USAGE.WAREHOUSE_METERING_HISTORY
WHERE START_TIME >= DATEADD('day', -30, CURRENT_TIMESTAMP());
```
→ Returns `908` rows successfully.
3. Verify the connection identity:
```sql
SELECT CURRENT_ROLE(), CURRENT_USER(), CURRENT_ACCOUNT();
```
→ Returns `ACCOUNTADMIN`, `SAURABH`, `BZB11272`.
4. Call `finops_analyze_credits` with `warehouse: snowflake_sample`, `days: 30`, `limit: 50`.
→ Returns all `unknown` warehouse names and `0.00` credits (13 rows of zeroed data).
5. Call `finops_warehouse_advice` with `warehouse: snowflake_sample`, `days: 30`.
→ Fails with: `000904 (42000): SQL compilation error: error line 3 at position 4 invalid identifier 'WAREHOUSE_SIZE'`.
6. Call `finops_expensive_queries` and `finops_unused_resources` — both return zeroed/empty results.

### Expected Behavior
FinOps tools should return actual credit consumption data matching the direct SQL query results (908 rows of valid metering history data across 13 active warehouses totaling ~230 credits over 30 days).

### Actual Behavior
- `finops_analyze_credits`: Returns masked data (all `unknown` / `0.00`)
- `finops_warehouse_advice`: SQL compilation error on `WAREHOUSE_SIZE` column
- `finops_expensive_queries`: Returns zeroed results
- `finops_unused_resources`: Returns zeroed results

### Workaround
Query `SNOWFLAKE.ACCOUNT_USAGE` views directly via `sql_execute` to get the actual data.

---

### Metadata

| Field | Value |
|-------|-------|
| CLI Version | v0.4.0 |
| Platform | darwin |
| Architecture | arm64 |
| OS Release | 24.6.0 |
| Category | bug |
| Working Directory | ac-examples |
| Session ID | ses_3070d9fdaffeV9OvBpIrq46996 |

貢獻指南

開啟貢獻指南

評估

這個 Issue 還沒有評估資料。

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。