mirror of
https://github.com/PR0M3TH3AN/SeedPass.git
synced 2026-10-27 16:02:05 +00:00
4.3 KiB
4.3 KiB
AI Agent TUI Testing
This document defines a repeatable, methodical TUI test workflow for AI agents.
Goal
Run SeedPass as a real interactive user and produce deterministic artifacts:
- Step-level pass/fail.
- Coverage checkpoints for major TUI features.
- Full transcript for debugging and regression comparison.
Runner
Use:
source .venv/bin/activate
python scripts/ai_tui_agent_test.py
The runner:
- creates an isolated temporary
HOME - launches
src/main.py --no-clipboard - executes a scenario profile (
core,extended, orstress) - writes artifacts to
artifacts/agent_tui_test/<timestamp>/
Scenario Profiles
core: fast smoke path (onboarding, invalid input checks, add/retrieve/search/list, exit)extended: full end-to-end path including all entry kinds, archive/restore, and settings flowsstress: deterministic repeated negative-input and back-navigation loops
Agent Commands Today
Use these command tiers when agents are validating changes:
- Fast targeted checks (recommended during iteration):
source .venv/bin/activate
pytest -q src/tests/test_manager_add_password.py src/tests/test_archive_restore.py src/tests/test_stats_screen.py src/tests/test_bip85_init.py
pytest -q src/tests/test_ai_tui_agent_harness.py
python scripts/ai_tui_agent_test.py --scenario core
- Full regression check (before merge):
source .venv/bin/activate
pytest -q
pytest -q --cov=src --cov-report=json:artifacts/coverage/coverage.json src/tests
python scripts/check_critical_coverage.py artifacts/coverage/coverage.json
python scripts/ai_tui_agent_test.py --scenario extended
- Stability sweep for TUI prompt timing:
source .venv/bin/activate
python scripts/ai_tui_agent_test.py --scenario stress --stress-cycles 6 --stress-seed 1337
Artifacts
Each run writes:
report.json: status, step results, coverage points, failure info.transcript.clean.txt: ANSI-stripped terminal output.transcript.raw.txt: raw terminal output with ANSI.
report.json also includes scenario-specific validation metadata:
required_coverage_keysrequired_post_conditionspost_conditions
Current Coverage Points
The harness marks these checkpoints as true only when observed:
startup_onboardingmain_menuinvalid_input_resilienceadd_password_quickinvalid_length_validationadd_totpadd_all_entry_typesretrieve_entrysearch_entrieslist_entriesmodify_entryarchive_restoretotp_codes_viewsettings_toggles_lock_unlocksettings_statsgraceful_exit
extended scenario also enforces post-conditions:
archive_restore_consistency: restored entries are no longer listed in archived viewlock_unlock_recovers_retrieval: retrieval still works after lock/unlock
CI/Agent Use Pattern
Recommended agent sequence:
python scripts/ai_tui_agent_test.py- Parse
report.json - Fail task if
status != "passed"or any checkpoint isfalse - If failed, inspect
transcript.clean.txtfor prompt-flow drift or regressions - Inspect
artifacts/coverage/coverage.jsonand critical coverage gate output when module thresholds fail
Optional Flags
python scripts/ai_tui_agent_test.py --help
Useful options:
--scenario:core,extended, orstress--stress-cycles: number of loops forstressprofile--stress-seed: fixed RNG seed for deterministic invalid-input campaigns instress--timeout: per-prompt timeout--password: fixed password used during test--output-dir: custom artifact root--keep-home: preserve generated profile state for local debugging--verbose: print step progress
Coverage gate helper:
python scripts/check_critical_coverage.py artifacts/coverage/coverage.json./scripts/tui2_coverage_gate.sh(focused TUI v2 + service-path thresholds)- Use
--threshold PATH=PERCENTto override defaults. - Use
--no-default-thresholdsfor focused local smoke checks.
Extending Coverage
When adding new TUI flows:
- Add deterministic steps to
scripts/ai_tui_agent_test.py. - Add a new coverage checkpoint key.
- Assert on concrete prompt/output text, not timing.
- Keep inputs deterministic and avoid clipboard-dependent behavior.
Roadmap
Future testing milestones are tracked in docs/agent_testing_roadmap.md.