Skip to content

feat(demo): add ddl and index management workflows#36

Merged
luckydizzier merged 1 commit intomainfrom
codex/2025-10-01_20-50-50_implement-m2-from-demo-tasks
Oct 1, 2025
Merged

feat(demo): add ddl and index management workflows#36
luckydizzier merged 1 commit intomainfrom
codex/2025-10-01_20-50-50_implement-m2-from-demo-tasks

Conversation

@luckydizzier
Copy link
Owner

@luckydizzier luckydizzier commented Oct 1, 2025

Summary

  • add schema DDL preview domain contracts, infrastructure generator, and reactive viewmodel bindings
  • implement filesystem-backed index management with command handlers surfaced through the demo app
  • extend demo tests and helpers to cover schema/index workflows and mark milestone M2 tasks as complete

Testing

  • dotnet format
  • dotnet build xBase.sln -c Release
  • dotnet test xBase.sln --configuration Release

https://chatgpt.com/codex/tasks/task_e_68dd91b73a3483229bb10ff84d9b280a

Summary by CodeRabbit

  • New Features
    • Added Schema Designer to generate preview scripts (up/down) for create, alter, and drop table operations.
    • Added Index Manager to create and drop indexes with status and error feedback.
    • Selected table now syncs automatically to the Schema Designer and Index Manager.
  • Documentation
    • Updated milestone tasks to reflect completed features.
  • Tests
    • Added unit tests for schema preview generation and index management flows.
    • Introduced a shared test host factory and a temporary catalog utility for filesystem-based testing.

Copilot AI review requested due to automatic review settings October 1, 2025 20:51
@coderabbitai
Copy link

coderabbitai bot commented Oct 1, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

Introduces schema DDL preview capability and index lifecycle management across domain, infrastructure, and app layers. Adds new view models, services, records, DI registrations, and tests. ShellViewModel now coordinates table selection with new view models. Test utilities and host factory added. Tasks doc updated to reflect completed items.

Changes

Cohort / File(s) Summary
App DI
src/demo/XBase.Demo.App/DependencyInjection/ServiceCollectionExtensions.cs
Registers SchemaDesignerViewModel and IndexManagerViewModel as singletons.
App ViewModels (Schema)
src/demo/XBase.Demo.App/ViewModels/SchemaDesignerViewModel.cs, .../SchemaColumnViewModel.cs, .../SchemaColumnChangeViewModel.cs
Adds schema designer VM with commands for CREATE/ALTER/DROP previews; column and column-change VMs with conversion to domain definitions.
App ViewModels (Indexes)
src/demo/XBase.Demo.App/ViewModels/IndexManagerViewModel.cs
Adds index manager VM with create/drop commands, busy state, status/error handling, and table targeting.
App Shell integration
src/demo/XBase.Demo.App/ViewModels/ShellViewModel.cs
Injects and exposes new VMs; forwards selected table changes; resets on failures.
Domain Schema Models
src/demo/XBase.Demo.Domain/Schema/DdlPreview.cs, .../Schema/TableSchemaDefinition.cs
Introduces DDL preview record and schema/alteration definitions with enums/records for columns and changes.
Domain Services
src/demo/XBase.Demo.Domain/Services/ISchemaDdlService.cs, .../IIndexManagementService.cs, .../Models/IndexRequests.cs
Adds service interfaces for DDL previews and index management; adds request/result records with validation and factories.
Infrastructure Services
src/demo/XBase.Demo.Infrastructure/Schema/TemplateSchemaDdlService.cs, .../Indexes/FileSystemIndexManagementService.cs
Implements provider-neutral DDL preview service and filesystem-based index create/drop service with logging, validation, and cancellation.
Infrastructure DI
src/demo/XBase.Demo.Infrastructure/ServiceCollectionExtensions.cs
Registers ISchemaDdlService and IIndexManagementService implementations as singletons.
Tests: Host/Utils
tests/XBase.Demo.App.Tests/DemoHostFactory.cs, .../TempCatalog.cs
Adds test host factory and temporary catalog helper for filesystem-backed tests.
Tests: ViewModels
tests/XBase.Demo.App.Tests/IndexManagerViewModelTests.cs, .../SchemaDesignerViewModelTests.cs, .../ShellViewModelTests.cs
Adds tests for index manager and schema designer; updates shell tests to use DemoHostFactory; removes inline host scaffolding.
Docs
src/demo/tasks.md
Marks three M2 tasks as completed.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor User
  participant ShellVM as ShellViewModel
  participant SchemaVM as SchemaDesignerViewModel
  participant DdlSvc as ISchemaDdlService

  User->>ShellVM: Select table
  ShellVM->>SchemaVM: SetTargetTable(table)
  rect rgba(230,245,255,0.6)
    note right of User: Generate CREATE preview
    User->>SchemaVM: Execute GenerateCreatePreviewCommand
    SchemaVM->>DdlSvc: BuildCreateTablePreviewAsync(schema)
    DdlSvc-->>SchemaVM: DdlPreview
    SchemaVM-->>User: PreviewUp/Down set, Operation set
  end

  rect rgba(245,230,255,0.6)
    note right of User: Generate ALTER preview
    User->>SchemaVM: Execute GenerateAlterPreviewCommand
    SchemaVM->>DdlSvc: BuildAlterTablePreviewAsync(alteration)
    DdlSvc-->>SchemaVM: DdlPreview
    SchemaVM-->>User: PreviewUp/Down set, Operation set
  end

  rect rgba(255,240,230,0.6)
    note right of User: Generate DROP preview
    User->>SchemaVM: Execute GenerateDropPreviewCommand
    SchemaVM->>DdlSvc: BuildDropTablePreviewAsync(tableName)
    DdlSvc-->>SchemaVM: DdlPreview
    SchemaVM-->>User: PreviewUp/Down set, Operation set
  end
Loading
sequenceDiagram
  autonumber
  actor User
  participant ShellVM as ShellViewModel
  participant IndexVM as IndexManagerViewModel
  participant IdxSvc as IIndexManagementService
  participant FS as FileSystem

  User->>ShellVM: Select table
  ShellVM->>IndexVM: SetTargetTable(table)

  rect rgba(230,255,240,0.6)
    note right of User: Create index
    User->>IndexVM: Execute CreateIndexCommand
    IndexVM->>IdxSvc: CreateIndexAsync(request)
    IdxSvc->>FS: Write placeholder index file
    FS-->>IdxSvc: OK/Fail
    IdxSvc-->>IndexVM: IndexOperationResult
    IndexVM-->>User: StatusMessage / ErrorMessage
  end

  rect rgba(255,235,230,0.6)
    note right of User: Drop index
    User->>IndexVM: Execute DropIndexCommand(item)
    IndexVM->>IdxSvc: DropIndexAsync(request)
    IdxSvc->>FS: Delete index file
    FS-->>IdxSvc: OK/Fail
    IdxSvc-->>IndexVM: IndexOperationResult
    IndexVM-->>User: StatusMessage / ErrorMessage
  end
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Poem

I tap my paws on schema snow,
DDL flakes in up/down flow.
I nibble indexes, crisp and neat,
Create, then drop— a tidy treat.
With previews bright and logs in sight,
This burrow’s build feels just right. 🐇✨

✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch codex/2025-10-01_20-50-50_implement-m2-from-demo-tasks

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 44579b0 and 143e0b8.

📒 Files selected for processing (20)
  • src/demo/XBase.Demo.App/DependencyInjection/ServiceCollectionExtensions.cs (1 hunks)
  • src/demo/XBase.Demo.App/ViewModels/IndexManagerViewModel.cs (1 hunks)
  • src/demo/XBase.Demo.App/ViewModels/SchemaColumnChangeViewModel.cs (1 hunks)
  • src/demo/XBase.Demo.App/ViewModels/SchemaColumnViewModel.cs (1 hunks)
  • src/demo/XBase.Demo.App/ViewModels/SchemaDesignerViewModel.cs (1 hunks)
  • src/demo/XBase.Demo.App/ViewModels/ShellViewModel.cs (5 hunks)
  • src/demo/XBase.Demo.Domain/Schema/DdlPreview.cs (1 hunks)
  • src/demo/XBase.Demo.Domain/Schema/TableSchemaDefinition.cs (1 hunks)
  • src/demo/XBase.Demo.Domain/Services/IIndexManagementService.cs (1 hunks)
  • src/demo/XBase.Demo.Domain/Services/ISchemaDdlService.cs (1 hunks)
  • src/demo/XBase.Demo.Domain/Services/Models/IndexRequests.cs (1 hunks)
  • src/demo/XBase.Demo.Infrastructure/Indexes/FileSystemIndexManagementService.cs (1 hunks)
  • src/demo/XBase.Demo.Infrastructure/Schema/TemplateSchemaDdlService.cs (1 hunks)
  • src/demo/XBase.Demo.Infrastructure/ServiceCollectionExtensions.cs (2 hunks)
  • src/demo/tasks.md (1 hunks)
  • tests/XBase.Demo.App.Tests/DemoHostFactory.cs (1 hunks)
  • tests/XBase.Demo.App.Tests/IndexManagerViewModelTests.cs (1 hunks)
  • tests/XBase.Demo.App.Tests/SchemaDesignerViewModelTests.cs (1 hunks)
  • tests/XBase.Demo.App.Tests/ShellViewModelTests.cs (1 hunks)
  • tests/XBase.Demo.App.Tests/TempCatalog.cs (1 hunks)

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds DDL and index management workflows to the demo application by implementing schema preview generation, filesystem-based index operations, and reactive viewmodel bindings. The changes complete milestone M2 tasks for basic schema operations.

  • Add schema DDL preview domain contracts and infrastructure generator
  • Implement filesystem-backed index management with command handlers
  • Extend demo app with reactive viewmodels and testing infrastructure

Reviewed Changes

Copilot reviewed 20 out of 20 changed files in this pull request and generated no comments.

Show a summary per file
File Description
tests/XBase.Demo.App.Tests/TempCatalog.cs New test helper for creating temporary catalogs with table/index placeholders
tests/XBase.Demo.App.Tests/ShellViewModelTests.cs Refactored to use shared host factory and extracted TempCatalog
tests/XBase.Demo.App.Tests/SchemaDesignerViewModelTests.cs New tests for DDL preview generation workflows
tests/XBase.Demo.App.Tests/IndexManagerViewModelTests.cs New tests for index create/drop operations
tests/XBase.Demo.App.Tests/DemoHostFactory.cs Shared factory for creating test hosts
src/demo/tasks.md Mark M2 milestone tasks as complete
src/demo/XBase.Demo.Infrastructure/ServiceCollectionExtensions.cs Register new DDL and index management services
src/demo/XBase.Demo.Infrastructure/Schema/TemplateSchemaDdlService.cs DDL script generator implementation
src/demo/XBase.Demo.Infrastructure/Indexes/FileSystemIndexManagementService.cs Filesystem-based index lifecycle service
src/demo/XBase.Demo.Domain/Services/Models/IndexRequests.cs Domain models for index operations
src/demo/XBase.Demo.Domain/Services/ISchemaDdlService.cs Service interface for DDL generation
src/demo/XBase.Demo.Domain/Services/IIndexManagementService.cs Service interface for index management
src/demo/XBase.Demo.Domain/Schema/TableSchemaDefinition.cs Domain models for schema definitions
src/demo/XBase.Demo.Domain/Schema/DdlPreview.cs Domain model for DDL preview results
src/demo/XBase.Demo.App/ViewModels/ShellViewModel.cs Integrate schema designer and index manager viewmodels
src/demo/XBase.Demo.App/ViewModels/SchemaDesignerViewModel.cs Reactive viewmodel for DDL preview generation
src/demo/XBase.Demo.App/ViewModels/SchemaColumnViewModel.cs Viewmodel for column definitions
src/demo/XBase.Demo.App/ViewModels/SchemaColumnChangeViewModel.cs Viewmodel for column change operations
src/demo/XBase.Demo.App/ViewModels/IndexManagerViewModel.cs Reactive viewmodel for index operations
src/demo/XBase.Demo.App/DependencyInjection/ServiceCollectionExtensions.cs Register new viewmodel services

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@luckydizzier luckydizzier merged commit 7b67591 into main Oct 1, 2025
1 check was pending
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants