mirror of
https://github.com/PR0M3TH3AN/SeedPass.git
synced 2026-10-27 07:52:03 +00:00
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.
49 lines
1.2 KiB
Bash
Executable File
49 lines
1.2 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
set -eo pipefail
|
|
|
|
mkdir -p artifacts/coverage
|
|
|
|
pytest_args=(-vv)
|
|
if [[ -n "${STRESS_ARGS:-}" ]]; then
|
|
pytest_args+=(${STRESS_ARGS})
|
|
fi
|
|
if [[ "${RUNNER_OS:-}" == "Windows" ]]; then
|
|
pytest_args+=(-n 1)
|
|
fi
|
|
pytest_args+=(
|
|
--cov=src
|
|
--cov-report=xml
|
|
--cov-report=term-missing
|
|
--cov-report=json:artifacts/coverage/coverage.json
|
|
--cov-fail-under=20
|
|
src/tests
|
|
)
|
|
|
|
timeout_bin="timeout"
|
|
if ! command -v "$timeout_bin" >/dev/null 2>&1; then
|
|
if command -v gtimeout >/dev/null 2>&1; then
|
|
timeout_bin="gtimeout"
|
|
else
|
|
timeout_bin=""
|
|
fi
|
|
fi
|
|
|
|
if [[ -n "$timeout_bin" ]]; then
|
|
$timeout_bin 15m pytest "${pytest_args[@]}" 2>&1 | tee pytest.log
|
|
status=${PIPESTATUS[0]}
|
|
else
|
|
echo "timeout command not found; running tests without timeout" >&2
|
|
pytest "${pytest_args[@]}" 2>&1 | tee pytest.log
|
|
status=${PIPESTATUS[0]}
|
|
fi
|
|
|
|
if [[ $status -eq 124 ]]; then
|
|
echo "::error::Tests exceeded 15-minute limit"
|
|
tail -n 20 pytest.log
|
|
exit 1
|
|
fi
|
|
if [[ $status -eq 0 && "${CRITICAL_COVERAGE_GATE:-0}" == "1" ]]; then
|
|
python scripts/check_critical_coverage.py artifacts/coverage/coverage.json
|
|
fi
|
|
exit $status
|