Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.thesozocrm.com/llms.txt

Use this file to discover all available pages before exploring further.

Bug Fix Workflow

This guide covers how to identify, fix, and deploy bug fixes safely.

Bug Severity Levels

Critical

  • Security vulnerabilities
  • Data loss
  • System crashes
  • Fix immediately

High

  • Feature broken
  • Performance issues
  • Fix within 24 hours

Medium

  • UI issues
  • Minor functionality problems
  • Fix within 1 week

Low

  • Cosmetic issues
  • Nice-to-have improvements
  • Fix when convenient

Bug Fix Process

Step 1: Identify and Report

1

Reproduce the Bug

Confirm you can reproduce the issue
2

Create Linear Issue

Create bug report in Linear with:
  • Clear description
  • Steps to reproduce
  • Expected vs actual behavior
  • Screenshots/videos if applicable
3

Assign Priority

Set severity level (Critical/High/Medium/Low)

Step 2: Investigate

1

Check Logs

Review browser console, Firebase logs, Sentry errors
2

Identify Root Cause

Find the exact line/function causing the issue
3

Check Related Code

Look for similar issues in related files

Step 3: Fix

1

Create Hotfix Branch

git checkout main
git pull origin main
git checkout -b hotfix/bug-description
2

Write Fix

Implement the fix with proper error handling
3

Add Tests

Add tests to prevent regression
4

Test Locally

Verify fix works in local environment

Step 4: Deploy

1

Create PR

PR from hotfix branch → main Mark as “Hotfix” in PR title
2

Get Approval

Requires 2 approvals for production
3

Merge and Deploy

Merge triggers automatic deployment
4

Verify Fix

Test in production after deployment

Production Bug Fixes

Critical Bugs

Critical bugs require immediate attention and may bypass normal PR process with approval.
Process:
  1. Create hotfix branch from main
  2. Fix the issue
  3. Test thoroughly
  4. Create PR with “HOTFIX” label
  5. Get expedited review (2 approvals)
  6. Merge and deploy
  7. Monitor closely after deployment

Non-Critical Bugs

Process:
  1. Create bug fix branch from dev
  2. Fix the issue
  3. Add tests
  4. Create PR to dev
  5. Normal review process
  6. Merge to devstagingmain

Hotfix Branch Strategy

From Production (Critical)

# Start from main (production)
git checkout main
git pull origin main
git checkout -b hotfix/critical-bug-fix

# Make fix
# ... code changes ...

# Commit and push
git commit -m "Hotfix: Fix critical bug description"
git push origin hotfix/critical-bug-fix

# Create PR: hotfix/critical-bug-fix → main
# After merge, also merge to dev to keep in sync

From Dev (Non-Critical)

# Start from dev
git checkout dev
git pull origin dev
git checkout -b fix/bug-description

# Make fix
# ... code changes ...

# Commit and push
git commit -m "Fix: Bug description"
git push origin fix/bug-description

# Create PR: fix/bug-description → dev
# Normal flow: dev → staging → main

Post-Fix Steps


Best Practices

Fix Root Cause

Don’t just patch symptoms

Add Tests

Prevent regression with tests

Test Thoroughly

Test fix in similar scenarios

Document the Fix

Add comments explaining the fix

Review Related Code

Check for similar issues elsewhere

Communicate

Notify team of critical fixes

Common Bug Patterns

Null/Undefined Errors

// ❌ Bad
const value = data.field.value;

// ✅ Good
const value = data?.field?.value ?? defaultValue;

Missing Error Handling

// ❌ Bad
await riskyOperation();

// ✅ Good
try {
  await riskyOperation();
} catch (error) {
  console.error('Error:', error);
  toast.error('Operation failed');
}

Race Conditions

// ❌ Bad
useEffect(() => {
  fetchData().then(setData);
}, []);

// ✅ Good
useEffect(() => {
  let cancelled = false;
  fetchData().then(data => {
    if (!cancelled) setData(data);
  });
  return () => { cancelled = true; };
}, []);