Skip to content

fix(core): restart affected nodes after core deletion - #934

Merged
T3ST3ST3R0N merged 1 commit into
PasarGuard:devfrom
dr-hoseyn:codex/fix-core-delete-restart
Oct 8, 2026
Merged

T3ST3ST3R0N merged 1 commit into
PasarGuard:devfrom
dr-hoseyn:codex/fix-core-delete-restart

Conversation

@dr-hoseyn

Copy link
Copy Markdown
Contributor

Summary

  • Clear node core references explicitly when deleting one core. SQLite does not currently enable foreign key actions, so its ON DELETE SET NULL does not run.
  • Capture affected node IDs before single or bulk deletion, then force reconnect only those active nodes after they fall back to the default core.
  • Cover single deletion with and without restart, and bulk deletion of multiple cores, while verifying unrelated nodes are untouched.

Verification

  • pytest tests/api/test_core.py tests/api/test_bulk_delete_entities.py -q — 32 passed (using the local SQLite test database).
  • ruff check app/db/crud/core.py app/routers/core.py tests/api/test_bulk_delete_entities.py --no-fix — passed.
  • ruff format --check app/db/crud/core.py app/routers/core.py tests/api/test_bulk_delete_entities.py — passed.

Bulk deletion now reconnects affected active nodes automatically. Single deletion continues to honor the existing restart_nodes option.

@coderabbitai

coderabbitai Bot commented Sep 24, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: 94b37589-bf90-4719-9904-1db3613e8ca8

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@T3ST3ST3R0N
T3ST3ST3R0N merged commit a5b28f3 into PasarGuard:dev Oct 8, 2026
10 checks passed
@T3ST3ST3R0N

Copy link
Copy Markdown
Collaborator

Thanks, merged. Capturing the affected nodes before the delete was exactly what was missing, and clearing core_config_id explicitly also covers SQLite, where the foreign key action does not run. The tests (failing on dev, passing here) made this easy to verify. Heads-up: #875 also touches app/routers/core.py, so it will need a quick rebase.

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