Skip to content

Develop - #68

Merged
Billos merged 7 commits into
mainfrom
develop
Apr 1, 2026
Merged

Develop#68
Billos merged 7 commits into
mainfrom
develop

Conversation

@Billos

@Billos Billos commented Apr 1, 2026

Copy link
Copy Markdown
Owner

Summary by CodeRabbit

  • Chores
    • Updated firefly-iii-sdk dependency to a newer version
    • Removed axios library dependency
    • Optimized dependency installation across CI/CD workflows and Docker builds
    • Updated test infrastructure

@Billos
Billos requested a review from Copilot April 1, 2026 12:10
@Billos Billos self-assigned this Apr 1, 2026
@coderabbitai

coderabbitai Bot commented Apr 1, 2026

Copy link
Copy Markdown

Warning

Rate limit exceeded

@Billos has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 4 minutes and 4 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 4 minutes and 4 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: fb07b719-5483-4164-bd11-0c764fdff193

📥 Commits

Reviewing files that changed from the base of the PR and between bbb2e05 and 6ffbd89.

⛔ Files ignored due to path filters (1)
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (11)
  • .github/workflows/ci.yml
  • .github/workflows/coverage-pages.yml
  • .github/workflows/release.yml
  • Dockerfile
  • package.json
  • src/__tests__/autoImport.test.ts
  • src/client.ts
  • src/modules/notifiers/discord.ts
  • src/modules/notifiers/gotify.ts
  • src/queues/jobs/autoImport.ts
  • src/queues/jobs/checkBudgetLimit.ts
📝 Walkthrough

Walkthrough

The pull request removes the axios HTTP library and replaces it with native fetch API calls across the codebase. It updates the Firefly SDK dependency, removes axios from dependencies, and adds --ignore-scripts flags to npm/yarn install commands in CI workflows and Docker configuration. One API configuration option is renamed from baseURL to baseUrl.

Changes

Cohort / File(s) Summary
CI Workflow Script Updates
.github/workflows/ci.yml, .github/workflows/coverage-pages.yml, .github/workflows/release.yml
Added --ignore-scripts flag to npm i commands to skip package lifecycle scripts during dependency installation across all three workflows.
Docker Configuration
Dockerfile
Added apk update before installing tzdata in the runtime image stage, and appended --ignore-scripts flag to the Yarn install command for production dependencies.
Dependency Management
package.json
Removed axios dependency (^1.7.9) and updated @billos/firefly-iii-sdk from version 6.5.1-sdk.5 to 6.5.5-sdk.2.
Client Configuration
src/client.ts
Renamed API configuration option from baseURL to baseUrl in both client and paypalClient initialization calls.
Test HTTP Mocking
src/__tests__/autoImport.test.ts
Replaced axios mocking with global fetch mocking; updated all HTTP call assertions to verify fetch invocations instead of axios.post calls.
Auto-Import HTTP Request
src/queues/jobs/autoImport.ts
Replaced axios.post call with fetch using POST method for triggering the autoimport endpoint.
Discord Notifier
src/modules/notifiers/discord.ts
Removed Axios instance initialization; replaced all HTTP requests (post, delete) with fetch calls; added explicit error handling for non-OK responses and JSON response parsing.
Gotify Notifier
src/modules/notifiers/gotify.ts
Replaced Axios instance with fetch for all HTTP operations (POST, GET, DELETE); added explicit response validation, error throwing for non-2xx status codes, and JSON response parsing; updated message ID retrieval and deletion logic.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

🐰 Fetch me not with axios anymore,
Native calls now open every door,
Scripts ignored, dependencies shed,
Lighter loads and cleaner thread,
A leaner app, refreshed and true—
Modernized through and through!

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Title check ❓ Inconclusive The title 'Develop' is vague and does not convey meaningful information about the changeset, which involves removing axios dependency and migrating to fetch API across multiple files. Replace with a descriptive title that summarizes the main change, such as 'Replace axios with native fetch API' or 'Migrate from axios HTTP client to fetch'.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch develop

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.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the project to a newer @billos/firefly-iii-sdk version and removes the axios dependency by migrating HTTP calls to the built-in fetch, while also tightening dependency installation by ignoring lifecycle scripts in CI and the runtime Docker image.

Changes:

  • Bump @billos/firefly-iii-sdk to 6.5.5-sdk.2 and update client configuration accordingly.
  • Replace axios usage with fetch in the auto-import job and notifier implementations (Discord/Gotify), and adjust unit tests.
  • Harden installs by adding --ignore-scripts in GitHub Actions and the runtime Docker image.

Reviewed changes

Copilot reviewed 10 out of 11 changed files in this pull request and generated 11 comments.

