Skip to content

fix: make legacy UMO migration retryable - #10441

Open
pei711 wants to merge 1 commit into
AstrBotDevs:masterfrom
pei711:fix/10390-retryable-umop-migration
Open

pei711 wants to merge 1 commit into
AstrBotDevs:masterfrom
pei711:fix/10390-retryable-umop-migration

Conversation

@pei711

@pei711 pei711 commented Oct 7, 2026 •

Copy link
Copy Markdown

Summary

  • Validate all legacy UMO entries on a deep copy before persisting either store, and retain malformed metadata so startup can retry after correction.
  • Persist the routing table before removing legacy profile fields; update in-memory routing only after the write succeeds.
  • Add regression coverage for malformed entries, duplicate routes, storage failures, and retry behavior.

Fixes #10390

Validation

  • uv run pytest tests/unit/test_migra_45_to_46.py tests/unit/test_astrbot_config_manager.py -q (11 passed)
  • uv run ruff format --check astrbot/core/db/migration/migra_45_to_46.py astrbot/core/umop_config_router.py tests/unit/test_migra_45_to_46.py
  • uv run ruff check astrbot/core/db/migration/migra_45_to_46.py astrbot/core/umop_config_router.py tests/unit/test_migra_45_to_46.py

Summary by Sourcery

Make legacy UMO migration atomic and retryable across validation, routing persistence, and profile metadata updates.

Bug Fixes:

  • Make legacy UMO migration retryable by validating entries before persistence and preserving legacy metadata when validation or storage fails.
  • Prevent in-memory routing state from changing until routing persistence succeeds.

Enhancements:

  • Persist migrated routing data before removing legacy profile mappings, enabling safe recovery after partial failures.

Tests:

  • Add regression coverage for malformed routes, duplicate mappings, persistence failures, router state consistency, and successful retry behavior.

@sourcery-ai sourcery-ai Bot left a comment

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.

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

Sourcery assessment

Needs a human reviewer. If the migration derives an incorrect route or profile mapping, it persists configuration that can affect where messages are handled and removes the legacy metadata from the stored profile. Reverting the code does not undo those writes, but the routing and profile state are bounded and can be repaired or reconstructed by rerunning or correcting the migration.


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

@pei711

pei711 commented Oct 20, 2026

Copy link
Copy Markdown
Author

Hi @Soulter, friendly ping on this one — CI is green and it merges cleanly. Happy to adjust anything if needed.

This branch has not been deployed

No deployments
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.

4.5 to 4.6 migration can lose legacy UMO routing data on invalid patterns

1 participant