Skip to content

feat: Add inline dependency rendering to TaskTreeView - #49

Merged
frankbria merged 2 commits into
mainfrom
feat/taskview-dependency-rendering
Dec 5, 2025
Merged

feat: Add inline dependency rendering to TaskTreeView#49
frankbria merged 2 commits into
mainfrom
feat/taskview-dependency-rendering

Conversation

@frankbria

@frankbria frankbria commented Dec 5, 2025

Copy link
Copy Markdown
Owner

Summary

Adds inline dependency rendering to TaskTreeView component, replacing the previous hover-only tooltip implementation with immediately visible text.

Fixes #42

Changes Made

TaskTreeView.tsx

  • Simplified dependency display (lines 228-233): Replaced 40-line hover tooltip with 6-line inline text
  • Format: Depends on: task-1, task-3 (comma-separated)
  • Kept visual indicators: 🔗 emoji and blocked status badge remain unchanged

TaskTreeView.test.tsx

  • Removed skip decorators: Lines 248 and 382 tests now run
  • Updated test: Line 607 test updated to match new "Depends on" format

Visual Changes

Before:

T-002 Create login form component
  🔗 in_progress  ↳ 1 dependency  [hover for tooltip]

After:

T-002 Create login form component
  🔗 in_progress  Depends on: task-1

Test Results

All TaskTreeView tests pass (38/38)
Full frontend suite passes (1096 tests)
No regressions introduced

Specific Tests Fixed

  • should display task dependencies (line 248)
  • should handle multiple dependencies correctly (line 382)

Acceptance Criteria

All criteria from issue #42 met:

  • Tasks with dependencies show "depends on" text
  • Dependency task IDs/names are displayed
  • Multiple dependencies are handled correctly (comma-separated)
  • Tests pass
  • Skip decorators removed

Code Quality

  • Lines of code: -36 (simplified from 40 to 6 lines)
  • Test coverage: Maintained at 100% for component
  • No new dependencies: Uses existing React patterns
  • Accessibility: Text is immediately visible without interaction

Review Checklist

Summary by CodeRabbit

  • Changes

    • Task dependency information now displays inline with "Depends on: [task IDs]" format instead of hover tooltip for improved visibility.
  • Tests

    • Re-enabled two previously skipped dependency-related tests and updated assertions to verify the new inline dependency display format.

✏️ Tip: You can customize this high-level summary in your review settings.

- Replace hover tooltip with inline "Depends on: task-1, task-3" text
- Remove .skip from two dependency tests (lines 248, 382)
- Update dependency count test to match new format
- Simplify implementation from 40 lines to 6 lines

Fixes #42

Test Results:
- All 38 TaskTreeView tests pass
- Full suite: 1096 tests pass
- No regressions introduced

Visual Change:
Before: "↳ 1 dependency" (hover for details)
After: "Depends on: task-1, task-3" (inline, immediately visible)
@coderabbitai

coderabbitai Bot commented Dec 5, 2025

Copy link
Copy Markdown
Contributor

Warning

Rate limit exceeded

@frankbria has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 13 minutes and 59 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between 6ef9188 and 3d0ccc6.

📒 Files selected for processing (1)
  • web-ui/src/components/TaskTreeView.tsx (1 hunks)

Walkthrough

The pull request re-enables two previously skipped tests for task dependency rendering and updates the TaskTreeView component to display task dependencies inline as "Depends on: [ids]" text, replacing a previous hover-tooltip implementation. Tests verify dependency display under expanded task states.

Changes

Cohort / File(s) Summary
Test updates
web-ui/src/components/TaskTreeView.test.tsx
Re-enabled two skipped tests: "should display task dependencies" and "should handle multiple dependencies correctly". Updated assertions from dependency counts to pattern-based text matching ("depends on" with task IDs).
Component implementation
web-ui/src/components/TaskTreeView.tsx
Simplified dependency display by removing hover tooltip and replacing it with inline "Depends on: [ids]" text span. No changes to dependency computation logic.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

  • Straightforward test re-enablement with updated assertions
  • Minimal UI text replacement in component render logic
  • No complex business logic or control-flow changes
  • Focused scope affecting only dependency display rendering

