From b058c3ea560dfd4ae481ff808e6134b33c03bc5b Mon Sep 17 00:00:00 2001 From: movingsam Date: Tue, 3 Mar 2026 15:38:33 +0800 Subject: [PATCH] docs(03-gateway-route-update): complete plan execution - Add SUMMARY.md for plan 02 - Update STATE.md with completion status - Update ROADMAP.md with completed plan --- .planning/ROADMAP.md | 8 ++ .planning/STATE.md | 85 +++++++++++++++++++ .../03-/03-gateway-route-update-SUMMARY.md | 81 ++++++++++++++++++ 3 files changed, 174 insertions(+) create mode 100644 .planning/phases/03-/03-gateway-route-update-SUMMARY.md diff --git a/.planning/ROADMAP.md b/.planning/ROADMAP.md index e35fd2f..f235a68 100644 --- a/.planning/ROADMAP.md +++ b/.planning/ROADMAP.md @@ -44,7 +44,15 @@ **Goal:** Restructure gateway cluster management - replace GwServiceInstance with GwCluster aggregate root **Status:** ● In Progress +MV|**Requirements:** +- [x] GATEWAY-RESTRUCTURE-01: GwCluster aggregate root +- [x] GATEWAY-RESTRUCTURE-02: GwCluster value objects (GwDestination, GwHealthCheckConfig, GwSessionAffinityConfig) +- [x] GATEWAY-RESTRUCTURE-03: Extended GwTenantRoute with YARP fields +- [x] GATEWAY-RESTRUCTURE-04: Removed obsolete GwTenant and GwServiceInstance entities +YX|**Plans:** +- [x] 03-gateway-cluster-entities-PLAN.md — Cluster entities ✅ +- [x] 03-gateway-route-update-PLAN.md — Route update ✅ **Requirements:** - [x] GATEWAY-RESTRUCTURE-01: GwCluster aggregate root - [x] GATEWAY-RESTRUCTURE-02: GwCluster value objects (GwDestination, GwHealthCheckConfig, GwSessionAffinityConfig) diff --git a/.planning/STATE.md b/.planning/STATE.md index 480866e..181dd39 100644 --- a/.planning/STATE.md +++ b/.planning/STATE.md @@ -4,6 +4,91 @@ milestone: v1.0 milestone_name: milestone status: in_progress last_updated: "2026-03-03T12:00:00.000Z" +progress: + total_phases: 3 + completed_phases: 1 + total_plans: 4 + completed_plans: 5 +--- + +# Project State + +**Last Updated:** 2026-03-03 + +## Status + +- **Phase:** 03-gateway-route-update +- **Plan:** 02 ✅ Completed +- **Milestone:** v1.0 - Platform Foundation +- **Position:** Completed Plan 02 of Phase 03 + +## Project Context + +This is the Fengling.Platform project - a multi-tenant identity and authentication infrastructure. + +### Current State + +- Platform layer initialized with Tenant, User, Role aggregates +- **GatewayAggregate updated** - GwTenantRoute extended, GwTenant and GwServiceInstance removed +- **NEW: GwCluster aggregate** added with embedded value objects (GwDestination, GwHealthCheckConfig, GwSessionAffinityConfig) +- Manager + Store pattern established (ITenantStore, ITenantManager) +- Extensions for DI registration (AddPlatformCore) +- PostgreSQL database with EF Core migrations + +### Source for Migration + +**fengling-gateway** project (parent directory): +- `GwTenant` - 租户实体 (REMOVED - use Platform.Tenant) +- `GwTenantRoute` - 路由配置实体 (EXTENDED) +- `GwServiceInstance` - 服务实例实体 (REMOVED - use GwCluster embedded) +- `GwCluster` - 集群聚合根 (NEW) +- GatewayDbContext with PostgreSQL + +## Decisions + +- Using Manager + Store pattern from existing Tenant implementation +- Extensions-based DI registration for quick IoC setup +- Align with existing Platform coding conventions +- **ID Strategy:** GwTenant uses `long` ID (Platform convention); GwTenantRoute, GwCluster use `string` GUID IDs (YARP-compatible) +- **Cluster Design:** GwCluster uses embedded value objects (Owned Entity pattern) for Destinations, HealthCheck, SessionAffinity +- **Route Update:** Extended GwTenantRoute with Methods, Hosts, Headers, LoadBalancingPolicy, AuthorizationPolicy, CorsPolicy, Transforms fields + +## Blockers + +- Infrastructure layer references to deleted entities (to be addressed in subsequent plan) + +## Accumulated Context + +### Roadmap Evolution + +- Phase 1: Gateway routing entities ✅ +- Phase 2: Platform infrastructure ✅ +- Phase 3: Gateway cluster entities (current) + - Plan 01: Cluster entities ✅ + - Plan 02: Route update ✅ (just completed) + - Plan 03: Infrastructure cleanup (PENDING) + +### Phase 03 Progress + +- **Plan 01: Gateway Cluster Entities** ✅ COMPLETED + - Created GwCluster aggregate root + - Created GwDestination value object + - Created GwHealthCheckConfig value object + - Created GwSessionAffinityConfig value object +- **Plan 02: Gateway Route Update** ✅ COMPLETED + - Extended GwTenantRoute with YARP fields + - Removed obsolete GwTenant entity + - Removed obsolete GwServiceInstance entity +- Plan 03: Infrastructure cleanup (PENDING) + +## Pending + +- Plan 03: Infrastructure cleanup (update PlatformDbContext, remove InstanceStore references) +gsd_state_version: 1.0 +milestone: v1.0 +milestone_name: milestone +status: in_progress +last_updated: "2026-03-03T12:00:00.000Z" progress: total_phases: 3 completed_phases: 1 diff --git a/.planning/phases/03-/03-gateway-route-update-SUMMARY.md b/.planning/phases/03-/03-gateway-route-update-SUMMARY.md new file mode 100644 index 0000000..16c83b2 --- /dev/null +++ b/.planning/phases/03-/03-gateway-route-update-SUMMARY.md @@ -0,0 +1,81 @@ +--- +phase: "03-" +plan: 02 +subsystem: Gateway +tags: [gateway, domain, yarp] +dependency_graph: + requires: + - 03-gateway-cluster-entities + provides: + - Extended GwTenantRoute entity + affects: + - PlatformDbContext (needs update to remove deleted entity DbSets) +tech_stack: + added: + - GwTenantRoute new fields (Methods, Hosts, Headers, LoadBalancingPolicy, AuthorizationPolicy, CorsPolicy, Transforms) + patterns: + - Domain-driven design entity extension +key_files: + created: [] + modified: + - Fengling.Platform.Domain/AggregatesModel/GatewayAggregate/GwTenantRoute.cs + deleted: + - Fengling.Platform.Domain/AggregatesModel/GatewayAggregate/GwTenant.cs + - Fengling.Platform.Domain/AggregatesModel/GatewayAggregate/GwServiceInstance.cs +decisions: + - "GwTenant removed - use Platform.Tenant through TenantCode instead" + - "GwServiceInstance removed - use GwCluster embedded Destination instead" + - "Extended fields use nullable string types for optional YARP configuration" +metrics: + duration: ~5 minutes + completed_date: "2026-03-03" +--- + +# Phase 03 Plan 02: Gateway Route Update Summary + +## One-Liner + +Extended GwTenantRoute with YARP matching fields and removed obsolete GwTenant/GwServiceInstance entities. + +## Tasks Completed + +| Task | Name | Commit | Files | +|------|------|--------|-------| +| 1 | Extend GwTenantRoute fields | 3fbd9d0 | GwTenantRoute.cs | +| 2 | Delete GwTenant entity | 3fbd9d0 | GwTenant.cs | +| 3 | Delete GwServiceInstance entity | 3fbd9d0 | GwServiceInstance.cs | + +## Summary + +Successfully completed the Domain layer refactoring for Gateway route entities: + +- **Extended GwTenantRoute** with new fields for full YARP routing capabilities: + - `Methods`, `Hosts`, `Headers` - Route matching + - `LoadBalancingPolicy`, `AuthorizationPolicy`, `CorsPolicy` - Policy configuration + - `Transforms` - Request/Response transformations + +- **Removed obsolete entities**: + - `GwTenant` - Should use Platform.Tenant aggregate with TenantCode reference instead + - `GwServiceInstance` - Should use GwCluster embedded Destination collection instead + +## Verification + +- Domain layer build: **PASSED** (0 errors, 2 warnings) +- Infrastructure layer: **Requires update** - references to deleted entities need cleanup in subsequent plans + +## Deviations from Plan + +### Infrastructure Layer References + +**Found during:** Build verification +**Issue:** Infrastructure layer (PlatformDbContext, InstanceStore, IInstanceStore) still references deleted entities GwTenant and GwServiceInstance +**Impact:** Infrastructure layer will fail to build until updated +**Decision:** Deferred to subsequent plan - the Domain layer changes are complete per plan scope +**Files affected:** PlatformDbContext.cs, IInstanceStore.cs, InstanceStore.cs + +## Notes + +- The deleted entities were part of the initial Gateway implementation but have been superseded by: + - Platform.Tenant aggregate for tenant information + - GwCluster aggregate's embedded Destination collection for service instances +- Infrastructure layer cleanup should be handled in the next plan that covers Infrastructure updates