feat: multi-server query execution, user config (furlab.jsonc), and SettingsCommand#60
Merged
feat: multi-server query execution, user config (furlab.jsonc), and SettingsCommand#60
Conversation
- Add FurLab.runsettings for MSTest parallelization - Update .gitignore for CODE_REVIEW.md - Document required MSTest attributes in CLAUDE.md - Archive SQL injection fix openspec change set
Also add missing System.Linq using to test files where needed.
Adiciona atributos DisplayName e Description nos métodos de teste para melhor descritividade e organização. Remove testes redundantes e consolida verificações onde aplicável. Melhora a clareza dos nomes dos métodos de teste conforme as diretrizes do projeto.
…ion and interactive selection - Introduced `furlab.jsonc` for user-specific server configurations, replacing `appsettings.json`. - Added interactive server selection for `query run` command, allowing multiple server selection. - Implemented `-c` parameter for inline query execution, mutually exclusive with `-i`. - Added guard rails for destructive queries with regex detection and user confirmation. - Enabled configurable parallel execution of queries across multiple servers with failure tolerance. - Introduced new `settings db-servers` command for managing server configurations (CRUD operations). - Implemented auto-discovery of databases with configurable exclusion patterns. - Enhanced CSV output to include metadata such as Server, Database, ExecutedAt, Status, RowCount, and Error. - Updated documentation and specifications to reflect new features and changes.
- Added UserConfigService for managing user configurations in furlab.jsonc. - Introduced models for ServerConfigEntry and UserDefaults. - Implemented JSONC parsing with comment stripping and schema validation. - Created SqlQueryAnalyzer to detect potentially destructive SQL queries. - Added QueryType enum to classify SQL queries as Safe or Destructive. - Integrated Polly for automatic retries on transient failures. - Refactored DockerService error messages to English. - Added SettingsCommand for managing database server configurations. - Updated Program.cs to register new services and commands.
…, ensuring errors are logged in the terminal and not in the CSV
…port - Updated QUERY_COMMAND.md to reflect new command usage and execution flow for multi-server queries. - Simplified command options and clarified CSV output formats. - Added examples for using connection strings and handling multiple databases. - Enhanced the task list in query-run-multi-server/tasks.md with completed tests for query analysis and server configuration. - Introduced CsvExportTests to validate CSV output formats and data integrity. - Added SqlQueryAnalyzerTests to ensure correct classification of SQL query types. - Implemented UserConfigServiceTests to verify configuration loading and server management functionalities. - Created a new example configuration file (furlab.example.jsonc) with detailed comments for user guidance.
… and user feedback - Updated QueryCommand to throw exceptions instead of using AnsiConsole for error messages, enhancing error handling. - Added detailed exception messages for invalid options and file paths in QueryCommand. - Refactored SettingsCommand to throw exceptions for required parameters and existing server names, improving clarity. - Changed user prompts and messages in SettingsCommand to English for consistency. - Enhanced error handling in Program.cs to provide clearer feedback for various exceptions. - Updated SqlQueryAnalyzer to document limitations regarding CTE parsing. - Migrated CSV writing logic to CsvExporter for better code organization. - Added unit tests for edge cases in UnescapeInlineQuery and SqlQueryAnalyzer. - Implemented legacy configuration loading in UserConfigService with tests for various scenarios.
…s and SettingsCommand
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
furlab.jsonc): replacesappsettings.jsonwith a user-managed config file under%LOCALAPPDATA%\FurLab. IntroducesIUserConfigService,ServerConfigEntry,UserConfig,UserDefaults, and legacy migration viaTryLoadLegacyConfig.QueryCommandrewrite: native multi-server execution withParallel.ForEachAsync, auto-database discovery via Npgsql (nopsqlbinary required), inline query support (-c), destructive query detection with confirmation prompt, Polly retry with exponential backoff, and consolidated/per-server CSV export via extractedCsvExporter.SettingsCommand: newsettings db-serverssubcommands (ls,add,rm,test) for managing server configurations interactively or via flags.SqlQueryAnalyzer: regex-based detection of destructive SQL keywords with CTE support. Known limitation (multiple CTEs) documented and covered by tests.Program.cs:EnableDefaultExceptionHandler = falseso exceptions from handlers propagate to a structured try/catch with 14 clauses, semantic exit codes, and AnsiConsole formatted messages — no raw stack traces shown to users.FurLab.CodeAnalysisproject,appsettings.json/appsettings.example.json, dead--database(singular) option, and allEnvironment.Exitcalls from business logic.Test coverage
140 tests passing (2 skipped — Windows-only platform tests):
UserConfigServiceTests— 15 tests including 4 forTryLoadLegacyConfigSqlQueryAnalyzerTests— 24 tests including CTE edge cases and known-limitation documentationCsvExportTests— 8 tests againstCsvExporterdirectly (no logic duplication)QueryCommandTests— 11 tests including 9UnescapeInlineQueryedge cases