Poem

🐰 Hops with glee, dependencies now show!
No tooltips hiding, just text in a row—
"Depends on" whispers, clear as can be,
Task relationships for all eyes to see!

Pre-merge checks and finishing touches

✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed Title accurately captures the main change: adding inline dependency rendering to TaskTreeView component.
Linked Issues check ✅ Passed PR implementation meets all acceptance criteria from issue #42: dependencies rendered inline, IDs displayed, multiple dependencies comma-separated, tests fixed and skip decorators removed.
Out of Scope Changes check ✅ Passed All changes are scoped to TaskTreeView component and its tests, directly addressing issue #42 objectives without unrelated modifications.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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 and usage tips.

@claude

claude Bot commented Dec 5, 2025

Copy link
Copy Markdown

Code Review - PR #49: Add inline dependency rendering to TaskTreeView

Summary

This PR successfully simplifies the dependency display in TaskTreeView by replacing a complex hover tooltip with inline text. The change improves UX by making dependency information immediately visible without user interaction.


Positive Aspects

  1. Significant Code Simplification

    • Reduced from 40 lines to 6 lines (-85% LOC)
    • Removed complex hover tooltip logic with nested lookups
    • Cleaner, more maintainable code
  2. Improved Accessibility

    • Dependencies now visible without hover interaction
    • Better for keyboard navigation and screen readers
    • No reliance on CSS group-hover patterns
  3. Test Coverage

    • Removed skip decorators (lines 248, 382)
    • Updated test assertions to match new format
    • All 38 TaskTreeView tests passing
  4. Consistent Pattern

    • Matches existing issue-level dependency rendering (line 152-156)

Issues and Concerns

1. Type Safety - Potential Runtime Error (CRITICAL)

Location: TaskTreeView.tsx:231

While hasDependencies checks task.depends_on?.length, TypeScript doesn't narrow the type inside JSX. If task.depends_on is undefined at runtime, this will throw an error.

Recommendation: Add non-null assertion or defensive check:

  • Option 1: task.depends_on!.join
  • Option 2: hasDependencies && task.depends_on && (...)

2. Loss of Rich Dependency Information (UX REGRESSION)

Before: Hover tooltip showed task numbers, titles, status, and color-coded indicators

After: Shows only task IDs (e.g., task-1, task-3)

Impact: Users lost ability to see dependency titles and completion status without navigation

Recommendation: Consider showing task numbers or adding tooltip back for expanded details

3. Visual Spacing (MINOR)

The new inline text appears immediately after the blocked badge. Consider adding ml-2 margin for better visual separation.


Testing

Test Updates: Appropriate

  • Line 612-616: Changed from dependency count to inline pattern match
  • Tests now validate inline rendering instead of hover behavior

Missing Test Cases:

  1. Test for undefined depends_on (edge case)
  2. Test for empty depends_on array (edge case)

Recommendations

Priority:

  1. HIGH: Fix potential runtime error with non-null assertion or defensive check
  2. MEDIUM: Consider restoring some rich dependency info
  3. LOW: Add margin for visual spacing
  4. LOW: Add edge case tests

Overall Assessment

Verdict: Approve with Minor Changes

This PR successfully addresses issue #42 and improves code maintainability. The main concern is the potential runtime error with task.depends_on.join(). Please add null safety before merging.

Risk Level: Medium (type safety issue could cause production errors)

Merge Recommendation: Merge after fixing null safety issue.

Great work on simplifying the code! The reduction from 40 lines to 6 lines is impressive.

@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: 0

🧹 Nitpick comments (3)
web-ui/src/components/TaskTreeView.test.tsx (3)

248-259: Consider deduplicating single-dependency display tests

