Skip to content

fix(webui): keep registration entry flow setting after restart#64

Open
ilh-github wants to merge 2 commits intodou-jiang:mainfrom
ilh-github:codex/fix-registration-entry-flow-persistence
Open

fix(webui): keep registration entry flow setting after restart#64
ilh-github wants to merge 2 commits intodou-jiang:mainfrom
ilh-github:codex/fix-registration-entry-flow-persistence

Conversation

@ilh-github
Copy link
Copy Markdown

问题

  • 在命令行启动路径里,main() 会先调用 update_settings(),再执行数据库初始化。
  • 当数据库尚未初始化时,update_settings() 会基于默认内存配置构建设置,导致 registration_entry_flow 等已持久化字段被回退为默认值(native)。
  • 现象就是:设置页改成 ABCard 后,重启进程又变回默认。

修复

  • webui.py::main() 中先执行与 setup_application() 一致的初始化前置步骤:
    • _load_dotenv()
    • 创建 data/logs 目录
    • 注入 APP_DATA_DIR/APP_LOGS_DIR
    • initialize_database()
  • 然后再执行 update_settings(...) 的 CLI/环境变量覆盖。

结果

  • registration_entry_flow 等数据库配置在重启后保持不变。
  • CLI 参数仍可正常覆盖对应字段。

验证

  • 本地复现并验证:
    • 修复前:registration.entry_flow=abcard,按命令行启动流程后读到 native
    • 修复后:同流程下保持 abcard
  • 回归:PYTHONPATH=. ./.venv/bin/pytest -q tests/test_settings_registration_auto_fields.py

@ilh-github ilh-github force-pushed the codex/fix-registration-entry-flow-persistence branch from 360f262 to d49fff2 Compare April 1, 2026 06:06
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