Skip to content

fix: add ChatUIProject & SessionProjectRelation to shared constants & test cases#7414

Merged
RC-CHN merged 1 commit intoAstrBotDevs:masterfrom
RC-CHN:fix-webchat-backup
Apr 8, 2026
Merged

fix: add ChatUIProject & SessionProjectRelation to shared constants & test cases#7414
RC-CHN merged 1 commit intoAstrBotDevs:masterfrom
RC-CHN:fix-webchat-backup

Conversation

@RC-CHN
Copy link
Copy Markdown
Member

@RC-CHN RC-CHN commented Apr 8, 2026

Will fix #7376

Modifications / 改动点

This PR fixes a backup/restore issue where WebChat project data was not included in the shared backup model registry.

Core changes:

Added chatui_projects and session_project_relations to the backup model mapping in astrbot/core/backup/constants.py
Updated backup-related test expectations in tests/test_backup.py
As a result, WebChat projects and their session relationships can now be exported and restored correctly.

  • This is NOT a breaking change. / 这不是一个破坏性变更。

Screenshots or Test Results / 运行截图或测试结果

image ---

Checklist / 检查清单

  • 😊 If there are new features added in the PR, I have discussed it with the authors through issues/emails, etc.
    / 如果 PR 中有新加入的功能,已经通过 Issue / 邮件等方式和作者讨论过。

  • 👀 My changes have been well-tested, and "Verification Steps" and "Screenshots" have been provided above.
    / 我的更改经过了良好的测试,并已在上方提供了“验证步骤”和“运行截图”

  • 🤓 I have ensured that no new dependencies are introduced, OR if new dependencies are introduced, they have been added to the appropriate locations in requirements.txt and pyproject.toml.
    / 我确保没有引入新依赖库,或者引入了新依赖库的同时将其添加到 requirements.txtpyproject.toml 文件相应位置。

  • 😮 My changes do not introduce malicious code.
    / 我的更改没有引入恶意代码。

Summary by Sourcery

Ensure WebChat project data is included in the shared backup/restore model registry.

Bug Fixes:

  • Include ChatUIProject and SessionProjectRelation tables in the backup model mapping so WebChat projects and their session relations are backed up and restored correctly.

Tests:

  • Update backup model expectations to cover the new WebChat project and session relation tables in the main DB models test.

@auto-assign auto-assign bot requested review from Soulter and advent259141 April 8, 2026 03:33
@dosubot dosubot bot added the size:XS This PR changes 0-9 lines, ignoring generated files. label Apr 8, 2026
Copy link
Copy Markdown
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@dosubot dosubot bot added area:core The bug / feature is about astrbot's core, backend feature:chatui The bug / feature is about astrbot's chatui, webchat labels Apr 8, 2026
@RC-CHN RC-CHN merged commit 76fcc56 into AstrBotDevs:master Apr 8, 2026
7 checks passed
@RC-CHN RC-CHN deleted the fix-webchat-backup branch April 8, 2026 03:36
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request integrates ChatUIProject and SessionProjectRelation into the backup system by updating the core constants and the associated test suite. The review feedback identifies an opportunity to improve test coverage by including several other missing tables in the expected_tables list to ensure all models defined in the backup process are correctly tracked.

Comment on lines +1020 to +1021
"chatui_projects",
"session_project_relations",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

While adding chatui_projects and session_project_relations is correct, the expected_tables list is still missing several other tables that are currently defined in MAIN_DB_MODELS (specifically persona_folders, platform_message_history, platform_sessions, command_configs, and command_conflicts). To ensure the test provides full coverage and correctly tracks all models included in the backup process, it is recommended to include all keys from MAIN_DB_MODELS in this list.

            "persona_folders",
            "platform_message_history",
            "platform_sessions",
            "chatui_projects",
            "session_project_relations",
            "command_configs",
            "command_conflicts",

NekyuuYa pushed a commit to NekyuuYa/AstrBot-Lite that referenced this pull request Apr 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:core The bug / feature is about astrbot's core, backend feature:chatui The bug / feature is about astrbot's chatui, webchat size:XS This PR changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Astrbot备份功能无法正常备份webchat中“项目”的内容

1 participant