Skip to content

fix(view): count nested task files#1235

Open
hutiefang76 wants to merge 1 commit into
Fission-AI:mainfrom
hutiefang76:codex/openspec-1202-nested-tasks
Open

fix(view): count nested task files#1235
hutiefang76 wants to merge 1 commit into
Fission-AI:mainfrom
hutiefang76:codex/openspec-1202-nested-tasks

Conversation

@hutiefang76

@hutiefang76 hutiefang76 commented Jun 22, 2026

Copy link
Copy Markdown

Fixes #1202

Summary

  • count every tasks.md under a change directory when computing task progress
  • keep root tasks.md behavior intact while supporting layered schemas such as backend/tasks.md and frontend/tasks.md
  • add a view regression test for nested task files

Verification

  • pnpm vitest run test/core/view.test.ts
  • pnpm vitest run test/core/list.test.ts test/core/archive.test.ts test/core/view.test.ts
  • pnpm run build
  • pnpm run lint
  • git diff --check

I used OpenAI Codex to help implement and check this change, and reviewed the diff and test results before submitting.

Summary by CodeRabbit

  • New Features

    • Task progress tracking now aggregates information from multiple task files within nested directory structures.
  • Tests

    • Added test coverage to verify task progress calculation correctly handles nested directory scenarios.

@hutiefang76 hutiefang76 requested a review from TabishB as a code owner June 22, 2026 01:08
@coderabbitai

coderabbitai Bot commented Jun 22, 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: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: f974adc7-d14a-4bdf-ba4b-e5dbbcb12df0

📥 Commits

Reviewing files that changed from the base of the PR and between 1b06fdd and ab8f9aa.

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

📝 Walkthrough

Walkthrough

getTaskProgressForChange is refactored to recursively locate all tasks.md files under a change directory using a new findTaskFiles helper, then aggregate task counts across all found files. A new test in view.test.ts validates this behavior with nested backend/tasks.md and frontend/tasks.md files.

Changes

Nested tasks.md Aggregation

Layer / File(s) Summary
findTaskFiles helper and getTaskProgressForChange refactor
src/utils/task-progress.ts
findTaskFiles(dir) recursively traverses subdirectories and returns sorted paths for files named tasks.md. getTaskProgressForChange now calls findTaskFiles, reads each result, and sums { total, completed } from countTasksFromContent across all files. formatTaskStatus is unchanged.
ViewCommand nested tasks test
test/core/view.test.ts
Adds a test that writes backend/tasks.md (0/2 complete) and frontend/tasks.md (1/1 complete) under layered-change, executes ViewCommand, and asserts the rendered output shows Task Progress: 1/3 (33% complete) and the ◉ layered-change indicator.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Suggested reviewers

  • TabishB
  • alfred-openspec

Poem

🐇 Hopping through folders, deep and wide,
No tasks.md now left to hide!
Backend, frontend — count them all,
No nested checkbox shall ever fall.
The view now sees what status knew,
One rabbit fixed it, through and through! ✅

🚥 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 accurately summarizes the main change: fixing the view command to count nested task files instead of just root-level ones.
Linked Issues check ✅ Passed The PR fully addresses issue #1202 by implementing recursive task file detection and aggregating task counts across nested directories, making openspec view consistent with openspec status.
Out of Scope Changes check ✅ Passed All changes are directly scoped to the stated objective: updating task progress computation in task-progress.ts and adding a regression test in view.test.ts.

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

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.

Feedback: openspec view does not detect nested tasks.md files

1 participant