Skip to content

Add local dynamic rule engine and document architecture#13

Merged
JuanEstebanMedina merged 5 commits into
mainfrom
develop
Jun 26, 2026
Merged

Add local dynamic rule engine and document architecture#13
JuanEstebanMedina merged 5 commits into
mainfrom
develop

Conversation

@JuanEstebanMedina

Copy link
Copy Markdown
Owner

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:

  • Added a new JsonRuleRepository in backend/app/adapters/json_rule_repository.py that loads, validates, and parses rule definitions from a local JSON file, enforcing schema and value correctness.
  • Integrated the rule engine into the backend dependency injection system in backend/app/dependencies.py, ensuring it is initialized at startup and injected into the OrderService. [1] [2] [3] [4] [5]
  • Updated backend/app/adapters/__init__.py to export the new JsonRuleRepository.

Domain Model and Error Handling:

  • Extended the domain model (backend/app/domain/__init__.py and backend/app/domain/exceptions.py) to include rule engine entities, parameters, and new error types for rule configuration and conflicting state overrides. [1] [2]
  • Added a FastAPI exception handler for RuleStateOverrideConflictError in backend/app/api/exception_handlers.py to return a 409 Conflict response when rule-driven state changes conflict. [1] [2]

Persistence and Testing:

  • Updated the DynamoDB order repository to persist the calculated amount field from rule actions and adjusted test coverage paths in the CI workflow for backend code. [1] [2] [3] [4]

Documentation:

  • Added a section to README.md describing 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.

@vercel

vercel Bot commented Jun 26, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
order-state-machine-technical-test Ready Ready Preview, Comment Jun 26, 2026 12:56am

@sonarqubecloud

Copy link
Copy Markdown

@JuanEstebanMedina
JuanEstebanMedina merged commit 13b7267 into main Jun 26, 2026
4 checks passed
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.

1 participant