Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

michelle0927
Copy link
Collaborator

@michelle0927 michelle0927 commented Sep 22, 2025

Resolves #18421

  • Implements new action list-policies
  • Expensify API does not provide an endpoint for listing report IDs

Summary by CodeRabbit

  • New Features

    • Added an Expensify “List Policies” action to retrieve policies from your account.
    • Supports optional filters: admin-only policies and by user email.
    • Provides a summary of the number of policies retrieved and returns the policy list.
  • Chores

    • Bumped Expensify component package version to 0.3.0.

Copy link

vercel bot commented Sep 22, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

2 Skipped Deployments
Project Deployment Preview Comments Updated (UTC)
pipedream-docs Ignored Ignored Sep 22, 2025 5:26pm
pipedream-docs-redirect-do-not-edit Ignored Ignored Sep 22, 2025 5:26pm

Copy link
Contributor

coderabbitai bot commented Sep 22, 2025

Walkthrough

Adds a new Expensify action to list policies with optional admin-only and userEmail filters, returning an array and setting a summary. Updates the Expensify package version from 0.2.0 to 0.3.0.

Changes

Cohort / File(s) Summary of Changes
Expensify Action: List Policies
components/expensify/actions/list-policies/list-policies.ts
New action added: key "expensify-list-policies", version "0.0.1". Accepts props expensify, optional adminOnly (boolean), optional userEmail (string). Runs this.expensify.getPolicyList({ $, userEmail, adminOnly }), sets $summary with count, returns `response?.policyList
Package Version Bump
components/expensify/package.json
Version updated from "0.2.0" to "0.3.0".

Sequence Diagram(s)

sequenceDiagram
  actor User
  participant Action as List Policies Action
  participant ExpApp as Expensify App Client
  participant API as Expensify API

  User->>Action: Invoke with adminOnly, userEmail
  Action->>ExpApp: getPolicyList({ $, userEmail, adminOnly })
  ExpApp->>API: Request policyList
  API-->>ExpApp: policyList response
  ExpApp-->>Action: { policyList }
  Note right of Action: Set $summary with count
  Action-->>User: Return policyList (or [])
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

I hop through policies, neat and spry,
Counting lists beneath the clouded sky.
A whisker twitch—admin or user’s mail,
I fetch the IDs, follow the trail.
Version bumped, I thump with glee—
Reports to come? We’ll wait and see. 🐇✨

Pre-merge checks and finishing touches

❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Linked Issues Check ⚠️ Warning Linked issue #18421 requested two actions: listing policies and listing reports (the latter via a combinedReportData/file call with filter parameters). This PR implements the list-policies action (returns policyList) and bumps the package version, satisfying the policy-list objective, but it does not implement the list-reports action or the combinedReportData flow required by the linked issue, so the overall linked-issue requirements are not fully met. To satisfy #18421, add the "list-reports" action implementing the combinedReportData file request with appropriate filter props (policyIDList, startDate, endDate, reportState), include usage examples and automated/manual test steps, and ensure credentials and outputSettings are handled consistent with the provided API examples.
Description Check ⚠️ Warning The PR description does not follow the repository's required template (which expects a "## WHY" section); it only contains "Resolves #18421" and two brief bullets, omitting the motivation, scope, implementation notes, usage examples, and testing information required by the template. Please update the PR description to use the repository template by adding a "## WHY" section that explains the motivation and expected impact, include implementation details (what was added/changed), usage examples or API details, and any testing or verification steps, and explicitly note which linked-issue tasks are completed versus outstanding.
✅ Passed checks (3 passed)
Check name Status Explanation
Title Check ✅ Passed The title "Expensify - new action list-policies" succinctly and accurately describes the primary change—adding a new Expensify action to list policies—and is concise and easy to scan in the project history.
Out of Scope Changes Check ✅ Passed The only other change in the diff is a package version bump (components/expensify/package.json from 0.2.0 to 0.3.0), which is appropriate for adding a new action and does not introduce unrelated or out-of-scope code changes.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch issue-18421

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (2)
components/expensify/actions/list-policies/list-policies.ts (2)

10-24: Optional: set a default for adminOnly to document intent.

Declaring a default avoids “undefined” being sent and clarifies UX.

     adminOnly: {
       type: "boolean",
       label: "Admin Only",
       description: "Whether or not to only get policies for which the user is an admin",
       optional: true,
+      default: false,
     },

32-34: Optional: richer summary for better run visibility.

Include filters in the summary for quick context in runs.

-    $.export("$summary", `Successfully retrieved ${response?.policyList?.length || 0} policies`);
+    const count = Array.isArray(response?.policyList) ? response.policyList.length : 0;
+    $.export("$summary", `Retrieved ${count} policies${this.userEmail ? ` for ${this.userEmail}` : ""}${this.adminOnly ? " (admin only)" : ""}`);
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6e80efa and 047fc84.

📒 Files selected for processing (2)
  • components/expensify/actions/list-policies/list-policies.ts (1 hunks)
  • components/expensify/package.json (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: pnpm publish
  • GitHub Check: Publish TypeScript components
  • GitHub Check: Verify TypeScript components
  • GitHub Check: Lint Code Base
🔇 Additional comments (5)
components/expensify/actions/list-policies/list-policies.ts (4)

4-10: Good action metadata and docs link.

Key/name/description/version/type are consistent and clear.


4-9: Scope check — list-reports missing; confirm or split

Search shows existing combinedReportData usage in components/expensify/app/expensify.app.ts and components/expensify/actions/export-report/export-report.ts; no dedicated list-reports action detected. Issue #18421 also requested "list reports" via combinedReportData — if intentionally out of scope, split or open a follow‑up. Should I scaffold a list-reports action (filters: policyIDList, startDate, endDate, reportState)?


25-30: Confirmed: getPolicyList signature and response shape match usage. getPolicyList is implemented in components/expensify/app/expensify.app.ts as async getPolicyList({ $, userEmail, adminOnly = true }) and callers destructure { policyList }, so returning { policyList: any[] } is correct.


4-9: No change required — keys consistently use the "expensify-" prefix.
All actions in components/expensify/actions use keys prefixed with "expensify-" (expensify-create-expense, expensify-create-report, expensify-export-report, expensify-export-report-to-pdf, expensify-list-policies).

components/expensify/package.json (1)

3-3: Version bump looks good — confirm release notes and semver intent.

components/expensify/package.json now "version": "0.3.0". No component-level CHANGELOG/release-notes found and no "breaking"/"deprecated" matches under components/expensify. Add/update release notes to document the new action and confirm this is intended as a minor (non‑breaking) bump.

Copy link
Collaborator

@GTFalcao GTFalcao left a comment

Choose a reason for hiding this comment

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

LGTM!

@vunguyenhung vunguyenhung merged commit 0c007db into master Sep 23, 2025
10 checks passed
@vunguyenhung vunguyenhung deleted the issue-18421 branch September 23, 2025 06:41
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.

[ACTION] Expensify: list policies, list reports
3 participants