Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ defmodule Cadet.Mixfile do
{:ex_machina, "~> 2.3"},
{:ex_rated, "~> 2.0"},
{:guardian, "~> 2.0"},

This comment was marked as outdated.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Bug: The application references Guardian.DB.Token.SweeperServer, which was renamed to Guardian.DB.Sweeper in Guardian.DB v3.0, causing a startup failure.
Severity: CRITICAL

Suggested Fix

In lib/cadet/application.ex, update the worker from Guardian.DB.Token.SweeperServer to Guardian.DB.Sweeper to use the correct module name for the new version.

Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent.
Verify if this is a real issue. If it is, propose a fix; if not, explain why it's not
valid.

Location: mix.exs#L73

Potential issue: The application's worker list references
`Guardian.DB.Token.SweeperServer`. Following the upgrade to Guardian.DB v3.0, this
module has been renamed to `Guardian.DB.Sweeper`. This incorrect module reference will
cause the application to fail during initialization because the specified module no
longer exists, preventing the application from starting.

{:guardian_db, "~> 2.0"},
{:guardian_db, "~> 3.0"},
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Bug: The upgrade to Guardian.DB v3 is incomplete. It's missing required configuration changes for the adapter and sweeper, which will cause authentication flows to fail at runtime.
Severity: CRITICAL

Suggested Fix

In config/config.exs, add adapter: Guardian.DB.EctoAdapter to the :guardian, Guardian.DB configuration. In lib/cadet/application.ex, update the worker from Guardian.DB.Token.SweeperServer to Guardian.DB.Sweeper. Also, remove the now-obsolete sweep_interval configuration key.

Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent.
Verify if this is a real issue. If it is, propose a fix; if not, explain why it's not
valid.

Location: mix.exs#L74

Potential issue: Upgrading `guardian_db` to version 3.0 introduces several breaking
changes that are not addressed in this PR. The application configuration is missing the
mandatory `adapter` key, which is required for `Guardian.DB` functions to operate.
Additionally, the token sweeper worker has been renamed from
`Guardian.DB.Token.SweeperServer` to `Guardian.DB.Sweeper`, and the `sweep_interval`
configuration option is obsolete. These omissions will cause runtime failures during
critical authentication operations like token creation, verification, and revocation.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Bug: The guardian_db v3.0.0 upgrade requires an explicit adapter configuration, which is missing. This will cause authentication flows to fail at runtime.
Severity: HIGH

Suggested Fix

In config/config.exs, add adapter: Guardian.DB.EctoAdapter to the :guardian, Guardian.DB configuration block to explicitly use the default Ecto adapter.

Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent.
Verify if this is a real issue. If it is, propose a fix; if not, explain why it's not
valid.

Location: mix.exs#L74

Potential issue: The upgrade to `guardian_db` v3.0.0 introduces a breaking change where
the adapter must be explicitly configured. The application's configuration in
`config/config.exs` is missing the required `adapter` key. This will cause Guardian.DB
functions, which are used for authentication flows like login and token verification, to
fail at runtime.

{:hackney, "~> 1.6"},
{:httpoison, "~> 2.3", override: true},
{:jason, "~> 1.2"},
Expand Down
Loading