Skip to content

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

Open
Noor-ul-ain001 wants to merge 1 commit into
github:mainfrom
Noor-ul-ain001:fix/setup-tasks-ps1-out-null-swallow
Open

fix(powershell): stop Out-Null swallowing setup-tasks AVAILABLE_DOCS lines#4188
Noor-ul-ain001 wants to merge 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>
@Noor-ul-ain001
Noor-ul-ain001 requested a review from mnriem as a code owner August 18, 2026 16:33
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