Development Guide โ
Comprehensive guide for contributors and maintainers working on the cyber.trackr.live OpenAPI project.
๐ Quick Start for New Contributors โ
1. Environment Setup โ
bash
# Clone and setup
git clone https://github.com/mitre/cyber-trackr-live.git
cd cyber-trackr-live
# Install dependencies
bundle install # Ruby dependencies
npm install # Node.js dependencies (for docs)
# Verify setup
bundle exec rake test # Run Ruby tests
npm run docs:validate # Validate OpenAPI spec
2. Development Workflow โ
3. Common Development Tasks โ
Update API Specification:
bash
# 1. Edit the spec
vi openapi/openapi.yaml
# 2. Validate changes
npm run docs:validate
# 3. Regenerate Ruby client
./scripts/generate_client.sh
# 4. Run tests
bundle exec rake test
Add New Endpoint:
bash
# 1. Add to OpenAPI spec
# 2. Regenerate client
# 3. Add helper method (if needed)
vi lib/cyber_trackr_helper.rb
# 4. Add tests
vi test/cyber_trackr_helper_test.rb
# 5. Update documentation
npm run docs:build
๐ Development Guides โ
Core Development โ
- OpenAPI Development - Working with the specification, validation, and best practices
- API Testing - Two-tier testing strategy and implementation
- Release Process - Complete automated release workflow
Architecture Deep Dives โ
- Two-Tier Testing - Spectral + Ruby testing separation
๐ง Development Workflows โ
Feature Development Process โ
Bug Fix Workflow โ
Reproduce the Issue
bash# Create minimal test case bundle exec ruby -I lib -I test test/debug_issue.rb
Identify Root Cause
- OpenAPI specification issue?
- Generated client issue?
- Helper method issue?
- Test coverage gap?
Fix and Validate
bash# Fix the issue # Run targeted tests bundle exec rake test # Run full validation npm run docs:validate bundle exec rake test:all
Documentation Updates โ
bash
# For VitePress documentation
npm run docs:dev # Start dev server
npm run docs:build # Build static site
# For Ruby client docs
bundle exec yard doc # Generate YARD docs
bundle exec yard server # Preview at localhost:8808
๐งช Testing Strategy โ
Two-Tier Testing Architecture โ
Test Commands Reference โ
bash
# Tier 1: Spectral validation (< 1 second)
npm run docs:validate
# Tier 2: Ruby testing
bundle exec rake test # Core tests (fast)
bundle exec rake test:all # All tests including live API
bundle exec rake test:stage2b # Live API only
# Full validation pipeline
npm run docs:validate && bundle exec rake test:all
๐๏ธ Project Architecture โ
Key Design Principles โ
OpenAPI-First Workflow
- Single source of truth:
openapi/openapi.yaml
- All clients generated from specification
- Version synchronization across artifacts
- Single source of truth:
Separation of Concerns
- Spectral: Static specification validation
- Ruby tests: Dynamic behavior validation
- VitePress: Documentation generation
- GitHub Actions: Automated deployment
Cross-Platform Compatibility
- Faraday HTTP client (no external dependencies)
- Docker-based client generation
- CI/CD across Windows, macOS, Linux
File Structure Overview โ
cyber-trackr-live/
โโโ openapi/
โ โโโ openapi.yaml # Single source of truth
โโโ lib/
โ โโโ cyber_trackr_client/ # Generated client (don't edit)
โ โโโ cyber_trackr_helper.rb # Custom helper methods
โโโ test/
โ โโโ cyber_trackr_helper_test.rb
โ โโโ live_api_validation_test.rb
โโโ docs/ # VitePress documentation
โโโ scripts/
โ โโโ generate_client.sh # Client generation script
โโโ tasks/
โโโ release.rake # Automated release process
๐ Release Engineering โ
Automated Release Process โ
Our release process is fully automated using the proven train-juniper pattern:
bash
# Local development creates tags
bundle exec rake release:patch # Bug fixes
bundle exec rake release:minor # New features
bundle exec rake release:major # Breaking changes
# GitHub Actions handles publication
git push origin v{version} # Triggers automated deployment
Release Components โ
- OpenAPI Specification Versioning - Single source of truth
- Ruby Client Generation - Automated with version sync
- Dual Changelog System - Separate OpenAPI and gem changelogs
- GitHub Pages Deployment - Automated documentation updates
- RubyGems Publication - OIDC trusted publishing
๐ก Contributing Guidelines โ
Before You Start โ
- Read the docs - Especially Contributing Guide
- Check existing issues - Avoid duplicate work
- Discuss major changes - Open an issue first for big features
Development Best Practices โ
- โ
Validate early - Run
npm run docs:validate
frequently - โ Test thoroughly - Both tiers of testing
- โ Follow conventions - OpenAPI 3.1.1 best practices
- โ Document changes - Update relevant documentation
- โ Version consistency - Keep all artifacts synchronized
Pull Request Checklist โ
- [ ] OpenAPI specification validates with Spectral
- [ ] Ruby tests pass (both core and live API)
- [ ] Generated client updated (if spec changed)
- [ ] Documentation updated (if applicable)
- [ ] Changelog entries added (if applicable)
- [ ] Cross-platform compatibility verified
๐ Getting Help โ
- General Questions - GitHub Discussions
- Bug Reports - GitHub Issues
- Security Issues - Email saf-security@mitre.org
- MITRE Internal - Slack #saf-team channel
Ready to contribute? Start with the Quick Start section above!