Skip to content

RIC-T39 Backend work for IC updates#434

Merged
ucswift merged 1 commit into
masterfrom
develop
Jul 21, 2026
Merged

RIC-T39 Backend work for IC updates#434
ucswift merged 1 commit into
masterfrom
develop

Conversation

@ucswift

@ucswift ucswift commented Jul 21, 2026

Copy link
Copy Markdown
Member

Summary by CodeRabbit

  • New Features

    • Added incident needs tracking, including descriptions, priorities, quantities, fulfillment status, and sorting.
    • Added responder incident views showing objectives, needs, notes, attachments, assignments, and lane leads.
    • Added command detail editing for estimated completion times and important information.
    • Added tactical objective progress updates with in-progress and completion states.
    • Added lane lead, resource movement, assignment, release, and command transfer notifications.
    • Added activity history entries for needs, objective progress, lane leads, and command detail updates.
  • Documentation

    • Updated API documentation for the new incident command features and models.

@request-info

request-info Bot commented Jul 21, 2026

Copy link
Copy Markdown

Thanks for opening this, but we'd appreciate a little more information. Could you update it with more details?

@coderabbitai

coderabbitai Bot commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Adds incident needs, objective progress, lane lead data, command detail fields, responder incident views, database migrations, notification fan-out, and v4 API endpoints across the incident command model, service, repository, and web layers.

Changes

Incident command workflow

