Skip to content

[HOLD WEB#54776] Render agent rule change logs in NewDot #admins#96773

Open
yuwenmemon wants to merge 2 commits into
mainfrom
yuwen-660979-agent-rule-changelog
Open

[HOLD WEB#54776] Render agent rule change logs in NewDot #admins#96773
yuwenmemon wants to merge 2 commits into
mainfrom
yuwen-660979-agent-rule-changelog

Conversation

@yuwenmemon

@yuwenmemon yuwenmemon commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

@puneetlath please review

Explanation of Change

Renders the three new agent-rule change-log system messages in NewDot's #admins room, so admins get a visible audit trail whenever an agent rule is added, updated, or deleted. Add/update messages show the rule title and full prompt; delete shows just the title (the title is server-generated and may be empty, so each message falls back to a generic phrasing).

The backend that emits these POLICYCHANGELOG_{ADD,UPDATE,DELETE}_AGENT_RULE actions is the companion Auth PR https://github.com/Expensify/Auth/pull/23134. Deploy this NewDot PR first so the messages render as soon as Auth starts emitting them; an unhandled subtype simply renders nothing (no crash). OldDot's own rendering is the companion Web-Expensify PR https://github.com/Expensify/Web-Expensify/pull/54776.

Fixed Issues

For https://github.com/Expensify/Expensify/issues/660979
PROPOSAL:

Tests

  1. On a Control workspace, open Workspace > Rules > AI and add an agent rule.
  2. Open the workspace #admins room and confirm a system message records the rule being added, showing its title and prompt.
  3. Edit the rule's prompt and confirm an "updated" system message appears with the title and new prompt.
  4. Delete the rule and confirm a "deleted" system message appears showing the title.
  5. Confirm the #admins room's LHN preview shows the concise "added/updated/deleted an agent rule" text.
  6. Verify that no errors appear in the JS console.
Screenshot 2026-07-23 at 12 42 49 AM Screenshot 2026-07-23 at 12 43 44 AM Screenshot 2026-07-23 at 12 44 30 AM

(Requires the companion Auth PR on the same environment to emit the actions.)

  • Verify that no errors appear in the JS console

Offline tests

These are server-emitted system messages, so no new offline behavior is introduced — an already-synced #admins room shows the cached messages while offline.

QA Steps

Same as tests (run on staging once the companion Auth change is deployed there).

  • Verify that no errors appear in the JS console

PR Author Checklist

  • I linked the correct issue in the ### Fixed Issues section above
  • I wrote clear testing steps that cover the changes made in this PR
    • I added steps for local testing in the Tests section
    • I added steps for the expected offline behavior in the Offline steps section
    • I added steps for Staging and/or Production testing in the QA steps section
    • I added steps to cover failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
    • I tested this PR with a High Traffic account against the staging or production API to ensure there are no regressions (e.g. long loading states that impact usability).
  • I included screenshots or videos for tests on all platforms
  • I ran the tests on all platforms & verified they passed on:
    • Android: Native
    • Android: mWeb Chrome
    • iOS: Native
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
  • I verified there are no console errors (if there's a console error not related to the PR, report it or open an issue for it to be fixed)
  • I followed proper code patterns (see Reviewing the code)
    • I verified that comments were added to code that is not self explanatory
    • I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
    • I verified any copy / text that was added to the app is grammatically correct in English. It adheres to proper capitalization guidelines (note: only the first word of header/labels should be capitalized), and is either coming verbatim from figma or has been approved by marketing (in order to get marketing approval, ask the Bug Zero team member to add the Waiting for copy label to the issue)
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I followed the guidelines as stated in the Review Guidelines
  • I tested other components that can be impacted by my changes (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar are working as expected)
  • If a new CSS style is added I verified that:
    • A similar style doesn't already exist
    • The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))
  • If the PR modifies the UI (e.g. new buttons, new UI components, changing the padding/spacing/sizing, moving components, etc) or modifies the form input styles:
    • I verified that all the inputs inside a form are aligned with each other.
    • I added Design label and/or tagged @Expensify/design so the design team can review the changes.
  • I added unit tests for any new feature or bug fix in this PR to help automatically prevent regressions in this user flow.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.

Screenshots/Videos

@OSBotify

Copy link
Copy Markdown
Contributor

🦜 Polyglot Parrot! 🦜

Squawk! Looks like you added some shiny new English strings. Allow me to parrot them back to you in other tongues:

View the translation diff
diff --git a/src/languages/de.ts b/src/languages/de.ts
index a09698b9842..184201e3be1 100644
--- a/src/languages/de.ts
+++ b/src/languages/de.ts
@@ -8605,9 +8605,10 @@ Fügen Sie weitere Ausgabelimits hinzu, um den Cashflow Ihres Unternehmens zu sc
             `hat die Standardausgabenkategorie für „${mccGroupName}“ in „${newCategory}“ geändert (zuvor „${oldCategory}“)`,
         updatedRequireCompanyCards: ({enabled}: {enabled: boolean}) => `${enabled ? 'aktiviert' : 'deaktiviert'} die Anforderung für Firmenkartenkäufe`,
         agentRule: {
-            added: ({title, prompt}: {title: string; prompt: string}) => (title ? `Agentenregel "${title}" hinzugefügt: ${prompt}` : `Eine Agentenregel hinzugefügt: ${prompt}`),
-            updated: ({title, prompt}: {title: string; prompt: string}) => (title ? `Agentenregel "${title}" aktualisiert auf: ${prompt}` : `Eine Agentenregel aktualisiert auf: ${prompt}`),
-            deleted: ({title}: {title: string}) => (title ? `Agentenregel "${title}" entfernt` : 'Eine Agentenregel entfernt'),
+            added: ({title, prompt}: {title: string; prompt: string}) => (title ? `hat die Agentenregel „${title}“ hinzugefügt: ${prompt}` : `hat eine Agentenregel hinzugefügt: ${prompt}`),
+            updated: ({title, prompt}: {title: string; prompt: string}) =>
+                title ? `hat die Agentenregel „${title}“ aktualisiert auf: ${prompt}` : `eine Agentenregel aktualisiert zu: ${prompt}`,
+            deleted: ({title}: {title: string}) => (title ? `hat die Agentenregel „${title}“ gelöscht` : 'hat eine Agentenregel gelöscht'),
         },
         expensifyCardRule: {
             actionVerb: {block: 'blockiert', allow: 'erlaubt'},
diff --git a/src/languages/es.ts b/src/languages/es.ts
index 31737008cd8..64fed33d1ba 100644
--- a/src/languages/es.ts
+++ b/src/languages/es.ts
@@ -8069,9 +8069,9 @@ El plan Controlar empieza en 9 $ por miembro activo al mes.`,
         updatedCardFeedStatementPeriod: (feedName: string, newValue?: string, previousValue?: string) =>
             `cambió el día de cierre del período de estado de cuenta de la fuente de tarjetas "${feedName}"${newValue ? ` a "${newValue}"` : ''}${previousValue ? ` (previamente "${previousValue}")` : ''}`,
         agentRule: {
-            added: ({title, prompt}: {title: string; prompt: string}) => (title ? `agregó la regla de agente "${title}": ${prompt}` : `agregó una regla de agente: ${prompt}`),
-            updated: ({title, prompt}: {title: string; prompt: string}) => (title ? `actualizó la regla de agente "${title}" a: ${prompt}` : `actualizó una regla de agente a: ${prompt}`),
-            deleted: ({title}: {title: string}) => (title ? `eliminó la regla de agente "${title}"` : 'eliminó una regla de agente'),
+            added: ({title, prompt}: {title: string; prompt: string}) => (title ? `añadió la regla de agente «${title}»: ${prompt}` : `añadió una regla de agente: ${prompt}`),
+            updated: ({title, prompt}: {title: string; prompt: string}) => (title ? `actualizó la regla del agente «${title}» a: ${prompt}` : `actualizó una regla de agente a: ${prompt}`),
+            deleted: ({title}: {title: string}) => (title ? `eliminó la regla de agente «${title}»` : 'eliminó una regla de agente'),
         },
         expensifyCardRule: {
             actionVerb: {block: 'bloqueado', allow: 'permitido'},
diff --git a/src/languages/fr.ts b/src/languages/fr.ts
index d591fe52028..358b47cb9d6 100644
--- a/src/languages/fr.ts
+++ b/src/languages/fr.ts
@@ -8640,10 +8640,10 @@ Ajoutez davantage de règles de dépenses pour protéger la trésorerie de l’e
             `a modifié la catégorie de dépense par défaut pour « ${mccGroupName} » en « ${newCategory} » (auparavant « ${oldCategory} »)`,
         updatedRequireCompanyCards: ({enabled}: {enabled: boolean}) => `${enabled ? 'activé' : 'désactivé'} l’exigence d’achats par carte d’entreprise`,
         agentRule: {
-            added: ({title, prompt}: {title: string; prompt: string}) => (title ? `a ajouté la règle d'agent "${title}" : ${prompt}` : `a ajouté une règle d'agent : ${prompt}`),
+            added: ({title, prompt}: {title: string; prompt: string}) => (title ? `a ajouté la règle d’agent « ${title} » : ${prompt}` : `a ajouté une règle d’agent : ${prompt}`),
             updated: ({title, prompt}: {title: string; prompt: string}) =>
-                title ? `a mis à jour la règle d'agent "${title}" en : ${prompt}` : `a mis à jour une règle d'agent en : ${prompt}`,
-            deleted: ({title}: {title: string}) => (title ? `a supprimé la règle d'agent "${title}"` : `a supprimé une règle d'agent`),
+                title ? `a mis à jour la règle d’agent « ${title} » en : ${prompt}` : `a mis à jour une règle d’agent en : ${prompt}`,
+            deleted: ({title}: {title: string}) => (title ? `a supprimé la règle d’agent « ${title} »` : 'a supprimé une règle d’agent'),
         },
         expensifyCardRule: {
             actionVerb: {block: 'bloqué', allow: 'autorisé'},
diff --git a/src/languages/it.ts b/src/languages/it.ts
index e4f2c11e190..05bf26683a1 100644
--- a/src/languages/it.ts
+++ b/src/languages/it.ts
@@ -8587,9 +8587,10 @@ Aggiungi altre regole di spesa per proteggere il flusso di cassa aziendale.`,
             `ha modificato la categoria di spesa predefinita per "${mccGroupName}" in "${newCategory}" (precedentemente "${oldCategory}")`,
         updatedRequireCompanyCards: ({enabled}: {enabled: boolean}) => `${enabled ? 'abilitato' : 'disabilitato'} il requisito per gli acquisti con carta aziendale`,
         agentRule: {
-            added: ({title, prompt}: {title: string; prompt: string}) => (title ? `regola dell'agente "${title}" aggiunta: ${prompt}` : `regola dell'agente aggiunta: ${prompt}`),
-            updated: ({title, prompt}: {title: string; prompt: string}) => (title ? `regola dell'agente "${title}" aggiornata in: ${prompt}` : `regola dell'agente aggiornata in: ${prompt}`),
-            deleted: ({title}: {title: string}) => (title ? `regola dell'agente "${title}" rimossa` : `regola dell'agente rimossa`),
+            added: ({title, prompt}: {title: string; prompt: string}) => (title ? `ha aggiunto la regola dell'agente "${title}": ${prompt}` : `ha aggiunto una regola agente: ${prompt}`),
+            updated: ({title, prompt}: {title: string; prompt: string}) =>
+                title ? `ha aggiornato la regola dell'agente "${title}" in: ${prompt}` : `ha aggiornato una regola dell'agente in: ${prompt}`,
+            deleted: ({title}: {title: string}) => (title ? `ha eliminato la regola agente "${title}"` : 'ha eliminato una regola agente'),
         },
         expensifyCardRule: {
             actionVerb: {block: 'bloccato', allow: 'consentito'},
diff --git a/src/languages/ja.ts b/src/languages/ja.ts
index 186f088085c..f100ec24bae 100644
--- a/src/languages/ja.ts
+++ b/src/languages/ja.ts
@@ -8478,8 +8478,8 @@ ${reportName}`,
         agentRule: {
             added: ({title, prompt}: {title: string; prompt: string}) => (title ? `エージェントルール「${title}」を追加しました:${prompt}` : `エージェントルールを追加しました:${prompt}`),
             updated: ({title, prompt}: {title: string; prompt: string}) =>
-                title ? `エージェントルール「${title}」を次のように更新しました:${prompt}` : `エージェントルールを次のように更新しました:${prompt}`,
-            deleted: ({title}: {title: string}) => (title ? `エージェントルール「${title}」を削除しました` : `エージェントルールを削除しました`),
+                title ? `エージェントルール「${title}」を次の内容に更新しました:${prompt}` : `エージェントルールを次の内容に更新しました:${prompt}`,
+            deleted: ({title}: {title: string}) => (title ? `エージェントルール「${title}」を削除しました` : 'エージェントルールを削除しました'),
         },
         expensifyCardRule: {
             actionVerb: {block: 'ブロック済み', allow: '許可済み'},
diff --git a/src/languages/nl.ts b/src/languages/nl.ts
index 8c308c3666a..03b6cbc2b5c 100644
--- a/src/languages/nl.ts
+++ b/src/languages/nl.ts
@@ -8558,9 +8558,10 @@ er bestedingsregels toe om de kasstroom van het bedrijf te beschermen.`,
             `heeft de standaarduitgavencategorie voor ‘${mccGroupName}’ gewijzigd in ‘${newCategory}’ (voorheen ‘${oldCategory}’)`,
         updatedRequireCompanyCards: ({enabled}: {enabled: boolean}) => `vereiste ${enabled ? 'ingeschakeld' : 'uitgeschakeld'} voor bedrijfskaarttransacties`,
         agentRule: {
-            added: ({title, prompt}: {title: string; prompt: string}) => (title ? `agentregel "${title}" toegevoegd: ${prompt}` : `een agentregel toegevoegd: ${prompt}`),
-            updated: ({title, prompt}: {title: string; prompt: string}) => (title ? `agentregel "${title}" bijgewerkt naar: ${prompt}` : `een agentregel bijgewerkt naar: ${prompt}`),
-            deleted: ({title}: {title: string}) => (title ? `agentregel "${title}" verwijderd` : `een agentregel verwijderd`),
+            added: ({title, prompt}: {title: string; prompt: string}) => (title ? `heeft de agentregel "${title}" toegevoegd: ${prompt}` : `heeft een agentregel toegevoegd: ${prompt}`),
+            updated: ({title, prompt}: {title: string; prompt: string}) =>
+                title ? `heeft de agentregel „${title}” bijgewerkt naar: ${prompt}` : `heeft een agentregel bijgewerkt naar: ${prompt}`,
+            deleted: ({title}: {title: string}) => (title ? `heeft de agentregel '${title}' verwijderd` : 'heeft een agentregel verwijderd'),
         },
         expensifyCardRule: {
             actionVerb: {block: 'geblokkeerd', allow: 'toegestaan'},
diff --git a/src/languages/pl.ts b/src/languages/pl.ts
index 862f6257854..e3216571511 100644
--- a/src/languages/pl.ts
+++ b/src/languages/pl.ts
@@ -8538,9 +8538,9 @@ Dodaj więcej zasad wydatków, żeby chronić płynność finansową firmy.`,
             `zmieniono domyślną kategorię wydatków dla „${mccGroupName}” na „${newCategory}” (poprzednio „${oldCategory}”)`,
         updatedRequireCompanyCards: ({enabled}: {enabled: boolean}) => `${enabled ? 'włączone' : 'wyłączone'} wymóg dotyczący zakupów kartą służbową`,
         agentRule: {
-            added: ({title, prompt}: {title: string; prompt: string}) => (title ? `dodano regułę agenta "${title}": ${prompt}` : `dodano regułę agenta: ${prompt}`),
-            updated: ({title, prompt}: {title: string; prompt: string}) => (title ? `zaktualizowano regułę agenta "${title}" na: ${prompt}` : `zaktualizowano regułę agenta na: ${prompt}`),
-            deleted: ({title}: {title: string}) => (title ? `usunięto regułę agenta "${title}"` : `usunięto regułę agenta`),
+            added: ({title, prompt}: {title: string; prompt: string}) => (title ? `dodał(a) regułę agenta „${title}”: ${prompt}` : `dodano regułę agenta: ${prompt}`),
+            updated: ({title, prompt}: {title: string; prompt: string}) => (title ? `zaktualizowano regułę agenta „${title}” na: ${prompt}` : `zaktualizowano regułę agenta na: ${prompt}`),
+            deleted: ({title}: {title: string}) => (title ? `usunięto regułę agenta „${title}”` : 'usunął(-ę) regułę agenta'),
         },
         expensifyCardRule: {
             actionVerb: {block: 'zablokowane', allow: 'dozwolone'},
diff --git a/src/languages/pt-BR.ts b/src/languages/pt-BR.ts
index 749e3aaf28a..df79fcb7f10 100644
--- a/src/languages/pt-BR.ts
+++ b/src/languages/pt-BR.ts
@@ -8547,8 +8547,8 @@ Adicione mais regras de gasto para proteger o fluxo de caixa da empresa.`,
         agentRule: {
             added: ({title, prompt}: {title: string; prompt: string}) => (title ? `adicionou a regra de agente "${title}": ${prompt}` : `adicionou uma regra de agente: ${prompt}`),
             updated: ({title, prompt}: {title: string; prompt: string}) =>
-                title ? `atualizou a regra de agente "${title}" para: ${prompt}` : `atualizou uma regra de agente para: ${prompt}`,
-            deleted: ({title}: {title: string}) => (title ? `removeu a regra de agente "${title}"` : `removeu uma regra de agente`),
+                title ? `atualizou a regra do agente "${title}" para: ${prompt}` : `atualizou uma regra de agente para: ${prompt}`,
+            deleted: ({title}: {title: string}) => (title ? `excluiu a regra de agente "${title}"` : 'excluiu uma regra de agente'),
         },
         expensifyCardRule: {
             actionVerb: {block: 'bloqueado', allow: 'permitido'},
diff --git a/src/languages/zh-hans.ts b/src/languages/zh-hans.ts
index 3f7cb167397..3fdabd1cb49 100644
--- a/src/languages/zh-hans.ts
+++ b/src/languages/zh-hans.ts
@@ -8284,9 +8284,9 @@ ${reportName}`,
         addedReportField: (fieldType: string, fieldName?: string, defaultValue?: string) => `已添加 ${fieldType} 报告字段“${fieldName}”${defaultValue ? ` 默认值为“${defaultValue}”` : ''}`,
         updatedRequireCompanyCards: ({enabled}: {enabled: boolean}) => `${enabled ? '已启用' : '已禁用'} 公司商务卡消费要求`,
         agentRule: {
-            added: ({title, prompt}: {title: string; prompt: string}) => (title ? `已添加代理规则"${title}":${prompt}` : `已添加一条代理规则:${prompt}`),
-            updated: ({title, prompt}: {title: string; prompt: string}) => (title ? `已将代理规则"${title}"更新为:${prompt}` : `已更新一条代理规则:${prompt}`),
-            deleted: ({title}: {title: string}) => (title ? `已删除代理规则"${title}"` : `已删除一条代理规则`),
+            added: ({title, prompt}: {title: string; prompt: string}) => (title ? `已添加代理规则“${title}”:${prompt}` : `添加了一条代理规则:${prompt}`),
+            updated: ({title, prompt}: {title: string; prompt: string}) => (title ? `已将智能体规则“${title}”更新为:${prompt}` : `已将代理规则更新为:${prompt}`),
+            deleted: ({title}: {title: string}) => (title ? `已删除代理规则“${title}”` : '删除了代理规则'),
         },
         expensifyCardRule: {
             actionVerb: {block: '已阻止', allow: '允许'},

Note

You can apply these changes to your branch by copying the patch to your clipboard, then running pbpaste | git apply 😉

View workflow run

@yuwenmemon

Copy link
Copy Markdown
Contributor Author

(Yuwen's Agent) Squawk received 🦜 — adopted the suggested translations for all 9 locales in a104f43.

@codecov

codecov Bot commented Jul 22, 2026

Copy link
Copy Markdown

Codecov Report

❌ Looks like you've decreased code coverage for some files. Please write tests to increase, or at least maintain, the existing level of code coverage. See our documentation here for how to interpret this table.

Files with missing lines Coverage Δ
src/CONST/index.ts 94.81% <ø> (ø)
src/libs/AgentRuleChangeLogUtils.ts 100.00% <100.00%> (ø)
...x/report/actionContents/PolicyChangeLogContent.tsx 100.00% <100.00%> (ø)
src/libs/ReportNameUtils.ts 81.60% <50.00%> (-0.45%) ⬇️
src/libs/SidebarUtils.ts 80.11% <50.00%> (-0.28%) ⬇️
... and 130 files with indirect coverage changes

@yuwenmemon
yuwenmemon marked this pull request as ready for review July 22, 2026 23:37
@yuwenmemon
yuwenmemon requested review from a team as code owners July 22, 2026 23:37
@melvin-bot
melvin-bot Bot requested a review from joekaufmanexpensify July 22, 2026 23:37
@yuwenmemon
yuwenmemon requested a review from puneetlath July 22, 2026 23:37
@melvin-bot
melvin-bot Bot requested review from youssef-lr and removed request for a team July 22, 2026 23:37
@melvin-bot

melvin-bot Bot commented Jul 22, 2026

Copy link
Copy Markdown

@youssef-lr Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button]

@yuwenmemon yuwenmemon changed the title Render agent rule change logs in NewDot #admins [HOLD WEB#54776] Render agent rule change logs in NewDot #admins Jul 23, 2026
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.

2 participants