Skip to content

refactor: update package versions, remove deprecated endpoints, and c…#90

Merged
foxminchan merged 1 commit into
mainfrom
docs/enhance-docs
Jul 28, 2025
Merged

refactor: update package versions, remove deprecated endpoints, and c…#90
foxminchan merged 1 commit into
mainfrom
docs/enhance-docs

Conversation

@foxminchan

@foxminchan foxminchan commented Jul 28, 2025

Copy link
Copy Markdown
Owner

…lean up unused code

Pull Request Description

Checklist

  • My code follows the DDD principles
  • I've used the latest C# features and idioms
  • I've added/updated unit tests for business logic
  • Service boundaries are maintained (no cross-service direct dependencies)
  • Repository pattern is used for data access
  • Domain Events are used for cross-service communication
  • I've registered new services in AppHost project (if applicable)
  • I've updated both entities and DTOs (if applicable)

Summary by CodeRabbit

  • Deprecations

    • Marked the GET endpoint at /api/v1/order-state-machine as deprecated in API documentation and OpenAPI specs.
    • Added a deprecation notice to the related query documentation.
  • Removals

    • Removed the order state machine API endpoint and its related query and handler from the Finance service.
    • Deleted associated unit tests for the removed endpoint and query.
    • Removed dashboard integration and related extensions.
    • Eliminated various middleware and service registrations, including CORS, OpenAPI, authentication, rate limiting, and MediatR from the Finance service.
    • Removed persistence service extension and related project/package references.
  • Bug Fixes

    • Logging was removed from rate limiting rejection and idempotency request creation to streamline behavior.
  • Chores

    • Updated and cleaned up package dependencies, removing unused packages and updating versions where necessary.

Copilot AI review requested due to automatic review settings July 28, 2025 05:06
@coderabbitai

coderabbitai Bot commented Jul 28, 2025

Copy link
Copy Markdown

Caution

Review failed

The pull request is closed.

Walkthrough

This update removes the "GetOrderState" API endpoint, its supporting query, handler, and related tests from the Finance service. Associated OpenAPI specs, documentation, and deprecation notices are updated. Several package references are removed or updated, and various middleware, logging, and dashboard features are stripped from the app host and service registration. Some constructors and extension points are simplified, focusing the Finance service on core persistence and saga state machine functionality.

Changes

Cohort / File(s) Change Summary
Finance Service: Remove GetOrderState Endpoint, Query, Handler, and Tests
src/Services/Finance/BookWorm.Finance/Feature/GetOrderStateEndpoint.cs, src/Services/Finance/BookWorm.Finance/Feature/GetOrderStateQuery.cs, src/Services/Finance/BookWorm.Finance.UnitTests/GetOrderStateEndpointTests.cs, src/Services/Finance/BookWorm.Finance.UnitTests/GetOrderStateQueryTests.cs
Deleted the endpoint, query, handler, and all related unit tests for the "GetOrderState" feature in the Finance service.
Finance Service: Remove Persistence Extension
src/Services/Finance/BookWorm.Finance/Infrastructure/Extensions.cs
Deleted the extension class and method for registering persistence services in the Finance service.
Finance Service: Update Service Registration and Middleware
src/Services/Finance/BookWorm.Finance/Extensions/Extensions.cs, src/Services/Finance/BookWorm.Finance/Program.cs
Refactored service registration to remove CORS, OpenAPI, authentication, rate limiting, MediatR, metrics, and custom endpoints. Focused on database context setup and saga state machine registration. Simplified middleware pipeline, removing CORS, timeouts, Keycloak, rate limiting, and OpenAPI UI.
OpenAPI and Documentation Deprecation
docs/eventcatalog/domains/Store/subdomains/Orders/services/FinanceService/openapi-v1.yml, docs/eventcatalog/openapi-files/finance-api.yml, docs/eventcatalog/domains/Store/subdomains/Orders/services/FinanceService/queries/GetOrderStateMachine/index.mdx
Marked the "/api/v1/order-state-machine" GET endpoint as deprecated in OpenAPI specs and added a deprecation notice in the query documentation.
App Host: Remove Dashboard and OpenAPI Registration
src/Aspire/BookWorm.AppHost/AppHost.cs, src/Aspire/BookWorm.AppHost/Extensions/Infrastructure/DashboardExtensions.cs
Removed dashboard container registration and OpenAPI documentation for the finance API from the app host. Deleted dashboard extension class.
Rate Limiter and Idempotency: Remove Logging and HtmlSanitizer
src/Aspire/BookWorm.ServiceDefaults/Kestrel/RateLimiterExtensions.cs, src/BuildingBlocks/BookWorm.Chassis/BookWorm.Chassis.csproj, src/Services/Ordering/BookWorm.Ordering/Infrastructure/Idempotency/RequestManager.cs
Removed logging and HtmlSanitizer dependencies from rate limiter rejection and request manager. Updated constructor signatures and removed related code.
Project and Package Reference Clean-up
Directory.Packages.props, src/Services/Finance/BookWorm.Finance/BookWorm.Finance.csproj
Removed or updated package references: removed HtmlSanitizer and MassTransit.StateMachineVisualizer, upgraded Marten.AspNetCore.

Sequence Diagram(s)

sequenceDiagram
    participant Client
    participant FinanceAPI
    participant (Removed) GetOrderStateEndpoint
    participant (Removed) GetOrderStateHandler

    %% Old flow (now removed)
    Client->>FinanceAPI: GET /order-state-machine
    FinanceAPI->>GetOrderStateEndpoint: HandleAsync()
    GetOrderStateEndpoint->>GetOrderStateHandler: Handle(query)
    GetOrderStateHandler-->>GetOrderStateEndpoint: DOT string
    GetOrderStateEndpoint-->>FinanceAPI: 200 OK (DOT string)
    FinanceAPI-->>Client: Response

    %% New flow (after removal)
    Client->>FinanceAPI: GET /order-state-machine
    FinanceAPI-->>Client: 404 Not Found (Endpoint deprecated/removed)
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Suggested labels

