Skip to content

Conversation

@joshsmithxrm
Copy link
Owner

Summary

  • Tab contrast: Active tabs now use the environment color as background (e.g., Blue background with White text) instead of colored text on DarkGray. Inactive tabs use bright variants of hard-to-read colors (Blue→BrightBlue, Brown→BrightYellow, Gray→White). Adds GetContrastingForeground() and GetBrightForegroundColor() helpers.
  • Escape key UX: Escape no longer closes SQL Query tabs. It stops at returning focus to the query editor — use Ctrl+W to intentionally close tabs. This prevents accidental tab closure when users reflexively press Escape after dismissing dialogs.
  • ObjectDisposedException fix: Added _disposed guard to ProfileCreationDialog.Dispose() to prevent CancellationTokenSource.Cancel() on an already-disposed CTS. Terminal.Gui's Responder.Dispose() can invoke Dispose(true) multiple times.

Test plan

  • Build: 0 warnings, 0 errors (net9.0)
  • TUI unit tests: 346 passed, 0 failed
  • Manual: verify tab contrast with Blue, Red, Green, Cyan, Gray environment colors
  • Manual: verify Escape in SQL tab no longer closes the tab
  • Manual: verify profile creation flow no longer throws ObjectDisposedException

🤖 Generated with Claude Code

joshsmithxrm and others added 30 commits February 7, 2026 18:07
…nsition

Override the terminal's 16-color ANSI palette via OSC 4 escape sequences on
startup so the TUI renders identically regardless of terminal color theme.
Restore the original palette on exit via OSC 104. Respects NO_COLOR and
redirected output.

Wire InitializeAsync completion to the splash screen so it transitions from
"Initializing..." → "Ready" → main menu instead of spinning forever.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The AcquireTokenByUsernamePassword API is deprecated but still functional.
PPDS intentionally supports username/password auth for environments where
interactive auth isn't viable. Added pragma with migration link for future reference.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
ADRs have been superseded by specs. Remove the docs/adr/ directory
and all references to ADR documents across markdown, source code
comments, and config files. Update pointers to use docs/specs/.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Three fixes for multi-environment tab support:

1. SqlQueryScreen.Title now uses captured EnvironmentDisplayName instead
   of Session.CurrentEnvironmentDisplayName, so each tab shows its own
   environment rather than the global session state.

2. OnActiveTabChanged now calls UpdateDisplayedEnvironment to sync the
   status bar with the active tab's environment without persisting to
   profile or pre-warming providers.

3. Tab labels now include environment badge (e.g., [DEV], [PROD]) and
   use environment-tinted colors (red=PROD, yellow=SANDBOX, green=DEV)
   for inactive tabs to visually distinguish environments.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Cover UpdateDisplayedEnvironment, environment capture at screen creation,
SqlQueryScreen title formatting, GetTabScheme color logic, and TabBar
environment type detection from commit 1d9ed05.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The debounce handler on MenuBar.MouseClick fired before MenuBar's
internal MouseEvent() toggle logic, randomly suppressing clicks the
framework needed to maintain open/close state. This is a known
Terminal.Gui v1.x WindowsDriver bug (issues #386, #1848) — fixed
in v2. Added comment documenting the constraint.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
TabBar was positioned at Y=0 overlapping the MenuBar, making it
invisible. Moved to Y=1 so it renders between menu and content area.

KeyboardShortcutsDialog now reads live bindings from IHotkeyRegistry
instead of a hardcoded list, eliminating divergence between registered
hotkeys and what the help dialog displays. Tab management shortcuts
(Ctrl+T, Ctrl+W, Ctrl+Tab, etc.) were registered but never shown.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add persistent environment configuration support with:
- EnvironmentColor enum (13 terminal palette colors)
- EnvironmentConfig model (url, label, type, color)
- EnvironmentConfigCollection (root object for environments.json)
- EnvironmentConfigStore (load/save/get/remove with file-based persistence)
- ProfilePaths additions for environments.json path

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…rehensive unit tests

Introduces the application service layer for environment configuration:
- IEnvironmentConfigService interface with color/type/label resolution
- EnvironmentConfigService with built-in type defaults, URL heuristics,
  and priority-based resolution (explicit > type-default > URL > gray)
- 9 unit tests for EnvironmentConfigStore (CRUD, merge, normalize, round-trip)
- 16 unit tests for EnvironmentConfigService (resolution priority, type defaults)

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

Environment selector now opens a new SQL Query tab on the selected
environment (or switches to an existing tab if one is already open on
that URL). Previously it only updated the session state while the
active tab kept querying its original environment.

Profile switch closes all open tabs since connection pools are
invalidated when credentials change. Returns to main menu.

Added TabManager.FindTabByEnvironment() for tab-by-URL lookup and
CloseAllTabs() for bulk close. SqlQueryScreen constructor now accepts
explicit environmentUrl and displayName for targeted tab creation.

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

Add EnvironmentColor-based overloads to TuiColorPalette for status bar
and tab schemes. Update ITuiThemeService with config-aware methods
(GetStatusBarSchemeForUrl, GetEnvironmentLabelForUrl, GetResolvedColor).
Update TuiStatusBar, TabManager, and TabBar to use configurable colors
instead of hardcoded EnvironmentType detection.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…vice into InteractiveSession

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…bel, type, and color

Add a new dialog accessible from the environment selector that allows
users to configure display settings per environment: custom label, type
classification (Production/Sandbox/etc.), and color override. The dialog
loads existing config from EnvironmentConfigService and persists changes
on save. Also wires a "Configure" button into EnvironmentSelectorDialog.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- TabBar.UpdateHighlight now uses EnvironmentColor instead of
  EnvironmentType, so user-configured colors persist on tab switch
- Config dialog color list adds "(Use type default)" option to avoid
  accidentally persisting an explicit color override
- Shorten type hint text to fit within dialog width

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
TabBar was using a local EnvironmentType-to-string mapping that only
knew URL heuristics, causing all tabs to show [PROD] when environments
share the same regional datacenter (.crm.dynamics.com).

Now uses ITuiThemeService.GetEnvironmentLabelForUrl() which goes through
the full resolution chain: user config → Discovery API type → URL
heuristics. This matches the status bar's label resolution.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The CRM URL suffix (crm, crm2, crm4, crm9, etc.) indicates geographic
region (NA, SA, EMEA, UK), not environment type. A production org can
be on crm4 and a sandbox on crm. Removed the Sandbox/Production
heuristics based on these suffixes from both TuiThemeService and
EnvironmentConfigService.

Keyword detection (dev, test, qa, trial in org name) is retained as
a last-resort hint. The correct source is the Discovery API type
stored in the profile, or explicit user configuration.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Wire UI refresh after EnvironmentConfigDialog saves (ConfigChanged event
  on InteractiveSession, RefreshTabColors on TabManager, handler in TuiShell)
- Fix GetEnvironmentLabelForUrl to check ResolveLabelAsync before type
  abbreviation, so user-configured custom labels are displayed
- Add tab close confirmation when screen has unsaved work (HasUnsavedWork
  on ITuiScreen/TuiScreenBase, MessageBox in NavigateBack)
- Add state capture to EnvironmentConfigDialog (ITuiStateCapture pattern)
- Remove "Coming Soon" menu items and main menu button
- Add tests for RefreshTabColors and ConfigChanged event (173 → 179 tests)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…iew panel, and config access

Environment selector now shows resolved type labels from config service instead
of raw Discovery API types. Added preview panel showing URL, type, label, color,
and config status for selected environment. Configure Environment is now accessible
from Tools menu and status bar right-click, not just the selector dialog. Selecting
an unconfigured environment prompts to set label/type/color with Discovery API type
pre-seeded.

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

Add two missing auth methods to ProfileCreationDialog:
- Certificate Store (Windows-only, thumbprint-based SPN auth)
- Username & Password (ROPC flow with MFA warning)

Dialog redesigned with platform-aware method list, semantic AuthMethod
mapping instead of index-based logic, relative positioning via
Pos.Bottom(), and separate Credentials frame for username/password.

Add explicit Rename button to ProfileSelectorDialog row 1, replacing
the hidden F2-only keyboard shortcut with a discoverable UI element.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Terminal.Gui's Application.Init() sets Colors.Base/TopLevel/Menu/Dialog/Error
to its own built-in theme. Views that fall back to these globals rendered with
terminal default colors on the first frame, only correcting after an environment
switch triggered a redraw. Override all five globals with our TuiColorPalette
immediately after Init() so the first render uses our dark theme.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Two issues caused wrong colors on first load after splash:

1. TuiTerminalPalette.Apply() ran before Application.Init(), so the OSC 4
   palette override was applied to the wrong screen buffer. Moved to after
   Init so it affects the buffer Terminal.Gui actually renders on.

2. Application.Top.ColorScheme was set by Init() to the old Colors.TopLevel
   default. Overriding Colors.TopLevel afterward doesn't retroactively
   update Top's existing reference. Now explicitly set Top.ColorScheme.

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

Environment selector was unconditionally opening a SQL tab when no
matching tab existed, even when the user was on the splash screen with
no tabs open. Now only performs tab navigation when tabs are already
open, letting the user stay on splash and choose what to open next.

Also removes the old main menu transition — splash now stays as the
persistent home screen instead of auto-transitioning after init.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Subclass MenuBar to fix two flicker issues at the correct event channel:
- Alt key toggle: bare Alt can only open menus, not close them (matches
  VS Code/Windows Terminal behavior). Closes via Esc/click instead.
- Mouse click debounce: suppress close events within 300ms of open to
  prevent Windows console driver duplicate event bug.

Consolidate all menu reflection (openedByHotKey, CloseAllMenus) into
PpdsMenuBar. Remove SuppressNextAltMenuFocus hack from HotkeyRegistry
and SqlQueryScreen. HotkeyRegistry now uses Func<bool> for menu-open
check instead of holding a MenuBar reference.

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

Update logo color from BrightGreen to BrightCyan for visual consistency.
Add design doc for smart copy/paste redesign with column-scoped selection.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Redesign copy behavior: Ctrl+C copies single cell value or multi-cell
selection with headers (TSV). Ctrl+Shift+C inverts header behavior.
Selection respects column bounds from MultiSelectedRegions. Status bar
shows self-teaching hints about the alternative shortcut.

Extract shared TableCopyHelper used by both QueryResultsTableView and
DataTableView, replacing duplicated copy logic.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Comprehensive spec for evolving the SQL query engine with execution
plan layer (Volcano model), expression evaluator, TDS Endpoint
acceleration, parallel aggregate partitioning, DML via SQL, metadata
schema, and window functions. Includes 25-task implementation plan
with dependency graph for parallel agent execution.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Status bar now shows context-aware copy shortcuts: single-cell selection
shows "copy value / with header", multi-cell shows "copy with headers /
values only". Updates live as selection changes via SelectedCellChanged.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Foundation for query engine v2 execution plan layer. Introduces
expression tree types (binary, unary, function, case, cast, aggregate)
and statement type hierarchy. No behavioral changes.

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

@github-advanced-security github-advanced-security bot left a comment

Choose a reason for hiding this comment

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

CodeQL found more than 20 potential problems in the proposed changes. Check the Files changed tab for more details.

- Separate test/qa/uat URLs into DetectEnvironmentType_TestKeywords_ReturnsTest
  (was incorrectly grouped under DevKeywords expecting Development)
- Add missing EnvironmentType.Test case to GetEnvironmentLabel test
- Update E2E navigateToSqlQuery helper for expanded frame title with
  Ctrl+Space, Alt+arrows hints
- Update Escape test to verify tab stays open (new behavior)

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

Summary of Changes

Hello @joshsmithxrm, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the TUI (Text User Interface) experience by refining visual elements, improving user interaction, and addressing a critical stability bug. The changes introduce dynamic tab coloring for better contrast and readability, ensuring active environments are clearly distinguishable. User workflow is streamlined by modifying the Escape key's behavior in SQL Query tabs, preventing unintended tab closures and promoting more deliberate actions. Furthermore, a robust fix for an ObjectDisposedException in the profile creation dialog improves the overall reliability and stability of the application during resource management.

Highlights

  • Tab Contrast: Active tabs now use the environment's configured color as their background, providing better visual distinction. Inactive tabs utilize brighter foreground variants of hard-to-read colors for improved readability. New helper methods, GetContrastingForeground() and GetBrightForegroundColor(), were introduced to support this dynamic coloring.
  • Escape Key User Experience: The Escape key's behavior in SQL Query tabs has been modified. Instead of closing the tab, it now returns focus to the query editor. Users should use Ctrl+W for intentional tab closure, preventing accidental data loss when dismissing dialogs.
  • ObjectDisposedException Fix: A _disposed guard has been added to ProfileCreationDialog.Dispose() to prevent CancellationTokenSource.Cancel() from being called on an already-disposed CancellationTokenSource. This addresses a bug where Terminal.Gui's Responder.Dispose() could invoke Dispose(true) multiple times, leading to ObjectDisposedException.
Changelog
  • .github/CODE_SCANNING.md
    • Updated source references for several PPDS analyzer rules (PPDS001-PPDS005, PPDS007) from specific ADR numbers to a general "Architecture" label.
    • Removed the "Architecture (ADRs)" section.
  • .github/codeql/codeql-config.yml
    • Modified a comment related to LINQ style suggestions, removing the specific ADR reference "conflicts with ADR-0024".
  • .github/copilot-instructions.md
    • Removed specific ADR references from section headers related to File I/O, Progress Reporting, and Error Handling.
  • .gitignore
    • Added .muse/ directory to the ignore list.
  • CLAUDE.md
    • Removed specific ADR references from "NEVER" and "ALWAYS" sections.
    • Updated "Key Files" section, replacing docs/adr/ and docs/patterns/ with docs/specs/.
    • Removed references to ADRs in the "Architecture" section.
  • CONTRIBUTING.md
    • Removed specific ADR references from the "Pattern" table.
    • Updated file structure and "Getting Help" sections to refer to docs/specs/ instead of docs/adr/.
  • Directory.Packages.props
    • Added Microsoft.Data.SqlClient with version 5.2.2 to the Azure and Identity item group.
  • README.md
    • Removed the "Architecture Decisions" section and its ADR references.
  • docs/FEATURE_ROADMAP.md
    • Removed specific ADR references from feature descriptions.
    • Removed the "Architecture Decision Records" section.
  • docs/adr/0017_GIT_BRANCHING_STRATEGY.md
    • This file was deleted.
  • docs/adr/README.md
    • This file was deleted.
  • docs/plans/2026-02-07-environment-config.md
    • New file added, detailing a plan to implement user-configurable environment types and colors in the TUI.
  • docs/plans/2026-02-08-accurate-count-star.md
    • New file added, outlining a plan to replace stale COUNT(*) results with accurate partitioned aggregates.
  • docs/plans/2026-02-08-auth-bugfix.md
    • New file added, specifying a plan to fix interactive and device code authentication in TUI profile creation.
  • docs/plans/2026-02-08-code-review-fixes.md
    • New file added, detailing a plan to address various critical and important code review findings.
  • docs/plans/2026-02-08-copy-paste-design.md
    • New file added, outlining a redesign for smart copy/paste behavior in table views.
  • docs/plans/2026-02-08-enable-prefetch-tui.md
    • New file added, detailing a plan to enable prefetch for TUI query execution for smoother scrolling.
  • docs/plans/2026-02-08-intellisense-review-fixes.md
    • New file added, outlining a plan to fix SQL IntelliSense code review issues.
  • docs/plans/2026-02-08-query-engine-v2-fixes.md
    • New file added, detailing a plan for query engine v2 review fixes.
  • docs/plans/2026-02-08-query-engine-v2-followup.md
    • New file added, outlining a plan for query engine v2 follow-up fixes.
  • docs/plans/2026-02-08-query-engine-v2.md
    • New file added, providing a comprehensive specification for Query Engine v2.
  • docs/plans/2026-02-08-sql-intellisense-design.md
    • New file added, detailing the design for SQL IntelliSense and syntax highlighting.
  • docs/plans/2026-02-08-vscode-extension-mvp.md
    • New file added, outlining the plan for a VS Code Extension MVP.
  • docs/plans/2026-02-09-adaptive-aggregate-retry.md
    • New file added, detailing a plan for adaptive aggregate retry in partitioned queries.
  • docs/plans/2026-02-09-auth-di-registration.md
    • New file added, outlining a plan for Auth DI registration.
  • docs/plans/2026-02-09-autocomplete-popup-alignment.md
    • New file added, detailing a plan to fix autocomplete popup alignment.
  • docs/specs/query-engine-v2.md
    • New file added, providing a comprehensive specification for Query Engine v2.
  • extension/README.md
    • Updated the description of the extension's architecture, removing a specific ADR reference.
  • specs/analyzers.md
    • Updated source references for several PPDS analyzer rules from specific ADR numbers to a general "—" label.
  • src/PPDS.Analyzers/PPDS.Analyzers.csproj
    • Removed Microsoft.CodeAnalysis.CSharp.Workspaces package reference.
  • src/PPDS.Auth/Credentials/CredentialProviderFactory.cs
    • Removed the CreateInteractiveProvider method.
    • Updated AuthMethod.DeviceCode case in CreateAsync and Create methods to directly use DeviceCodeCredentialProvider.FromProfile.
  • src/PPDS.Auth/Credentials/DeviceCodeCredentialProvider.cs
    • Added _cachedResultUrl field to track the environment URL associated with the cached authentication result.
    • Modified token caching logic to ensure the cached token's URL matches the target environment URL, preventing scope mismatches.
  • src/PPDS.Auth/Credentials/UsernamePasswordCredentialProvider.cs
    • Added _cachedResultUrl field for cached authentication results.
    • Updated token caching logic to ensure the cached token's URL matches the target environment URL.
    • Added #pragma warning disable CS0618 for AcquireTokenByUsernamePassword as it's deprecated but intentionally used.
  • src/PPDS.Auth/DependencyInjection/ServiceCollectionExtensions.cs
    • New file added: Provides an extension method AddAuthServices to register ProfileStore, EnvironmentConfigStore, and NativeCredentialStore as singletons for DI.
  • src/PPDS.Auth/PPDS.Auth.csproj
    • Added Microsoft.Extensions.DependencyInjection.Abstractions package reference.
  • src/PPDS.Auth/Profiles/EnvironmentColor.cs
    • New enum added: Defines named colors for environment theming, mapping to 16-color terminal palette.
  • src/PPDS.Auth/Profiles/EnvironmentConfig.cs
    • New class added: Represents user-configurable settings for a Dataverse environment, including label, type, and color override.
  • src/PPDS.Auth/Profiles/EnvironmentConfigCollection.cs
    • New class added: Root object for environments.json, holding per-environment configs and custom type defaults.
  • src/PPDS.Auth/Profiles/EnvironmentConfigStore.cs
    • New class added: Manages persistent storage of EnvironmentConfigCollection, including load/save, get/remove config, clear cache, and IDisposable implementation with a disposed guard.
  • src/PPDS.Auth/Profiles/ProfilePaths.cs
    • Added EnvironmentsFileName constant and EnvironmentsFile property for the new environment configuration file.
  • src/PPDS.Auth/Profiles/ProfileResolver.cs
    • Removed ADR reference from remarks.
  • src/PPDS.Cli/Commands/Auth/AuthCommandGroup.cs
    • Updated ExecuteCreateAsync, ExecuteListAsync, ExecuteSelectAsync, ExecuteDeleteAsync, ExecuteUpdateAsync, ExecuteNameAsync, ExecuteClearAsync, ExecuteWhoAsync methods to resolve ProfileStore and ISecureCredentialStore from a local IServiceProvider created via ProfileServiceFactory.CreateLocalProvider(), replacing direct instantiation.
  • src/PPDS.Cli/Commands/Data/ImportCommand.cs
    • Removed ADR reference from comment.
  • src/PPDS.Cli/Commands/Env/EnvCommandGroup.cs
    • Added CreateConfigCommand() and CreateTypeCommand() for managing environment display settings and custom types.
    • Updated ExecuteListAsync, ExecuteSelectAsync, ExecuteWhoAsync, ExecuteConfigSetAsync, ExecuteConfigShowAsync, ExecuteConfigRemoveAsync, ExecuteConfigListAsync, ExecuteTypeDefaultAsync, and ExecuteTypeRemoveAsync to resolve ProfileStore, ISecureCredentialStore, and IEnvironmentConfigService from DI using ProfileServiceFactory.CreateLocalProvider().
  • src/PPDS.Cli/Commands/Query/ExplainCommand.cs
    • New file added: Implements the explain command to show the execution plan for a SQL query without executing it.
  • src/PPDS.Cli/Commands/Query/QueryCommandGroup.cs
    • Added ExplainCommand.Create() to the list of subcommands.
  • src/PPDS.Cli/Commands/Query/SqlCommand.cs
    • Added --explain, --tds, --confirm, --dry-run, and --no-limit options.
    • Updated ExecuteAsync method signature and logic to handle these new options, including showing the execution plan, routing through TDS, and DML safety checks.
  • src/PPDS.Cli/Commands/Serve/Handlers/RpcMethodHandler.cs
    • Updated constructor to accept IServiceProvider authServices.
    • Migrated AuthListAsync, AuthWhoAsync, AuthSelectAsync, EnvListAsync, EnvSelectAsync, PluginsListAsync, WithActiveProfileAsync to resolve ProfileStore and ISecureCredentialStore from _authServices instead of manual instantiation.
  • src/PPDS.Cli/Commands/Serve/ServeCommand.cs
    • Updated ExecuteAsync to create a local IServiceProvider via ProfileServiceFactory.CreateLocalProvider() and pass it to RpcMethodHandler.
  • src/PPDS.Cli/Infrastructure/DaemonConnectionPoolManager.cs
    • Updated DefaultLoadProfilesAsync to use ProfileServiceFactory.CreateLocalProvider() for ProfileStore resolution.
  • src/PPDS.Cli/Infrastructure/ElapsedTimeConsoleFormatter.cs
    • Removed ADR reference from comment.
  • src/PPDS.Cli/Infrastructure/Errors/ErrorCodes.cs
    • Added new Query error codes: AggregateLimitExceeded, DmlBlocked, DmlRowCapExceeded, PlanTimeout, TypeMismatch, MemoryLimitExceeded, CompletionFailed, ValidationFailed.
  • src/PPDS.Cli/Infrastructure/Errors/ExceptionMapper.cs
    • Added using PPDS.Dataverse.Query.Execution;.
    • Added mapping for QueryExecutionException to ExitCodes.Failure and its ErrorCode.
  • src/PPDS.Cli/Infrastructure/Errors/PpdsException.cs
    • Removed ADR reference from remarks.
  • src/PPDS.Cli/Infrastructure/IOperationProgress.cs
    • Removed ADR reference from remarks.
  • src/PPDS.Cli/Infrastructure/IServiceProviderFactory.cs
    • Removed ADR reference from remarks.
  • src/PPDS.Cli/Infrastructure/ProfileServiceFactory.cs
    • Added CreateLocalProvider() static method.
    • Updated CreateFromProfileAsync to use CreateLocalProvider() for ProfileStore and NativeCredentialStore.
    • Removed ADR reference from CreateProviderFromSources comment.
  • src/PPDS.Cli/Infrastructure/Progress/IProgressReporter.cs
    • Removed ADR reference from remarks.
  • src/PPDS.Cli/Plugins/Registration/IPluginRegistrationService.cs
    • Removed ADR references from remarks.
  • src/PPDS.Cli/Plugins/Registration/PluginRegistrationService.cs
    • Removed ADR references from remarks.
  • src/PPDS.Cli/Services/Environment/EnvironmentConfigService.cs
    • New file added: Implements IEnvironmentConfigService for managing environment display settings, including URL heuristics for type detection.
  • src/PPDS.Cli/Services/Environment/EnvironmentService.cs
    • Removed ADR reference from remarks.
  • src/PPDS.Cli/Services/Environment/IEnvironmentConfigService.cs
    • New file added: Defines the interface for managing environment configuration (labels, types, colors).
  • src/PPDS.Cli/Services/Environment/IEnvironmentService.cs
    • Removed ADR reference from remarks.
  • src/PPDS.Cli/Services/Export/ExportService.cs
    • Removed ADR reference from remarks.
  • src/PPDS.Cli/Services/Export/IExportService.cs
    • Removed ADR reference from remarks.
  • src/PPDS.Cli/Services/History/IQueryHistoryService.cs
    • Removed ADR references from remarks.
  • src/PPDS.Cli/Services/History/QueryHistoryService.cs
    • Removed ADR references from remarks.
  • src/PPDS.Cli/Services/ISqlLanguageService.cs
    • New file added: Defines the application service interface for SQL language features (tokenization, completions, validation).
  • src/PPDS.Cli/Services/Profile/IProfileService.cs
    • Removed ADR reference from remarks.
    • Updated CreateProfileAsync signature to include beforeInteractiveAuth parameter.
    • Added AuthMethod, Username, Password properties to ProfileCreateRequest.
  • src/PPDS.Cli/Services/Profile/ProfileService.cs
    • Removed ADR reference from remarks.
    • Updated CreateProfileAsync signature to include beforeInteractiveAuth parameter.
    • Added logic to store ROPC credentials (Username, Password).
    • Updated CreateProfileAsync to set the newly created profile as active.
    • Changed DetermineAuthMethod to internal static and added logic to prioritize request.AuthMethod.
    • Added validation for UsernamePassword auth method.
    • Updated CreateCredentialProvider to pass beforeInteractiveAuth and handle UsernamePassword auth.
  • src/PPDS.Cli/Services/Query/ISqlQueryService.cs
    • Added using PPDS.Dataverse.Query.Planning;.
    • Added ExplainAsync and ExecuteStreamingAsync methods.
  • src/PPDS.Cli/Services/Query/SqlQueryRequest.cs
    • Added UseTdsEndpoint, DmlSafety, EnablePrefetch properties.
  • src/PPDS.Cli/Services/Query/SqlQueryResult.cs
    • Changed TranspiledFetchXml to nullable.
    • Added DmlSafetyResult property.
  • src/PPDS.Cli/Services/Query/SqlQueryResultExpander.cs
    • Updated ExpandFormattedValueColumns to skip expansion for aggregate results.
  • src/PPDS.Cli/Services/Query/SqlQueryService.cs
    • Added various using statements.
    • Updated constructor to accept ITdsQueryExecutor, IBulkOperationExecutor, IMetadataQueryExecutor, poolCapacity.
    • Initialized QueryPlanner, PlanExecutor, DmlSafetyGuard.
    • Rewrote ExecuteAsync to use the new plan execution pipeline, including DML safety checks, aggregate metadata fetching, and plan execution.
    • Implemented ExplainAsync to build and format the execution plan.
    • Implemented ExecuteStreamingAsync for incremental result delivery.
    • Added helper methods FetchAggregateMetadataAsync, InferColumnsFromRow, ExpandStreamingChunk, ExtractPoolCapacity, ExtractEffectiveParallelism.
  • src/PPDS.Cli/Services/Query/SqlQueryStreamChunk.cs
    • New file added: Defines a chunk of streaming query results, including rows, columns, entity name, total rows, completion status, and transpiled FetchXML.
  • src/PPDS.Cli/Services/ServiceRegistration.cs
    • Added using PPDS.Auth.DependencyInjection;, using PPDS.Dataverse.BulkOperations;, using PPDS.Dataverse.Metadata;, using PPDS.Dataverse.Query;.
    • Called services.AddAuthServices().
    • Removed services.AddSingleton<ProfileStore>().
    • Updated ISqlQueryService registration to use a factory method that resolves dependencies and pool.GetTotalRecommendedParallelism().
    • Added ISqlLanguageService registration.
    • Added IEnvironmentConfigService registration.
  • src/PPDS.Cli/Services/SqlLanguageService.cs
    • New file added: Implements ISqlLanguageService by composing SqlSourceTokenizer, SqlCompletionEngine, and SqlValidator.
  • src/PPDS.Cli/Tui/Dialogs/EnvironmentConfigDialog.cs
    • New file added: Dialog for configuring environment display settings (label, type, color).
  • src/PPDS.Cli/Tui/Dialogs/EnvironmentDetailsDialog.cs
    • Added _disposed field and updated Dispose guard.
  • src/PPDS.Cli/Tui/Dialogs/EnvironmentSelectorDialog.cs
    • Added using PPDS.Auth.Profiles;.
    • Increased dialog width and height.
    • Added _previewUrl, _previewType, _previewColor, _previewStatus labels and a previewFrame for displaying environment details.
    • Updated layout to include previewFrame.
    • Added configButton and its OnConfigureClicked handler to open EnvironmentConfigDialog.
    • Updated OnSelectedItemChanged to call UpdatePreviewPanel.
    • Added UpdatePreviewPanel and ResolveDisplayType methods for dynamic preview display.
  • src/PPDS.Cli/Tui/Dialogs/KeyboardShortcutsDialog.cs
    • Added using PPDS.Cli.Tui.Infrastructure;.
    • Replaced Shortcuts with BuiltInShortcuts.
    • Updated constructor to accept IHotkeyRegistry.
    • Added BuildShortcutList, GetScreenScopeName, FormatShortcutsText, GetScopeOrder methods for dynamic shortcut display.
    • Updated CaptureState to use _allShortcuts.
  • src/PPDS.Cli/Tui/Dialogs/ProfileCreationDialog.cs
    • Added using System.Runtime.InteropServices;.
    • Updated _authMethodNames and _authMethods to be dynamically built based on OS and include CertificateStore and UsernamePassword auth methods.
    • Increased dialog height.
    • Added _thumbprintLabel, _thumbprintField, _credFrame, _usernameField, _passwordField for new auth methods.
    • Updated layout to include _credFrame.
    • Updated OnAuthMethodChanged to handle new auth methods and toggle visibility of relevant fields.
    • Updated OnAuthenticateClicked to validate inputs for new auth methods.
    • Updated BuildCreateRequest to include AuthMethod, CertificateThumbprint, Username, Password.
    • Added _disposed field and updated Dispose guard.
  • src/PPDS.Cli/Tui/Dialogs/ProfileSelectorDialog.cs
    • Removed _hintLabel and updated layout accordingly.
    • Added renameButton and its ShowRenameDialog handler.
    • Updated CaptureState to include HasRenameButton.
    • Updated OnClearAllClicked to pass _session to ClearAllProfilesDialog.
  • src/PPDS.Cli/Tui/Helpers/TableCopyHelper.cs
    • New file added: Provides shared logic for smart copy/paste operations in TableViews, handling single/multi-cell selections and optional headers.
  • src/PPDS.Cli/Tui/Infrastructure/EnvironmentType.cs
    • Added Test enum value for test/QA/UAT environments.
  • src/PPDS.Cli/Tui/Infrastructure/HotkeyRegistry.cs
    • Removed SuppressNextAltMenuFocus, SetMenuBar methods and related fields.
    • Added SetMenuOpenCheck method and _isMenuOpen field.
    • Updated TryHandle to use _isMenuOpen and allow Alt+letter combinations for menu accelerators while blocking plain letters.
  • src/PPDS.Cli/Tui/Infrastructure/ITuiThemeService.cs
    • Added using PPDS.Auth.Profiles;.
    • Added GetStatusBarSchemeForUrl, GetEnvironmentLabelForUrl, GetResolvedColor methods for environment-aware theming.
  • src/PPDS.Cli/Tui/Infrastructure/TabManager.cs
    • Added using PPDS.Auth.Profiles;.
    • Updated AddTab to use _themeService.GetResolvedColor and store EnvironmentColor in TabInfo.
    • Added FindTabByEnvironment, CloseAllTabs, RefreshTabColors methods for tab management and color updates.
    • Updated CaptureState to include EnvironmentColor in TabInfoState.
    • Updated TabInfo record to include EnvironmentColor.
  • src/PPDS.Cli/Tui/Infrastructure/TuiColorPalette.cs
    • Added using System.Collections.Generic;, using PPDS.Auth.Profiles;, using PPDS.Dataverse.Sql.Intellisense;.
    • Converted many ColorScheme properties to lazy-initialized static fields for performance.
    • Added StatusBar_Test ColorScheme.
    • Added GetStatusBarScheme(EnvironmentColor envColor), GetForegroundColor(EnvironmentColor envColor), GetContrastingForeground(Color background), GetBrightForegroundColor(EnvironmentColor envColor) for dynamic color resolution.
    • Updated GetTabScheme(EnvironmentType envType, bool isActive) to delegate to GetTabScheme(EnvironmentColor envColor, bool isActive).
    • Added GetTabScheme(EnvironmentColor envColor, bool isActive) for dynamic tab coloring.
    • Added SqlSyntax dictionary and SqlError attribute for SQL syntax highlighting.
    • Renamed ValidateBlueBackgroundRule to ValidateCyanBackgroundRule and updated its logic to reflect new design rules.
  • src/PPDS.Cli/Tui/Infrastructure/TuiOperationProgress.cs
    • Removed ADR reference from remarks.
  • src/PPDS.Cli/Tui/Infrastructure/TuiTerminalPalette.cs
    • New file added: Manages terminal palette override via OSC 4 escape sequences for consistent 16-color appearance across emulators.
  • src/PPDS.Cli/Tui/InteractiveSession.cs
    • Updated constructor to accept EnvironmentConfigStore.
    • Removed _envConfigStore field initialization.
    • Updated GetThemeService to inject _envConfigService.
    • Added EnvironmentConfigService property.
    • Added NotifyConfigChanged method to refresh tab colors.
    • Added _envConfigStore.Dispose() in DisposeAsync.
    • Added pre-load of _envConfigStore in InitializeAsync to prevent UI thread blocking.
  • src/PPDS.Cli/Tui/PpdsApplication.cs
    • Updated Run to create ProfileServiceFactory.CreateLocalProvider() and resolve ProfileStore and EnvironmentConfigStore from it.
    • Disposed _authProvider.
    • Updated InteractiveSession constructor call to pass EnvironmentConfigStore.
  • src/PPDS.Cli/Tui/Screens/SqlQueryScreen.cs
    • Added using PPDS.Cli.Services;.
    • Added _sqlLanguageService, _metadataProvider, _completionCts, _validationCts, _validationTimerToken for IntelliSense and validation.
    • Updated constructor to accept ISqlLanguageService and ICachedMetadataProvider.
    • Rewrote _queryInput to be SyntaxHighlightedTextView for syntax highlighting.
    • Added _autocompletePopup for IntelliSense suggestions.
    • Implemented OnQueryInputChanged, OnQueryInputKeyPress, OnQueryInputMouseClick for IntelliSense trigger, navigation, and application.
    • Added TriggerCompletionsAsync, RunValidationAsync, ShowAutocompletePopup, HideAutocompletePopup, ApplyCompletion, UpdateCompletionWordStart helper methods.
    • Updated OnQueryInputKeyPress to handle Ctrl+Space, Escape, Tab, Enter for autocomplete control.
    • Updated OnQueryInputKeyPress to handle Ctrl+Shift+Up/Down for resizing the query editor.
    • Updated ExecuteQueryAsync to use ExecuteStreamingAsync for incremental result display and handle DML safety results.
    • Updated ExecuteQueryAsync to show elapsed time with a spinner.
    • Added ShowExplainDialog to display query execution plans.
    • Added _editorHeight and _editorHeightOption for editor resizing.
    • Updated Dispose to cancel and dispose CancellationTokenSources and the validation timer.
  • src/PPDS.Cli/Tui/Views/AutocompletePopup.cs
    • New file added: Implements a floating ListView for displaying IntelliSense completion suggestions.
    • Removed kind icon prefix from FormatItem for better visual alignment with typed text.
  • src/PPDS.Cli/Tui/Views/DataTableView.cs
    • Updated EscapeFilterValue to correctly escape ] character for DataView.RowFilter.
  • src/PPDS.Cli/Tui/Views/QueryResultsTableView.cs
    • Updated LoadMoreAsync to broaden exception handling, catching general Exception.
  • src/PPDS.Cli/Tui/Views/SplitterView.cs
    • Updated OnMouseEvent to reset _dragStartScreenY after a drag event, preventing erratic resizing behavior.
  • src/PPDS.Cli/Tui/Views/SyntaxHighlightedTextView.cs
    • New file added: Subclass of TextView that provides SQL syntax highlighting, autocomplete integration, and validation error display.
    • Positioned autocomplete popup at word start column for better visual alignment.
  • src/PPDS.Cli/Tui/Views/TabBar.cs
    • Updated GetTabScheme to use EnvironmentColor for dynamic tab coloring.
    • Updated DrawTab to use EnvironmentColor for tab background and foreground.
  • src/PPDS.Dataverse/Metadata/CachedMetadataProvider.cs
    • Updated InvalidateAll to dispose and clear semaphore dictionaries, preventing resource leaks.
  • src/PPDS.Dataverse/Metadata/ICachedMetadataProvider.cs
    • New file added: Defines the interface for a cached metadata provider, including methods for entities, attributes, relationships, and cache management.
  • src/PPDS.Dataverse/Query/Execution/ExpressionEvaluator.cs
    • Removed VariableScope property to ensure thread safety; SqlQueryService now creates a per-execution evaluator.
  • src/PPDS.Dataverse/Query/Execution/PlanExecutor.cs
    • New file added: Executes a query plan tree, consuming rows from IQueryPlanNodes.
  • src/PPDS.Dataverse/Query/Execution/QueryExecutionException.cs
    • New file added: Custom exception for structured query execution errors, including an ErrorCode.
  • src/PPDS.Dataverse/Query/Execution/QueryPlanResult.cs
    • New file added: Represents the result of query planning, including the root plan node, FetchXML, and virtual columns.
  • src/PPDS.Dataverse/Query/Execution/QueryRow.cs
    • New file added: Represents a single row of data flowing through the execution plan.
  • src/PPDS.Dataverse/Query/IQueryExecutor.cs
    • Updated GetTotalRecordCountAsync to be a regular interface method (removed default implementation).
    • Added GetMinMaxCreatedOnAsync for retrieving min/max createdon dates for aggregate partitioning.
  • src/PPDS.Dataverse/Query/Planning/AdaptiveAggregateScanNode.cs
    • New file added: Wraps a FetchXML aggregate scan with adaptive retry logic, splitting date ranges recursively on 50K aggregate limit errors.
  • src/PPDS.Dataverse/Query/Planning/IQueryPlanNode.cs
    • New file added: Defines the interface for a node in the query execution plan tree (Volcano/iterator model).
  • src/PPDS.Dataverse/Query/Planning/Nodes/ClientFilterNode.cs
    • New file added: Filters rows client-side based on a SQL condition.
  • src/PPDS.Dataverse/Query/Planning/Nodes/CountOptimizedNode.cs
    • New file added: Optimizes COUNT(*) queries using RetrieveTotalRecordCountRequest.
  • src/PPDS.Dataverse/Query/Planning/Nodes/DmlExecuteNode.cs
    • New file added: Executes DML operations (INSERT, UPDATE, DELETE) using IBulkOperationExecutor.
  • src/PPDS.Dataverse/Query/Planning/Nodes/FetchXmlScanNode.cs
    • Updated PrepareFetchXmlForExecution to handle top and page attribute conflict, converting top to count.
    • Narrowed bare catch to XmlException in PrepareFetchXmlForExecution.
  • src/PPDS.Dataverse/Query/Planning/Nodes/MergeAggregateNode.cs
    • New file added: Merges partial aggregate results from multiple partitions.
  • src/PPDS.Dataverse/Query/Planning/Nodes/MetadataScanNode.cs
    • Made MetadataExecutor nullable to correctly reflect deferred resolution.
  • src/PPDS.Dataverse/Query/Planning/Nodes/ParallelPartitionNode.cs
    • Removed aggregate-limit wrapping logic, as AdaptiveAggregateScanNode now handles per-partition retries.
    • Disposed SemaphoreSlim to prevent resource leaks.
  • src/PPDS.Dataverse/Query/Planning/Nodes/PrefetchScanNode.cs
    • New file added: Implements page-ahead buffering for FetchXmlScanNode to enable zero-wait scrolling.
  • src/PPDS.Dataverse/Query/Planning/Nodes/ProjectNode.cs
    • New file added: Handles column selection, renaming, and expression evaluation in the execution plan.
  • src/PPDS.Dataverse/Query/Planning/Partitioning/DateRangePartitioner.cs
    • New file added: Partitions date ranges for parallel aggregate queries.
  • src/PPDS.Dataverse/Query/Planning/PlanFormatter.cs
    • New file added: Formats query execution plans for display (e.g., in EXPLAIN output).
  • src/PPDS.Dataverse/Query/Planning/QueryPlanContext.cs
    • New file added: Provides shared context for query plan execution, including connection pool, expression evaluator, and cancellation token.
  • src/PPDS.Dataverse/Query/Planning/QueryPlanDescription.cs
    • New file added: Describes a query execution plan for display purposes.
  • src/PPDS.Dataverse/Query/Planning/QueryPlanOptions.cs
    • New file added: Defines options for query planning, such as max rows, paging, TDS endpoint usage, and DML safety.
  • src/PPDS.Dataverse/Query/Planning/QueryPlanner.cs
    • Rewrote Plan method to use the new plan execution pipeline, handling DML, metadata, and aggregate queries.
    • Removed IsBareCountStar short-circuit.
    • Updated PlanAggregateWithPartitioning to wrap each partition in AdaptiveAggregateScanNode.
    • Added PlanMetadataQuery, PlanInsert, PlanUpdate, PlanDelete methods.
    • Integrated PrefetchScanNode for SELECT queries.
  • src/PPDS.Dataverse/Query/QueryExecutor.cs
    • Implemented GetTotalRecordCountAsync using RetrieveTotalRecordCountRequest.
    • Implemented GetMinMaxCreatedOnAsync using FetchXML aggregate queries for min/max createdon.
  • src/PPDS.Dataverse/Sql/Ast/ISqlStatement.cs
    • New file added: Base interface for all SQL statement types.
  • src/PPDS.Dataverse/Sql/Ast/SqlBlockStatement.cs
    • New file added: Represents a BEGIN...END block in SQL.
  • src/PPDS.Dataverse/Sql/Ast/SqlDeleteStatement.cs
    • New file added: Represents a DELETE SQL statement.
  • src/PPDS.Dataverse/Sql/Ast/SqlExpression.cs
    • New file added: Defines the AST hierarchy for SQL expressions (literals, columns, binary, unary, functions, CASE, IIF, CAST, aggregates, subqueries).
  • src/PPDS.Dataverse/Sql/Ast/SqlIfStatement.cs
    • New file added: Represents an IF...ELSE SQL statement.
  • src/PPDS.Dataverse/Sql/Ast/SqlInsertStatement.cs
    • New file added: Represents an INSERT SQL statement.
  • src/PPDS.Dataverse/Sql/Ast/SqlSelectStatement.cs
    • Added HasAggregates property to detect aggregate queries.
  • src/PPDS.Dataverse/Sql/Ast/SqlUpdateStatement.cs
    • New file added: Represents an UPDATE SQL statement.
  • src/PPDS.Dataverse/Sql/Intellisense/AutocompletePopup.cs
    • Removed kind icon prefix from FormatItem for better visual alignment with typed text.
  • src/PPDS.Dataverse/Sql/Intellisense/CachedMetadataProvider.cs
    • Updated InvalidateAll to dispose and clear semaphore dictionaries, preventing resource leaks.
  • src/PPDS.Dataverse/Sql/Intellisense/ICachedMetadataProvider.cs
    • New file added: Defines the interface for a cached metadata provider, including methods for entities, attributes, relationships, and cache management.
  • src/PPDS.Dataverse/Sql/Intellisense/SqlCompletionEngine.cs
    • Updated attribute lookup to handle exceptions gracefully during metadata retrieval.
  • src/PPDS.Dataverse/Sql/Intellisense/SqlCursorContext.cs
    • Narrowed bare catch clauses to specific exceptions (OperationCanceledException, Exception) for better error handling.
  • src/PPDS.Dataverse/Sql/Intellisense/SqlSourceTokenizer.cs
    • Narrowed bare catch clause to specific exceptions for robust tokenization.
  • src/PPDS.Dataverse/Sql/Intellisense/SqlValidator.cs
    • Fixed ValidateConditionColumns to be async and await all calls, resolving a fire-and-forget issue.
    • Sealed SqlValidator class.
    • Improved FindIdentifierPosition to accept a search-start hint for more accurate error positioning.
  • src/PPDS.Dataverse/Sql/Parsing/SqlParser.cs
    • Updated ParseStatement to return ISqlStatement, supporting the new AST hierarchy.
  • src/PPDS.Dataverse/Sql/Transpilation/SqlToFetchXmlTranspiler.cs
    • Removed TranspileWithVirtualColumns method, as virtual column expansion is now handled in the service layer.
  • src/PPDS.Mcp/Infrastructure/McpConnectionPoolManager.cs
    • Updated constructor to accept ProfileStore via dependency injection.
  • src/PPDS.Mcp/Infrastructure/McpToolContext.cs
    • Updated constructor to accept ProfileStore and ISecureCredentialStore via dependency injection.
  • src/PPDS.Mcp/Program.cs
    • Added builder.Services.AddAuthServices() to register authentication services in the host DI container.
  • tests/PPDS.Cli.Tests/Commands/Query/ExplainCommandTests.cs
    • New file added: Provides integration tests for the explain CLI command, covering plan output, error handling, and DML plan inspection.
  • tests/PPDS.Cli.Tests/Services/Environment/EnvironmentConfigServiceTests.cs
    • New file added: Provides unit tests for EnvironmentConfigService, covering color/type resolution priority and URL heuristics.
  • tests/PPDS.Cli.Tests/Services/Environment/EnvironmentConfigStoreTests.cs
    • Added test for null-clear behavior in SaveConfigAsync.
  • tests/PPDS.Cli.Tests/Services/Profile/ProfileServiceTests.cs
    • Added tests for ProfileCreateRequest.AuthMethod property and DetermineAuthMethod logic.
  • tests/PPDS.Cli.Tests/Services/Query/SqlQueryServiceTests.cs
    • Added test for DML safety guard in the streaming path.
    • Added test to verify EnablePrefetch produces PrefetchScanNode in the plan.
  • tests/PPDS.Cli.Tests/Tui/MultiEnvironmentSessionTests.cs
    • Updated TabInfo constructor calls to include the new EnvironmentColor parameter.
  • tests/PPDS.Cli.Tests/Tui/SqlValidatorTests.cs
    • Added tests for WHERE column diagnostics to ensure proper validation of unknown columns.
  • tests/PPDS.Cli.Tests/Tui/TuiColorPaletteTests.cs
    • Updated ValidateBlueBackgroundRule to ValidateCyanBackgroundRule to align with new design rules for cyan backgrounds.
  • tests/PPDS.Dataverse.Tests/Query/Planning/Nodes/AdaptiveAggregateScanNodeTests.cs
    • New file added: Provides unit and integration-style tests for AdaptiveAggregateScanNode, verifying its recursive retry logic on 50K aggregate limit errors.
  • tests/PPDS.Dataverse.Tests/Query/Planning/Nodes/CountOptimizedNodeTests.cs
    • Updated tests to reflect the new behavior where CountOptimizedNode is not the default path for bare COUNT(*).
  • tests/PPDS.Dataverse.Tests/Query/Planning/Nodes/FetchXmlScanNodeTests.cs
    • Added tests for top and page attribute conflict resolution in FetchXML generation.
  • tests/PPDS.Dataverse.Tests/Query/Planning/Nodes/ParallelPartitionNodeTests.cs
    • Removed tests for aggregate-limit wrapping, as this logic is now handled by AdaptiveAggregateScanNode.
  • tests/PPDS.Dataverse.Tests/Query/Planning/QueryPlannerTests.cs
    • Updated tests for Plan_BareCountStar_* to reflect the new aggregate path behavior.
  • tests/PPDS.Dataverse.Tests/Query/QueryExecutorTests.cs
    • Added tests for GetTotalRecordCountAsync and GetMinMaxCreatedOnAsync methods.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Replace `as` casts followed by `.Should().NotBeNull()` and null-forgiving
