fix(dashboard): guard task detail log rendering - #1677
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughAdds ChangesLegacy Log Entry Field Compatibility
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
This PR hardens task activity-log parsing/rendering in the dashboard so legacy/operator-shaped log entries (using text/detail) don’t break UI features that expect action/outcome.
Changes:
- Added
getTaskLogEntryAction/getTaskLogEntryOutcomehelpers with safe fallbacks. - Updated stall-log scanning and Task Detail log rendering to use the helpers.
- Added Vitest coverage for legacy/malformed log-entry handling.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/dashboard/app/utils/taskLogEntryDisplay.ts | Introduces helper functions and a “like” type for safely extracting display strings from mixed-shape log entries. |
| packages/dashboard/app/utils/findInReviewStallLogEntry.ts | Uses the new helper to avoid .match on missing/non-string action. |
| packages/dashboard/app/components/TaskDetailModal.tsx | Updates UI rendering and regex matching to rely on safe action/outcome extraction. |
| packages/dashboard/app/tests/task-log-entry-display.test.ts | Adds test coverage for fallback behavior and non-throwing stall scanning. |
| .changeset/guard-task-detail-log-entry-shape.md | Records a patch changeset describing the guard behavior change. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Greptile SummaryGuards all activity-log rendering in
Confidence Score: 5/5Safe to merge — the change is a targeted crash guard with no behavioral changes to the happy path, and all four affected code sites have been updated. All direct entry.action accesses in the rendering and stall-detection paths are replaced with the new safe helpers. taskTiming.ts already used || / ?? guards that make it safe. The new utility has clear fallback semantics, and five regression tests confirm the crash-prone scenarios now return safe values instead of throwing. No files require special attention. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Task log entry from DB] --> B{has action field?}
B -- "yes, non-blank" --> C[use entry.action]
B -- "no / blank" --> D{has text field?}
D -- "yes, non-blank" --> E[use entry.text]
D -- "no" --> F[return empty string]
G[Task log entry from DB] --> H{has outcome field?}
H -- "yes, non-blank" --> I[use entry.outcome]
H -- "no / blank" --> J{has detail field?}
J -- "yes, non-blank" --> K[use entry.detail]
J -- "no" --> L[return undefined]
C --> M[regex match / render]
E --> M
F --> M
I --> N[render outcome div]
K --> N
L --> O[skip outcome div]
Reviews (4): Last reviewed commit: "fix(dashboard): document legacy task log..." | Re-trigger Greptile |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
packages/dashboard/app/utils/taskLogEntryDisplay.ts (1)
1-29: 🛠️ Refactor suggestion | 🟠 Major | ⚡ Quick winAdd FNXC_LOG comments per coding guidelines.
The coding guidelines require FNXC comments for all important changes in
packages/**/*.{ts,tsx,js,jsx}files. Add a jsdoc comment above each function describing the date (format yyyy-MM-dd-hh:mm) and the requirement it addresses (fallback for legacy log entry fields).📝 Suggested documentation
import type { TaskLogEntry } from "`@fusion/core`"; export type TaskLogEntryLike = Partial<TaskLogEntry> & { action?: unknown; outcome?: unknown; text?: unknown; detail?: unknown; }; +/** + * FNXC:TaskDetail 2026-06-14 Extract action string from log entry with fallback to legacy 'text' field. + * Requirement: Task detail activity log must not crash when rendering legacy/operator log entries + * that use text/detail instead of action/outcome fields. + */ export function getTaskLogEntryAction(entry: TaskLogEntryLike | null | undefined): string { if (typeof entry?.action === "string") { return entry.action; } if (typeof entry?.text === "string") { return entry.text; } return ""; } +/** + * FNXC:TaskDetail 2026-06-14 Extract optional outcome string from log entry with fallback to legacy 'detail' field. + * Requirement: Task detail activity log must not crash when rendering legacy/operator log entries + * that use text/detail instead of action/outcome fields. + */ export function getTaskLogEntryOutcome(entry: TaskLogEntryLike | null | undefined): string | undefined { if (typeof entry?.outcome === "string" && entry.outcome.length > 0) { return entry.outcome; } if (typeof entry?.detail === "string" && entry.detail.length > 0) { return entry.detail; } return undefined; }As per coding guidelines, add FNXC comments describing the date of the change (format yyyy-MM-dd-hh:mm) and describing the requirements or the change in requirements. Write FNXC:Area-of-product in front of all comments. Write most of this as jsdocs but add short comments for important variables and complex parts.
🤖 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 `@packages/dashboard/app/utils/taskLogEntryDisplay.ts` around lines 1 - 29, Add FNXC jsdoc comments above both the getTaskLogEntryAction and getTaskLogEntryOutcome functions per coding guidelines. Each comment should include the current date in yyyy-MM-dd-hh:mm format, reference the FNXC:Area-of-product format, and describe that the functions provide fallback support for legacy log entry fields (action/text for getTaskLogEntryAction and outcome/detail for getTaskLogEntryOutcome).Source: Coding guidelines
packages/dashboard/app/components/TaskDetailModal.tsx (1)
3239-3270: 🛠️ Refactor suggestion | 🟠 Major | ⚡ Quick winAdd FNXC comment documenting the log entry display change.
Per coding guidelines, add a short FNXC comment above line 3242 noting the date and requirement: safe extraction of action/outcome from log entries that may use legacy text/detail fields.
📝 Suggested comment
{(() => { let highlightedOnce = false; return [...workingTask.log].reverse().map((entry, i) => { + // FNXC:TaskDetail 2026-06-14 Safe extraction with fallback to legacy text/detail fields const action = getTaskLogEntryAction(entry); const outcome = getTaskLogEntryOutcome(entry); const stallMatch = action.match(IN_REVIEW_STALL_LOG_REGEX)As per coding guidelines, add FNXC:Area-of-product in front of all comments and describe the requirements or the change in requirements.
🤖 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 `@packages/dashboard/app/components/TaskDetailModal.tsx` around lines 3239 - 3270, Add a FNXC comment above the highlightedOnce variable declaration in the anonymous function that maps workingTask.log entries. The comment should follow the format "FNXC:Area-of-product" and document the requirement that the getTaskLogEntryAction and getTaskLogEntryOutcome function calls safely extract action and outcome from log entries that may use legacy text/detail fields, noting when this requirement was established.Source: Coding guidelines
🤖 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.
Outside diff comments:
In `@packages/dashboard/app/components/TaskDetailModal.tsx`:
- Around line 3239-3270: Add a FNXC comment above the highlightedOnce variable
declaration in the anonymous function that maps workingTask.log entries. The
comment should follow the format "FNXC:Area-of-product" and document the
requirement that the getTaskLogEntryAction and getTaskLogEntryOutcome function
calls safely extract action and outcome from log entries that may use legacy
text/detail fields, noting when this requirement was established.
In `@packages/dashboard/app/utils/taskLogEntryDisplay.ts`:
- Around line 1-29: Add FNXC jsdoc comments above both the getTaskLogEntryAction
and getTaskLogEntryOutcome functions per coding guidelines. Each comment should
include the current date in yyyy-MM-dd-hh:mm format, reference the
FNXC:Area-of-product format, and describe that the functions provide fallback
support for legacy log entry fields (action/text for getTaskLogEntryAction and
outcome/detail for getTaskLogEntryOutcome).
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 92e422e1-631b-4de6-b6be-d075752ed91b
📒 Files selected for processing (5)
.changeset/guard-task-detail-log-entry-shape.mdpackages/dashboard/app/__tests__/task-log-entry-display.test.tspackages/dashboard/app/components/TaskDetailModal.tsxpackages/dashboard/app/utils/findInReviewStallLogEntry.tspackages/dashboard/app/utils/taskLogEntryDisplay.ts
34cf56b to
bcfb1e9
Compare
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
packages/dashboard/app/utils/inReviewStallCopy.ts (1)
113-120: 🛠️ Refactor suggestion | 🟠 Major | ⚡ Quick winAdd FNXC JSDoc comment documenting the legacy log entry handling.
This function now handles legacy log entry formats via
getTaskLogEntryAction, which prevents crashes when log entries lack theactionfield—an important behavioral change that should be documented.📝 Suggested JSDoc
+/** + * FNXC:TaskLogs YYYY-MM-DD-HH:MM + * Detects whether a task was auto-disposed due to in-review stall deadlock. + * Uses getTaskLogEntryAction to handle legacy log entries that may lack the action field, + * preventing crashes when rendering activity logs with operator or legacy-shaped entries. + */ export function getInReviewStallDeadlockCopy(task: Pick<Task, "pausedReason" | "log">): InReviewStallDeadlockCopy | undefined {As per coding guidelines, changes should include FNXC comments with dates (format yyyy-MM-dd-hh:mm) and requirement descriptions.
🤖 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 `@packages/dashboard/app/utils/inReviewStallCopy.ts` around lines 113 - 120, Add a FNXC JSDoc comment to the getInReviewStallDeadlockCopy function that documents the legacy log entry handling behavior. The comment should explain that the function uses getTaskLogEntryAction to safely handle legacy log entry formats that may lack the action field, which prevents crashes when processing older log data. Include the FNXC comment with a date in yyyy-MM-dd-hh:mm format and a brief requirement description explaining the purpose of this backward compatibility handling.Source: Coding guidelines
🤖 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.
Outside diff comments:
In `@packages/dashboard/app/utils/inReviewStallCopy.ts`:
- Around line 113-120: Add a FNXC JSDoc comment to the
getInReviewStallDeadlockCopy function that documents the legacy log entry
handling behavior. The comment should explain that the function uses
getTaskLogEntryAction to safely handle legacy log entry formats that may lack
the action field, which prevents crashes when processing older log data. Include
the FNXC comment with a date in yyyy-MM-dd-hh:mm format and a brief requirement
description explaining the purpose of this backward compatibility handling.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 5cc80a80-3280-411a-8c0f-f0ea513c2ebb
📒 Files selected for processing (6)
.changeset/guard-task-detail-log-entry-shape.mdpackages/dashboard/app/__tests__/task-log-entry-display.test.tspackages/dashboard/app/components/TaskDetailModal.tsxpackages/dashboard/app/utils/findInReviewStallLogEntry.tspackages/dashboard/app/utils/inReviewStallCopy.tspackages/dashboard/app/utils/taskLogEntryDisplay.ts
✅ Files skipped from review due to trivial changes (1)
- .changeset/guard-task-detail-log-entry-shape.md
🚧 Files skipped from review as they are similar to previous changes (4)
- packages/dashboard/app/tests/task-log-entry-display.test.ts
- packages/dashboard/app/utils/taskLogEntryDisplay.ts
- packages/dashboard/app/utils/findInReviewStallLogEntry.ts
- packages/dashboard/app/components/TaskDetailModal.tsx
bcfb1e9 to
84cf3ff
Compare
Summary
text/detailfields instead ofaction/outcome.Root cause
A live Atlas Notes task had an operator activity entry shaped as
{ text, detail, type }.TaskDetailModalassumed every activity entry hadentry.actionand calledentry.action.match(...), which crashed the section withundefined is not an object.Verification
corepack pnpm --filter @fusion/dashboard exec vitest run app/__tests__/task-log-entry-display.test.ts --silent=passed-only --reporter=dotcorepack pnpm --filter @fusion/dashboard typecheckcorepack pnpm --filter @fusion/dashboard buildSummary by CodeRabbit
text/detailmapping, empty/fallback behavior, malformed inputs, and safe handling when actions are missing.