GitHub Workflow & Code Refactoring
This manual defines the collaborative standards for version control, code submission, and technical debt management within the PlugZero ecosystem.
🏗️ 1. Repository Structure & Git Management
PlugZero uses a decoupled repository architecture. You must manage two distinct codebases simultaneously.
The Decoupled Repositories
- Backend (
plugzero_api): Django REST Framework + Celery + Scikit-Learn.- Remote:
https://github.com/plugzero/plugzero-api.git
- Remote:
- Frontend (
plugzero-analytics): Next.js 16 + Tailwind CSS.- Remote:
https://github.com/plugzero/plugzero-analytics.git
- Remote:
Standardizing Remotes
Ensure your local origin points to the organization repo, not a personal fork, to ensure CI/CD synchronization:
git remote set-url origin git@github.com:plugzero/plugzero-analytics.git🔄 2. The Contribution Cycle (SOP)
A. The Pull Protocol
Before starting any new feature or refactor, always sync your local environment with the latest production state:
git checkout main
git pull origin main --rebaseB. Branching Strategy
main: Production-ready code. Never commit directly tomain.feat/[name]: New features or logic additions.fix/[issue]: Bug fixes.refactor/[target]: Improving code structure without changing outward behavior.
C. Commit Standards (Semantic Commits)
feat: Adding a new analysis engine or UI component.fix: Resolving an API crash or CSS misalignment.docs: Updating manuals (like these).refactor: Optimizing existing data models or cleaning up tech debt.
🛠️ 3. Code Refactoring & Tech Debt
Transitioning from Mocks to Production
Many early-stage services may contain stubbed logic (pass statements or mock return values).
Refactoring Checklist:
- Verification: Locate any
MOCK_API_KEYor hardcoded response logic (e.g., inai_engine.py). - Implementation: Replace mocks with production-ready services using environment variables.
- Stability: Ensure refactored code maintains backward compatibility with saved
AnalysisResultJSON objects in the database.
Linting Compliance
Refactored code MUST pass the following automated checks:
- Frontend:
npm run lint(ESLint 9 compliance). - Backend: Standard PEP8 styles.
🚦 4. Pull Request (PR) Pre-flight Checklist
Before pushing code for review, verify:
- Cross-Stack Check: If you changed a backend model, did you update the frontend
zodschema or API call? - Dependency Check: Are all new packages listed in
package.jsonorrequirements.txt? - Data Integrity: Will your change require a database migration? Is the migration file included?
- Manual Sync: Check if your change invalidates any logic in the other technical manuals.
Collaboration Tip: Always link your PR to a specific ticket or task ID to ensure a clear audit trail of why a change was made.