Skip to content

Consistency Mechanism #74

Closed
Closed

Description

@mariajgrimaldi

Description

Define a mechanism to ensure consistency between Open edX domain objects (e.g., users, libraries, courses) and their associated Casbin policies. The goal is to avoid orphaned or stale policies when objects are updated or deleted. For the MVP, we should adopt a simple, app-level approach, while keeping the door open to evolving toward a more robust proxy/backreference model later.

Problem

  • Orphaned policies: Policies can remain in the datastore even after their related objects are deleted.
  • Inconsistent state: Updates to domain objects may not be reflected in policies.
  • MVP risk: Without a minimal consistency mechanism, enforcement results could become unreliable.

Possible Approaches

  1. Application-level solution (MVP)

    • Keep the policy table in sync directly at the application layer.
    • When an object is updated or deleted, ensure policies are explicitly updated/removed in the same operation.
    • This is simpler, faster to implement, and fits MVP needs.
  2. Proxy/Backreference model (Future option)

    • Introduce an intermediate proxy model that links policies to domain objects (via foreign keys).
    • Enables transactional consistency and can also store metadata.
    • Provides a more scalable and systematic solution, but adds modeling complexity.

Requirements

  • Ensure policies do not outlive their related objects.
  • Define a minimal consistency mechanism for MVP (app-level).
  • Document an evolution path toward adopting the proxy model if/when complexity grows.
  • Keep consistency logic aligned with:
    • Policy Lifecycle Load and Clear Management
    • Duplicate Management
    • Default Policy Initialization

Acceptance Criteria

  • Policies tied to deleted objects are cleaned up immediately.
  • No orphaned or stale policies exist after object lifecycle changes.
  • MVP uses the application-level approach for consistency.
  • Future work is documented to evolve into a proxy model if required.

Notes

  • The proxy/backreference model is a strong candidate for long-term consistency and metadata storage, but is not required for the MVP.
  • For the MVP, correctness and simplicity should take priority.

Metadata

Metadata

Labels

MVPRequired for an MVP release of this feature

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions