Skip to content

Feat/dynamic rule engine mvp#12

Merged
JuanEstebanMedina merged 4 commits into
developfrom
feat/dynamic-rule-engine-mvp
Jun 26, 2026
Merged

Feat/dynamic rule engine mvp#12
JuanEstebanMedina merged 4 commits into
developfrom
feat/dynamic-rule-engine-mvp

Conversation

@JuanEstebanMedina

@JuanEstebanMedina JuanEstebanMedina commented Jun 25, 2026

Copy link
Copy Markdown
Owner

This pull request introduces a local, dynamic rule engine MVP to the backend. It adds a new JsonRuleRepository for loading and validating rules from a JSON file, defines a comprehensive rule domain model, and integrates rule evaluation into the service layer. The changes also include improved exception handling for rule-related errors and update the DynamoDB repository to persist calculated amounts.

Rule Engine MVP Implementation:

  • Added a new JsonRuleRepository adapter that loads and validates business rules from a local JSON file at startup (backend/app/adapters/json_rule_repository.py, backend/app/adapters/__init__.py) [1] [2].
  • Defined a complete rule domain model in backend/app/domain/rule.py, including rule structure, supported actions, and evaluation context (backend/app/domain/rule.py, backend/app/domain/__init__.py) [1] [2].
  • Integrated the rule engine (RuleEngine) and repository into dependency injection and the service layer, ensuring rules are applied after state-machine validation (backend/app/dependencies.py) [1] [2] [3] [4] [5] [6].

Persistence and Data Model Updates:

  • Updated the DynamoDB order repository to persist the final calculated amount when committing a state transition (backend/app/adapters/dynamodb_order_repository.py) [1] [2] [3].

Error Handling and API Improvements:

  • Added custom exceptions for rule configuration and state override conflicts, and registered corresponding FastAPI exception handlers (backend/app/domain/exceptions.py, backend/app/api/exception_handlers.py) [1] [2] [3].

Documentation:

  • Updated the README.md to document the rule engine MVP, its boundaries, and a pointer to detailed documentation (README.md).

Ports and Interfaces:

  • Registered the new RuleRepository port for use in the application (backend/app/ports/__init__.py).

@vercel

vercel Bot commented Jun 25, 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:27am

@sonarqubecloud

Copy link
Copy Markdown

@JuanEstebanMedina
JuanEstebanMedina merged commit 4d3ffe4 into develop Jun 26, 2026
4 checks passed
@JuanEstebanMedina
JuanEstebanMedina deleted the feat/dynamic-rule-engine-mvp branch June 26, 2026 00:55
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