Add Windows backend test preflight script#7799
Conversation
Greptile SummaryThis PR adds
Confidence Score: 3/5The preflight script itself is read-only and safe, but the README example command will fail for most new Windows contributors before they can even run it. The README documents backend/README.md — the PowerShell invocation example needs the Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A([Start test-preflight.ps1]) --> B{Python found?}
B -- Yes --> C[Record launcher path]
B -- No --> D[FAIL: python not found]
C --> E{pytest importable?}
D --> E
E -- Yes --> F[PASS: pytest version]
E -- No --> G[FAIL: pytest missing]
F --> H{black in PATH?}
G --> H
H -- Yes --> I[PASS: black]
H -- No --> J[WARN: black missing]
I & J --> K[Check 7 Python package imports]
K --> L{All importable?}
L -- No --> M[WARN per missing pkg]
L -- Yes --> N[PASS per pkg]
M & N --> O[Check ENCRYPTION_SECRET / integration env vars]
O --> P{redis-cli in PATH?}
P -- Yes --> Q{Redis PING OK?}
Q -- Yes --> R[PASS: Redis connected]
Q -- No --> S[WARN: not reachable]
P -- No --> T[WARN: redis-cli missing]
R & S & T --> U{unit test files exist?}
U -- Yes --> V[PASS: N files found]
U -- No --> W[FAIL: no unit tests]
V & W --> X{test.sh exists?}
X -- Yes --> Y[Parse pytest lines / check paths]
Y --> Z{Any missing?}
Z -- Yes --> AA[FAIL: missing refs]
Z -- No --> AB[PASS: all refs resolve]
X -- No --> AC[FAIL: test.sh not found]
AA & AB & AC --> AD[Print summary]
AD --> AE{FailCount > 0?}
AE -- Yes --> AF([exit 1])
AE -- No --> AG{WarnCount > 0?}
AG -- Yes --> AH([exit 0 with warnings])
AG -- No --> AI([exit 0 all clear])
Reviews (1): Last reviewed commit: "test(backend): add Windows preflight scr..." | Re-trigger Greptile |
| Windows PowerShell: | ||
| ```powershell | ||
| .\test-preflight.ps1 | ||
| ``` |
There was a problem hiding this comment.
The documented PowerShell command
. est-preflight.ps1 will fail on most fresh Windows installs because the default execution policy is Restricted (and sometimes RemoteSigned), which blocks running .ps1 files directly. The PR description itself uses the full form with -ExecutionPolicy Bypass, which is the reliable cross-system invocation. Using the short form without that flag will produce a confusing "running scripts is disabled" error for new contributors.
| Windows PowerShell: | |
| ```powershell | |
| .\test-preflight.ps1 | |
| ``` | |
| Windows PowerShell: | |
| ```powershell | |
| powershell -NoProfile -ExecutionPolicy Bypass -File .\test-preflight.ps1 |
There was a problem hiding this comment.
Addressed in ca5f7e8f8. The README now documents the reliable Windows invocation:
powershell -NoProfile -ExecutionPolicy Bypass -File .\test-preflight.ps1I re-ran that exact command on Windows: 11 passed, 9 warnings, 0 failed.
| $RootDir = Split-Path -Parent $MyInvocation.MyCommand.Path | ||
| Set-Location $RootDir |
There was a problem hiding this comment.
Set-Location permanently changes the working directory of the calling PowerShell session if the script is dot-sourced (. . est-preflight.ps1). Wrapping with Push-Location / Pop-Location scopes the change to the script's execution and restores the caller's CWD on exit. Because the script has multiple exit paths, a try/finally block is the safest way to ensure Pop-Location always runs.
| $RootDir = Split-Path -Parent $MyInvocation.MyCommand.Path | |
| Set-Location $RootDir | |
| $RootDir = Split-Path -Parent $MyInvocation.MyCommand.Path | |
| Push-Location $RootDir |
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
There was a problem hiding this comment.
Addressed in ca5f7e8f8. The script now uses Push-Location $RootDir and a finally { Pop-Location } block so the caller's CWD is restored even through the script's normal exit paths.
Re-verified with:
powershell -NoProfile -ExecutionPolicy Bypass -File .\test-preflight.ps1Result: 11 passed, 9 warnings, 0 failed.
|
Addressed the Windows preflight review feedback in
Re-verified on Windows: powershell -NoProfile -ExecutionPolicy Bypass -File .\test-preflight.ps1Result: 11 passed, 9 warnings, 0 failed. Also re-ran |
kodjima33
left a comment
There was a problem hiding this comment.
Windows test preflight tooling — approve only (new capability)
Summary
backend/test-preflight.ps1, a PowerShell equivalent of the existing backendtest-preflight.shchecks.test.shfile references.backend/README.md.Why
The backend setup docs already include Windows installation paths, but the backend test preflight helper only had a bash entrypoint. This gives Windows contributors a native PowerShell command to validate their backend test environment before running the full suite.
Testing
powershell -NoProfile -ExecutionPolicy Bypass -File .\test-preflight.ps1-> 11 passed, 9 warnings, 0 failed in this Windows venvgit diff --check -- backend/test-preflight.ps1 backend/README.md