docs(03-gateway-infrastructure-update): complete plan 03 of phase 03

- Created SUMMARY.md with plan execution details
- Updated STATE.md with current position

Plan 03 COMPLETE - Infrastructure layer updated for GwCluster.
This commit is contained in:
movingsam 2026-03-03 15:48:36 +08:00
parent a6558137af
commit 38f71d7274
2 changed files with 101 additions and 93 deletions

View File

@ -8,7 +8,7 @@ progress:
total_phases: 3
completed_phases: 1
total_plans: 4
completed_plans: 5
completed_plans: 6
---
# Project State
@ -17,10 +17,10 @@ progress:
## Status
- **Phase:** 03-gateway-route-update
- **Plan:** 02 ✅ Completed
- **Phase:** 03-gateway-infrastructure-update
- **Plan:** 03 ✅ Completed
- **Milestone:** v1.0 - Platform Foundation
- **Position:** Completed Plan 02 of Phase 03
- **Position:** Completed Plan 03 of Phase 03
## Project Context
@ -31,8 +31,9 @@ This is the Fengling.Platform project - a multi-tenant identity and authenticati
- 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<TContext>)
- **NEW: IClusterStore/ClusterStore** - Store pattern for GwCluster
- Manager + Store pattern established (ITenantStore, ITenantManager, IRouteStore, IClusterStore)
- Extensions for DI registration (AddPlatformCore<TContext>, AddGatewayCore<TContext>)
- PostgreSQL database with EF Core migrations
### Source for Migration
@ -55,7 +56,7 @@ This is the Fengling.Platform project - a multi-tenant identity and authenticati
## Blockers
- Infrastructure layer references to deleted entities (to be addressed in subsequent plan)
None.
## Accumulated Context
@ -65,8 +66,8 @@ This is the Fengling.Platform project - a multi-tenant identity and authenticati
- 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)
- Plan 02: Route update ✅
- Plan 03: Infrastructure cleanup ✅ (just completed)
### Phase 03 Progress
@ -79,90 +80,11 @@ This is the Fengling.Platform project - a multi-tenant identity and authenticati
- Extended GwTenantRoute with YARP fields
- Removed obsolete GwTenant entity
- Removed obsolete GwServiceInstance entity
- Plan 03: Infrastructure cleanup (PENDING)
- **Plan 03: Infrastructure Update** ✅ COMPLETED
- Updated PlatformDbContext with GwCluster DbSet
- Created IClusterStore/ClusterStore
- Deleted IInstanceStore/InstanceStore
## 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
total_plans: 4
completed_plans: 4
---
# Project State
**Last Updated:** 2026-03-03
## Status
- **Phase:** 03-gateway-cluster-entities
- **Plan:** 01 ✅ Completed
- **Milestone:** v1.0 - Platform Foundation
- **Position:** Completed Plan 01 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 created** with GwTenant, GwTenantRoute, GwServiceInstance entities
- **NEW: GwCluster aggregate** added with embedded value objects (GwDestination, GwHealthCheckConfig, GwSessionAffinityConfig)
- Manager + Store pattern established (ITenantStore, ITenantManager)
- Extensions for DI registration (AddPlatformCore<TContext>)
- PostgreSQL database with EF Core migrations
### Source for Migration
**fengling-gateway** project (parent directory):
- `GwTenant` - 租户实体
- `GwTenantRoute` - 路由配置实体
- `GwServiceInstance` - 服务实例实体 (being replaced by GwCluster)
- `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
## Blockers
None
## Accumulated Context
### Roadmap Evolution
- Phase 1: Gateway routing entities ✅
- Phase 2: Platform infrastructure ✅
- Phase 3: Gateway cluster entities (current)
- Plan 01: Cluster entities ✅ (just completed)
- Plan 02: Infrastructure for cluster (PENDING)
- Plan 03: Gateway route integration (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: Infrastructure (PENDING)
- Plan 03: Gateway route integration (PENDING)
## Pending
- Plan 02: Infrastructure (Store, Manager, DbContext for GwCluster)
- Plan 03: Integration with existing GwTenantRoute
- Plan 04: Gateway DI registration (update DI registration for IClusterStore)

View File

@ -0,0 +1,86 @@
---
phase: "03-"
plan: 03
subsystem: Gateway
tags: [gateway, infrastructure, cluster, store, efcore]
dependency_graph:
requires: [GwCluster (from plan 01)]
provides: [IClusterStore, ClusterStore, PlatformDbContext update]
affects: [Extensions, GatewayExtensions]
tech_stack:
added:
- IClusterStore interface
- ClusterStore<TContext> implementation
patterns:
- Manager + Store pattern (ASP.NET Core Identity style)
- Generic DbContext constraint
- Soft delete
- Owned Entity for embedded collections
key_files:
created:
- Fengling.Platform.Infrastructure/IClusterStore.cs
- Fengling.Platform.Infrastructure/ClusterStore.cs
modified:
- Fengling.Platform.Infrastructure/PlatformDbContext.cs
- Fengling.Platform.Infrastructure/Extensions.cs
- Fengling.Platform.Infrastructure/GatewayExtensions.cs
deleted:
- Fengling.Platform.Infrastructure/IInstanceStore.cs
- Fengling.Platform.Infrastructure/InstanceStore.cs
decisions:
- "IClusterStore follows IRouteStore pattern for consistency"
- "ClusterStore uses soft delete for GwCluster entities"
- "OwnsMany used for embedded Destinations collection in EF Core"
metrics:
duration: ""
completed_date: "2026-03-03"
---
# Phase 03- Plan 03: Gateway Infrastructure Update Summary
## One-Liner
Updated PlatformDbContext with GwCluster DbSet and EF Core configuration, created IClusterStore/ClusterStore to replace obsolete IInstanceStore/InstanceStore.
## Completed Tasks
| Task | Name | Commit | Files |
|------|------|--------|-------|
| 1 | Update PlatformDbContext | a655813 | PlatformDbContext.cs |
| 2 | Create IClusterStore interface | a655813 | IClusterStore.cs |
| 3 | Create ClusterStore implementation | a655813 | ClusterStore.cs |
| 4 | Delete IInstanceStore and InstanceStore | a655813 | IInstanceStore.cs, InstanceStore.cs (deleted) |
## Verification
- [x] PlatformDbContext updated - removed GwTenant/GwServiceInstance DbSets, added GwCluster with EF Core config
- [x] IClusterStore interface created with all CRUD + Destination management methods
- [x] ClusterStore<TContext> implementation created with soft delete support
- [x] Old IInstanceStore/InstanceStore deleted (replaced by IClusterStore)
- [x] Build passes with 0 errors
## Deviations from Plan
**1. [Rule 2 - Auto-add missing functionality] Fixed DI registration references**
- **Found during:** Build verification
- **Issue:** Extensions.cs and GatewayExtensions.cs still referenced deleted IInstanceStore
- **Fix:** Updated both files to register IClusterStore/ClusterStore instead
- **Files modified:** Extensions.cs, GatewayExtensions.cs
**2. [Rule 1 - Auto-fix bug] Fixed EF Core OwnsMany configuration**
- **Found during:** Build verification
- **Issue:** PlatformDbContext had incorrect OwnsMany builder usage
- **Fix:** Corrected configuration to use proper OwnedMany pattern with shadow property for foreign key
- **Files modified:** PlatformDbContext.cs
## Auth Gates
None.
## Notes
The Infrastructure layer is now ready for the next phase:
- GwCluster aggregate is properly configured in DbContext
- IClusterStore follows the established Manager + Store pattern
- All obsolete IInstanceStore references have been removed
- DI registration updated in both Extensions.cs and GatewayExtensions.cs