fix: display task complexity in list after analyze-complexity#1672
fix: display task complexity in list after analyze-complexity#1672withsivram wants to merge 1 commit intoeyaltoledano:mainfrom
Conversation
…o#1614) When tasks are stored under a non-master tag in legacy format and the list command defaults to 'master', the complexity report lookup was using 'master' as the tag — which doesn't match the tag-specific report file (e.g., task-complexity-report_foo.json). Root cause: In legacy format, FormatHandler.extractTasks() falls back from 'master' to the first available tag when loading tasks, but FileStorage.loadTasks() was still passing 'master' to the complexity enrichment step, causing a report file mismatch. Fix: Add FormatHandler.resolveTag() to determine the actual tag used for task extraction, then pass that resolved tag to enrichTasksWithComplexity() so the correct complexity report is loaded. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
🦋 Changeset detectedLatest commit: add4239 The changes in this PR will be included in the next version bump. Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
📝 WalkthroughWalkthroughThis PR fixes a bug where task complexity data failed to display in the Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 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
Fixes a legacy tag-fallback mismatch so task-master list shows complexity scores (instead of N/A) after running analyze-complexity on a non-master tag, by ensuring the complexity report lookup uses the same resolved tag as task extraction.
Changes:
- Add
FormatHandler.resolveTag()to determine the effective tag used when legacymasterfalls back to the first available tag. - Update
FileStorage.loadTasks()to pass the resolved “actual tag” into complexity enrichment/report lookup. - Add unit + integration tests covering the regression and edge cases, plus a patch changeset.
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/tm-core/src/modules/storage/adapters/file-storage/format-handler.ts | Adds tag-resolution helper to mirror legacy extraction fallback behavior. |
| packages/tm-core/src/modules/storage/adapters/file-storage/file-storage.ts | Uses resolved tag for complexity enrichment so the correct report file is loaded. |
| packages/tm-core/src/modules/storage/adapters/file-storage/format-handler.spec.ts | Adds unit tests for resolveTag() behavior and consistency with extraction. |
| packages/tm-core/tests/integration/storage/complexity-tag-fallback.test.ts | Adds integration coverage for the reported regression (issue #1614). |
| .changeset/fix-complexity-tag-fallback.md | Publishes the bugfix as a patch release note for @tm/core. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| import { afterEach, beforeEach, describe, expect, it } from 'vitest'; | ||
| import * as fs from 'fs'; | ||
| import * as path from 'path'; | ||
| import * as os from 'os'; | ||
| import { FileStorage } from '../../../src/modules/storage/adapters/file-storage/file-storage.js'; | ||
|
|
There was a problem hiding this comment.
This integration test file is missing the standard file-level header comment (e.g., @fileoverview) that other tests in tests/integration/storage use. Adding a short header describing the scenario and regression (issue #1614) would keep test documentation consistent and make intent easier to scan in the suite.
| const availableKeys = Object.keys(data).filter( | ||
| (key) => key !== 'tasks' && key !== 'metadata' | ||
| ); | ||
| if (tag === 'master' && availableKeys.length > 0) { | ||
| return availableKeys[0]; |
There was a problem hiding this comment.
resolveTag() re-implements the same legacy fallback-tag selection logic that already exists in extractTasksFromLegacy() and extractMetadataFromLegacy(). To prevent future drift between these code paths, consider extracting a single private helper (e.g., “resolveLegacyTag”) and reusing it in all three places.
| import { describe, expect, it } from 'vitest'; | ||
| import { FormatHandler } from './format-handler.js'; | ||
|
|
There was a problem hiding this comment.
This new spec file doesn’t include a file-level header comment (e.g., @fileoverview), while other spec files in this package typically do. Adding a short header helps keep test intent discoverable when browsing the src/ tree.
There was a problem hiding this comment.
🧹 Nitpick comments (1)
.changeset/fix-complexity-tag-fallback.md (1)
5-5: Tighten the changeset summary to one concise user-facing sentence.This currently mixes user impact with implementation detail. Consider keeping only the user-visible behavior change.
✍️ Suggested wording
-Fix complexity data not showing in `list` after `analyze-complexity` with tags. When tasks are stored under a non-master tag and the list command defaults to 'master', complexity data from the tag-specific report is now correctly loaded. +Show computed complexity in `task-master list` after `analyze-complexity` when using tags.Based on learnings: "Provide a concise, single-line changeset summary in imperative mood ... from a user/consumer perspective, not implementation details."
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In @.changeset/fix-complexity-tag-fallback.md at line 5, Replace the current multi-part summary in .changeset/fix-complexity-tag-fallback.md with a single concise, imperative user-facing sentence (drop implementation details like "when tasks are stored under a non-master tag" or "defaults to 'master'"); for example, state the user-visible effect such as "Load complexity data from tag-specific reports when listing tasks" ensuring it's one line, imperative mood, and focused on behavior change.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In @.changeset/fix-complexity-tag-fallback.md:
- Line 5: Replace the current multi-part summary in
.changeset/fix-complexity-tag-fallback.md with a single concise, imperative
user-facing sentence (drop implementation details like "when tasks are stored
under a non-master tag" or "defaults to 'master'"); for example, state the
user-visible effect such as "Load complexity data from tag-specific reports when
listing tasks" ensuring it's one line, imperative mood, and focused on behavior
change.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 77479f2f-dc29-4fcb-bde4-cadd567727c0
📒 Files selected for processing (5)
.changeset/fix-complexity-tag-fallback.mdpackages/tm-core/src/modules/storage/adapters/file-storage/file-storage.tspackages/tm-core/src/modules/storage/adapters/file-storage/format-handler.spec.tspackages/tm-core/src/modules/storage/adapters/file-storage/format-handler.tspackages/tm-core/tests/integration/storage/complexity-tag-fallback.test.ts
Summary
N/Ainlistoutput after runninganalyze-complexitywith a tagloadTasks('master')falls back to the first available tag (e.g.,foo) when loading tasks, but was still using'master'when looking up the complexity report — causing a file path mismatch (task-complexity-report.jsonvstask-complexity-report_foo.json)FormatHandler.resolveTag()to determine the actual tag used for task extraction, then pass it toenrichTasksWithComplexity()so the correct complexity report is loadedTest plan
task-master parse-prd --input .taskmaster/docs/prd.md --tag foothentask-master analyze-complexity --tag foothentask-master list— complexity column should now show scoresnpm run test -w @tm/core -- --run format-handler.spec --no-coverage— 5 unit tests for resolveTag passnpm run test -w @tm/core -- --run complexity-tag-fallback --no-coverage— 3 integration tests pass (including the key regression test)npm run test -w @tm/core -- --run file-storage-metadata --no-coverage— all 18 existing tests pass (no regressions)npm run typecheck -w @tm/core— no type errorsFixes #1614
🤖 Generated with Claude Code
Summary by CodeRabbit
Release Notes