Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

feat: prevent deletion of seeded entity schemas#21

Draft
themusicman wants to merge 3 commits into
main from
feat/prevent-delete-seeded-entities
Draft

feat: prevent deletion of seeded entity schemas #21
themusicman wants to merge 3 commits into
main from
feat/prevent-delete-seeded-entities

Conversation

@themusicman

@themusicman themusicman commented Feb 19, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add a guard to DeleteEntity that rejects attempts to delete the schema of seeded entity types (people, tasks, notes, links, interests, skills)
  • Add Seeds.seeded_type?/1 helper to check if a type is seeded
  • Add comprehensive tests for both the guard and the helper

Detailed Changes

Backend

  • Brain.Seeds — New seeded_type?/1 function that checks membership against entity_types/0
  • DeleteEntity — Pre-delete guard that blocks schema-targeted deletions (__schema__, schema, type name, <type>.json) for seeded types while still allowing normal entity deletions within those types
  • Brain.Helpers — New :protected_entity_type error formatting with the offending type name

Tests

  • SeedsTestseeded_type?/1 returns true for all 6 seeded types, false for custom types and nil
  • BrainActionsTest — Rejection of seeded schema deletion, successful entity deletion within seeded types, successful deletion in custom types

Test plan

  • seeded_type?/1 returns true for all seeded types
  • seeded_type?/1 returns false for non-seeded values
  • Deleting a seeded type schema target is rejected with clear error
  • Deleting a normal entity within a seeded type still works
  • Deleting entities in custom (non-seeded) types still works

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

1 participant

AltStyle によって変換されたページ (->オリジナル) /