Skip to content

Conversation

jcortes
Copy link
Collaborator

@jcortes jcortes commented Sep 18, 2025

WHY

Resolves #10502

Summary by CodeRabbit

  • New Features

    • None
  • Bug Fixes

    • Improved reliability when listing users and articles, including safer handling when account context is missing and more robust pagination.
    • Clearer error messages and graceful fallbacks to prevent crashes during failures.
  • Documentation

    • Updated in-app documentation link for getting a single article to the main schema documentation page.
  • Chores

    • Bumped versions for Omnivore package and related actions to reflect stability and maintenance updates.

@jcortes jcortes self-assigned this Sep 18, 2025
Copy link

vercel bot commented Sep 18, 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 18, 2025 5:56pm
pipedream-docs-redirect-do-not-edit Ignored Ignored Sep 18, 2025 5:56pm

Copy link
Contributor

coderabbitai bot commented Sep 18, 2025

Walkthrough

This PR updates metadata across Omnivore actions (version and a description link), bumps the package version, and modifies control flow in components/omnivore/omnivore.app.mjs for listUsers and listArticles to use try/catch, guard on response?.me === null, adjust error handling, and change data access/mapping.

Changes

Cohort / File(s) Summary
Omnivore app control flow adjustments
components/omnivore/omnivore.app.mjs
Refactored listUsers and listArticles: wrap in try/catch, guard on response?.me === null, serialize errorCodes on throw, adjust data access to response.users/response.articles, update mapping and returned shapes, log on error and return [] (listUsers) or [] (on error noted for listArticles).
Action metadata/version bumps
components/omnivore/actions/get-article/get-article.mjs, components/omnivore/actions/save-page/save-page.mjs, components/omnivore/actions/save-url/save-url.mjs, components/omnivore/actions/search-for-pages/search-for-pages.mjs
Bumped versions: get-article 0.0.2→0.0.3 (also updated description URL to remove line anchor); save-page 0.0.1→0.0.2; save-url 0.0.2→0.0.3; search-for-pages 0.0.2→0.0.3. No logic changes.
Package manifest version
components/omnivore/package.json
Version updated 0.2.1→0.2.2.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant U as UI / Caller
  participant A as OmnivoreApp.listUsers
  participant G as Omnivore API

  U->>A: invoke listUsers()
  A->>G: fetch users
  G-->>A: response
  alt response?.me === null
    A->>A: throw JSON.stringify(errorCodes)
  else success
    A->>A: users = response.users<br/>map to options
    A-->>U: options (array)
  end
  par Error path
    A-->>U: [] (after logging "listUsers error")
  end
Loading
sequenceDiagram
  autonumber
  participant U as UI / Caller
  participant A as OmnivoreApp.listArticles
  participant G as Omnivore API

  U->>A: invoke listArticles(after?)
  A->>G: fetch articles
  G-->>A: response
  alt response?.me === null
    A->>A: throw JSON.stringify(errorCodes)
  else success
    A->>A: {edges, hasNextPage, endCursor} = response.articles
    A-->>U: { options: edges.map(mapper), context: { after: hasNextPage && endCursor || null } }
  end
  par Error path
    A-->>U: [] (after logging "listArticles error")
  end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

A nibble of versions, a hop through the code,
I tidied the trails where the user list flowed.
Caught errors mid-burrow, mapped articles right,
Bumped tiny numbers by soft moonlight.
Thump-thump—tests pass—ears up, let’s go! 🐇✨

Pre-merge checks and finishing touches

❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Out of Scope Changes Check ⚠️ Warning This PR includes several metadata-only changes unrelated to the linked bug: version bumps in save-page, save-url, search-for-pages actions, a components/omnivore package.json version bump, and a minor docs-link tweak in get-article.mjs; these changes are out-of-scope for fixing the "list users" bug. Either split the unrelated version/package metadata changes and the docs-link change into a separate PR or document in this PR why they are included together, and ensure changelog/release notes and CI/test runs are updated and passing before merging.
Description Check ⚠️ Warning The PR description only contains "## WHY\n\nResolves #10502" and does not follow the repository template's intent because it lacks a root-cause summary, a description of what was changed (files/behaviour), and verification or testing instructions, making the description incomplete for reviewers. Please expand the PR description to complete the "## WHY" section with a brief root-cause explanation, list the key files changed (e.g., components/omnivore/omnivore.app.mjs and relevant actions), describe the implemented fix at a high level, and add reproduction/verification steps and any tests added so reviewers can validate the fix.
✅ Passed checks (3 passed)
Check name Status Explanation
Title Check ✅ Passed The title "[FIX] Omnivore Get Article cannot list users" is concise, specific, and directly reflects the primary intent of the changeset: fixing the Get Article component's inability to list users; the raw summary shows targeted modifications to omnivore.app.mjs's listUsers implementation that align with this title.
Linked Issues Check ✅ Passed The changes to components/omnivore/omnivore.app.mjs (removing unsafe destructuring, adding try/catch, guarding response?.me === null, and using response.users.map) directly target the "cannot list users" failure described in [#10502], so the code changes appear to meet the linked issue's primary objective.
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 fix-omnivore-get-article-cannot-list-users

Tip

👮 Agentic pre-merge checks are now available in preview!

Pro plan users can now enable pre-merge checks in their settings to enforce checklists before merging PRs.

  • Built-in checks – Quickly apply ready-made checks to enforce title conventions, require pull request descriptions that follow templates, validate linked issues for compliance, and more.
  • Custom agentic checks – Define your own rules using CodeRabbit’s advanced agentic capabilities to enforce organization-specific policies and workflows. For example, you can instruct CodeRabbit’s agent to verify that API documentation is updated whenever API schema files are modified in a PR. Note: Upto 5 custom checks are currently allowed during the preview period. Pricing for this feature will be announced in a few weeks.

Please see the documentation for more information.

Example:

reviews:
  pre_merge_checks:
    custom_checks:
      - name: "Undocumented Breaking Changes"
        mode: "warning"
        instructions: |
          Pass/fail criteria: All breaking changes to public APIs, CLI flags, environment variables, configuration keys, database schemas, or HTTP/GraphQL endpoints must be documented in the "Breaking Change" section of the PR description and in CHANGELOG.md. Exclude purely internal or private changes (e.g., code not exported from package entry points or explicitly marked as internal).

Please share your feedback with us on this Discord post.


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 (5)
components/omnivore/actions/save-url/save-url.mjs (1)

8-8: Avoid line-anchored docs links (fragile).
Line anchors in the Omnivore schema drift. Align with get-article by linking the file root.

Apply this diff:

-  description: "Save a URL to Omnivore. [See the documentation](https://github.com/omnivore-app/omnivore/blob/main/packages/api/src/schema.ts#L2590)",
+  description: "Save a URL to Omnivore. [See the documentation](https://github.com/omnivore-app/omnivore/blob/main/packages/api/src/schema.ts)",
components/omnivore/actions/search-for-pages/search-for-pages.mjs (1)

8-8: Drop schema line anchor for stability.
Mirror get-article’s doc link style.

-  description: "Search for pages in Omnivore. [See the documentation](https://github.com/omnivore-app/omnivore/blob/main/packages/api/src/schema.ts#L2680)",
+  description: "Search for pages in Omnivore. [See the documentation](https://github.com/omnivore-app/omnivore/blob/main/packages/api/src/schema.ts)",
components/omnivore/actions/get-article/get-article.mjs (1)

78-80: Sanity check the response shape before exporting summary.
If the API returns no article (but no errorCodes), response.article could be null and the summary would throw. Consider a guard.

-    step.export("$summary", `Successfully retrieved article with ID \`${response.article.id}\`.`);
+    if (response.article?.id) {
+      step.export("$summary", `Successfully retrieved article with ID \`${response.article.id}\`.`);
+    } else {
+      step.export("$summary", "Retrieved article.");
+    }

Would you confirm the getArticle selection set always includes article { id } when errorCodes is empty?

components/omnivore/omnivore.app.mjs (2)

23-38: Fix inconsistent shape checks and throw Error objects (userId options).

  • Checking response?.me === null but mapping response.users is inconsistent.
  • Throwing strings hinders stack traces; prefer Error.
  • Use console.error for errors.
         try {
           const response = await this.listUsers();

-          if (response?.me === null) {
-            return [];
-          }
+          if (!Array.isArray(response?.users)) {
+            return [];
+          }

-          if (response.errorCodes?.length) {
-            throw JSON.stringify(response.errorCodes, null, 2);
-          }
+          if (response.errorCodes?.length) {
+            throw new Error(JSON.stringify(response.errorCodes, null, 2));
+          }

           return response.users.map(mapper);
         } catch (error) {
-          console.log("listUsers error", error);
+          console.error("listUsers error", error);
           return [];
         }

58-60: Keep return shape consistent; simplify after; throw Error objects (articleId options).

  • Return { options: [], context: { after: null } } everywhere to keep a stable shape.
  • Prefer hasNextPage ? endCursor : null for clarity.
  • Throw Error, not strings. Use console.error.
-        if (after === null) {
-          return [];
-        }
+        if (after === null) {
+          return {
+            options: [],
+            context: { after: null },
+          };
+        }

         try {
           const response =
             await this.listArticles({
               first: constants.DEFAULT_LIMIT,
               after,
             });

           if (response?.me === null) {
             return [];
           }

-          if (response.errorCodes?.length) {
-            throw JSON.stringify(response.errorCodes, null, 2);
-          }
+          if (response.errorCodes?.length) {
+            throw new Error(JSON.stringify(response.errorCodes, null, 2));
+          }

           const {
             edges,
             pageInfo: {
               hasNextPage,
               endCursor,
             },
           } = response.articles;

           return {
             options: edges.map(mapper),
             context: {
-              after: hasNextPage && endCursor || null,
+              after: hasNextPage ? endCursor : null,
             },
           };
-        } catch (error) {
-          console.log("listArticles error", error);
-          return [];
-        }
+        } catch (error) {
+          console.error("listArticles error", error);
+          return {
+            options: [],
+            context: { after: null },
+          };
+        }

Also applies to: 62-76, 77-91, 91-94

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4636f3e and 8793181.

📒 Files selected for processing (6)
  • components/omnivore/actions/get-article/get-article.mjs (1 hunks)
  • components/omnivore/actions/save-page/save-page.mjs (1 hunks)
  • components/omnivore/actions/save-url/save-url.mjs (1 hunks)
  • components/omnivore/actions/search-for-pages/search-for-pages.mjs (1 hunks)
  • components/omnivore/omnivore.app.mjs (2 hunks)
  • components/omnivore/package.json (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
components/omnivore/omnivore.app.mjs (4)
components/omnivore/actions/get-article/get-article.mjs (1)
  • response (71-72)
components/omnivore/actions/save-page/save-page.mjs (1)
  • response (75-81)
components/omnivore/actions/save-url/save-url.mjs (1)
  • response (61-67)
components/omnivore/actions/search-for-pages/search-for-pages.mjs (1)
  • response (41-41)
⏰ 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: Verify TypeScript components
  • GitHub Check: Publish TypeScript components
  • GitHub Check: Lint Code Base
🔇 Additional comments (5)
components/omnivore/actions/save-url/save-url.mjs (1)

10-10: Version bump looks good.
No functional changes. Safe to publish.

components/omnivore/package.json (1)

3-3: Package version bump LGTM.
Consistent with action version bumps.

components/omnivore/actions/search-for-pages/search-for-pages.mjs (1)

10-10: Version bump looks good.
No behavior change.

components/omnivore/actions/save-page/save-page.mjs (1)

10-10: Version bump looks good.
No logic changes.

components/omnivore/actions/get-article/get-article.mjs (1)

7-9: Good: removed fragile schema line anchor; version bump OK.
This reduces link rot and aligns with other files.

Copy link
Collaborator

@luancazarine luancazarine left a comment

Choose a reason for hiding this comment

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

Hi @jcortes, LGTM! Ready for QA!

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.

[BUG] Omnivore "Get Article" cannot list users
2 participants