This new test correctly verifies the inline "depends on … task-1" text using a resilient regex, but it overlaps quite a bit with the later "should show dependency count for tasks with dependencies" test that asserts the same behavior. You might consider consolidating these two into a single focused test to reduce duplication and future maintenance when copy changes.


382-405: Tighten multi-dependency assertion to cover comma-separated formatting

The multi-dependency test ensures all three IDs appear in order, which is good, but it doesn’t assert the comma-separated requirement specifically. To lock in the expected format, consider asserting the exact text (or a more precise regex), e.g.:

-  const multiDepElements = screen.getAllByText(/depends on.*task-1.*task-3.*task-5/i);
+  const multiDepElements = screen.getAllByText(/Depends on:\s*task-1,\s*task-3,\s*task-5/i);

or even:

-  const multiDepElements = screen.getAllByText(/depends on.*task-1.*task-3.*task-5/i);
-  expect(multiDepElements.length).toBeGreaterThan(0);
+  const [multiDepElement] = screen.getAllByText(/Depends on:/i);
+  expect(multiDepElement).toHaveTextContent('Depends on: task-1, task-3, task-5');

This would more directly enforce the “comma-separated” acceptance criterion.


607-618: Test name no longer matches behavior (no “count” is asserted)

The updated assertion now checks for "depends on … task-1" text, which is correct for the new inline UI, but the test name still says "should show dependency count". To avoid confusion, consider renaming it to better reflect the behavior under test, e.g.:

