Skip to content

Added reEvaluation support for rules engine#1195

Merged
akhiljain1907 merged 21 commits intoadobe:dev-v5.8.0from
akhiljain1907:feat/ReEvaluation
Feb 9, 2026
Merged

Added reEvaluation support for rules engine#1195
akhiljain1907 merged 21 commits intoadobe:dev-v5.8.0from
akhiljain1907:feat/ReEvaluation

Conversation

@akhiljain1907
Copy link
Copy Markdown
Contributor

@akhiljain1907 akhiljain1907 commented Dec 23, 2025

Description

This PR adds support for parsing the meta object with reEvaluate key in rules JSON and introduces a re-evaluation mechanism for the Launch Rules Engine.

Changes

  1. Meta Object Parsing
  • LaunchRule now includes a reevaluable property parsed from meta.reEvaluate in the rules JSON
  • Added JSONRuleMeta struct to handle metadata parsing
  • Defaults to false if not specified
  1. Re-evaluation Interceptor Support
  • Extensions using LaunchRulesEngine can register a RuleReevaluationInterceptor via setReevaluationInterceptor(_:)
  • When reevaluable rules match, the interceptor is notified and rule processing is paused
  • Processing resumes when the extension calls the completion callback
  1. Schema Consequence Handling
  • Only rules with schema type consequences can trigger re-evaluation
  • When any reevaluable rule matches, all rules with schema consequences are held back
  • This ensures consistency in consequence delivery and behavior
  • Non-schema rules (add, mod, dispatch, etc.) are processed immediately

Related Issue

Motivation and Context

How Has This Been Tested?

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • I have signed the Adobe Open Source CLA.
  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@akhiljain1907 akhiljain1907 changed the title Added reEvaluation support for rules engine [WIP] - Added reEvaluation support for rules engine Dec 23, 2025
@akhiljain1907 akhiljain1907 marked this pull request as draft January 6, 2026 06:52
@akhiljain1907 akhiljain1907 changed the title [WIP] - Added reEvaluation support for rules engine Added reEvaluation support for rules engine Jan 22, 2026
…ore-ios into feat/ReEvaluation

# Conflicts:
#	API/AEPCore-ios.json
#	API/AEPCore-tvos.json
@akhiljain1907 akhiljain1907 marked this pull request as ready for review January 22, 2026 09:43
…terceptor instead of passing the original event
@akhiljain1907 akhiljain1907 changed the base branch from main to dev-v5.8.0 February 5, 2026 13:27
Copy link
Copy Markdown
Member

@sbenedicadb sbenedicadb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good with just a few updates requested 👍

public struct LaunchRule: Rule {
public let condition: Evaluable
public let consequences: [RuleConsequence]
public let reevaluable: Bool
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think it's better to pull in the meta dictionary here rather than one specific value inside that dictionary.

this puts us in a better place for future usage of the meta object inside of a launch rule to deliver new properties, etc.

we could make reEvaluable a read-only computed property for convenience.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, we should have the meta dictionary passed instead of just reEvaluate key for future usage. I have made that change.

Comment on lines +82 to +84
enum CodingKeys: String, CodingKey {
case reEvaluate
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't need coding keys enum since the property name we are using is the same as the named coding key

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes i have removed it.


/// Metadata for a rule containing reevaluation settings
struct JSONRuleMeta: Codable {
var reEvaluate: Bool?
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

might be more clear to a reader and safer to just make this value non-optional, and with a default value?

let reEvaluate: Bool = false

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As i am parsing entire meta dictionary now, i have removed this JSONRuleMeta struct.

@akhiljain1907
Copy link
Copy Markdown
Contributor Author

Thanks a lot @sbenedicadb for reviewing. I have addressed the comments, can you please take a look and approve if it looks good?

Copy link
Copy Markdown
Member

@sbenedicadb sbenedicadb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good!

@akhiljain1907 akhiljain1907 merged commit 8a0e6cf into adobe:dev-v5.8.0 Feb 9, 2026
16 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.

4 participants