ref: Update Igniter install task#1079
Open
andreas-ementio wants to merge 2 commits into
Open
Conversation
* update install mix task to use finch (commit 49ef2f7) * bump installed jason dependency to ~> 1.4 * use config_env() in generated prod.exs * only add Sentry.PlugCapture when the project uses Cowboy
| end | ||
|
|
||
| defp setup_endpoint(igniter, endpoint) do | ||
| # Sentry.PlugCapture is only recommended for Cowboy; on Bandit it can |
There was a problem hiding this comment.
Bug: The has_dep?(:plug_cowboy) check reads from the on-disk mix.exs, not in-memory state. If sentry.install is composed after add_dep without applying changes, the check will fail.
Severity: LOW
Suggested Fix
The has_dep? check should be made aware of pending changes in the igniter state. Alternatively, if this composition pattern is unsupported, the documentation for Igniter should be updated to clarify that changes must be applied before running dependent tasks.
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: lib/mix/tasks/sentry.install.ex#L141
Potential issue: The `sentry.install` task uses
`Igniter.Project.Deps.has_dep?(:plug_cowboy)` to decide whether to add
`Sentry.PlugCapture`. This function checks the on-disk `mix.exs` file, not the in-memory
state of an `igniter` process. If a developer programmatically composes tasks by first
adding `:plug_cowboy` with `add_dep` and then immediately running `sentry.install`
without first applying the changes to disk, the check will incorrectly return `false`.
This results in `Sentry.PlugCapture` being omitted from the configuration, even though
the project will have the `:plug_cowboy` dependency.
Did we get this right? 👍 / 👎 to inform future reviews.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
changing the following in the installer mix task :