Add local dynamic rule engine and document architecture#13
Merged
Conversation
…e-mvp Feat/dynamic rule engine mvp
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



This pull request introduces a local, JSON-based rule engine MVP to the backend, enabling dynamic business rule evaluation and action execution during order processing. The most significant changes include the implementation of a robust rule loader and validator, integration of the rule engine into the backend's dependency system and service layer, and updates to the persistence and error-handling logic to support rule-driven state changes. Additionally, the documentation has been updated to describe the rule engine's boundaries and usage.
Rule Engine Implementation and Integration:
JsonRuleRepositoryinbackend/app/adapters/json_rule_repository.pythat loads, validates, and parses rule definitions from a local JSON file, enforcing schema and value correctness.backend/app/dependencies.py, ensuring it is initialized at startup and injected into theOrderService. [1] [2] [3] [4] [5]backend/app/adapters/__init__.pyto export the newJsonRuleRepository.Domain Model and Error Handling:
backend/app/domain/__init__.pyandbackend/app/domain/exceptions.py) to include rule engine entities, parameters, and new error types for rule configuration and conflicting state overrides. [1] [2]RuleStateOverrideConflictErrorinbackend/app/api/exception_handlers.pyto return a 409 Conflict response when rule-driven state changes conflict. [1] [2]Persistence and Testing:
amountfield from rule actions and adjusted test coverage paths in the CI workflow for backend code. [1] [2] [3] [4]Documentation:
README.mddescribing the rule engine MVP, its boundaries, and a pointer to detailed documentation.These changes lay the foundation for dynamic, configurable business logic in the backend, while clearly documenting current limitations and extension points.