.NET

Poem

Out with the old, the state machine’s gone,
Endpoints and queries have all moved on.
Docs now warn, “This path’s deprecated!”
Tests and handlers, all vacated.
Middleware trimmed, the dashboard’s no more—
Clean and focused, the code we restore!
🚀

Note

⚡️ Unit Test Generation is now available in beta!

Learn more here, or try it out under "Finishing Touches" below.


📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 01ab07d and d24dddd.

📒 Files selected for processing (17)
  • Directory.Packages.props (1 hunks)
  • docs/eventcatalog/domains/Store/subdomains/Orders/services/FinanceService/openapi-v1.yml (1 hunks)
  • docs/eventcatalog/domains/Store/subdomains/Orders/services/FinanceService/queries/GetOrderStateMachine/index.mdx (1 hunks)
  • docs/eventcatalog/openapi-files/finance-api.yml (1 hunks)
  • src/Aspire/BookWorm.AppHost/AppHost.cs (0 hunks)
  • src/Aspire/BookWorm.AppHost/Extensions/Infrastructure/DashboardExtensions.cs (0 hunks)
  • src/Aspire/BookWorm.ServiceDefaults/Kestrel/RateLimiterExtensions.cs (0 hunks)
  • src/BuildingBlocks/BookWorm.Chassis/BookWorm.Chassis.csproj (0 hunks)
  • src/Services/Finance/BookWorm.Finance.UnitTests/GetOrderStateEndpointTests.cs (0 hunks)
  • src/Services/Finance/BookWorm.Finance.UnitTests/GetOrderStateQueryTests.cs (0 hunks)
  • src/Services/Finance/BookWorm.Finance/BookWorm.Finance.csproj (0 hunks)
  • src/Services/Finance/BookWorm.Finance/Extensions/Extensions.cs (2 hunks)
  • src/Services/Finance/BookWorm.Finance/Feature/GetOrderStateEndpoint.cs (0 hunks)
  • src/Services/Finance/BookWorm.Finance/Feature/GetOrderStateQuery.cs (0 hunks)
  • src/Services/Finance/BookWorm.Finance/Infrastructure/Extensions.cs (0 hunks)
  • src/Services/Finance/BookWorm.Finance/Program.cs (0 hunks)
  • src/Services/Ordering/BookWorm.Ordering/Infrastructure/Idempotency/RequestManager.cs (2 hunks)
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch docs/enhance-docs

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@foxminchan
foxminchan merged commit 8ea121d into main Jul 28, 2025
2 of 3 checks passed
@foxminchan
foxminchan deleted the docs/enhance-docs branch July 28, 2025 05:06

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 performs a comprehensive cleanup by removing deprecated endpoints, updating package versions, and eliminating unused code dependencies. The primary focus is on removing the GetOrderStateMachine feature from the Finance service and cleaning up related infrastructure.

Key Changes:

  • Removed the deprecated GetOrderStateMachine endpoint and its associated query handler from the Finance service
  • Eliminated unused package dependencies (HtmlSanitizer, MassTransit.StateMachineVisualizer)
  • Updated Marten.AspNetCore package version from 8.3.3 to 8.4.0
  • Streamlined service configurations by removing redundant middleware and endpoint mappings

Reviewed Changes

Copilot reviewed 17 out of 17 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
RequestManager.cs Removed unused logger dependency and HtmlSanitizer usage, simplified error handling
Finance/Program.cs Removed redundant middleware configurations and endpoint mappings
Finance/Infrastructure/Extensions.cs Deleted entire file containing persistence service configuration
GetOrderStateQuery.cs Removed deprecated query handler for order state machine visualization
GetOrderStateEndpoint.cs Removed deprecated REST endpoint for order state machine
Finance/Extensions/Extensions.cs Consolidated persistence services configuration and removed unused dependencies
Finance project files Removed MassTransit.StateMachineVisualizer package reference and associated unit tests
BookWorm.Chassis.csproj Removed HtmlSanitizer package reference
RateLimiterExtensions.cs Removed HtmlSanitizer usage from rate limiting logging
DashboardExtensions.cs Removed custom dashboard configuration
AppHost.cs Removed Finance API from OpenAPI configuration and custom dashboard setup
Documentation files Marked GetOrderStateMachine endpoint as deprecated in OpenAPI specs and EventCatalog
Directory.Packages.props Updated Marten version and removed unused package references

@@ -1,4 +1,4 @@
using BookWorm.Chassis.Mediator;
using BookWorm.Constants.Aspire;

Copilot AI Jul 28, 2025

Copy link

Choose a reason for hiding this comment

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

The using statement for BookWorm.Chassis.Mediator was removed but several related services that likely depend on it (like CommandHandlerMetrics, QueryHandlerMetrics, IActivityScope) were also removed. However, GlobalExceptionHandler is still being registered but its dependency chain should be verified to ensure it doesn't require the removed mediator services.

Copilot uses AI. Check for mistakes.
@netlify

netlify Bot commented Jul 28, 2025

Copy link
Copy Markdown

Deploy Preview for bookwormdev canceled.

Name Link
🔨 Latest commit d24dddd
🔍 Latest deploy log https://app.netlify.com/projects/bookwormdev/deploys/68870549ef49f60008bb4350

@sonarqubecloud

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot mentioned this pull request Oct 2, 2025
8 tasks
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.

2 participants