Testing Architecture Overview
Palyra employs a “pyramid” testing model with specialized tracks for different failure modes:- Deterministic Core Tests: Fast, hermetic tests for critical logic in
palyradandpalyra-cli. - Workflow Regression Matrix: End-to-end integration tests that simulate complex user journeys (e.g., setup, backup, restore).
- CLI Install Smoke Tests: Validation of production-ready artifacts across Windows, macOS, and Linux.
- Fuzzing: Property-based and mutation-based testing for untrusted input parsers.
- Parity Fixtures: Ensuring behavioral consistency across different transport layers and platforms.
Test Execution Flow
The following diagram illustrates how different test suites are orchestrated during the CI lifecycle. Diagram: CI Test Orchestration Flow Sources:scripts/test/run-deterministic-core.sh:1-64(), .github/workflows/cli-install-smoke.yml:1-63(), crates/palyra-cli/tests/workflow_regression_matrix.rs:29-190()
Deterministic Core Tests
The core tests focus on the daemon’s internal state transitions and the CLI’s command parsing without requiring external network access. These are orchestrated byscripts/test/run-deterministic-core.ps1 (or .sh).
Key components tested:
- Daemon Surfaces: gRPC route messaging, admin surface job lifecycles, and OpenAI-compatible auth flows scripts/test/run-deterministic-core.ps1#24-28.
- Desktop State: Tauri state file initialization and onboarding defaults scripts/test/run-deterministic-core.ps1#17-22.
- Web Console: Frontend unit tests for
consoleApiand React component logic scripts/test/run-deterministic-core.ps1#30-35.
Deterministic Fixtures
The system usescrates/palyra-connector-core/tests/fixtures/channel_simulator_expected.json to verify that channel simulators produce byte-for-byte identical output across versions scripts/test/check-deterministic-fixtures.ps1#5-7. The check-deterministic-fixtures.sh script enforces that these fixtures are updated and committed whenever underlying logic changes scripts/test/check-deterministic-fixtures.sh#20-26.
Sources: scripts/test/run-deterministic-core.ps1:1-36(), scripts/test/check-deterministic-fixtures.ps1:1-32()
Workflow Regression Matrix
Theworkflow_regression_matrix.rs suite performs high-level integration testing by spawning actual palyrad and palyra processes. It simulates real-world usage patterns in a temporary workspace crates/palyra-cli/tests/workflow_regression_matrix.rs#31-35.
Key Regression Scenarios
- Setup and Onboarding: Validates the
--non-interactivewizard for bothlocalandremotemodes crates/palyra-cli/tests/workflow_regression_matrix.rs#57-119. - Configuration Lifecycle: Tests
palyra configurefor modifying gateway sections, ports, and TLS paths crates/palyra-cli/tests/workflow_regression_matrix.rs#121-162. - Backup and Restore: Ensures that the
palyra backup createandrestorecommands correctly preserve the workspace, journal, and state root crates/palyra-cli/tests/workflow_regression_matrix.rs#173-190.
crates/palyra-cli/tests/workflow_regression_matrix.rs:31-55()
CLI Install Smoke Tests
Smoke tests verify the integrity of the release artifacts. Unlike core tests which usecargo test, these run against the compiled production binary crates/palyra-cli/tests/installed_smoke.rs#43-56.
Smoke Harness Implementation
The harness usesscripts/test/run-cli-install-smoke.ps1 to:
- Initialize a
New-ScenarioContextwith isolated environment variables likePALYRA_CONFIGandPALYRA_VAULT_DIRscripts/test/run-cli-install-smoke.ps1#41-83. - Invoke commands via
Invoke-TranscriptCommand, which capturesstdout,stderr, andexit_codeinto a detailed transcript for CI debugging scripts/test/run-cli-install-smoke.ps1#126-200. - Verify the
palyra update --dry-runandpalyra uninstallflows to ensure maintenance commands work on an installed system crates/palyra-cli/tests/installed_smoke.rs#102-146.
scripts/test/run-cli-install-smoke.ps1:41-200(), crates/palyra-cli/tests/installed_smoke.rs:1-148()
Fuzzing Targets
Palyra usescargo-fuzz (libFuzzer) to find edge cases in parsers that handle untrusted data. Fuzz targets are located in the fuzz/ directory.
| Target | Crate / Module | Purpose |
|---|---|---|
workspace_patch_parser | palyra-common | Fuzzes RFC 6902-style JSON patches used in A2UI. |
process_runner_input_parser | palyra-common | Fuzzes the serialization/deserialization of tool execution payloads crates/palyra-common/src/process_runner_input.rs. |
config_path_parser | palyra-cli | Fuzzes path resolution and URI scheme parsing in CLI configuration. |
fuzz/Cargo.lock:1-258(), fuzz/fuzz_targets/workspace_patch_parser.rs(), fuzz/fuzz_targets/process_runner_input_parser.rs()
Performance Smoke Tests
Thescripts/test/run-performance-smoke.ps1 script executes high-frequency operations to detect regressions in latency or resource consumption.
- Journal Append Throughput: Measures the time to commit 1,000 events to the
JournalStore. - Vault Encryption Latency: Measures the overhead of
SensitiveBytesenvelope encryption. - Startup Latency: Ensures the
palyraddaemon reaches aReadystate within defined thresholds.
scripts/test/run-performance-smoke.ps1(), crates/palyra-cli/tests/workflow_regression_matrix.rs:26-27()