fix: notify goal description mentions#4555
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Hey - I've found 1 issue, and left some high level feedback:
- In
GoalCreated.dispatch/1, consider guarding againstgoal.descriptionbeingnil(e.g., by defaulting to an empty rich text structure) before callingRichContent.find_mentioned_ids/2to avoid edge-case crashes when a goal is created without a description. - For
load_preloaded_resource(:goal, ids), you may want to normalizeg.description(e.g., ensure it is non-nil or in a consistent rich-text shape) so the direct mention classifier doesn't have to handlenilor unexpected formats differently per resource type.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- In `GoalCreated.dispatch/1`, consider guarding against `goal.description` being `nil` (e.g., by defaulting to an empty rich text structure) before calling `RichContent.find_mentioned_ids/2` to avoid edge-case crashes when a goal is created without a description.
- For `load_preloaded_resource(:goal, ids)`, you may want to normalize `g.description` (e.g., ensure it is non-nil or in a consistent rich-text shape) so the direct mention classifier doesn't have to handle `nil` or unexpected formats differently per resource type.
## Individual Comments
### Comment 1
<location path="app/lib/operately/activities/notifications/goal_created.ex" line_range="8" />
<code_context>
goal = Operately.Goals.get_goal!(goal_id)
- people = [goal.champion_id, goal.reviewer_id]
+ mentioned_ids = RichContent.find_mentioned_ids(goal.description, :decode_ids)
+ people = [goal.champion_id, goal.reviewer_id | mentioned_ids]
</code_context>
<issue_to_address>
**issue (bug_risk):** Guard against nil goal.description when passing it into RichContent.find_mentioned_ids.
If `goal.description` can be `nil` (e.g. for API-created or legacy goals), this call can raise. Please normalize to a safe default (e.g. `goal.description || ""` or a guard clause) before calling `RichContent.find_mentioned_ids/2`.
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
mancinux
force-pushed
the
codex/1219-description-mention-notifications
branch
from
May 27, 2026 13:31
5f3fdb0 to
f437a1d
Compare
Signed-off-by: Luca Mancini <lmancini@operately.com>
mancinux
force-pushed
the
codex/1219-description-mention-notifications
branch
from
May 27, 2026 14:42
2500c0f to
4c79834
Compare
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.
resolves #1219