This document outlines the rigorous engineering standards required for all contributions to the Software Engineering Collective (bhos-sec). We treat all internal repositories as production-grade environments. Excellence is not an act, but a habit.
Before writing a single line of code, it is critical to understand why we enforce structural rigor.
Code reviews are not a rubber-stamping exercise; they are our primary defense against technical debt and our most effective mechanism for knowledge transfer.
- Quality Assurance: A second pair of eyes catches edge cases, architectural deviations, and algorithmic inefficiencies that the original author might miss.
- Mentorship: Reviews are technical mentorship sessions. They provide actionable feedback and elevate the entire team's engineering baseline.
- Shared Ownership: No single person should be the sole point of failure for any module. Reviews distribute system understanding across the Collective.
We do not believe in code that works "on my machine." If it is not reliably tested, it is fundamentally broken.
- Confidence in Refactoring: Comprehensive tests allow us to evolve the architecture aggressively without fear of regressions.
- Living Documentation: Well-written tests explain how a module is intended to be used better than any static wiki page.
- Automated Contracts: Tests enforce the invariants of our systems. When our CI/CD pipeline runs, tests act as the non-negotiable contract that must be fulfilled before a merge can occur.
Giant, monolithic Pull Requests are an anti-pattern. They are impossible to review effectively and serve as a magnet for hidden bugs.
- The Ideal Size: A PR should solve one specific problem. It should take a reviewer no more than 15-20 minutes to read and comprehend.
- The Hard Limit: Any PR exceeding 400 lines of code (LOC) (excluding auto-generated code, lock files, or mass renames) is considered too large and will be rejected.
- If a feature requires more than 400 lines, it must be logically broken down into smaller, independently mergable PRs (e.g., Database schema in PR #1, Core logic in PR #2, API endpoints in PR #3).
Chaos in version control is unacceptable. We enforce a strictly standardized Git workflow to ensure a clean, auditable history.
Direct commits to the main or master branches are strictly prohibited. All changes must be integrated via PRs. The main branch must always remain stable and deployable.
Branches must be scoped to specific tasks and predictably named:
- Features:
feat/feature-name(e.g.,feat/auth-middleware) - Bug Fixes:
fix/issue-description(e.g.,fix/memory-leak-db) - Chore/Maintenance:
chore/task-name(e.g.,chore/dependency-updates) - Documentation:
docs/document-name(e.g.,docs/api-spec)
All commit messages must adhere to the Conventional Commits specification. This semantic approach drives our automated changelogs.
feat:A new feature.fix:A bug fix.chore:Maintenance tasks, dependency bumps.docs:Documentation updates.style:Code style fixes (formatting, missing semicolons, etc.).refactor:Code changes that neither fix a bug nor add a feature, but improve internal structure.
For those transitioning from academic projects to professional workflows, here is the expected sequence of operations.
Always ensure you are branching off the latest state of the main branch to prevent painful merge conflicts later.
# Switch to the main branch
git checkout main
# Pull the latest changes from the remote repository
git pull origin main
# Create and switch to your new strictly-named branch
git checkout -b feat/your-new-featureCommit often, but ensure commits represent logical chunks of work. Messages must follow the Conventional Commits format.
# Stage your specific changes (avoid `git add .` unless necessary)
git add src/your_modified_file.py
# Commit with a descriptive conventional message
git commit -m "feat: add user authentication middleware"If main has progressed while you were working on your branch, you must pull those changes into your branch to resolve conflicts locally before opening a PR.
# While on your feature branch, pull the latest main
git pull origin main
# If conflicts occur, resolve them carefully in your editor, then:
git add .
git commit -m "chore: resolve merge conflicts with main"# Push your branch to the remote repository
git push -u origin feat/your-new-featureAfter pushing, navigate to GitHub and open a Pull Request. Ensure you fill out the required PR template entirely.
In a high-velocity engineering environment, you will encounter complex Git scenarios. Here is how we handle them systematically.
Sometimes you need to build feature B before feature A is merged into main. Do not merge A locally into main and then branch off. Instead, create a "stacked" branch.
- Create branch
Afrommainand start working:git checkout -b feat/A main git commit -m "feat: initial work on A" - When you need to start feature
Bwhich depends onA, branch directly offA, notmain:# From branch feat/A git checkout -b feat/B - The PR Rule: When opening a PR for
feat/B, change the "base branch" in GitHub frommaintofeat/A. Do not targetmainyet, as it will include all the commits fromAand make the PR impossible to review. OnceAis merged intomain, GitHub will automatically retargetBtomain.
Merge conflicts are not errors; they are simply Git asking for human intervention when two people modify the same lines of code. Do not panic.
- Pull the latest target branch: If you are merging
feat/Aintomain, first get the latestmain.git checkout main git pull origin main
- Merge
maininto your feature branch:git checkout feat/A git merge main
- Resolve the Conflicts: Git will explicitly mark the conflicting areas in your files with
<<<<<<<,=======, and>>>>>>>.- Open your IDE (VSCode, JetBrains) and use their conflict resolution tools.
- Look at the incoming change (
main) and your current change (feat/A). - Decide which code to keep, or manually write a combination of both.
- Crucial: Delete the Git conflict markers (
<<<<<<<,=======,>>>>>>>) before saving.
- Complete the Merge:
git add <resolved-files> git commit -m "chore: resolve merge conflicts with main"
(Note: Advanced users may prefer git rebase main instead of git merge main for a cleaner history, but standard merging is the baseline requirement.)
Human review is fallible; our CI/CD pipelines are not. A 'Green' build is an absolute prerequisite for any merge.
- Linting & Formatting: Code must conform to our stylistic tenets without exception. Python code is strictly enforced via
Black, and JavaScript/TypeScript viaESLint. - Unit Testing: Regressions or failing tests will immediately block the build.
- Security Scanning: We employ
CodeQLto automatically detect vulnerabilities, hardcoded secrets, and anti-patterns before human intervention.
By contributing to the Collective, you agree to maintain the high standards of this engineering culture.