11 KiB
Matrix Testing Implementation Guide
Status: COMPLETE Date: 2025-11-20 Owner: CLAUDE_MATRIX_TEST (Platform Matrix Testing Specialist)
Overview
This document summarizes the comprehensive platform/configuration matrix testing system implemented for yaze. It solves the critical gap: only testing default configurations, missing interactions between CMake flags.
Problem Solved
Before
- Only 3 configurations tested (ci-linux, ci-macos, ci-windows)
- No testing of flag combinations
- Silent failures for problematic interactions like:
- GRPC=ON but REMOTE_AUTOMATION=OFF
- HTTP_API=ON but AGENT_CLI=OFF
- AI_RUNTIME=ON but JSON=OFF
After
- 7 distinct configurations tested locally before each push
- 20+ configurations tested nightly on all platforms via GitHub Actions
- Automatic constraint enforcement in CMake
- Clear documentation of all interactions
- Developer-friendly local testing script
Files Created
1. Documentation
/docs/internal/configuration-matrix.md (800+ lines)
Comprehensive reference for all CMake configuration flags:
- Section 1: All 18 CMake flags with defaults, purpose, dependencies
- Section 2: Flag interaction graph and dependency chains
- Section 3: Tested configuration matrix (Tier 1, 2, 3)
- Section 4: Problematic combinations (6 patterns) and how they're fixed
- Section 5: Coverage by configuration (what each tests)
- Section 6-8: Usage, dependencies reference, future improvements
Use when: You need to understand a specific flag or its interactions
/docs/internal/testing/matrix-testing-strategy.md (650+ lines)
Strategic guide for matrix testing:
- Section 1: Problem statement with real bug examples
- Section 2: Why we use a smart matrix (not exhaustive)
- Section 3: Problematic patterns and their fixes
- Section 4: Tools overview
- Section 5-9: Integration with workflow, monitoring, troubleshooting
Use when: You want to understand the philosophy behind the tests
/docs/internal/testing/QUICKSTART.md (150+ lines)
One-page quick reference:
- One-minute version of how to use matrix tester
- Common commands and options
- Available configurations
- Error handling
- Link to full docs
Use when: You just want to run tests quickly
2. Automation
/.github/workflows/matrix-test.yml (350+ lines)
GitHub Actions workflow for nightly/on-demand testing:
Execution:
- Triggered: Nightly (2 AM UTC) + manual dispatch +
[matrix]in commit message - Platforms: Linux, macOS, Windows (in parallel)
- Configurations per platform: 6-7 distinct flag combinations
- Runtime: ~45 minutes total
Features:
- Automatic matrix generation per platform
- Clear result summaries
- Captured test logs on failure
- Aggregation job for final status report
What it tests:
Linux (6 configs): minimal, grpc-only, full-ai, cli-no-grpc, http-api, no-json
macOS (4 configs): minimal, full-ai, agent-ui, universal
Windows (4 configs): minimal, full-ai, grpc-remote, z3ed-cli
3. Local Testing Tool
/scripts/test-config-matrix.sh (450+ lines)
Bash script for local pre-push testing:
Quick usage:
# Test all configs on current platform
./scripts/test-config-matrix.sh
# Test specific config
./scripts/test-config-matrix.sh --config minimal
# Smoke test (configure only, 30 seconds)
./scripts/test-config-matrix.sh --smoke
# Verbose output with timing
./scripts/test-config-matrix.sh --verbose
Features:
- Platform auto-detection (Linux/macOS/Windows)
- 7 built-in configurations
- Parallel builds (configurable)
- Result tracking and summary
- Debug logs per configuration
- Help text:
./scripts/test-config-matrix.sh --help
Output:
[INFO] Testing: minimal
[INFO] Configuring CMake...
[✓] Configuration successful
[✓] Build successful
[✓] Unit tests passed
Results: 7/7 passed
✓ All configurations passed!
Configuration Matrix Overview
Tier 1: Core Platform Builds (Every Commit)
Standard CI that everyone knows about:
ci-linux- gRPC, Agent CLIci-macos- gRPC, Agent UI, Agent CLIci-windows- gRPC, core features
Tier 2: Feature Combinations (Nightly)
Strategic tests of important flag interactions:
Minimal - No AI, no gRPC
- Validates core functionality in isolation
- Smallest binary size
- Most compatible configuration
gRPC Only - gRPC without automation
- Tests server infrastructure
- No AI runtime overhead
- Useful for headless automation
Full AI Stack - All features
- Maximum complexity
- Tests all integrations
- Catches subtle linking issues
HTTP API - REST endpoints
- Tests external integration
- Validates command dispatcher
- API-first architecture
No JSON - Ollama mode only
- Tests optional dependency
- Validates graceful degradation
- Smaller alternative
CLI Only - CLI without GUI
- Headless workflows
- Server-side focused
- Minimal GUI dependencies
All Off - Library only
- Edge case validation
- Embedded usage
- Minimal viable config
Tier 3: Platform-Specific (As Needed)
Architecture-specific builds:
- Windows ARM64
- macOS Universal Binary
- Linux GCC/Clang variants
How It Works
For Developers (Before Pushing)
# 1. Make your changes
git add src/...
# 2. Test locally
./scripts/test-config-matrix.sh
# 3. If all pass: commit and push
git commit -m "fix: cool feature"
git push
The script will:
- Configure each of 7 key combinations
- Build each configuration in parallel
- Run unit tests for each
- Report pass/fail summary
- Save logs for debugging
In GitHub Actions
When a commit is pushed:
- Tier 1 runs immediately (standard CI)
- Tier 2 runs nightly (comprehensive matrix)
To trigger matrix testing immediately:
git commit -m "feature: new thing [matrix]" # Runs matrix tests on this commit
Or via GitHub UI:
- Actions > Configuration Matrix Testing > Run workflow
Key Design Decisions
1. Smart Matrix, Not Exhaustive
- Avoiding: Testing 2^18 = 262,144 combinations
- Instead: 7 local configs + 20 nightly configs
- Why: Fast feedback loops for developers, comprehensive coverage overnight
2. Automatic Constraint Enforcement
CMake automatically resolves problematic combinations:
if(YAZE_ENABLE_REMOTE_AUTOMATION AND NOT YAZE_ENABLE_GRPC)
set(YAZE_ENABLE_GRPC ON ... FORCE) # Force consistency
endif()
Benefit: Impossible to create broken configurations through CMake flags
3. Platform-Specific Testing
Each platform has unique constraints:
- Windows: MSVC ABI compatibility, gRPC version pinning
- macOS: Universal binary, Homebrew dependencies
- Linux: GCC version, glibc compatibility
4. Tiered Execution
- Tier 1 (Every commit): Core builds, ~15 min
- Tier 2 (Nightly): Feature combinations, ~45 min
- Tier 3 (As needed): Architecture-specific, ~20 min
Problematic Combinations Fixed
Pattern 1: GRPC Without Automation
Before: Would compile with gRPC headers but no server code
After: CMake forces YAZE_ENABLE_REMOTE_AUTOMATION=ON if YAZE_ENABLE_GRPC=ON
Pattern 2: HTTP API Without CLI Stack
Before: REST endpoints defined but no command dispatcher
After: CMake forces YAZE_ENABLE_AGENT_CLI=ON if YAZE_ENABLE_HTTP_API=ON
Pattern 3: AI Runtime Without JSON
Before: Gemini service couldn't parse JSON responses
After: no-json config in matrix tests this edge case
Pattern 4: Windows GRPC Version Mismatch
Before: gRPC <1.67.1 had MSVC ABI issues
After: ci-windows preset pins to stable version
Pattern 5: macOS Arm64 Dependency Issues
Before: Silent failures on ARM64 architecture
After: mac-uni tests both arm64 and x86_64
Integration with Existing Workflows
CMake Changes
- No changes to existing presets
- New constraint enforcement in
cmake/options.cmake(already exists) - All configurations inherit from standard base presets
CI/CD Changes
- Added new workflow:
.github/workflows/matrix-test.yml - Existing workflows unaffected
- Matrix tests complement (don't replace) standard CI
Developer Workflow
- Pre-push: Run
./scripts/test-config-matrix.sh(optional but recommended) - Push: Standard GitHub Actions runs automatically
- Nightly: Comprehensive matrix tests validate all combinations
Getting Started
For Immediate Use
-
Run local tests before pushing:
./scripts/test-config-matrix.sh -
Check results:
- Green checkmarks = safe to push
- Red X = debug with
--verboseflag
-
Understand your config:
- Read
/docs/internal/configuration-matrix.mdSection 1
- Read
For Deeper Understanding
- Strategy: Read
/docs/internal/testing/matrix-testing-strategy.md - Implementation: Read
.github/workflows/matrix-test.yml - Local tool: Run
./scripts/test-config-matrix.sh --help
For Contributing
When adding a new CMake flag:
- Update
cmake/options.cmake(define option + constraints) - Update
/docs/internal/configuration-matrix.md(document flag + interactions) - Add test config to
/scripts/test-config-matrix.sh - Add matrix job to
/.github/workflows/matrix-test.yml
Monitoring & Maintenance
Daily
- Check nightly matrix test results (GitHub Actions)
- Alert if any configuration fails
Weekly
- Review failure patterns
- Check for new platform-specific issues
Monthly
- Audit matrix configuration
- Check if new flags need testing
- Review binary size impact
Future Enhancements
Short Term
- Add binary size tracking per configuration
- Add compile time benchmarks per configuration
- Auto-generate configuration compatibility chart
Medium Term
- Integrate with release pipeline
- Add performance regression detection
- Create configuration validator tool
Long Term
- Separate coupled flags (AI_RUNTIME from ENABLE_AI)
- Tier 0 smoke tests on every commit
- Web dashboard of results
- Configuration recommendation tool
Files at a Glance
| File | Purpose | Audience |
|---|---|---|
/docs/internal/configuration-matrix.md |
Flag reference & matrix definition | Developers, maintainers |
/docs/internal/testing/matrix-testing-strategy.md |
Why & how matrix testing works | Architects, TechLead |
/docs/internal/testing/QUICKSTART.md |
One-page quick reference | All developers |
/.github/workflows/matrix-test.yml |
Nightly/on-demand CI testing | DevOps, CI/CD |
/scripts/test-config-matrix.sh |
Local pre-push testing tool | All developers |
Questions?
- How do I use this? → Read
docs/internal/testing/QUICKSTART.md - What configs are tested? → Read
docs/internal/configuration-matrix.mdSection 3 - Why test this way? → Read
docs/internal/testing/matrix-testing-strategy.md - Add new config? → Update all four files above
- Debug failure? → Run with
--verbose, check logs inbuild_matrix/<config>/
Status: Ready for immediate use
Testing: Locally via ./scripts/test-config-matrix.sh
CI: Nightly via .github/workflows/matrix-test.yml