Branching & PR Conventions

This document outlines the branching strategy, pull request workflow, and contribution guidelines for MiningOS repositories.

For development environment setup, see Contribution Workflow. For repository organization, see Repository Structure.


Branching Strategy

MiningOS follows a simplified Git Flow model with main as the single permanent branch.

Branch Paradigm

spinner
Branch
Purpose
Merges From
Merges To

main

Production-ready, deployed code

feature/*, fix/*, hotfix/*

Branch Types

Branch Type
Pattern
Purpose
Lifetime

main

main

Production-ready code

Permanent

feature

feature/<description>

New functionality

Temporary

fix

fix/<description>

Bug fixes

Temporary

hotfix

hotfix/<description>

Critical production fixes

Temporary

docs

docs/<description>

Documentation updates

Temporary

refactor

refactor/<description>

Code restructuring

Temporary

Branch Naming Conventions

Use lowercase with hyphens for readability:

For naming conventions in code, see Contribution Workflow — Naming Conventions.

Branch Lifecycle

spinner

Diagram Explanation:

  • Feature and fix branches are created from main

  • Completed work merges back into main after PR approval

  • main represents production-ready code at all times

  • Releases are tagged directly on main after significant merges

Repository Setup

MiningOS uses a fork-based workflow with upstream remotes for synchronization with parent repositories. For the repository hierarchy, see Repository Structure — Repository Hierarchy.

Initial Setup

Upstream Synchronization

Keep your fork synchronized with upstream changes:

A convenience script (upstream-merge.sh) is provided in most repositories:

For directory structure including this script, see Repository Structure — Standard Directory Structure.

Creating a Feature Branch

Workflow

Commit Message Conventions

MiningOS follows Conventional Commitsarrow-up-right specification.

Commit Format

Commit Types

Type
Description
Example

feat

New feature

feat(rpc): add getThingStats method

fix

Bug fix

fix(modbus): resolve connection timeout

docs

Documentation

docs(readme): update installation steps

style

Code style (formatting)

style: fix indentation in worker.js

refactor

Code restructuring

refactor(stats): simplify aggregation logic

perf

Performance improvement

perf(rtd): batch RTD writes to Hyperbee

test

Adding/fixing tests

test(rpc): add unit tests for listThings

chore

Maintenance tasks

chore: update dependencies

Scope Examples

Scope should reflect the component or module affected:

Scope
Description
Related Documentation

rpc

RPC method changes

config

Configuration changes

stats

Statistics/aggregation

Commit Examples

Pull Request Workflow

Before Creating a PR

  1. Run tests (see Testing Guidelines):

  2. Rebase on latest main — incorporate changes from main (conflicts may ensue):

  3. Squash commits — condense branch into shorter sequence of larger commits:

PR Title Format

Follow the same convention as commits:

Examples:

  • feat(rpc): add getContainerStats method

  • fix(worker): resolve memory leak in RTD collection

  • docs(api): document all RPC methods

PR Description Template

For code style guidelines, see Contribution Workflow — Code Standards. For documentation requirements, see Code Documentation Standards.

PR Review Process

  1. Automated Checks: Ensure linting and tests pass

  2. Code Review: At least one approval required

  3. Address Feedback: Resolve all review comments

  4. Squash and Merge: Maintain clean commit history

Handling Upstream Inheritance

MiningOS workers inherit from base classes across repositories (see Repository Structure — Repository Hierarchy). When changes are needed in a parent repository:

  1. Create PR in parent repo first

  2. Wait for merge and release

  3. Update dependency in child repo:

  4. Test integration in child repo (see Testing Guidelines — Test Inheritance)

  5. Create PR in child repo referencing parent changes

For creating new workers in the hierarchy, see Adding New Worker Type.

Release Process

Release Workflow

Releases are created by merging feature/fix branches into main and tagging, as described in the steps below:

Process steps:

  1. Contributor creates feature/fix branch from main

  2. Contributor runs tests on the branch

  3. If tests fail, Contributor fixes issues and returns to step 2

  4. Contributor creates Pull Request targeting main

  5. Reviewer performs code review

  6. If changes requested, Contributor addresses feedback, pushes fixes, and returns to step 2

  7. If rejected, Reviewer closes PR and process ends

  8. If approved, Reviewer merges branch into main

  9. Reviewer tags the release with version number (if applicable)

  10. Reviewer deploys to production

  11. If deployment fails, Reviewer rolls back to previous tag and returns to step 3

  12. Process ends successfully

The BPMN diagram below illustrates the workflow:

spinner

Version Tagging

Versioning

MiningOS follows Semantic Versioningarrow-up-right:

  • MAJOR (1.x.x): Breaking API changes

  • MINOR (x.1.x): New features, backward compatible

  • PATCH (x.x.1): Bug fixes, backward compatible

Quick Reference

Common Git Commands

PR Checklist


Last updated