Skip to content

Conversation

@Huggin423
Copy link

Description

This PR refactors the implementation to match the Go Casbin approach, as requested by the maintainer.

It introduces *WithoutNotify internal methods that operate strictly on the memory model (bypassing both adapter and watcher) and updates self* methods to call them directly. This prevents infinite loops in distributed environments.

Related Issue

Fixes #506

Verification

  • Tested locally using the provided test script.
  • Verified that selfAddPolicy updates memory correctly without invoking adapter.addPolicy.

@coveralls
Copy link

coveralls commented Jan 6, 2026

Pull Request Test Coverage Report for Build 20746293363

Details

  • 41 of 62 (66.13%) changed or added relevant lines in 2 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-1.0%) to 77.263%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/internalEnforcer.ts 34 55 61.82%
Totals Coverage Status
Change from base Build 20679550322: -1.0%
Covered Lines: 1682
Relevant Lines: 2053

💛 - Coveralls

@Huggin423 Huggin423 force-pushed the fix/506-go-style-implementation branch from 289e9fb to afa3426 Compare January 6, 2026 12:36
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.

Feature request: Methods in enforcer for adding, updating and deleting policies without usage of adapter (even if autoSave is true)

2 participants