Files
SeedPass/scripts/installer_smoke_windows.ps1
thePR0M3TH3AN 03958106e1 Add agent mode, hardened TUI harness, coverage gates, and cross-platform installer smoke CI
This commit delivers four related improvements focused on reliability and automation while preserving existing human/TUI workflows.

1) Agent-first CLI mode (additive)
- Added new `seedpass agent` command group (`src/seedpass/cli/agent.py`) and wired it into CLI root.
- Implemented non-interactive profile bootstrap: `seedpass agent init` with `--seed|--seed-file|--generate-seed` and password env injection (`--password-env`).
- Added policy management commands: `agent policy-show` and `agent policy-set` with allow/deny kind controls.
- Added JSON-based secret retrieval: `seedpass -f <fingerprint> agent get <query> --ttl <sec>` with lease metadata and policy enforcement.
- Kept regular human mode fully available; no behavioral changes to interactive TUI entrypoint.

2) TUI agent harness deepening and stabilization
- Refactored harness into scenario profiles: `core`, `extended`, `stress` with `--scenario` selection.
- Added deterministic seeded stress campaigns: `--stress-cycles`, `--stress-seed`.
- Added scenario-specific required coverage keys and report metadata.
- Added post-condition assertions in extended scenario (archive/restore consistency, lock/unlock retrieval recovery).
- Hardened prompt matching for output variants and fail-fast behavior on non-zero SeedPass exit codes.
- Added harness unit tests for helper logic and control flow.

3) Critical module coverage gate tooling
- Added `scripts/check_critical_coverage.py` to enforce per-module thresholds from coverage JSON and report uncovered functions.
- Added override controls (`--threshold`, `--no-default-thresholds`) and optional JSON result output.
- Integrated coverage JSON generation into CI helper script and optional gate execution via `CRITICAL_COVERAGE_GATE=1`.
- Tuned default thresholds using full-suite baseline and increased strictness:
  - `src/main.py >= 50%`
  - `src/seedpass/core/manager.py >= 60%`
  - `src/seedpass/core/encryption.py >= 80%`
  - `src/seedpass/core/migrations.py >= 90%`
- Added tests for coverage gate parser/analysis logic and targeted manager worker path tests.

4) Installer validation framework for beta/main
- Added cross-platform installer smoke scripts:
  - `scripts/installer_smoke_unix.sh`
  - `scripts/installer_smoke_windows.ps1`
- Added GitHub Actions workflow `.github/workflows/installer-smoke.yml` with:
  - reduced PR matrix
  - full scheduled/manual matrix across OS/branch/mode
  - per-job log capture and artifact uploads for failure triage
- Added installer testing documentation and linked from README.

Additional housekeeping
- Added `.venv/` to `.gitignore`.
- Updated docs for new harness scenarios, seeded stress mode, post-condition metadata, coverage gate usage, and installer testing workflow.
2026-02-23 15:47:59 -05:00

59 lines
1.7 KiB
PowerShell

param(
[string]$Branch = "beta",
[ValidateSet("tui", "gui", "both")]
[string]$Mode = "tui"
)
$ErrorActionPreference = "Stop"
if (-not (Get-Command git -ErrorAction SilentlyContinue)) {
throw "git is required for installer smoke test"
}
$TempHome = Join-Path $env:RUNNER_TEMP ("seedpass-installer-home-" + [guid]::NewGuid().ToString("N"))
New-Item -ItemType Directory -Path $TempHome -Force | Out-Null
try {
$env:USERPROFILE = $TempHome
$env:HOME = $TempHome
Write-Host "[INFO] Smoke install start: branch=$Branch mode=$Mode home=$TempHome"
if ($Mode -eq "tui") {
& "$PSScriptRoot\install.ps1" -Branch $Branch
} else {
& "$PSScriptRoot\install.ps1" -Branch $Branch -IncludeGui
}
$LauncherPath = Join-Path $env:USERPROFILE ".seedpass\app\bin\seedpass.cmd"
$AppDir = Join-Path $env:USERPROFILE ".seedpass\app"
if (-not (Test-Path $LauncherPath)) {
throw "launcher missing: $LauncherPath"
}
if (-not (Test-Path (Join-Path $AppDir ".git"))) {
throw "install dir missing git checkout: $AppDir"
}
$ActualBranch = (git -C $AppDir rev-parse --abbrev-ref HEAD).Trim()
if ($ActualBranch -ne $Branch) {
throw "expected branch '$Branch', got '$ActualBranch'"
}
cmd /c "`"$LauncherPath`" --help" | Out-Null
Write-Host "[INFO] Re-running installer to validate idempotence"
if ($Mode -eq "tui") {
& "$PSScriptRoot\install.ps1" -Branch $Branch
} else {
& "$PSScriptRoot\install.ps1" -Branch $Branch -IncludeGui
}
cmd /c "`"$LauncherPath`" --help" | Out-Null
Write-Host "[SUCCESS] Installer smoke test passed (branch=$Branch mode=$Mode)"
}
finally {
if (Test-Path $TempHome) {
Remove-Item -Recurse -Force $TempHome
}
}