Skip to content

fix(powershell): stop Out-Null swallowing setup-tasks AVAILABLE_DOCS lines - #4188

Merged
mnriem merged 1 commit into
github:mainfrom
Noor-ul-ain001:fix/setup-tasks-ps1-out-null-swallow
Aug 19, 2026
Merged

fix(powershell): stop Out-Null swallowing setup-tasks AVAILABLE_DOCS lines#4188
mnriem merged 1 commit into
github:mainfrom
Noor-ul-ain001:fix/setup-tasks-ps1-out-null-swallow

Conversation

@Noor-ul-ain001

Copy link
Copy Markdown
Contributor

Summary

Test-FileExists / Test-DirHasFiles (in scripts/powershell/common.ps1) report their status line with Write-Output and also return $true/$false — both land on the PowerShell Success stream. setup-tasks.ps1's text-mode branch piped each call to | Out-Null to discard the boolean, which discards the whole stream item, report line included:

BEFORE (measured, powershell.exe -NoProfile -File ...):
  FEATURE_DIR:...\specs\001-my-feature
  TASKS_TEMPLATE:...\tasks-template.md
  AVAILABLE_DOCS:
  (3 lines)

AFTER:
  FEATURE_DIR:...\specs\001-my-feature
  TASKS_TEMPLATE:...\tasks-template.md
  AVAILABLE_DOCS:
    [OK] research.md
    [FAIL] data-model.md
    [FAIL] contracts/
    [FAIL] quickstart.md
  (7 lines)

The bash twin (scripts/bash/setup-tasks.sh) lists every document under AVAILABLE_DOCS:, so the PowerShell variant was silently returning less information for the same project state.

This is the exact same bug, same shared helpers, as the one just fixed in the sibling script check-prerequisites.ps1 (commit 2b36f0c, #3891) — same day's fix even documents Test-FileExists/Test-DirHasFiles's dual-stream behavior in a comment. setup-tasks.ps1 calls the identical two helpers the identical way and was left with the identical bug. Fix mirrors that PR exactly: replace | Out-Null with | Where-Object { $_ -isnot [bool] } so the report line passes through and only the boolean is dropped.

Test plan

  • Added test_setup_tasks_ps_text_output_lists_available_docs to tests/test_setup_tasks.py (mirrors the PS text-mode test added for check-prerequisites.ps1 in fix(powershell): stop Out-Null swallowing the AVAILABLE_DOCS status lines #3891)
  • Verified the new test fails without the fix (AVAILABLE_DOCS: printed with no lines under it) and passes with it
  • pytest tests/test_setup_tasks.py — 11 passed, 19 skipped (no pwsh in some environments), 1 pre-existing failure unrelated to this change (test_setup_tasks_ps_core_template_resolved — a JSON-encoding quirk in -Json mode under Windows PowerShell 5.1, reproduces identically on unmodified upstream/main)
  • Verified scripts/powershell/setup-tasks.ps1 stays ASCII-only (0 non-ASCII bytes)

🤖 Generated with Claude Code

…lines

Test-FileExists / Test-DirHasFiles report their line with Write-Output and
ALSO return $true/$false -- both on the Success stream. setup-tasks.ps1's
text-mode branch piped each call to `| Out-Null` to discard the boolean,
which discarded the report line with it, so AVAILABLE_DOCS: printed with
nothing under it:

  BEFORE (measured, powershell.exe -NoProfile -File ...):
    FEATURE_DIR:...\specs\001-my-feature
    TASKS_TEMPLATE:...\tasks-template.md
    AVAILABLE_DOCS:
    (3 lines)

  AFTER:
    FEATURE_DIR:...\specs\001-my-feature
    TASKS_TEMPLATE:...\tasks-template.md
    AVAILABLE_DOCS:
      [OK] research.md
      [FAIL] data-model.md
      [FAIL] contracts/
      [FAIL] quickstart.md
    (7 lines)

The bash twin (scripts/bash/setup-tasks.sh) lists every document under that
header, so the PowerShell variant silently returned less information for
the same inputs.

Same bug, same fix shape (filter out only the boolean with Where-Object)
as the sibling that was just fixed in check-prerequisites.ps1 (upstream
commit 2b36f0c, PR github#3891) -- this is the unfixed twin call site sharing
the same Test-FileExists/Test-DirHasFiles helpers in common.ps1.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

Copilot AI 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.

Pull request overview

Fixes PowerShell text output parity by preserving AVAILABLE_DOCS status lines, mirroring #3891.

Changes:

  • Filters only boolean helper results instead of discarding all output.
  • Adds a PowerShell regression test covering present and missing documents.
Show a summary per file
File Description
scripts/powershell/setup-tasks.ps1 Preserves document status lines in text mode.
tests/test_setup_tasks.py Adds regression coverage for AVAILABLE_DOCS output.

Review details

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

  • Files reviewed: 2/2 changed files
  • Comments generated: 0
  • Review effort level: Balanced

@mnriem
mnriem merged commit 6b7f4aa into github:main Aug 19, 2026
14 checks passed
@mnriem

mnriem commented Aug 19, 2026

Copy link
Copy Markdown
Collaborator

Thank you!

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.

3 participants