operator with direct casts across 10 test files. Direct casts throw
InvalidCastException on failure (equivalent test behavior) and eliminate
185 cs/dereferenced-value-may-be-null CodeQL alerts.

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

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request is very large and combines many unrelated changes, including major architectural refactoring of the query engine, documentation cleanup, and various TUI fixes and features. The title and description are misleading and only cover a small fraction of the changes. This makes the PR very difficult to review and violates the principle of small, focused pull requests. I'll recommend splitting it into multiple smaller PRs. My review will focus on the most significant issues found within the provided code patches.

joshsmithxrm and others added 11 commits February 9, 2026 16:07
SqlParser.Parse() already returns SqlSelectStatement, making the
explicit casts unnecessary. Resolves 12 CodeQL useless-cast-to-self alerts.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The (object?)null casts are unnecessary since the tuple element type is
already object?, so null is implicitly typed correctly. Resolves 12
CodeQL useless-upcast alerts across 5 test files.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Resolve CodeQL cs/useless-assignment-to-local alerts by removing or
discarding variables that are assigned but never read:

- TuiShell: remove unused `active` and `profile` locals in profile refresh methods
- SyntaxHighlightedTextView: use discard for fire-and-forget async, remove unused `subFrame`
- EnvironmentDetailsDialog: remove unused `region` variable
- TdsQueryExecutor: declare `columns` without initializing to empty list (reassigned before use)
- Test files: use `var _` discard in `await foreach` loops where row is not consumed

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Convert manual Dispose() calls to using-var declarations so disposable
objects are deterministically cleaned up even when assertions throw
before the explicit Dispose() is reached.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add `using` declarations to IDisposable locals that were not being
disposed: ContextMenu in DataTableView and CancellationTokenSource in
six test files. Resolves CodeQL local-not-disposed alerts.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace inefficient ContainsKey followed by indexer lookup with single
TryGetValue call in VariableScope and across test assertions. Resolves
CodeQL inefficient-containskey alerts.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add CodeQL suppression comments for intentional exact float comparisons:
- ExpressionEvaluator: divide-by-zero guards comparing double to 0.0
- CastConverter: SQL BIT cast checking float/double against zero

