refactor(core): align with cordis spatiotemporal composability architecture

- Purify core micro-kernel by removing context hardcoded helpers and reverse dependencies
- Eliminate init() side effects in infra plugins with reversible lifecycle disposal
- Completely isolate plugins by removing cross-plugin imports and using core/contracts
- Introduce TaskService and RiskControlService contracts for unified cross-plugin APIs
- Regenerate Swagger documentation and update developer guide matrix
- Achieve 0 violations in check_cordis_architecture.sh and 100% test pass
This commit is contained in:
ryan
2026-08-28 15:05:31 +08:00
parent fc7fae7b0e
commit 299ac30ee4
150 changed files with 4328 additions and 2923 deletions
+6 -6
View File
@@ -8,11 +8,11 @@ import (
"strings"
"sync"
"gorm.io/gorm"
"Wavelet/core"
"Wavelet/core/contracts"
"Wavelet/pkg/util"
database "Wavelet/plugins/infra/database"
"gorm.io/gorm"
)
var (
@@ -20,7 +20,8 @@ var (
dbSvc contracts.DBService
)
func setDBService(s contracts.DBService) {
// SetDBService sets the active DBService contract for the user domain plugin.
func SetDBService(s contracts.DBService) {
dbMu.Lock()
defer dbMu.Unlock()
dbSvc = s
@@ -28,7 +29,7 @@ func setDBService(s contracts.DBService) {
func getDB(ctx context.Context) *gorm.DB {
if c, ok := ctx.(*core.Context); ok && c != nil {
if s := c.DB(); s != nil {
if s, err := core.Inject[contracts.DBService](c); err == nil && s != nil {
return s.DB(ctx)
}
}
@@ -40,8 +41,7 @@ func getDB(ctx context.Context) *gorm.DB {
return s.DB(ctx)
}
// Fallback for standalone CLI commands running without core.App
return database.DB(ctx)
return nil
}
// GetUserByID 通过 ID 获取用户