-
Notifications
You must be signed in to change notification settings - Fork 5.5k
[FIX] Omnivore Get Article cannot list users #18406
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
The latest updates on your projects. Learn more about Vercel for GitHub. 2 Skipped Deployments
|
WalkthroughThis 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
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
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
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Poem
Pre-merge checks and finishing touches❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests
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.
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. Comment |
There was a problem hiding this 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 includesarticle { id }
whenerrorCodes
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 mappingresponse.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. Useconsole.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
📒 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.
There was a problem hiding this 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!
WHY
Resolves #10502
Summary by CodeRabbit
New Features
Bug Fixes
Documentation
Chores