These are correct SQL semantics where exact equality is intended.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- DateFunctions: cast int to double before multiplication to prevent precision loss
- CachedMetadataProvider: document double-check-lock pattern for CodeQL
- EnvironmentConfigService: document nullable coalescing reachability
- EnvironmentSelectorDialog: extract complex condition to named booleans
- EnvironmentConfigDialog: add missing XML summary on constructor
- TuiDialog: suppress virtual-call-in-constructor (Terminal.Gui pattern)
- DataTableView: suppress virtual-call-in-constructor (Terminal.Gui pattern)
- DataverseConnectionPool: document intentional static field write under lock
- UsernamePasswordCredentialProvider: document intentional obsolete API usage

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- MetadataScanNodeTests: assert on collected rows list to avoid unused-collection
- ClientWindowNodeTests: add Assert.Fail guard so result list is not flagged unused
- QueryExecutorTests: assert capturedQueries.Count to validate query execution
- ParallelPartitionNodeTests: document intentional static concurrency tracking
- EnvironmentServiceTests: catch specific IOException instead of bare catch
- ProfileServiceTests: catch specific IOException instead of bare catch

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Restructure EnvironmentConfigService null checks to clarify flow for
static analysis. Fix test assertions using BeOfType<> instead of as-cast
with null-forgiving. Remove unused list variable in cancellation test.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@joshsmithxrm joshsmithxrm merged commit b883eac into main Feb 9, 2026
16 checks passed
@joshsmithxrm joshsmithxrm deleted the fix/tui-colors branch February 9, 2026 23:49
@github-project-automation github-project-automation bot moved this from Todo to Done in PPDS Roadmap Feb 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants