Skip to content

[Due for payment 2026-10-16] [Rules Engine Release 2] [App] Use the new SetRule and DeleteRule commands #102275

Open

Description

@JS00001

Now that #102273 is complete and every user is using the latest version of the app, lets start using the SetRule and DeleteRule commands

Data storage

  • Each rule has the following structure:
{
  // For merchant rules, lets hard code this to 'policy'
  "scope": "policy" | "account",
  "scopeID": "<relevant ID based on the scope, so either the policyID, accountID, or domainAccountID>"
   // The triggers for a rule are when the relevant rules run. There must always be 1 trigger, but there can be more. For now, lets just worry
   // about CreateTransaction
  "triggers": {
    "0": "CreateTransaction",
  },
  // Filters follow the exact same AST format as search. They are infinitely extendable, however, for merchant rules, all we care about right now 
  // is the 'merchant' filter
  "filters": {
    "left": {
      "left": "merchant",
      "operator": "eq" | "neq" | "contains" | "notContains" | "gt" | "gte" | "lt" | "lte",
      "right": ["Hello world"],
    }
    "operator": "and"
    "right": {
      "left": "category",
      "operator": "eq" | "neq" | "contains" | "notContains" | "gt" | "gte" | "lt" | "lte",
      "right": ["Hello world"],
    },
  // The actions that are taken on any expenses that match the filters object above
  "actions": {
    "0": { "name": "Set", "field": "billable", "value": true},
    "1": { "name": "Set", "field": "merchant", "value": "modified merchant"},
    "2": { "name": "Set", "field": "category", "value": "category"},
    "3": { "name": "Set", "field": "tag", "value": "tag"},
    "4": { "name": "Set", "field": "reimbursable", "value": true},
    "5": { "name": "Set", "field": "vendorID", "value": "vendorid"},
    "6": { "name": "Set", "field": "comment", "value": "mycomment"},
    "7": { "name": "Set", "field": "tax", "value": { "field_id_TAX": {"externalID": "taxCode"}}},
  }
}

When a user creates a merchant rule, we should modify the filters to meet the request of the user, and we should modify the actions to include the fields the user wants to set. The triggers should always be just CreateTransaction for now

API Commands

SetRule - Sets a new rule in the database
Params

  • scope - The scope of the rule. For merchant rules, this should be policy
  • scopeID - The ID for the scope of the rule. For merchant rules, this should be the policyID
  • ruleID - A random rand64() value for the ID of the rule
  • priority - This determines which order the rules should apply in. For expense defaults, lets hard code this to 10000
  • value - The value of the rule. This will be an object that looks like:
{
  "filters": // ...
  "triggers": //...
  "actions": // ...
}

DeleteRule - Deletes a rule in the database
Params

  • ruleID - The ID of the rule
Issue OwnerCurrent Issue Owner: @Krishna2323

Activity

  1. melvin-bot commented on Sep 28, 2026

    @melvin-bot

    @Krishna2323 Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

  2. melvin-bot commented on Sep 30, 2026

    @melvin-bot

    @Krishna2323 Eep! 4 days overdue now. Issues have feelings too...

  3. changed the title [-][Rules Engine Release 1] Use the new SetRule and DeleteRule commands[/-] [+][Rules Engine Release 2] Use the new SetRule and DeleteRule commands[/+] on Oct 1, 2026
  4. changed the title [-][Rules Engine Release 2] Use the new SetRule and DeleteRule commands[/-] [+][Rules Engine Release 2] [App] Use the new SetRule and DeleteRule commands[/+] on Oct 1, 2026
  5. melvin-bot commented on Oct 2, 2026

    @melvin-bot

    @Krishna2323 Still overdue 6 days?! Let's take care of this!

  6. melvin-bot commented on Oct 3, 2026

    @melvin-bot

    @Krishna2323 Still overdue 6 days?! Let's take care of this!

  7. melvin-bot commented on Oct 6, 2026

    @melvin-bot

    @Krishna2323 10 days overdue. Is anyone even seeing these? Hello?

  8. 6 remaining items

  9. melvin-bot commented on Oct 9, 2026

    @melvin-bot

    @Krishna2323 / @situchan

    The solution for this issue has been 🚀 deployed to production 🚀 in version 9.5.6-6 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:

    If no regressions arise, payment will be issued on 2026-10-16. 🎊

  10. added
    Skip PaymentSkips all the payment process steps for an issue. Use it for fixed-price projects.
    on Oct 11, 2026
  11. JS00001 commented on Oct 12, 2026

    @JS00001
    ContributorAuthor

    We are going to need to re-create this PR since it was reverted. Note, it was not a regression, so there should be no penalty

  12. melvin-bot commented on Oct 13, 2026

    @melvin-bot

    Triggered auto assignment to @mallenexpensify (Awaiting Payment)

  13. Krishna2323 commented on Oct 13, 2026

    @Krishna2323
    Contributor

    @luacmartins, payments for the Rules Engine project will be handled centrally, so we should remove the Awaiting Payment label.

  14. luacmartins commented on Oct 13, 2026

    @luacmartins
    Contributor

    Ok, removed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

ReviewingHas a PR in reviewSkip PaymentSkips all the payment process steps for an issue. Use it for fixed-price projects.WeeklyKSv2

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions