Skip to content

Handle building group deletion: clean up on-chain policies correctly #4

@martinjms

Description

@martinjms

Problem

When a building group is deleted from the DApp, only localStorage is cleaned up. The on-chain policies on those assemblies remain unchanged.

Additionally, if an assembly belongs to multiple building groups, deleting one group should only remove that group's rules from the assembly's policy — not wipe the entire policy.

Current behavior

  • Delete building group → removed from localStorage only
  • On-chain policies unchanged
  • If assembly is in group A (rules 1,2) and group B (rules 3,4), Apply from group B overwrites all rules (loses rules 1,2)

Required behavior

  1. On delete: remove only the rules associated with the deleted group from each assembly's on-chain policy
  2. On Apply: merge rules from all building groups that contain the assembly
  3. Exclusive check: warn if adding an assembly that's already in another group, or support multi-group membership with proper merging
  4. Condition cleanup: condition objects can stay on-chain (they're reusable shared objects)

Design considerations

  • Each assembly has ONE policy on-chain (flat rule list)
  • Multiple building groups may reference the same assembly
  • Need to track which rules came from which group, either in localStorage metadata or on-chain
  • Consider making building group membership exclusive (simpler) vs supporting overlap (more flexible)

🤖 Generated with Claude Code

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions