Skip to content

fix(powershell): stop Out-Null swallowing the AVAILABLE_DOCS status lines - #3891

Merged
mnriem merged 1 commit into
github:mainfrom
jawwad-ali:fix/ps-checkprereq-outnull
Aug 13, 2026
Merged

fix(powershell): stop Out-Null swallowing the AVAILABLE_DOCS status lines#3891
mnriem merged 1 commit into
github:mainfrom
jawwad-ali:fix/ps-checkprereq-outnull

Conversation

@jawwad-ali

Copy link
Copy Markdown
Contributor

Problem

Test-FileExists and Test-DirHasFiles in scripts/powershell/common.ps1 do two things on the Success stream — they write the report line and return a bool:

function Test-FileExists {
    param([string]$Path, [string]$Description)
    if (Test-Path -Path $Path -PathType Leaf) {
        Write-Output "  [OK] $Description"
        return $true
    } else {
        Write-Output "  [FAIL] $Description"
        return $false
    }
}

check-prerequisites.ps1 piped the whole call to | Out-Null to throw away the boolean — which threw away the report line too.

Reproduction on current main (81bf741)

powershell.exe -NoProfile -File .specify/scripts/powershell/check-prerequisites.ps1 -IncludeTasks, in a project with specs/001-f/plan.md and specs/001-f/contracts/:

FEATURE_DIR:...\specs\001-f
AVAILABLE_DOCS:
=== line count: 2 ===

AVAILABLE_DOCS: is emitted with nothing under it. The bash and Python twins list all five documents for the same inputs, so the PowerShell variant silently returns less information — and any agent parsing the doc list sees none.

Fix

Drop only the boolean:

Test-FileExists -Path $paths.RESEARCH -Description 'research.md' | Where-Object { $_ -isnot [bool] }

Measured after the fix, same project plus research.md:

FEATURE_DIR:...\specs\001-f
AVAILABLE_DOCS:
  [OK] research.md
  [FAIL] data-model.md
  [FAIL] contracts/
  [FAIL] quickstart.md
  [FAIL] tasks.md
=== line count: 7 ===

No breaking change. JSON mode does not go through this path and is untouched. The booleans were already being discarded and are still discarded; the only difference is that the lines the helpers were writing now actually reach stdout. Exit codes unchanged.

The file stays ASCII-only — verified 0 non-ASCII bytes after the edit.

Verification

  • Fail-before / pass-after: the new test fails on unpatched source and passes with the fix. File: 1 failed → 12 passed, 8 skipped.
  • This is the first PowerShell text-mode test in this file — every existing PS test uses -Json, which is why the gap was never caught. It is gated on the file's existing HAS_PWSH or _WINDOWS_POWERSHELL guard.
  • Scoped regression: failure set identical to the clean-main baseline captured on 81bf741 (0 pre-existing in scope).
  • uvx ruff@0.15.0 check src tests → clean

Note this test file is also touched by my open #3785 and #3890, so expect a trivial append conflict depending on merge order — happy to rebase.


Written with assistance from Claude Code. Bug found, reproduced, and verified by me on current main with real powershell.exe.

@jawwad-ali
jawwad-ali requested a review from mnriem as a code owner July 31, 2026 07:58
…ines

Test-FileExists / Test-DirHasFiles report their line with Write-Output and
ALSO return $true/$false — both on the Success stream. The callers piped
the whole call to `| Out-Null` to discard the boolean, which discarded the
report line with it, so text mode printed the header and nothing under it:

  BEFORE (measured, powershell.exe -NoProfile -File ... -IncludeTasks):
    FEATURE_DIR:...\specs\001-f
    AVAILABLE_DOCS:
    (2 lines)

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

The bash and Python twins both list every document under that header, so
the PowerShell variant silently returned less information for the same
inputs.

Filter out only the boolean, keeping the report lines. Adds the first
PowerShell text-mode test in this file (every existing PS test is -Json).
File stays ASCII-only (verified 0 non-ASCII bytes).

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@jawwad-ali
jawwad-ali force-pushed the fix/ps-checkprereq-outnull branch from 59f5e38 to 6e52eb5 Compare July 31, 2026 08:20
@mnriem
mnriem requested a balanced review from Copilot August 10, 2026 17:38

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-mode prerequisite reporting so document status lines reach stdout while boolean helper results remain discarded.

Changes:

  • Filters only boolean helper output instead of suppressing the entire Success stream.
  • Adds a PowerShell regression test covering available-document status lines.
Show a summary per file
File Description
scripts/powershell/check-prerequisites.ps1 Preserves document status output in text mode.
tests/test_check_prerequisites_python_parity.py Tests PowerShell document reporting.

Review details

Tip

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 2b36f0c into github:main Aug 13, 2026
14 checks passed
@mnriem

mnriem commented Aug 13, 2026

Copy link
Copy Markdown
Collaborator

Thank you!

ira-at-work added a commit to ira-at-work/spec-kit that referenced this pull request Aug 17, 2026
* main: (27 commits)
  Add SpecAssay bundle to community catalog (github#4125)
  chore: release 0.16.4, begin 0.16.5.dev0 development (github#4124)
  Add SpecAssay preset to community catalog (github#4123)
  Update Intake Authoring Governance preset to v0.3.1 (github#4121)
  Update Superspec extension to v1.0.2 (github#4120)
  fix(taskstoissues): widen task-ID regex to match IDs longer than 3 digits (github#4101)
  Add Architecture Governance extension to community catalog (github#4122)
  fix(workflows): validate non-string step types (github#4111)
  Harden community submission workflow output allowlists (github#4103)
  chore(deps): bump github/codeql-action (init + analyze) from 4.37.5 to 4.37.6 (github#4114)
  Add SpecAssay Check extension to community catalog (github#4113)
  fix(integrations): dispatch goose commands via `goose run` (github#2416) (github#3781)
  fix(powershell): stop Out-Null swallowing the AVAILABLE_DOCS status lines (github#3891)
  fix: remove TOCTOU race in RunState.load (github#3839)
  fix: decode the zipped manifest as UTF-8 before parsing (github#3958)
  Update Agent Parity Governance preset to v0.4.2 (github#4110)
  fix: log progress tracker refresh errors instead of silently swallowing (github#3975)
  [extension] Add SpecJudge extension to community catalog (github#4079)
  fix(bundler): read the authoritative `default_integration` field, not only its legacy aliases (github#3880)
  fix(auth): treat exact host patterns literally (github#4108)
  ...
mnriem pushed a commit that referenced this pull request Aug 19, 2026
…lines (#4188)

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 #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>
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