Skip to content

Conversation

@TimelordUK
Copy link
Owner

Summary

Major refactoring of TUI functions to use orchestration pattern, achieving massive code reduction while maintaining all functionality.

Code Reduction Achievements

  • render_status_line: 534 → 20 lines (96% reduction)
  • handle_command_input: 416 → 130 lines (69% reduction)
  • handle_results_input: Refactored with orchestration pattern
  • run_app: 195 → 10 lines (95% reduction)

Architectural Improvements

  • All major TUI functions now follow clean orchestration pattern
  • Functions dispatch to focused try_handle_* sub-functions
  • Each sub-function has single responsibility
  • Dead code eliminated (e.g., update_vim_search_pattern)
  • Improved search state coordination (tactical fix for N key bug)

Documentation Added

  • Comprehensive state analysis (found 57 set_mode() calls)
  • State transition mapping
  • Parallel state manager design for future work
  • Sets foundation for gradual state management improvements

Testing

  • All existing functionality preserved
  • Code compiles without warnings
  • Formatting verified with cargo fmt

This PR completes Phase 2 of the TUI refactoring, making the codebase significantly more maintainable and setting the stage for future state management improvements.

🤖 Generated with Claude Code

TimelordUK and others added 4 commits August 24, 2025 12:54
…pattern

MAJOR REFACTORING ACHIEVEMENTS:
- render_status_line: 534 → 20 lines (96% reduction) using orchestration
- handle_command_input: 416 → 130 lines (69% reduction) with try_handle_* pattern
- handle_results_input: 159 → ~120 lines with focused sub-functions
- run_app: 195 → 10 lines (95% reduction) - pure orchestration

ARCHITECTURAL IMPROVEMENTS:
- All major functions now use clean dispatching to focused sub-functions
- Extracted mode styling, data source display, buffer info, and help text
- Added search state coordination (tactical fix for N key bug)
- Eliminated dead code (update_vim_search_pattern)

DESIGN PLANNING:
- Created comprehensive centralized state management design
- Identified root cause: state scattered across Buffer/VimSearchManager/ColumnSearch
- Designed Redux-style solution for proper state coordination

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
- Created comprehensive state analysis documenting 57 set_mode() calls
- Mapped state transition triggers and side effects
- Designed shadow state pattern to run parallel to existing state
- Avoids big bang migration by observing rather than replacing

This sets foundation for gradual state management improvements without
breaking existing functionality.
@TimelordUK TimelordUK merged commit 67dfee7 into main Aug 24, 2025
2 checks passed
TimelordUK added a commit that referenced this pull request Nov 2, 2025
Implements DuckDB-style SELECT * EXCLUDE (columns...) syntax for cleaner
column exclusion without manually listing all desired columns.

Key Changes:
- Parser: Added EXCLUDE token and parsing logic for * EXCLUDE (col1, col2, ...)
- AST: New SelectItem::StarExclude variant with excluded_columns list
- Query Engine: Expansion logic that filters out excluded columns at execution time
- Examples: Complete demo file with security, performance, and readability use cases

Features:
✓ Case-insensitive column matching
✓ Works with WHERE, ORDER BY, LIMIT, GROUP BY clauses
✓ Handles nonexistent columns gracefully (silently ignores)
✓ Table-qualified syntax support (future: table.* EXCLUDE)
✓ Multiple exclusions in single statement

Benefits:
- Security: Easy to exclude sensitive columns (passwords, SSNs, etc.)
- Performance: Skip large BLOB/TEXT columns when not needed
- Maintainability: New columns auto-included without query updates
- Readability: Clearer intent than listing 50+ columns manually

Implementation Notes:
- No transformer needed - expansion happens in query engine
- Reuses existing column resolution infrastructure
- Pattern matches all SelectItem match arms for completeness
- 10 files modified, comprehensive example suite added

Examples:
SELECT * EXCLUDE (password, created_at) FROM users;
SELECT * EXCLUDE (eccentricity, albedo) FROM solar_system WHERE type = 'Planet';

Completes roadmap item #10 (SELECT * EXCLUDE) - v1.66.0
Next: SELECT * REPLACE for column value transformation

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <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.

1 participant