-    it('should show dependency count for tasks with dependencies', async () => {
+    it('should show dependency text for tasks with dependencies', async () => {

The underlying expectation looks good; this is just a clarity tweak.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 78a1881 and 6ef9188.

📒 Files selected for processing (2)
  • web-ui/src/components/TaskTreeView.test.tsx (3 hunks)
  • web-ui/src/components/TaskTreeView.tsx (1 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
web-ui/src/**/*.{ts,tsx}

📄 CodeRabbit inference engine (CLAUDE.md)

web-ui/src/**/*.{ts,tsx}: Use TypeScript 5.3+ with React, strict mode, and maintain 85%+ test coverage for frontend code
Use React 18 with Tailwind CSS for frontend styling
Use Context + Reducer pattern (React Context with useReducer) for centralized state management in frontend

Files:

  • web-ui/src/components/TaskTreeView.tsx
  • web-ui/src/components/TaskTreeView.test.tsx
web-ui/**/*.{ts,tsx,test.ts,test.tsx}

📄 CodeRabbit inference engine (CLAUDE.md)

Run frontend tests with npm test from web-ui directory

Files:

  • web-ui/src/components/TaskTreeView.tsx
  • web-ui/src/components/TaskTreeView.test.tsx
web-ui/src/components/**/*.tsx

📄 CodeRabbit inference engine (CLAUDE.md)

Use React.memo on all Dashboard sub-components for performance optimization

Files:

  • web-ui/src/components/TaskTreeView.tsx
  • web-ui/src/components/TaskTreeView.test.tsx
🧠 Learnings (3)
📚 Learning: 2025-11-25T19:08:20.036Z
Learnt from: CR
Repo: frankbria/codeframe PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-25T19:08:20.036Z
Learning: Applies to web-ui/src/**/*.{ts,tsx} : Use TypeScript 5.3+ with React, strict mode, and maintain 85%+ test coverage for frontend code

Applied to files:

  • web-ui/src/components/TaskTreeView.test.tsx
📚 Learning: 2025-11-25T19:08:20.036Z
Learnt from: CR
Repo: frankbria/codeframe PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-25T19:08:20.036Z
Learning: Applies to web-ui/**/*.{ts,tsx,test.ts,test.tsx} : Run frontend tests with npm test from web-ui directory

Applied to files:

  • web-ui/src/components/TaskTreeView.test.tsx
📚 Learning: 2025-11-25T19:08:37.203Z
Learnt from: CR
Repo: frankbria/codeframe PR: 0
File: docs/CLAUDE.md:0-0
Timestamp: 2025-11-25T19:08:37.203Z
Learning: Applies to docs/web-ui/**/__tests__/**/*.test.{ts,tsx} : Create JavaScript test files colocated or in __tests__/ as *.test.ts

Applied to files:

  • web-ui/src/components/TaskTreeView.test.tsx
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: Backend Unit Tests
  • GitHub Check: Frontend Unit Tests
  • GitHub Check: claude-review
🔇 Additional comments (1)
web-ui/src/components/TaskTreeView.tsx (1)

228-233: Inline dependency text is clear and matches the new UX

The new inline "Depends on: …" span reuses the existing depends_on array, is correctly guarded by hasDependencies, and cleanly handles multiple dependencies via join(', '). This aligns with the PR’s accessibility and UX goals without introducing new edge cases.

1. Type Safety (CRITICAL):
   - Added defensive check: hasDependencies && task.depends_on &&
   - Prevents runtime error if depends_on is undefined
   - TypeScript type narrowing now properly handled

2. UX Improvement - Restore Rich Information:
   - Added tooltip with task numbers, titles, and status
   - Tooltip format: "T-001: Implement auth (completed)"
   - Keeps inline visibility while providing detailed hover info
   - Addresses UX regression from removing rich tooltip

3. Visual Spacing:
   - Added ml-2 margin for better badge separation
   - Added cursor-help for tooltip discoverability

Test Results:
- All 38 TaskTreeView tests pass
- No regressions introduced

Visual Result:
Inline: "Depends on: task-1, task-3"
Hover: "T-001: Implement auth (completed)
        T-003: Setup database (in_progress)"
@frankbria

Copy link
Copy Markdown
Owner Author

Code Review Feedback Addressed

Thanks for the thorough review! I've addressed all three concerns:

1. ✅ Type Safety Fix (CRITICAL)

Issue: task.depends_on.join() could throw runtime error if undefined

Fix: Added defensive check:

{hasDependencies && task.depends_on && (
  // ... safe to use task.depends_on.join()
)}

Impact: Prevents potential runtime crashes, TypeScript type narrowing now proper


2. ✅ Rich Dependency Information Restored

Issue: Lost task numbers, titles, and status indicators from previous tooltip

Fix: Added back rich tooltip while keeping inline visibility:

Inline (always visible):

Depends on: task-1, task-3

Tooltip (on hover):

Dependencies:
T-001: Implement authentication (completed)
T-003: Setup database (in_progress)

Implementation:

  • Native browser title attribute with newline-separated details
  • Shows task number, title, and status for each dependency
  • Fallback to dependency ID if task not found
  • Added cursor-help class for discoverability

Impact: Best of both worlds - immediate visibility + detailed information on demand


3. ✅ Visual Spacing Added

Issue: No spacing between blocked badge and dependency text

Fix: Added ml-2 margin-left class

Before:

🚫 BlockedDepends on: task-1

After:

🚫 Blocked  Depends on: task-1

Test Results

✅ All 38 TaskTreeView tests pass
✅ No regressions introduced
✅ Type safety verified

Commits

  • 6ef9188 - Initial implementation
  • 3d0ccc6 - Code review fixes (this update)

@claude

claude Bot commented Dec 5, 2025

Copy link
Copy Markdown

Code Review Summary

Overall Assessment:APPROVE - This is a well-executed improvement with excellent code quality, comprehensive testing, and clear UX benefits.


Strengths 💪

1. Excellent Simplification

  • -36 lines of code (40 → 6 lines) while maintaining functionality
  • Removed complex tooltip implementation in favor of simpler inline display
  • Cleaner, more maintainable code

2. Smart UX Compromise

The second commit addresses a potential UX regression beautifully:

  • Inline text provides immediate visibility ("Depends on: task-1, task-3")
  • Rich tooltip preserves detailed information on hover (task numbers, titles, status)
  • Best of both worlds! 🎯

3. Type Safety Improvements

The defensive check is critical:

{hasDependencies && task.depends_on && (

This prevents runtime errors if depends_on is undefined, which could happen since it is typed as optional (depends_on?: number[] in types/index.ts:69).

4. Comprehensive Testing

  • ✅ Re-enabled 2 previously skipped tests
  • ✅ Updated assertions to match new format
  • ✅ All 38 TaskTreeView tests passing
  • ✅ Full frontend suite (1096 tests) passing
  • No test debt introduced

5. Accessibility Win

  • Information is immediately visible without requiring hover interaction
  • cursor-help provides visual affordance for tooltip availability
  • Better for keyboard navigation and screen readers

Issues Found 🔍

1. Type Inconsistency Between Task Interfaces ⚠️

Location: web-ui/src/types/index.ts:69 vs web-ui/src/types/agentState.ts:103

Issue:

// types/index.ts - Used by TaskTreeView
depends_on?: number[];

// types/agentState.ts - Different schema
blocked_by?: number[];  // Different field name!

Impact:

  • Two different Task interfaces exist in the codebase
  • agentState.ts uses blocked_by instead of depends_on
  • This could cause confusion and bugs if these types are used interchangeably

Recommendation:
Consider consolidating these Task interfaces or at least documenting why they differ. The defensive check (task.depends_on &&) mitigates runtime issues, but the schema divergence should be addressed.

2. Minor: Task ID Type Ambiguity

Location: TaskTreeView.tsx:235-236

const depTask = allTasks.find(
  (t) => t.id === depId || t.task_number === depId
);

Issue:

  • The code checks both id and task_number fields
  • But depends_on is typed as number[] (presumably IDs)
  • The fallback to task_number suggests some uncertainty about the data shape

Recommendation:
Document which field is the canonical dependency reference. If both are needed for backward compatibility, add a comment explaining why.


Performance Considerations ⚡

Tooltip String Computation

Current implementation:
The tooltip is computed inline on every render for every task with dependencies.

Concern:

  • The .find() operation is O(n) where n = number of tasks
  • For k dependencies, this is O(k*n) per task
  • Runs on every render

Impact:

  • Likely negligible for typical task counts (<100)
  • Could become noticeable with hundreds of tasks

Recommendation:
Consider memoizing the tooltip string if performance issues are observed. This is low priority - premature optimization unless proven necessary.


Security Considerations 🔒

No security concerns identified

  • No XSS risk (React escapes text content automatically)
  • No injection vulnerabilities
  • No sensitive data exposure

Best Practices Alignment 📋

✅ Follows Project Conventions

Per CLAUDE.md guidelines:

  • Uses existing React patterns (no new dependencies)
  • Maintains test coverage at 100%
  • Simplifies code (avoids over-engineering)
  • No backwards-compatibility hacks

✅ Matches TypeScript/React Standards

  • Proper type narrowing with defensive checks
  • Clean JSX structure
  • Semantic HTML with accessibility considerations

Suggestions for Follow-up

Optional Enhancements (Not Blockers)

  1. Create a task to consolidate Task type definitions across types/index.ts and types/agentState.ts
  2. Document dependency ID semantics (id vs task_number usage)
  3. Consider memoization if performance becomes an issue with large task counts

Final Verdict

Status:APPROVED

This PR successfully:

  • ✅ Fixes issue Implement TaskTreeView dependency rendering #42
  • ✅ Improves UX (inline visibility + rich tooltips)
  • ✅ Simplifies codebase (-36 LOC)
  • ✅ Maintains 100% test coverage
  • ✅ Passes all tests (38/38 TaskTreeView, 1096/1096 full suite)
  • ✅ Includes proper type safety guards

The type inconsistency issue is worth addressing in a follow-up, but the defensive checks in this PR prevent any runtime issues.

Great work! 🎉


Review performed by Claude Code based on CLAUDE.md project guidelines

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.

Implement TaskTreeView dependency rendering

1 participant