AstrBot-Desktop/tests/README.md
YokiiroBW 353a439b41
一些检测仍在等待运行
ci / Portable quality checks (push) Waiting to run
ci / Windows Tauri build (push) Waiting to run
docs(p00): record spike results and unresolved boundaries
2026-07-18 21:00:49 +08:00

107 行
6.8 KiB
Markdown

# Test Strategy
## Current status
Local P00 frontend, Rust, browser, Tauri, Windows-native, installer, and 30-minute dual-SSE checks have recorded results.
As of 2026-07-18:
- Forgejo API/HTTP Git are reachable and the repository is verified empty; the configured SSH origin is not usable.
- Forgejo workflow execution and runner labels remain unverified.
- Rust 1.97.1, MSVC linking, Tauri development, release executable, and NSIS bundling are verified locally.
- No user-authorized UNC test directory has been supplied.
Unexecuted or externally blocked items remain labeled below and are not counted as passes.
## Test layers
| Layer | Intended command or procedure | Platform | Current result |
| --------------------------------------------------- | --------------------------------------- | ---------------- | --------------------------------------------------------------- |
| Frontend format, lint, typecheck, unit tests, build | `pnpm check:frontend` | Windows or Linux | Passed |
| Browser smoke | `pnpm test:e2e` | Windows | Passed: 1 Chromium test |
| Rust formatting | `cargo fmt --all -- --check` | Rust host | Passed |
| Rust Clippy | `cargo clippy ... -- -D warnings` | Rust host | Passed |
| Rust unit and integration tests | `cargo test --workspace` | Rust host | Passed: 40 tests; 2 explicit manual tests ignored |
| Rust compile check | `cargo check --workspace --all-targets` | Rust host | Passed |
| Tauri development smoke | `pnpm tauri:dev` | Windows | Passed: window launched and remained responsive |
| Tauri NSIS production build | `pnpm tauri:build` | Windows | Passed: executable and NSIS installer |
| Forgejo portable CI | `.forgejo/workflows/ci.yml` | Linux runner | Not executed: runner/API availability unverified |
| Forgejo Windows build | `ENABLE_WINDOWS_TAURI_CI=true` | Windows runner | Disabled pending a verified runner |
| UNC transaction Spike | Authorized disposable UNC fixture | Windows plus NAS | Local fixture passed; real UNC blocked by missing authorization |
## Automated coverage expectations
### Protocol and dual Mock Gateway
- Health, server-info, and capabilities endpoints for two mock instances.
- Authentication success and failure using fake credentials only.
- Concurrent A and B SSE streams.
- Rust-side local profile binding despite a conflicting remote profile_id.
- Independent connection state, cancellation, retry, and Last-Event-ID values.
- Duplicate event_id suppression.
- Disconnecting either mock without interrupting the other.
- Identical conversation_id and message_id values across profiles without data mixing.
### Policy and redaction
- Companion-slot local-tool proposals are rejected.
- Unknown tool names, expired requests, and wrong server identities are rejected.
- Path traversal, unauthorized UNC paths, and arbitrary absolute paths are rejected.
- Fake bearer tokens, passwords, cookies, API keys, URL credentials, and PEM material are redacted.
- Tests and snapshots never contain a real credential.
### File transactions
- Planning and dry-run do not mutate source or destination.
- Copy uses a temporary destination.
- Size and SHA-256 must match before final commit.
- ask, rename, and skip conflict policies never silently overwrite.
- Interruption or verification failure preserves the source.
- P00 never performs source cleanup.
## Windows manual and integration matrix
### Dual connection soak
Run two loopback Mock Gateway instances for at least 30 minutes. Record event counts per profile, duplicates suppressed, reconnect attempts, final connection states, process CPU, and resident memory. Stop A and B separately and confirm the surviving stream continues.
Status: passed after the shutdown-order fix. 1800.02 seconds, 1800 companion events, 1801 operations events, no cross-routing assertion. Final pre-exit sample: 1.38 CPU seconds, about 12.1 MiB working set, about 2.4 MiB private memory.
Command: `cargo test -p mock-gateway --test soak -- --ignored --nocapture`.
### Credential Manager
Use a clearly named test-only credential. Verify create, read, update, and delete from Rust; verify only an opaque reference is persisted; scan application output and storage for the fake secret value; remove the test credential at the end.
Status: passed with a generated fake secret; CRUD and cleanup verified.
### UI Automation and window capture
Use a standard non-elevated Windows dialog. Record structured UI Automation text when available. Verify a user-selected single-window capture fallback. Treat an elevated target as an expected access boundary; do not elevate the application or bypass Windows security.
Status: controlled non-elevated standard dialog passed; elevated/custom-drawn manual boundary remains.
### Event log and bounded diagnostics
Query only an explicit provider, time range, and optional process identifier. Return a structured summary rather than unrelated log content. Verify foreground-window, process, port, network-target, authorized log-tail, configuration parser, and redaction error paths.
Status: passed for bounded local and loopback fixtures.
### UNC file transaction
The user must explicitly identify a disposable source fixture and destination share. Generate unique test data, preserve the source, inject interruption only within the fixture, and never use an existing personal or production file. Record dry-run output, temporary copy, byte count, hash, final rename, conflict result, and recovery behavior.
Status: local transaction/recovery tests passed; real UNC remains blocked until an authorized disposable fixture is supplied.
## Result recording
Every executed check must record:
- Date and environment.
- Exact command or bounded manual procedure.
- Exit code or observed result.
- Sanitized log summary.
- Known limitations.
- Whether the result blocks MVP.
An unexecuted, skipped, or blocked item must retain that label. A configured workflow or test is not evidence that it passed.