Skip to content

chore: remove cost estimation and complexity scoring bindings#31

Merged
anandgupta42 merged 8 commits intomainfrom
cleanup/remove-cost-estimation
Mar 4, 2026
Merged

chore: remove cost estimation and complexity scoring bindings#31
anandgupta42 merged 8 commits intomainfrom
cleanup/remove-cost-estimation

Conversation

@suryaiyer95
Copy link
Contributor

@suryaiyer95 suryaiyer95 commented Mar 4, 2026

Summary

  • Remove guard_complexity_score and guard_estimate_cost from guard.py (Rust bindings removed in internal PR)
  • Remove complexity_score and estimate_cost endpoints from server.py
  • Replace guard_complexity_score call in feedback_store.py with simple length-based heuristic max(1.0, len(sql) / 100.0)
  • Remove associated tests from test_guard_new.py

4 files changed, 3 insertions, 113 deletions

Companion to: https://github.com/AltimateAI/altimate-core-internal/pull/38

Test plan

  • Verify server starts without import errors
  • Verify feedback store still works with length heuristic fallback
  • CI passes

🤖 Generated with Claude Code

- Remove both functions from guard.py (bindings removed in altimate-core-internal)
- Remove complexity_score and estimate_cost endpoints from server.py
- Replace `guard_complexity_score` call in feedback_store.py with length heuristic
- Remove associated tests from test_guard_new.py

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Comment on lines 822 to 827
result = SqlGuardResult(
success=raw.get("pass", True), data=raw, error=raw.get("error")
)
elif method == "sqlguard.complexity":
p = SqlGuardComplexityParams(**params)
raw = guard_complexity_score(p.sql, p.schema_path, p.schema_context)
result = SqlGuardResult(success=True, data=raw, error=raw.get("error"))
elif method == "sqlguard.semantics":
p = SqlGuardSemanticsParams(**params)
raw = guard_check_semantics(p.sql, p.schema_path, p.schema_context)

This comment was marked as outdated.

Remove `_static_heuristic` method and dialect-specific cost profiles
that depended on the now-removed `guard_complexity_score`. Tier 4
now returns a `no_data` response instead of fabricating estimates.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Comment on lines 822 to 827
result = SqlGuardResult(
success=raw.get("pass", True), data=raw, error=raw.get("error")
)
elif method == "sqlguard.complexity":
p = SqlGuardComplexityParams(**params)
raw = guard_complexity_score(p.sql, p.schema_path, p.schema_context)
result = SqlGuardResult(success=True, data=raw, error=raw.get("error"))
elif method == "sqlguard.semantics":
p = SqlGuardSemanticsParams(**params)
raw = guard_check_semantics(p.sql, p.schema_path, p.schema_context)

This comment was marked as outdated.

suryaiyer95 and others added 2 commits March 3, 2026 21:19
- Remove `TestSqlGuardComplexityDispatch` (2 tests for removed endpoint)
- Remove `TestSqlGuardCostDispatch` (2 tests for removed endpoint)
- Fix tier3 test to handle no_data fallback when table extraction fails

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Remove the entire `sql.predict_cost` / `sql.record_feedback` system:
- Delete `feedback_store.py` and its tests
- Remove `SqlPredictCostTool` and `SqlRecordFeedbackTool` TypeScript tools
- Remove protocol types, agent permissions, and bridge methods
- Clean up all prompt files, docs, and progress references

The static cost heuristic depended on the now-removed Rust
`complexity_score` binding. The observation-based tiers (1-3)
had no production usage. Removing entirely.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Comment on lines 997 to 1002
"sql.analyze": {} as { params: SqlAnalyzeParams; result: SqlAnalyzeResult },
"sql.optimize": {} as { params: SqlOptimizeParams; result: SqlOptimizeResult },
"sql.translate": {} as { params: SqlTranslateParams; result: SqlTranslateResult },
"sql.record_feedback": {} as { params: SqlRecordFeedbackParams; result: SqlRecordFeedbackResult },
"sql.predict_cost": {} as { params: SqlPredictCostParams; result: SqlPredictCostResult },
"sql.explain": {} as { params: SqlExplainParams; result: SqlExplainResult },
"sql.format": {} as { params: SqlFormatParams; result: SqlFormatResult },
"sql.fix": {} as { params: SqlFixParams; result: SqlFixResult },

This comment was marked as outdated.

