Skip to content

[Due for payment 2026-10-12] [Rules Engine Release 1] Support the GetRules command and rules_ collection #102273

Closed

Description

@JS00001

To start with, we will only support GetRules and the rules_ collection in the frontend. This allows us to get all users onto a version of the app that uses rules_ only

Data storage

  • We have added a new onyx collection: rules_<ruleID>
  • 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

GetRules - Gets all of the rules that a user has access to. This command takes no params. We return the rules_ collection, which SETs the value.

Note: Any rule that has a CreateTransaction trigger, and at least one Set action is an Expense Default Rule. Lets use that to determine where the rule shows up

Issue OwnerCurrent Issue Owner: @Krishna2323

Activity

  1. added
    Reviewing
    Weekly
    and removed
    Daily
    on Sep 26, 2026
  2. Krishna2323 commented on Sep 26, 2026

    @Krishna2323
    Contributor

    @situchan PR is ready for review: #102106

  3. melvin-bot commented on Oct 2, 2026

    @melvin-bot

    ⚠️ Looks like this issue was linked to a Deploy Blocker here

    If you are the assigned CME please investigate whether the linked PR caused a regression and leave a comment with the results.

    If a regression has occurred and you are the assigned CM follow the instructions here.

    If this regression could have been avoided please consider also proposing a recommendation to the PR checklist so that we can avoid it in the future.

  4. added
    Daily
    and removed
    Reviewing
    Weekly
    on Oct 5, 2026
  5. changed the title [-][Rules Engine Release 1] Support the `GetRules` command and `rules_` collection[/-] [+][Due for payment 2026-10-12] [Rules Engine Release 1] Support the `GetRules` command and `rules_` collection[/+] on Oct 5, 2026
  6. melvin-bot commented on Oct 5, 2026

    @melvin-bot

    @Krishna2323 / @situchan

    The solution for this issue has been 🚀 deployed to production 🚀 in version 9.5.1-9 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-12. 🎊

    The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the Contributor+ Checklist from here into a new comment on this GH and complete it. If you have the K2 extension, you can simply click: [this button]. If no checklist is needed for this issue, you can click: [no checklist button]

  7. reopened this on Oct 5, 2026
  8. melvin-bot commented on Oct 8, 2026

    @melvin-bot

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

  9. added
    Skip Payment
    on Oct 11, 2026
  10. JS00001 commented on Oct 12, 2026

    @JS00001
    ContributorAuthor

    @Krishna2323 are we going to pay this out as a part of the rules work?

  11. JS00001 commented on Oct 12, 2026

    @JS00001
    ContributorAuthor

    Feel free to reopen if not

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

Metadata

Metadata

Labels

DailySkip Payment

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions