Testing strategy
Quality Bar
Section titled “Quality Bar”Attestack handles evidence, hashes, signatures, and local files. The implementation should be boring, deterministic, and heavily tested.
Test Layers
Section titled “Test Layers”Unit Tests
Section titled “Unit Tests”Cover:
- Event hashing.
- Canonicalization.
- Sequence validation.
- Signature creation and verification.
- Bundle manifest digest calculation.
- Path redaction.
- CLI argument parsing.
Golden Tests
Section titled “Golden Tests”Maintain fixtures for:
- A valid minimal session.
- A valid session with command events.
- A valid bundle.
- Tampered event payload.
- Deleted event.
- Reordered events.
- Invalid signature.
- Mismatched artifact digest.
- Unsupported schema version.
Golden tests should verify exact expected outputs where reasonable.
Integration Tests
Section titled “Integration Tests”Exercise real CLI flows:
attestack initattestack start "test session"attestack run -- echo helloattestack note "manual review"attestack snapshotattestack stopattestack bundle createattestack verify .attestack/bundles/*.attestack.zipUse temporary directories and temporary Git repositories.
Security Tests
Section titled “Security Tests”Cover:
- Zip path traversal attempts.
- Oversized bundle files.
- Malformed JSON.
- Duplicate event sequence numbers.
- Missing previous hashes.
- Unknown signature algorithms.
- Non-canonical JSON encodings.
Cross-Platform Tests
Section titled “Cross-Platform Tests”The CLI should work on:
- Linux.
- macOS.
- Windows.
Normalize path handling and line endings in hash inputs. Be explicit when hashing raw command output versus normalized metadata.
Initial CI should run:
- Format check.
- Lint.
- Unit tests.
- Integration tests on Linux.
Later CI should add macOS and Windows.
Release Checks
Section titled “Release Checks”Before a tagged release:
- Build binaries.
- Run all tests.
- Generate checksums.
- Sign release artifacts.
- Verify the generated artifacts from a clean checkout.
Manual Smoke Test
Section titled “Manual Smoke Test”Use this before publishing:
cargo build --releasetmpdir="$(mktemp -d)"cd "$tmpdir"git initecho hello > README.mdgit add README.mdgit commit -m "init"attestack initattestack start "smoke"attestack run -- echo okattestack snapshotattestack stopattestack bundle createattestack verify .attestack/bundles/*.attestack.zipAdjust for Windows once packaging exists.