Show a summary per file
File Description
yarn.lock Updates lockfile to reflect SDK bump and removal of axios-related deps.
package.json Bumps @billos/firefly-iii-sdk and removes axios dependency.
src/client.ts Updates SDK client option naming (baseURLbaseUrl).
src/queues/jobs/autoImport.ts Switches importer trigger from axios POST to fetch.
src/__tests__/autoImport.test.ts Updates auto-import job tests to mock fetch instead of axios.
src/modules/notifiers/discord.ts Replaces axios webhook calls with fetch.
src/modules/notifiers/gotify.ts Replaces axios Gotify calls with fetch and adds basic error handling in one path.
Dockerfile Adds apk update and installs prod deps with --ignore-scripts.
.github/workflows/ci.yml Installs deps with npm i --ignore-scripts.
.github/workflows/release.yml Installs deps with npm i --ignore-scripts.
.github/workflows/coverage-pages.yml Installs deps with npm i --ignore-scripts.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/queues/jobs/autoImport.ts Outdated
Comment thread src/modules/notifiers/gotify.ts
Comment thread src/modules/notifiers/gotify.ts
Comment thread src/modules/notifiers/gotify.ts Outdated
Comment thread src/modules/notifiers/gotify.ts Outdated
Comment thread src/modules/notifiers/discord.ts Outdated
Comment thread src/__tests__/autoImport.test.ts
Comment thread src/modules/notifiers/gotify.ts
Comment thread src/modules/notifiers/gotify.ts
Comment thread src/modules/notifiers/discord.ts Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 6

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/__tests__/autoImport.test.ts (1)

4-28: ⚠️ Potential issue | 🔴 Critical

Fix global fetch mocking setup (currently breaks all tests).

vi.mock("fetch") is invalid—fetch is a global, not a module. This causes vi.mocked(fetch).mockResolvedValue(...) to fail with "mockResolvedValue is not a function" at line 24 because vi.mocked() returns the real fetch, which has no mock methods.

Use vi.stubGlobal("fetch", vi.fn()) instead, and add vi.unstubAllGlobals() to the afterEach cleanup.

Suggested fix
-vi.mock("fetch")
@@
   beforeEach(() => {
-    vi.mocked(fetch).mockResolvedValue({
-      ok: true,
-      status: 200,
-      json: async () => ({}),
-    } as Response)
+    vi.stubGlobal(
+      "fetch",
+      vi.fn().mockResolvedValue({
+        ok: true,
+        status: 200,
+        json: async () => ({}),
+      } as Response),
+    )
   })
@@
   afterEach(() => {
+    vi.unstubAllGlobals()
     vi.resetModules()
     vi.unstubAllEnvs()
     vi.clearAllMocks()
   })
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/__tests__/autoImport.test.ts` around lines 4 - 28, Replace the invalid
module mock for the global fetch with a global stub: remove vi.mock("fetch") and
instead call vi.stubGlobal("fetch", vi.fn()) before the tests (e.g., at
top-level) so vi.mocked(fetch) will return a mocked fn; in the test lifecycle,
keep the beforeEach that sets vi.mocked(fetch).mockResolvedValue(...) but add an
afterEach that calls vi.unstubAllGlobals() to restore the real global fetch;
update references around the beforeEach/afterEach and any uses of
vi.mocked(fetch) accordingly (look for vi.mocked(fetch), beforeEach, afterEach,
vi.stubGlobal, vi.unstubAllGlobals).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@Dockerfile`:
- Line 13: The Dockerfile currently runs "RUN apk update && apk add tzdata"
which leaves package index caches and increases image size; replace that RUN
invocation to use the no-cache option (i.e., use apk add --no-cache tzdata) so
the package index isn't stored in the image and image layers stay small; update
the RUN line that currently contains "apk update && apk add tzdata" accordingly.

In `@src/modules/notifiers/discord.ts`:
- Around line 18-28: The override sendMessageImpl in the Discord notifier uses a
single parameter so it treats the passed-in title as the message body, breaking
the AbstractNotifier.sendMessageImpl(title, content) contract; update the
Discord implementation to match the two-argument signature (e.g., override async
sendMessageImpl(title: string, content: string): Promise<string>) and build the
posted payload using both values (for example combine title and content into the
JSON body so the webhook posts both the title and the message body), keeping the
method name sendMessageImpl and returning the created message id as before.
- Around line 11-15: The fetch calls in notifyImpl and deleteMessageImpl that
POST to `${env.discordWebhook}?wait=true` lack response.ok checks like
sendMessageImpl; update both functions (notifyImpl and deleteMessageImpl) to
capture the fetch response, check response.ok, and handle non-OK responses
(throw or log with response status/text) so HTTP 4xx/5xx don't silently succeed;
for deleteMessageImpl specifically, only unset or remove the stored message ID
after a successful (response.ok) delete to avoid losing the ID on failed
deletes.

In `@src/modules/notifiers/gotify.ts`:
- Around line 53-55: The fetch calls in deleteAllMessagesImpl and
hasMessageIdImpl use relative URLs which fail in Node.js; update both fetch
invocations to use absolute URLs by prepending env.gotifyUrl (same pattern as
notifyImpl/sendMessageImpl), and also ensure hasMessageIdImpl does not swallow
errors—propagate or return false only after logging the error so
deleteMessageImpl can correctly decide to attempt deletions; locate these
changes in the functions deleteAllMessagesImpl, hasMessageIdImpl, and where
deleteMessageImpl relies on hasMessageIdImpl.
- Around line 20-24: notifyImpl and deleteMessageImpl are calling fetch but not
checking HTTP status; mirror sendMessageImpl by capturing the fetch response,
verify response.ok, and throw or return an error when not ok (include
response.status/text in the error message) so 4xx/5xx are surfaced;
additionally, in deleteMessageImpl do not unset the stored message ID before
performing the fetch—only clear the stored ID after a successful response.ok to
allow retries if deletion fails; reference the functions notifyImpl,
deleteMessageImpl and the existing sendMessageImpl guard pattern to implement
these checks.

In `@src/queues/jobs/autoImport.ts`:
- Around line 53-54: The fetch call using url is not checking HTTP status so
logger.info and the subsequent notifications run even on 4xx/5xx; update the
code that calls await fetch(url, { method: "POST" }) to capture the response
(const res = await fetch(...)), check res.ok, and only run logger.info and the
success notification when res.ok is true; on non-ok responses log a descriptive
error via logger.error including res.status and await res.text() (or JSON) and
surface or throw an error so callers/queues know the job failed; reference the
fetch call, the url variable, logger (logger.info/logger.error), and the
notification code so they are gated behind the res.ok check.

---

Outside diff comments:
In `@src/__tests__/autoImport.test.ts`:
- Around line 4-28: Replace the invalid module mock for the global fetch with a
global stub: remove vi.mock("fetch") and instead call vi.stubGlobal("fetch",
vi.fn()) before the tests (e.g., at top-level) so vi.mocked(fetch) will return a
mocked fn; in the test lifecycle, keep the beforeEach that sets
vi.mocked(fetch).mockResolvedValue(...) but add an afterEach that calls
vi.unstubAllGlobals() to restore the real global fetch; update references around
the beforeEach/afterEach and any uses of vi.mocked(fetch) accordingly (look for
vi.mocked(fetch), beforeEach, afterEach, vi.stubGlobal, vi.unstubAllGlobals).
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: b2d638d1-0759-47a4-b64e-4b40707b0175

📥 Commits

Reviewing files that changed from the base of the PR and between d9eead5 and bbb2e05.

⛔ Files ignored due to path filters (1)
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (10)
  • .github/workflows/ci.yml
  • .github/workflows/coverage-pages.yml
  • .github/workflows/release.yml
  • Dockerfile
  • package.json
  • src/__tests__/autoImport.test.ts
  • src/client.ts
  • src/modules/notifiers/discord.ts
  • src/modules/notifiers/gotify.ts
  • src/queues/jobs/autoImport.ts

Comment thread Dockerfile
Comment thread src/modules/notifiers/discord.ts Outdated
Comment thread src/modules/notifiers/discord.ts
Comment thread src/modules/notifiers/gotify.ts Outdated
Comment thread src/modules/notifiers/gotify.ts Outdated
Comment thread src/queues/jobs/autoImport.ts Outdated
Billos added 3 commits April 1, 2026 14:20
Bumps `@billos/firefly-iii-sdk` to version `6.5.5-sdk.2`. This update includes a change in the client configuration, where the `baseURL` property has been renamed to `baseUrl`. Adjusts client initialization to align with the new property name.
Billos added 2 commits April 1, 2026 14:21
Replaces the `axios` library with the built-in `fetch` API for all HTTP requests.

This change reduces project dependencies and leverages native platform capabilities. It impacts the Discord and Gotify notifiers, the auto-import job, and their associated unit tests.

Cleans up `axios` and its transitive dependencies from the project.
Billos added 2 commits April 1, 2026 14:26
Ensures external API calls using `fetch` explicitly check for non-successful
HTTP responses and throw detailed errors when requests fail. This improves
the reliability and provides clearer diagnostics for integrations with
Discord, Gotify, and the auto-import service.
Replaces previous `fetch` mocking approach with `vi.stubGlobal` in auto import tests. This simplifies and standardizes how the global `fetch` API is stubbed for test execution.
@Billos
Billos merged commit 60def1b into main Apr 1, 2026
4 checks passed
@Billos
Billos deleted the develop branch April 10, 2026 14:48
@coderabbitai coderabbitai Bot mentioned this pull request May 24, 2026
@coderabbitai coderabbitai Bot mentioned this pull request Jul 7, 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