Skip to content

fix: count nested tasks in progress (#1202)#1254

Open
zhangsan582 wants to merge 1 commit into
Fission-AI:mainfrom
zhangsan582:feature_0623_4
Open

fix: count nested tasks in progress (#1202)#1254
zhangsan582 wants to merge 1 commit into
Fission-AI:mainfrom
zhangsan582:feature_0623_4

Conversation

@zhangsan582

@zhangsan582 zhangsan582 commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Summary
Fixed GitHub issue #1202 on feature_0623_4: openspec view now counts nested tasks.md files such as backend/tasks.md and frontend/tasks.md.

Previously, openspec view only read openspec/changes//tasks.md, so changes using layered task files were classified as Draft even when they had task progress.

This fixes shared task progress detection by recursively aggregating every tasks.md under a change directory.

Changes

  • Updated src/utils/task-progress.ts to recursively collect and count nested tasks.md files.
  • Added test/core/view.test.ts coverage for a change with backend/tasks.md and frontend/tasks.md, verifying it appears as Active with progress instead of Draft.

Verification

  • pnpm exec vitest run test/core/view.test.ts --reporter=dot
  • pnpm exec tsc --noEmit
  • pnpm exec vitest run test/core/view.test.ts test/core/list.test.ts test/core/archive.test.ts --reporter=dot
  • pnpm run lint
  • pnpm run build

Commit

Summary by CodeRabbit

Bug Fixes

  • openspec view now recognizes task progress from nested task files and no longer incorrectly shows layered changes as Draft.

Documentation

  • No documentation or OpenSpec process files were changed.

Tests

  • Added regression coverage for nested task files under one change directory.

Summary by CodeRabbit

  • New Features
    • Change progress now reflects tasks found in nested folders, giving a more accurate completion percentage.
  • Bug Fixes
    • Fixed change status reporting so changes with multiple task lists are classified correctly in the active changes view.
    • Improved resilience when some task files can’t be read; other available task progress is still included.

@zhangsan582 zhangsan582 requested a review from TabishB as a code owner June 24, 2026 17:02
@coderabbitai

coderabbitai Bot commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: f94c9657-6ce5-45e5-8790-a4ce934f6c08

📥 Commits

Reviewing files that changed from the base of the PR and between 737518b and 521ced8.

📒 Files selected for processing (2)
  • src/utils/task-progress.ts
  • test/core/view.test.ts

📝 Walkthrough

Walkthrough

getTaskProgressForChange is rewritten to recursively discover all tasks.md files under a change directory using a new collectTaskFiles helper, aggregating total and completed counts across all found files instead of reading a single tasks.md. A corresponding ViewCommand test validates nested task file aggregation and percentage rendering.

Changes

Recursive Task Progress Aggregation

Layer / File(s) Summary
collectTaskFiles helper and aggregation rewrite
src/utils/task-progress.ts
Adds collectTaskFiles to recursively traverse a change directory and return all tasks.md paths (empty list on read failure). Rewrites getTaskProgressForChange to collect those paths, sort them, read each with per-file error skipping, and sum total/completed across all files.
ViewCommand nested tasks.md test
test/core/view.test.ts
Adds a test that sets up backend/tasks.md and frontend/tasks.md under a layered-change directory, runs ViewCommand.execute, and asserts the change appears in "Active Changes" with 33% and not in "Draft Changes".

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related issues

Poem

🐇 Down the warren, folders deep,
Each tasks.md I find in sleep.
No single file escapes my chase—
I tally all across the space!
Thirty-three percent complete,
My recursive hops are fleet. 🌿

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: counting nested task files in progress for change classification.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

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.

1 participant