suryaiyer95 and others added 3 commits March 3, 2026 21:44
…st_gate` tools

These tools called bridge methods whose server-side handlers were
already removed (they depended on the Rust `estimate_cost` and
`complexity_score` bindings).

- Delete 3 TypeScript tools and their registry entries
- Delete `ci/cost_gate.py` module and tests
- Remove protocol types and Pydantic models
- Clean up docs references

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Rename 33 TypeScript tool files: `sqlguard-*.ts` → `altimate-core-*.ts`
- Update class names: `SqlGuard*Tool` → `AltimateCore*Tool`
- Update tool IDs: `sqlguard_*` → `altimate_core_*`
- Update bridge methods: `"sqlguard.*"` → `"altimate_core.*"`
- Update protocol interfaces: `SqlGuard*Params` → `AltimateCore*Params`
- Update agent permissions in all 4 agent configs
- Update Python constant: `SQLGUARD_AVAILABLE` → `ALTIMATE_CORE_AVAILABLE`
- Update Python models and server dispatch method names
- Update all test files (test_guard, test_guard_new, test_server_guard, test_server_guard_new)
- Update prompt files, docs, and dbt lineage module comments

51 files changed, 654 substitutions (zero remaining `sqlguard` references)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…d `ProjectScanTool`

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copy link

@jontsai jontsai left a comment

Choose a reason for hiding this comment

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

LGTM

Clean companion to altimate-core-internal PR #38. Verified:

✓ All cost/complexity/feedback features removed (tools, endpoints, models, tests)
sqlguard_*altimate_core_* rename applied consistently across tools, protocol, agent configs, and prompts
✓ Deleted tool files: ci-cost-gate, sql-predict-cost, sql-record-feedback, sqlguard-complexity, sqlguard-cost
✓ Server endpoints, models, and guard functions cleaned up
✓ Test files updated/removed accordingly
✓ Registry imports updated to match new naming

Minor note: PR description mentions a length-based heuristic replacement in feedback_store.py, but the entire file was deleted (which is the right call since the feature is being removed entirely).

Ship it! 🚢

…predict/feedback tools

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@anandgupta42 anandgupta42 merged commit 52bcb84 into main Mar 4, 2026
4 checks passed
@kulvirgit kulvirgit deleted the cleanup/remove-cost-estimation branch March 10, 2026 21:06
anandgupta42 added a commit that referenced this pull request Mar 17, 2026
* chore: remove `guard_complexity_score` and `guard_estimate_cost`

- Remove both functions from guard.py (bindings removed in altimate-core-internal)
- Remove complexity_score and estimate_cost endpoints from server.py
- Replace `guard_complexity_score` call in feedback_store.py with length heuristic
- Remove associated tests from test_guard_new.py

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

* fix: remove static cost heuristic from feedback store

Remove `_static_heuristic` method and dialect-specific cost profiles
that depended on the now-removed `guard_complexity_score`. Tier 4
now returns a `no_data` response instead of fabricating estimates.

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

* fix: remove complexity/cost dispatch tests, fix tier3 assertion

- Remove `TestSqlGuardComplexityDispatch` (2 tests for removed endpoint)
- Remove `TestSqlGuardCostDispatch` (2 tests for removed endpoint)
- Fix tier3 test to handle no_data fallback when table extraction fails

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

* chore: remove `FeedbackStore` and cost prediction system

Remove the entire `sql.predict_cost` / `sql.record_feedback` system:
- Delete `feedback_store.py` and its tests
- Remove `SqlPredictCostTool` and `SqlRecordFeedbackTool` TypeScript tools
- Remove protocol types, agent permissions, and bridge methods
- Clean up all prompt files, docs, and progress references

The static cost heuristic depended on the now-removed Rust
`complexity_score` binding. The observation-based tiers (1-3)
had no production usage. Removing entirely.

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

* chore: remove dead `sqlguard_cost`, `sqlguard_complexity`, and `ci_cost_gate` tools

These tools called bridge methods whose server-side handlers were
already removed (they depended on the Rust `estimate_cost` and
`complexity_score` bindings).

- Delete 3 TypeScript tools and their registry entries
- Delete `ci/cost_gate.py` module and tests
- Remove protocol types and Pydantic models
- Clean up docs references

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

* refactor: rename `sqlguard` to `altimate-core` across entire codebase

- Rename 33 TypeScript tool files: `sqlguard-*.ts` → `altimate-core-*.ts`
- Update class names: `SqlGuard*Tool` → `AltimateCore*Tool`
- Update tool IDs: `sqlguard_*` → `altimate_core_*`
- Update bridge methods: `"sqlguard.*"` → `"altimate_core.*"`
- Update protocol interfaces: `SqlGuard*Params` → `AltimateCore*Params`
- Update agent permissions in all 4 agent configs
- Update Python constant: `SQLGUARD_AVAILABLE` → `ALTIMATE_CORE_AVAILABLE`
- Update Python models and server dispatch method names
- Update all test files (test_guard, test_guard_new, test_server_guard, test_server_guard_new)
- Update prompt files, docs, and dbt lineage module comments

51 files changed, 654 substitutions (zero remaining `sqlguard` references)

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

* fix: update cost-report skill to use finops tools instead of removed predict/feedback tools

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

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: anandgupta42 <anand@altimate.ai>
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.

3 participants