fix: normalize task IDs to numbers on load to fix comparison issues#1063
fix: normalize task IDs to numbers on load to fix comparison issues#1063Crunchyman-ralph merged 11 commits intonextfrom
Conversation
When tasks.json contains string IDs (e.g., "5" instead of 5), task lookups fail because the code uses parseInt() and strict equality (===) for comparisons. This fix normalizes all task and subtask IDs to numbers when loading the JSON, ensuring consistent comparisons throughout the codebase without requiring changes to multiple comparison locations. Fixes task not found errors when using string IDs in tasks.json.
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
- Added normalizeTaskIds function to convert string IDs to numbers - Applied normalization in readJSON for all code paths - Fixed set-task-status, add-task, and move-task to normalize IDs when working with raw data - Exported normalizeTaskIds function for use in other modules - Added test case for string ID normalization 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
…alls - Normalize all tags' data when creating _rawTaggedData in readJSON - Add support for handling malformed dotted subtask IDs (e.g., "5.1" -> 1) - Remove redundant normalizeTaskIds calls from set-task-status, add-task, and move-task - Add comprehensive test for mixed ID formats (string IDs and dotted notation) - Cleaner, more maintainable solution that normalizes IDs at load time 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
🦋 Changeset detectedLatest commit: b594795 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 |
|
Caution Review failedFailed to post review comments. WalkthroughThis update introduces normalization of task and subtask IDs from strings to numbers, ensuring consistent numeric identification throughout the codebase. It also fixes the expand command to correctly detect tag-specific complexity report files, removes a default CLI option to enable this detection, and adds a test for handling string and dotted IDs. Changes
Sequence Diagram(s)sequenceDiagram
participant CLI_User
participant CLI_Expand_Command
participant Utils
participant FileSystem
CLI_User->>CLI_Expand_Command: Run expand with tag context
CLI_Expand_Command->>FileSystem: Detect tag-specific complexity report file
FileSystem-->>CLI_Expand_Command: Return tag-specific report
CLI_Expand_Command->>Utils: Load and normalize task IDs (if needed)
Utils-->>CLI_Expand_Command: Return normalized tasks
CLI_Expand_Command-->>CLI_User: Complete expand operation with correct report and IDs
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Possibly related PRs
Note ⚡️ Unit Test Generation is now available in beta!Learn more here, or try it out under "Finishing Touches" below. ✨ Finishing Touches
🧪 Generate unit tests
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
Documentation and Community
|
…yaltoledano#1063) * fix: normalize task IDs to numbers on load to fix comparison issues When tasks.json contains string IDs (e.g., "5" instead of 5), task lookups fail because the code uses parseInt() and strict equality (===) for comparisons. This fix normalizes all task and subtask IDs to numbers when loading the JSON, ensuring consistent comparisons throughout the codebase without requiring changes to multiple comparison locations. Fixes task not found errors when using string IDs in tasks.json. * Added test * Don't mess up formatting * Fix formatting once and for all * Update scripts/modules/utils.js Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * Update scripts/modules/utils.js Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * Update scripts/modules/utils.js Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * fix: normalize task IDs to numbers on load to fix comparison issues - Added normalizeTaskIds function to convert string IDs to numbers - Applied normalization in readJSON for all code paths - Fixed set-task-status, add-task, and move-task to normalize IDs when working with raw data - Exported normalizeTaskIds function for use in other modules - Added test case for string ID normalization 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> * Simplified implementation * refactor: normalize IDs once when loading JSON instead of scattered calls - Normalize all tags' data when creating _rawTaggedData in readJSON - Add support for handling malformed dotted subtask IDs (e.g., "5.1" -> 1) - Remove redundant normalizeTaskIds calls from set-task-status, add-task, and move-task - Add comprehensive test for mixed ID formats (string IDs and dotted notation) - Cleaner, more maintainable solution that normalizes IDs at load time 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> * chore: run format to resolve CI issues --------- Co-authored-by: Carl Mercier <carl@carlmercier.com> Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> Co-authored-by: Claude <noreply@anthropic.com>
…yaltoledano#1063) * fix: normalize task IDs to numbers on load to fix comparison issues When tasks.json contains string IDs (e.g., "5" instead of 5), task lookups fail because the code uses parseInt() and strict equality (===) for comparisons. This fix normalizes all task and subtask IDs to numbers when loading the JSON, ensuring consistent comparisons throughout the codebase without requiring changes to multiple comparison locations. Fixes task not found errors when using string IDs in tasks.json. * Added test * Don't mess up formatting * Fix formatting once and for all * Update scripts/modules/utils.js Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * Update scripts/modules/utils.js Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * Update scripts/modules/utils.js Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * fix: normalize task IDs to numbers on load to fix comparison issues - Added normalizeTaskIds function to convert string IDs to numbers - Applied normalization in readJSON for all code paths - Fixed set-task-status, add-task, and move-task to normalize IDs when working with raw data - Exported normalizeTaskIds function for use in other modules - Added test case for string ID normalization 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> * Simplified implementation * refactor: normalize IDs once when loading JSON instead of scattered calls - Normalize all tags' data when creating _rawTaggedData in readJSON - Add support for handling malformed dotted subtask IDs (e.g., "5.1" -> 1) - Remove redundant normalizeTaskIds calls from set-task-status, add-task, and move-task - Add comprehensive test for mixed ID formats (string IDs and dotted notation) - Cleaner, more maintainable solution that normalizes IDs at load time 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> * chore: run format to resolve CI issues --------- Co-authored-by: Carl Mercier <carl@carlmercier.com> Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> Co-authored-by: Claude <noreply@anthropic.com>
…yaltoledano#1063) * fix: normalize task IDs to numbers on load to fix comparison issues When tasks.json contains string IDs (e.g., "5" instead of 5), task lookups fail because the code uses parseInt() and strict equality (===) for comparisons. This fix normalizes all task and subtask IDs to numbers when loading the JSON, ensuring consistent comparisons throughout the codebase without requiring changes to multiple comparison locations. Fixes task not found errors when using string IDs in tasks.json. * Added test * Don't mess up formatting * Fix formatting once and for all * Update scripts/modules/utils.js Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * Update scripts/modules/utils.js Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * Update scripts/modules/utils.js Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * fix: normalize task IDs to numbers on load to fix comparison issues - Added normalizeTaskIds function to convert string IDs to numbers - Applied normalization in readJSON for all code paths - Fixed set-task-status, add-task, and move-task to normalize IDs when working with raw data - Exported normalizeTaskIds function for use in other modules - Added test case for string ID normalization 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> * Simplified implementation * refactor: normalize IDs once when loading JSON instead of scattered calls - Normalize all tags' data when creating _rawTaggedData in readJSON - Add support for handling malformed dotted subtask IDs (e.g., "5.1" -> 1) - Remove redundant normalizeTaskIds calls from set-task-status, add-task, and move-task - Add comprehensive test for mixed ID formats (string IDs and dotted notation) - Cleaner, more maintainable solution that normalizes IDs at load time 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> * chore: run format to resolve CI issues --------- Co-authored-by: Carl Mercier <carl@carlmercier.com> Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> Co-authored-by: Claude <noreply@anthropic.com>
…yaltoledano#1063) * fix: normalize task IDs to numbers on load to fix comparison issues When tasks.json contains string IDs (e.g., "5" instead of 5), task lookups fail because the code uses parseInt() and strict equality (===) for comparisons. This fix normalizes all task and subtask IDs to numbers when loading the JSON, ensuring consistent comparisons throughout the codebase without requiring changes to multiple comparison locations. Fixes task not found errors when using string IDs in tasks.json. * Added test * Don't mess up formatting * Fix formatting once and for all * Update scripts/modules/utils.js Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * Update scripts/modules/utils.js Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * Update scripts/modules/utils.js Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * fix: normalize task IDs to numbers on load to fix comparison issues - Added normalizeTaskIds function to convert string IDs to numbers - Applied normalization in readJSON for all code paths - Fixed set-task-status, add-task, and move-task to normalize IDs when working with raw data - Exported normalizeTaskIds function for use in other modules - Added test case for string ID normalization 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> * Simplified implementation * refactor: normalize IDs once when loading JSON instead of scattered calls - Normalize all tags' data when creating _rawTaggedData in readJSON - Add support for handling malformed dotted subtask IDs (e.g., "5.1" -> 1) - Remove redundant normalizeTaskIds calls from set-task-status, add-task, and move-task - Add comprehensive test for mixed ID formats (string IDs and dotted notation) - Cleaner, more maintainable solution that normalizes IDs at load time 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> * chore: run format to resolve CI issues --------- Co-authored-by: Carl Mercier <carl@carlmercier.com> Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> Co-authored-by: Claude <noreply@anthropic.com>
…yaltoledano#1063) * fix: normalize task IDs to numbers on load to fix comparison issues When tasks.json contains string IDs (e.g., "5" instead of 5), task lookups fail because the code uses parseInt() and strict equality (===) for comparisons. This fix normalizes all task and subtask IDs to numbers when loading the JSON, ensuring consistent comparisons throughout the codebase without requiring changes to multiple comparison locations. Fixes task not found errors when using string IDs in tasks.json. * Added test * Don't mess up formatting * Fix formatting once and for all * Update scripts/modules/utils.js Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * Update scripts/modules/utils.js Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * Update scripts/modules/utils.js Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * fix: normalize task IDs to numbers on load to fix comparison issues - Added normalizeTaskIds function to convert string IDs to numbers - Applied normalization in readJSON for all code paths - Fixed set-task-status, add-task, and move-task to normalize IDs when working with raw data - Exported normalizeTaskIds function for use in other modules - Added test case for string ID normalization 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> * Simplified implementation * refactor: normalize IDs once when loading JSON instead of scattered calls - Normalize all tags' data when creating _rawTaggedData in readJSON - Add support for handling malformed dotted subtask IDs (e.g., "5.1" -> 1) - Remove redundant normalizeTaskIds calls from set-task-status, add-task, and move-task - Add comprehensive test for mixed ID formats (string IDs and dotted notation) - Cleaner, more maintainable solution that normalizes IDs at load time 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> * chore: run format to resolve CI issues --------- Co-authored-by: Carl Mercier <carl@carlmercier.com> Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> Co-authored-by: Claude <noreply@anthropic.com>
🐛 Bug Fix
🔍 Bug Description
When tasks.json contains string IDs (e.g., "5" instead of 5), task lookups fail because the code uses parseInt() and strict equality (===) for comparisons.
This fix normalizes all task and subtask IDs to numbers when loading the JSON, ensuring consistent comparisons throughout the codebase without requiring changes to multiple comparison locations.
Fixes task not found errors when using string IDs in tasks.json.
🔗 Related Issues
Reported on Discord: https://discord.com/channels/1354594356702478356/1398333561366642792
How to Test
Steps that caused the bug:
Expected result:
Task will be found as it should.
Quick verification:
# Commands to verify the fixContributor Checklist
npm run changesetnpm testnpm run format-checkFor Maintainers
Summary by CodeRabbit
Bug Fixes
Tests
Chores