feat: code review fixes and LSP enhancements#129
Conversation
CRITICAL fixes: - Fix unchecked type assertions in alter.go (RoleOption.String()) - Fix unchecked type assertions in value.go (Value.String()) - Fix race condition in metrics.go using atomic operations - Fix race condition in LSP documents.go with defensive copy - Fix race condition in watch.go with RWMutex protection HIGH priority fixes: - Add missing Node interface methods to WindowFrameBound - Fix LSP hover returning nil instead of empty response MEDIUM priority fixes: - Add semantic error builders (E3001-E3004) for UndefinedTable, UndefinedColumn, TypeMismatch, AmbiguousColumn - Add missing object pools for FunctionCall, CaseExpression, BetweenExpression, InExpression, SubqueryExpression, CastExpression - Improve UTF-8 handling in LSP GetWordAtPosition All changes verified with race detection tests. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Features: - Add MATERIALIZED/NOT MATERIALIZED parsing for CTEs (SQL standard) - Add comprehensive parser and AST metrics tracking - Add pool metrics for AST, statement, and expression objects Fixes: - Fix tokenizer negative column numbers in toSQLPosition - Correct column calculation to be consistently 1-based Metrics additions: - RecordParse() for parser operation tracking - RecordASTPoolGet/Put() for AST pool metrics - RecordStatementPoolGet/Put() for statement pool metrics - RecordExpressionPoolGet/Put() for expression pool metrics - Extended Stats struct with parser and pool metrics Tests: - Add TestParser_MaterializedCTE test cases - Update tokenizer error location test for correct column value - Add column validation to fuzz tests 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
- Add textDocument/documentSymbol for SQL statement outline - Add textDocument/signatureHelp with signatures for 20+ SQL functions - Add textDocument/codeAction for quick fixes (semicolon, uppercase) - Add protocol types: DocumentSymbol, SignatureHelp, CodeAction, etc. - Update ServerCapabilities to advertise new features 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
163b49d to
8b45971
Compare
|
Claude finished @ajitpratap0's task —— View job Pull Request Review - COMPREHENSIVE ANALYSISI'm conducting a comprehensive review of PR #129. Here's my complete analysis: Review Checklist
✅ EXCELLENT CHANGES - PRODUCTION READYCritical Fixes - Outstanding QualityType Assertion Safety ⭐⭐⭐⭐⭐
Race Condition Fixes ⭐⭐⭐⭐⭐
Feature ImplementationsMATERIALIZED CTE Support ⭐⭐⭐⭐⭐
LSP Protocol Enhancements ⭐⭐⭐⭐
Metrics System ⭐⭐⭐⭐⭐
AST Pool Architecture ⭐⭐⭐⭐
|
LSP Server Security: - Add rate limiting (100 requests/second) to prevent DoS - Add content length validation (max 10MB per message) - Add document size limits (max 5MB for validation) - Improve error handling for malformed JSON-RPC requests - Add missing LSP error codes (RequestCancelled, etc.) AST Pool Efficiency: - Convert recursive PutExpression() to iterative approach with work queue - Add MaxCleanupDepth and MaxWorkQueueSize limits to prevent stack overflow - Add pools for missing expression types: ExistsExpression, AnyExpression, AllExpression, ListExpression, UnaryExpression, ExtractExpression, PositionExpression, SubstringExpression - Update PutSelectStatement to use iterative expression cleanup 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
|
Claude finished @ajitpratap0's task —— View job Pull Request Review - Comprehensive AnalysisI'm conducting a comprehensive review of PR #129. Here's my complete analysis: Review Checklist
✅ EXCELLENT CHANGES - PRODUCTION READYCritical Fixes - Outstanding QualityType Assertion Safety ⭐⭐⭐⭐⭐
Race Condition Fixes ⭐⭐⭐⭐⭐
Feature ImplementationsMATERIALIZED CTE Support ⭐⭐⭐⭐⭐
LSP Protocol Enhancements ⭐⭐⭐⭐
Metrics System ⭐⭐⭐⭐⭐
AST Pool Architecture ⭐⭐⭐⭐
|
✅ All Review Suggestions AddressedAll items from the code review have been implemented in commit f6a0821: Performance & Memory Improvements
LSP Robustness Improvements
Additional Improvements
All tests pass with race detection ✅ 🤖 Generated with Claude Code |
- Added LSP server implementation details (CLI-009) - Added MATERIALIZED CTE support documentation - Added comprehensive metrics system features - Added AST pool architecture improvements - Added bug fixes section for type assertions and race conditions 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
- Added LSP server implementation details (CLI-009) - Added MATERIALIZED CTE support documentation - Added comprehensive metrics system features - Added AST pool architecture improvements - Added bug fixes section for type assertions and race conditions 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Ajit Pratap Singh <ajitpratapsingh@Ajits-Mac-mini.local> Co-authored-by: Claude <noreply@anthropic.com>
Summary
This PR includes code review fixes and LSP enhancements made after PR #128 was merged:
Critical Fixes
alter.goandvalue.gometrics.go,documents.go, andwatch.goNew Features
MATERIALIZED CTE Support (Phase 2.6)
AS MATERIALIZED (query)andAS NOT MATERIALIZED (query)syntaxExtended LSP Protocol Methods
textDocument/documentSymbol- SQL statement outline/symbolstextDocument/signatureHelp- Function signatures for 20+ SQL functionstextDocument/codeAction- Quick fixes (add semicolon, uppercase keywords)Comprehensive Metrics
Bug Fixes
Test plan
go test -race ./...)Files Changed
🤖 Generated with Claude Code