fix(codex): -print-codex-config 读取未经 SQLite 覆盖的半成品配置——抽取 BootstrapPersistence 共享持久化引导#83
Open
KasumiNova wants to merge 1 commit into
Open
fix(codex): -print-codex-config 读取未经 SQLite 覆盖的半成品配置——抽取 BootstrapPersistence 共享持久化引导#83KasumiNova wants to merge 1 commit into
KasumiNova wants to merge 1 commit into
Conversation
…sistence 共享持久化引导 根因:所有 -print-* 子命令在 SQLite 覆盖(cfg = *dbCfg)发生前就退出,而覆盖 逻辑只内联在 runTransform 内,导致 WebUI 编辑后的 provider/model/route 无法 被 -print-codex-config 读取,生成的 config.toml / models_catalog.json 是半成品。 方案:将 runTransform 内联的持久化引导(db.Registry 装配 + ConfigStore.LoadAll 覆盖 + 空库 seed)抽取为共享的 app.BootstrapPersistence,并新增轻量入口 app.TryLoadEffectiveConfig 供 print 路径使用。runTransform 与 main 的 print 路径 现在共享同一份覆盖语义,资源生命周期经 PersistenceResult.Shutdown 显式管理。 - internal/service/app/persistence.go: 新增 PersistenceResult、BootstrapPersistence、TryLoadEffectiveConfig - internal/service/app/app.go: runTransform 改用 BootstrapPersistence,移除内联逻辑 - cmd/moonbridge/main.go: print 分支前调用 TryLoadEffectiveConfig 覆盖 cfg - 新增 persistence_test.go(3 个单元测试)与 main_test.go 端到端回归测试
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
根因:所有 -print-* 子命令在 SQLite 覆盖(cfg = *dbCfg)发生前就退出,而覆盖 逻辑只内联在 runTransform 内,导致 WebUI 编辑后的 provider/model/route 无法 被 -print-codex-config 读取,生成的 config.toml / models_catalog.json 是半成品。
方案:将 runTransform 内联的持久化引导(db.Registry 装配 + ConfigStore.LoadAll 覆盖 + 空库 seed)抽取为共享的 app.BootstrapPersistence,并新增轻量入口 app.TryLoadEffectiveConfig 供 print 路径使用。runTransform 与 main 的 print 路径 现在共享同一份覆盖语义,资源生命周期经 PersistenceResult.Shutdown 显式管理。