10 — Contributing Guide

Git workflow, commit conventions, coding standards, and the PR process.


Rules

  1. All development and testing inside the Vagrant VM — never install dependencies on the host
  2. Every change must be understood — if you can't explain why, don't commit it
  3. Author of all commits is Krstan Vjestica — never attribute tools as authors
  4. Review the diff before committing — always
  5. Everything must pass before you commit — not vagrant validate, not a syntax check: the actual thing running. A change to the dev environment is proven by destroying the VM and building it again; a change to the platform is proven by a clean install plus the full Cypress regression

Development environment


Git Workflow

Branch naming

feature/dynamic-surveys        # New feature
fix/job-stuck-pending          # Bug fix
refactor/split-serializers     # Refactoring
docs/wiki-task-engine          # Documentation
test/inventory-api-tests       # Tests
chore/update-dependencies      # Maintenance

Standard flow

main is the integration branch. There is no devel branch in any Forail repo — branch from main and target main in the PR.

# 1. Create branch from main
git checkout main
git pull github main
git checkout -b feature/my-feature

# 2. Make changes, test, commit
vagrant rsync
vagrant ssh -c "cd /awx_devel && forail-test"
git add forail/main/models/my_model.py
git commit -m "feat(models): add Policy model for governance"

# 3. Push and create PR
git push github feature/my-feature
gh pr create --base main

Updating the branch

git checkout main && git pull github main
git checkout feature/my-feature
git rebase main

Remotes

Most repos have two: github (github.com/forail-platform, the canonical one, where CI and releases run) and origin (the GitLab mirror). Push branches and tags to both when you are done, or the mirror silently falls behind.


Commit Conventions

Format

type(scope): short description

Types

Type When Example
feat New feature feat(api): add /policies/ endpoint
fix Bug fix fix(tasks): prevent job stuck in pending
refactor Code restructuring refactor(serializers): split into modules
docs Documentation docs(wiki): add task engine documentation
test Tests test(api): add inventory CRUD tests
chore Maintenance chore(deps): update Django to 4.2.18

Scopes

models, api, tasks, ui, auth, rbac, deploy, ci, deps

Rules


Coding Standards

Python

TypeScript/React

Linting (run before every commit)

flake8 forail/ --count --statistics
cd forail/ui_next && npx tsc --noEmit

Pull Request Process

Before creating a PR

PR guidelines

Review Checklist

For the author:

For the reviewer:


Quick Reference — Common Development Tasks

Add a new API endpoint

  1. Model in forail/main/models/ → register in __init__.py
  2. Migration: forail-manage makemigrations main
  3. Serializer in forail/api/serializers/
  4. View in forail/api/views/
  5. URL module in forail/api/urls/ → register in urls.py
  6. Access class in forail/main/access.py
  7. Tests

Add a new frontend page

  1. TypeScript types in src/api/types.ts
  2. API hooks in src/api/hooks/
  3. Page in src/pages/
  4. Route in src/App.tsx
  5. Navigation in src/components/layout/Sidebar.tsx
  6. Tests

Add a management command

  1. File in forail/main/management/commands/
  2. Implement Command class with handle() method
  3. Test: forail-manage my_command --help