s9s Development Documentation
Welcome to the s9s development documentation. This directory contains comprehensive guides for developers working on the s9s project.
Quick Navigation
Getting Started
- Development Setup - Set up your development environment, prerequisites, IDE configuration, and build instructions
- Quick Start - Fork, clone, and make your first change
Core Development Guides
- Architecture Guide - Understand the system design, core components, and design patterns
- Testing Guide - Learn about unit tests, integration tests, benchmarks, and test coverage
- Contributing Guide - Follow the contribution process and understand code standards
- Linting Standards - Code quality requirements and linting configuration
- CI/CD Setup - Continuous integration pipeline, linting gate, and branch protection rules
Documentation by Role
New Contributors
- Read Development Setup to set up your environment
- Read Contributing Guide for the contribution process
- Pick an issue labeled "good first issue"
- Follow the Development Process workflow
- Submit a pull request
Feature Developers
- Review Architecture Guide to understand the system
- Read Testing Guide to write comprehensive tests
- Check Linting Standards for code quality
- Follow the Code Style guidelines
- Ensure CI/CD Setup checks pass before merge
Code Reviewers
- Understand the Architecture
- Verify Testing is comprehensive
- Check Code Style compliance
- Ensure CI/CD checks are green
- Use Linting Standards for quality assessment
Maintainers
- Monitor CI/CD performance and health
- Review and approve PRs following Contributing Guide
- Manage Linting Standards and linter updates
- Monitor Architecture decisions and evolution
Common Tasks
Set Up Development Environment
# Follow the setup guide # File: docs/development/setup.md make install-tools pre-commit install
Make a Code Change
git checkout -b feature/my-feature # Make changes following code style in contributing.md make fmt make lint make test git push origin feature/my-feature
Run Tests
# See testing.md for comprehensive testing guide make test # Unit tests make test-integration # Integration tests make bench # Benchmarks make coverage # Coverage report
Check Code Quality
# See linting.md for complete linting standards make lint make fmt golangci-lint run # Detailed linting
Debug Issues
# See architecture.md#debugging-and-diagnostics s9s --debug # Enable debug logging tail -f ~/.s9s/debug.log
Document Overview
Setup Guide
File:
docs/development/setup.mdCovers:
- Go installation and version management
- Development tools installation
- IDE setup (VS Code, GoLand/IntelliJ)
- Project structure overview
- Building from source
- Cross-compilation
- Mock mode development
- Troubleshooting common issues
Testing Guide
File:
docs/development/testing.mdCovers:
- Unit tests, integration tests, benchmarks
- Test coverage measurement and goals
- Writing unit tests and table-driven tests
- Running tests with various options
- Performance profiling (CPU, memory, trace)
- Optimization techniques
- Debug logging and Delve debugger
- Test organization and best practices
Architecture Guide
File:
docs/development/architecture.mdCovers:
- System architecture and layered design
- Core components (views, DAO, SLURM adapter, mock)
- Design patterns (interface segregation, dependency injection, etc.)
- Data flow and configuration management
- State management and concurrency model
- Error handling and security considerations
- Performance optimization strategies
- Testing architecture and extension points
Contributing Guide
File:
docs/development/contributing.mdCovers:
- Code of conduct and community values
- Getting started with fork and setup
- Development workflow and branching
- Commit message conventions (Conventional Commits)
- Code style standards (Go idioms, error handling, comments)
- UI/view guidelines
- Linting and code quality enforcement
- Testing requirements and test organization
- Pull request process and review requirements
- Issue reporting (bugs and features)
- Security reporting guidelines
Linting Standards
File:
docs/development/linting.mdCovers:
- Linting philosophy and goals
- 15 enabled linters with explanations
- Linter configuration in
.golangci.yml - Running linters (make lint, manual execution)
- Fixing lint issues by category
- Proper use of directives
//nolint - Pre-commit hooks and automation
- Disabled linters and their status
- CI/CD integration and requirements
- Best practices for linting
CI/CD Setup
File:
docs/development/ci-cd.mdCovers:
- GitHub Actions workflow overview
- Lint job, test job, build job, security job
- Linting gate implementation and enforcement
- Branch protection rules configuration
- Local testing before pushing
- Troubleshooting CI failures
- Common linting violations and fixes
- Best practices for different roles
Key Files Referenced
Configuration Files
- - Linter configuration
.golangci.yml - - CI/CD workflow definition
.github/workflows/ci.yml - - Pre-commit hooks configuration
.pre-commit-config.yaml - - Build and development automation
Makefile - /
go.mod- Go module dependenciesgo.sum
Test Organization
- - Package code with
internal/*/files*_test.go - - Integration tests
test/integration/ - - Performance benchmarks
test/performance/ - - Mock SLURM client for testing
pkg/slurm/mock.go
Development Standards
Code Quality Requirements
- 80%+ test coverage for new code
- All tests must pass before merge
- Code must pass all 15 linters
- Code must be formatted with gofumpt
- Imports must be organized with goimports
- go.mod must be tidy
Commit and PR Standards
- Follow Conventional Commits format
- PRs should be focused and reasonably sized
- Include tests for new functionality
- Update documentation when needed
- Address reviewer feedback promptly
Security Standards
- Never commit credentials
- Validate all user input
- Follow principle of least privilege
- No credentials in logs or debug output
- Use environment variables for sensitive data
Useful Commands
# Setup make install-tools # Install development tools pre-commit install # Install pre-commit hooks # Development make fmt # Format code make lint # Run linter make build # Build application go run cmd/s9s/main.go --mock # Run in mock mode # Testing make test # Run unit tests make test-integration # Run integration tests make bench # Run benchmarks make coverage # Generate coverage report # Debugging s9s --debug # Enable debug mode dlv debug cmd/s9s/main.go -- --mock # Use Delve debugger go tool pprof cpu.prof # Analyze profiles # CI/CD golangci-lint run # Full linting (as CI runs it) pre-commit run --all-files # Run all pre-commit hooks
Getting Help
If you have questions:
- Check the relevant documentation file above
- Search existing GitHub issues
- Review PR discussions for examples
- Join the s9s Discord community
- Reach out to maintainers
Contributing Workflow Checklist
- Read Development Setup and configure environment
- Read Contributing Guide
- Understand Architecture
- Create feature branch ()
git checkout -b feature/my-feature - Make changes following Code Style
- Write tests following Testing Guide
- Format code ()
make fmt - Run linter ()
make lint - Run tests ()
make test - Commit with Conventional Commits
- Push and create PR
- Ensure all CI/CD checks pass
- Address reviewer feedback
- Merge when approved and all checks pass
Related Resources
- Main README - Project overview
- GitHub Issues - Bug reports and feature requests
- GitHub Discussions - Community discussions
- s9s Discord - Real-time community chat
- Go Documentation - Go language reference
- tview Documentation - Terminal UI framework
- SLURM Documentation - SLURM reference
Happy coding! We look forward to your contributions to s9s.