Skip to main content

Pull Request Workflow

How to submit and review code changes.

Branch Naming

<type>/<ticket>-<short-description>

Examples:
feat/CRM-123-add-segment-builder
fix/CRM-456-resolve-identity-bug
chore/CRM-789-update-dependencies

Types:

  • feat - New feature
  • fix - Bug fix
  • chore - Maintenance
  • docs - Documentation
  • refactor - Code refactoring
  • test - Test changes

Before Creating PR

1. Run Tests

# Run all affected tests
npx nx affected -t test

# Or specific project
npx nx test crm-core
npx nx test crm-backend

2. Run Lint

npx nx lint crm-backend --max-warnings=0

3. Build

npx nx build crm-backend

4. Update Tests

  • Add tests for new code
  • Update tests for changed behavior
  • Minimum 80% coverage for new code

Creating the PR

Title Format

<type>(<scope>): <description>

Examples:
feat(crm): add AI segment builder
fix(crm): resolve identity matching for phones
docs(crm): add deployment runbook

PR Description Template

## Summary
Brief description of the change.

## Changes
- Added X
- Updated Y
- Fixed Z

## Testing
- [ ] Unit tests added/updated
- [ ] Integration tests added/updated
- [ ] Manual testing completed

## Related
- Closes #123
- Related to #456

Review Process

Reviewer Checklist

  1. Functionality

    • Does it work as intended?
    • Are edge cases handled?
  2. Code Quality

    • Follows coding standards?
    • No obvious bugs?
    • Appropriate error handling?
  3. Testing

    • Sufficient test coverage?
    • Tests are meaningful?
  4. Security

    • No sensitive data exposed?
    • Auth/authz correct?
    • Multi-tenancy enforced?
  5. Performance

    • No N+1 queries?
    • Appropriate indexes?
    • No memory leaks?

Leaving Feedback

# Use conventional prefixes

🔴 (blocking): This must be fixed before merge
🟡 (suggestion): Consider this improvement
🟢 (nit): Minor style issue
💭 (question): Need clarification

Merge Requirements

  • All CI checks pass
  • At least 1 approval
  • No unresolved blocking comments
  • Up to date with main

After Merge

If Database Changes

  1. Notify team of migration
  2. Monitor deployment
  3. Verify in staging

If Breaking API Changes

  1. Update API consumers
  2. Update documentation
  3. Consider deprecation period

Hotfix Process

For critical production issues:

# Create from main
git checkout main
git pull
git checkout -b hotfix/CRM-999-critical-fix

# Make minimal fix
# ...

# Create PR with hotfix label
# Request expedited review