Contributing to Huntable CTI Studio¶
Thank you for your interest in contributing to Huntable CTI Studio! This document provides guidelines and information for contributors.
Table of Contents¶
- Code of Conduct
- Getting Started
- Development Setup
- Code Style
- File Organization
- Testing
- Pull Request Process
- Reporting Bugs
- Feature Requests
- Security Issues
- Documentation
- Release Process
- Getting Help
Code of Conduct¶
Contributors are expected to be respectful and constructive in issues, pull requests, and
reviews. This repository does not currently ship a CODE_OF_CONDUCT.md; if one is added,
link it here.
Getting Started¶
Prerequisites¶
- Python 3.11+
- PostgreSQL 15+
- Redis 7+
- Docker & Docker Compose
- Git
Fork and Clone¶
- Fork the repository on GitHub
- Clone your fork locally:
- Add the upstream repository:
Development Setup¶
For the full local setup walkthrough, see Development Setup.
Package manager: This project uses
uv(not pip). CI runsuv sync --frozenanduv runfor all Python commands. Install uv before the steps below.
1. Environment Setup¶
# Provision environment and secure local secrets
./setup.sh --no-backups
# Start Docker services
./start.sh
2. Database Setup¶
# Database is automatically set up with Docker
# No manual setup required - PostgreSQL runs in container
# Access via: docker exec cti_postgres psql -U cti_user -d cti_scraper
3. Run Tests¶
# Quick health check (recommended first step)
python3 run_tests.py smoke
# Run specific test categories
python3 run_tests.py unit
python3 run_tests.py api
python3 run_tests.py integration
Code Style¶
We follow PEP 8 with some modifications:
Python Code Style¶
- Line length: 120 characters (configured in
pyproject.toml,[tool.ruff]) - Import order: Managed by
ruff(replaces isort) - Type hints: Required for all public functions and methods
- Docstrings: Use Google-style docstrings
Code Formatting¶
The project uses ruff for linting and formatting (configured in pyproject.toml). Pre-commit hooks run automatically on git commit:
To run manually:
File Organization¶
Directory Structure¶
Organize files according to their purpose and lifecycle:
Huntable-CTI-Studio/
├── utils/temp/ # Temporary scripts (ephemeral, one-off)
│ ├── debug_*.py # Debug scripts
│ ├── test_*.py # One-off test scripts
│ ├── analyze_*.py # Temporary analysis scripts
│ └── score_*.py # Temporary evaluation scripts
│
├── scripts/ # Reusable utility scripts (kept in repo)
│ ├── testing/ # Test utilities
│ ├── analysis/ # Analysis tools
│ ├── maintenance/ # Maintenance scripts (fix_*.py)
│ └── shell/ # Shell utilities
│
├── outputs/ # Generated reports/outputs (.gitignored)
│ ├── reports/ # Analysis reports (.md, .html, .json)
│ ├── exports/ # Data exports (.csv, .json)
│ └── benchmarks/ # Benchmark results
│
├── logs/ # Log files (.gitignored)
│
└── data/ # Test/data files (.gitignored)
Classification Rules¶
| Type | Location | Git Status | Purpose |
|---|---|---|---|
| Temporary scripts | utils/temp/ |
Tracked | One-off debug/test/analysis scripts |
| Reusable scripts | scripts/ |
Tracked | Production utilities, maintenance tools |
| Reports | outputs/reports/ |
Ignored | Generated markdown/HTML/JSON reports |
| Exports | outputs/exports/ |
Ignored | CSV/JSON data exports |
| Benchmarks | outputs/benchmarks/ |
Ignored | Benchmark results |
| Logs | logs/ |
Ignored | Application logs |
| Test artifacts | test-results/, allure-results/ |
Ignored | Test outputs |
Guidelines¶
- Temporary scripts (
utils/temp/): One-off scripts for debugging, testing, or analysis. These are tracked in git but may be cleaned up periodically. - Reusable scripts (
scripts/): Production utilities, maintenance tools, and scripts used regularly. Organized by purpose in subdirectories. - Generated outputs (
outputs/): All generated reports, exports, and benchmarks go here. Automatically ignored by git. - Root-level files: Keep only essential project files (README, docker-compose.yml, etc.) at the root. Move temporary or utility scripts to appropriate directories.
Testing¶
For comprehensive testing documentation, see tests/TESTING.mdin the repo root.
Quick Testing Commands¶
python3 run_tests.py smoke
python3 run_tests.py unit
python3 run_tests.py api
python3 run_tests.py integration
python3 run_tests.py ui
Test Requirements¶
- Unit Tests: Core functionality and business logic
- Integration Tests: Database and API interactions
- UI Tests: End-to-end user workflows
- API Tests: REST endpoint validation
- Security Tests: Vulnerability scanning and dependency auditing
Test Coverage¶
- CI enforces coverage gates on
src.services/src.utilsin.github/workflows/tests.yml(currently 60% combined baseline, 68% forsrc.services, 20% forsrc.utils; not a repo-wide 85% target) - Write tests for new features
- Update tests when modifying existing functionality
- Use appropriate test markers and categories
ML Feedback Feature Testing¶
For ML feedback features, follow the balanced testing approach: - Focus on critical paths that are most likely to break - Write integration tests that catch real-world issues - Keep tests simple and maintainable - Test the 3 essential areas: Huntable probability calculation, API contracts, and retraining workflow
See tests/TESTING.mdin the repo root for detailed guidelines.
Pull Request Process¶
1. Create a Feature Branch¶
2. Make Your Changes¶
- Write clear, descriptive commit messages
- Follow the existing code style
- Add tests for new functionality
- Update documentation as needed
3. Commit Your Changes¶
4. Push to Your Fork¶
5. Create a Pull Request¶
- Go to your fork on GitHub
- Click "New Pull Request"
- Select your feature branch
- Fill out the PR template
- Submit the PR
Pull Request Guidelines¶
- Title: Clear, descriptive title
- Description: Explain what the PR does and why
- Tests: Ensure all tests pass
- Documentation: Update docs if needed
- Breaking changes: Clearly mark breaking changes
PR Template¶
## Description
Brief description of changes
## Type of Change
- [ ] Bug fix
- [ ] New feature
- [ ] Breaking change
- [ ] Documentation update
## Testing
- [ ] Unit tests pass
- [ ] Integration tests pass
- [ ] Manual testing completed
## Checklist
- [ ] Code follows style guidelines
- [ ] Self-review completed
- [ ] Documentation updated
- [ ] No breaking changes (or documented)
Reporting Bugs¶
Before Reporting¶
- Check existing issues
- Try the latest version
- Reproduce the issue
Bug Report Template¶
**Describe the bug**
Clear description of what the bug is.
**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error
**Expected behavior**
Clear description of what you expected to happen.
**Environment:**
- OS: [e.g. macOS 14.0]
- Python: [e.g. 3.11.0]
**Additional context**
Add any other context about the problem here.
Feature Requests¶
Before Requesting¶
- Check if the feature already exists
- Consider if it fits the project scope
- Think about implementation details
Feature Request Template¶
**Is your feature request related to a problem?**
Clear description of the problem.
**Describe the solution you'd like**
Clear description of what you want to happen.
**Describe alternatives you've considered**
Clear description of any alternative solutions.
**Additional context**
Add any other context or screenshots.
Security Issues¶
Do not report security issues through public GitHub issues.
Please report security vulnerabilities using GitHub's private vulnerability reporting: go to the repository's Security tab and select Report a vulnerability.
See the Security Policy (.github/SECURITY.md) for the project's security posture.
Documentation¶
Code Documentation¶
- Use Google-style docstrings
- Include type hints
- Document complex algorithms
- Provide usage examples
API Documentation¶
- Document all endpoints
- Include request/response examples
- Document error codes
- Keep docs up to date
Release Process¶
Versioning¶
We follow Semantic Versioning:
- Major: Breaking changes
- Minor: New features, backward compatible
- Patch: Bug fixes, backward compatible
Release Checklist¶
- [ ] All tests pass
- [ ] Documentation updated
- [ ] Changelog updated
- [ ] Version bumped
- [ ] Release notes written
Getting Help¶
- Issues: GitHub issue tracker
- Discussions: GitHub discussions
- Documentation: Project README and docs
- Security: See Security Issues above
Acknowledgments¶
Thank you to all contributors who have helped make Huntable CTI Studio better! Your contributions are greatly appreciated.
Last updated: 2026-07-05 Last reviewed: 2026-09-01