Layer / File(s) Summary
Domain contracts and persistence schema
Core/Resgrid.Model/IncidentCommand/*, Core/Resgrid.Model/Events/*, Providers/.../M0093*, Repositories/.../IncidentCommandRepositories.cs
Adds IncidentNeed, command and lane linkage fields, objective progress fields, event types, repository support, and SQL/PostgreSQL schema migrations.
Service workflows and notifications
Core/Resgrid.Services/IncidentCommandService.cs, Core/Resgrid.Services/IncidentCommandNotificationService.cs, Core/Resgrid.Model/Services/*
Includes needs in board and sync data, updates objective and fulfillment behavior, publishes lane/resource/command notifications, and registers the new services.
v4 API endpoints and documentation
Web/Resgrid.Web.Services/Controllers/v4/IncidentCommandController.cs, Web/Resgrid.Web.Services/Models/v4/IncidentCommand/*, Web/Resgrid.Web.Services/Resgrid.Web.Services.xml
Adds command detail, responder view, objective progress, and need endpoints with request/result models and API documentation updates.

Estimated code review effort: 4 (Complex) | ~60 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Client
  participant IncidentCommandController
  participant IncidentCommandService
  participant IncidentCommandNotificationService
  participant CommunicationService
  Client->>IncidentCommandController: update command, objective, or need
  IncidentCommandController->>IncidentCommandService: validate and persist change
  IncidentCommandService->>IncidentCommandNotificationService: publish command notification
  IncidentCommandNotificationService->>CommunicationService: deliver user notification
  IncidentCommandService-->>IncidentCommandController: updated command data
  IncidentCommandController-->>Client: API result
Loading

Possibly related PRs

  • Resgrid/Core#416: Extends the same incident command event and command structure model areas.
  • Resgrid/Core#417: Also extends the incident command offline synchronization payloads.

Suggested reviewers: github-actions

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 38.24% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The title is related to the change, but it is too generic to convey the main backend updates or scope clearly. Rename it to describe the primary change, such as incident command backend updates for needs, leads, objectives, and notifications.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 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.

[HttpPost("UpdateObjectiveProgress")]
[ProducesResponseType(StatusCodes.Status200OK)]
[Authorize(Policy = ResgridResources.Command_Update)]
public async Task<ActionResult<ICModels.TacticalObjectiveResult>> UpdateObjectiveProgress([FromBody] ICModels.UpdateObjectiveProgressInput input)
[ProducesResponseType(StatusCodes.Status200OK)]
[Authorize(Policy = ResgridResources.Command_Update)]
[RequiresIncidentCapability(IncidentCapabilities.ManageObjectives)]
public async Task<ActionResult<ICModels.IncidentNeedResult>> SaveNeed([FromBody] IncidentNeed need)
[HttpPost("SetNeedStatus")]
[ProducesResponseType(StatusCodes.Status200OK)]
[Authorize(Policy = ResgridResources.Command_Update)]
public async Task<ActionResult<ICModels.IncidentNeedResult>> SetNeedStatus([FromBody] ICModels.SetNeedStatusInput input)

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
Core/Resgrid.Services/IncidentCommandNotificationService.cs (1)

141-199: 🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick win

Hoist the shared department lookups out of the recipient loop. SendToUserAsync fetches the department and text-to-call number for every recipient even though both are constant within a broadcast; resolve them once in BroadcastToIncidentAsync and pass them through, keeping only the per-user profile lookup inside the loop.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@Core/Resgrid.Services/IncidentCommandNotificationService.cs` around lines 141
- 199, The shared department and text-to-call number lookups currently occur for
every user through SendToUserAsync. Resolve them once in
BroadcastToIncidentAsync before the recipient loop, then update SendToUserAsync
to accept and reuse those resolved values while retaining only the per-user
profile lookup.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@Core/Resgrid.Services/IncidentCommandService.cs`:
- Around line 477-480: The per-call board and bundle need collections apply
inconsistent cancelled-status filtering. Align GetNeedsForCallAsync and the
GetCommandBoardAsync path with GetBundleForDepartmentAsync so both exclude
IncidentNeedStatus.Cancelled, preserving the existing ordering and other
filters.

---

Nitpick comments:
In `@Core/Resgrid.Services/IncidentCommandNotificationService.cs`:
- Around line 141-199: The shared department and text-to-call number lookups
currently occur for every user through SendToUserAsync. Resolve them once in
BroadcastToIncidentAsync before the recipient loop, then update SendToUserAsync
to accept and reuse those resolved values while retaining only the per-user
profile lookup.
🪄 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: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 701fafb0-49ab-4a12-882e-c96d3beb7ceb

📥 Commits

Reviewing files that changed from the base of the PR and between dacede9 and de29826.

⛔ Files ignored due to path filters (3)
  • Tests/Resgrid.Tests/Services/IncidentCommandContentServiceTests.cs is excluded by !**/Tests/**
  • Tests/Resgrid.Tests/Services/IncidentCommandNeedsAndLeadsTests.cs is excluded by !**/Tests/**
  • Tests/Resgrid.Tests/Services/IncidentCommandServiceParTests.cs is excluded by !**/Tests/**
📒 Files selected for processing (22)
  • Core/Resgrid.Model/Events/IncidentCommandEvents.cs
  • Core/Resgrid.Model/IncidentCommand/CommandStructureNode.cs
  • Core/Resgrid.Model/IncidentCommand/IncidentCommand.cs
  • Core/Resgrid.Model/IncidentCommand/IncidentCommandBoard.cs
  • Core/Resgrid.Model/IncidentCommand/IncidentCommandChanges.cs
  • Core/Resgrid.Model/IncidentCommand/IncidentCommandEnums.cs
  • Core/Resgrid.Model/IncidentCommand/IncidentNeed.cs
  • Core/Resgrid.Model/IncidentCommand/IncidentTacticals.cs
  • Core/Resgrid.Model/IncidentCommand/ResourceIncidentView.cs
  • Core/Resgrid.Model/Repositories/IIncidentCommandRepositories.cs
  • Core/Resgrid.Model/Services/IIncidentCommandNotificationService.cs
  • Core/Resgrid.Model/Services/IIncidentCommandService.cs
  • Core/Resgrid.Services/IncidentCommandNotificationService.cs
  • Core/Resgrid.Services/IncidentCommandService.cs
  • Core/Resgrid.Services/ServicesModule.cs
  • Providers/Resgrid.Providers.Migrations/Migrations/M0093_AddIncidentNeedsLaneLeadsAndObjectiveProgress.cs
  • Providers/Resgrid.Providers.MigrationsPg/Migrations/M0093_AddIncidentNeedsLaneLeadsAndObjectiveProgressPg.cs
  • Repositories/Resgrid.Repositories.DataRepository/IncidentCommandRepositories.cs
  • Repositories/Resgrid.Repositories.DataRepository/Modules/DataModule.cs
  • Web/Resgrid.Web.Services/Controllers/v4/IncidentCommandController.cs
  • Web/Resgrid.Web.Services/Models/v4/IncidentCommand/IncidentCommandModels.cs
  • Web/Resgrid.Web.Services/Resgrid.Web.Services.xml

Comment on lines 477 to +480
Nodes = nodes[callId].Where(x => x.DeletedOn == null).OrderBy(x => x.SortOrder).ToList(),
Assignments = assignments[callId].Where(x => x.ReleasedOn == null).ToList(),
Objectives = objectives[callId].OrderBy(x => x.SortOrder).ToList(),
Needs = needs[callId].Where(x => x.Status != (int)IncidentNeedStatus.Cancelled).OrderBy(x => x.SortOrder).ToList(),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Board vs. bundle Needs diverge on cancelled needs.

GetBundleForDepartmentAsync filters Status != Cancelled, but GetCommandBoardAsync populates Needs via GetNeedsForCallAsync (Line 1626), which returns cancelled needs too. So the live polled board and the offline bundle return different need sets for the same call, and the comment on Lines 475-476 ("mirror the per-call getter filters exactly") no longer holds. Align them — either add the cancelled filter to GetNeedsForCallAsync/board or drop it from the bundle.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@Core/Resgrid.Services/IncidentCommandService.cs` around lines 477 - 480, The
per-call board and bundle need collections apply inconsistent cancelled-status
filtering. Align GetNeedsForCallAsync and the GetCommandBoardAsync path with
GetBundleForDepartmentAsync so both exclude IncidentNeedStatus.Cancelled,
preserving the existing ordering and other filters.

@ucswift

ucswift commented Jul 21, 2026

Copy link
Copy Markdown
Member Author

Approve

@github-actions github-actions 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.

This PR is approved.

@ucswift
ucswift merged commit 60db890 into master Jul 21, 2026
17 of 19 checks passed
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