Shared Resources & Workflows
This document covers the shared resources, common workflows, and cross-project standards used across all OpticWorks engineering projects.
Shared Infrastructure
Section titled “Shared Infrastructure”GitHub Organization
Section titled “GitHub Organization”All repositories are hosted under the r-mccarty GitHub account:
| Repository | Description | Primary Language |
|---|---|---|
| hardwareOS | RS-1 embedded OS | C, Go, TypeScript |
| presence-dectection-engine | ESP32 presence sensing | C++, Python |
| opticworks-store | E-commerce platform | TypeScript |
| opticworks-intranet | This intranet site | TypeScript |
Cloud Services
Section titled “Cloud Services”| Service | Provider | Purpose | Projects |
|---|---|---|---|
| Cloudflare Workers | Cloudflare | Edge compute | Store |
| Cloudflare R2 | Cloudflare | Object storage | All |
| Cloudflare Access | Cloudflare | Zero-trust auth | Intranet |
| Hetzner Cloud | Hetzner | VPS hosting | Store backend |
| GitHub Actions | GitHub | CI/CD | All |
Common Third-Party Services
Section titled “Common Third-Party Services”| Service | Purpose | Projects |
|---|---|---|
| Stripe | Payments | Store |
| EasyPost | Shipping | Store |
| Resend | Store | |
| Hookdeck | Webhooks | Store |
| PagerDuty | Alerting | All production |
Development Standards
Section titled “Development Standards”Git Workflow
Section titled “Git Workflow”All projects follow the same branching strategy:
main (production) │ ├── develop (staging) │ │ │ ├── feature/new-feature │ ├── fix/bug-description │ └── chore/cleanup-task │ └── hotfix/critical-fix (emergency only)Branch Naming:
feature/- New featuresfix/- Bug fixeschore/- Maintenance tasksdocs/- Documentation updateshotfix/- Emergency production fixes
Commit Messages
Section titled “Commit Messages”Use Conventional Commits:
<type>(<scope>): <description>
[optional body]
[optional footer(s)]Types:
feat- New featurefix- Bug fixdocs- Documentationstyle- Formattingrefactor- Code restructuringtest- Testschore- Build/tooling
Examples:
feat(fusion): add Kalman filter velocity estimationfix(cart): resolve race condition in quantity updatedocs(readme): update installation instructionsPull Request Process
Section titled “Pull Request Process”- Create PR from feature branch to
develop - Fill template with description, testing steps, screenshots
- Request review from appropriate team member
- Address feedback and update code
- Squash merge after approval
- Delete branch after merge
PR Template:
## SummaryBrief description of changes
## Type of Change- [ ] Feature- [ ] Bug fix- [ ] Documentation- [ ] Refactoring
## Testing- [ ] Unit tests added/updated- [ ] Manual testing completed- [ ] E2E tests pass
## Screenshots(if applicable)
## Checklist- [ ] Code follows style guidelines- [ ] Self-reviewed code- [ ] Documentation updated- [ ] No breaking changes (or documented)Code Review Guidelines
Section titled “Code Review Guidelines”Reviewers should check:
- Code correctness and logic
- Test coverage
- Performance implications
- Security considerations
- Documentation
- Style consistency
Authors should:
- Keep PRs small (<400 lines)
- Respond to feedback within 24 hours
- Don’t merge your own PRs (unless trivial)
Shared Libraries
Section titled “Shared Libraries”@opticworks/math
Section titled “@opticworks/math”Common mathematical utilities:
import { KalmanFilter, HungarianAlgorithm } from '@opticworks/math';
// Kalman filteringconst kf = new KalmanFilter({ processNoise: 0.1 });kf.predict(dt);kf.update(measurement);
// Hungarian algorithmconst assignment = HungarianAlgorithm.solve(costMatrix);Used by: hardwareOS, presence-detection-engine
@opticworks/config
Section titled “@opticworks/config”Configuration management:
import { loadConfig, getEnvVar } from '@opticworks/config';
const config = loadConfig({ apiUrl: getEnvVar('API_URL', 'http://localhost:3000'), debug: getEnvVar('DEBUG', 'false') === 'true',});Used by: All projects
CI/CD Patterns
Section titled “CI/CD Patterns”Standard GitHub Actions
Section titled “Standard GitHub Actions”Lint and Test:
name: CI
on: [push, pull_request]
jobs: lint: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 with: node-version: 20 - run: npm ci - run: npm run lint - run: npm run testDeploy on Tag:
name: Deploy
on: push: tags: ['v*']
jobs: deploy: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - run: npm ci - run: npm run build - run: npm run deploy env: DEPLOY_TOKEN: ${{ secrets.DEPLOY_TOKEN }}Secrets Management
Section titled “Secrets Management”| Secret | Projects | Purpose |
|---|---|---|
CLOUDFLARE_API_TOKEN | All | Cloudflare deployments |
STRIPE_SECRET_KEY | Store | Payment processing |
EASYPOST_API_KEY | Store | Shipping |
SIGNING_KEY | hardwareOS | Firmware signing |
Testing Standards
Section titled “Testing Standards”Test Coverage Requirements
Section titled “Test Coverage Requirements”| Project | Unit Tests | Integration | E2E |
|---|---|---|---|
| hardwareOS | 80% | Required | Optional |
| presence-engine | 70% | Required | Optional |
| opticworks-store | 70% | Required | Required |
Test Naming
Section titled “Test Naming”describe('ComponentName', () => { describe('methodName', () => { it('should do expected behavior when condition', () => { // test });
it('should throw error when invalid input', () => { // test }); });});Documentation Standards
Section titled “Documentation Standards”Code Documentation
Section titled “Code Documentation”TypeScript/JavaScript:
/** * Calculate the optimal assignment between tracks and detections. * * @param costMatrix - NxM matrix of assignment costs * @returns Array of [trackIndex, detectionIndex] pairs * @throws {Error} If cost matrix is empty */function hungarianSolve(costMatrix: number[][]): [number, number][] { // implementation}C:
/** * @brief Update the Kalman filter with a new measurement. * * @param kf Pointer to the Kalman filter state * @param measurement The new measurement value * @return 0 on success, -1 on error */int kalman_update(kalman_filter_t *kf, float measurement);README Requirements
Section titled “README Requirements”Every repository should have:
- Project description
- Installation instructions
- Quick start guide
- Contributing guidelines
- License information
Cross-Project Communication
Section titled “Cross-Project Communication”Slack Channels
Section titled “Slack Channels”| Channel | Purpose | Members |
|---|---|---|
#engineering | General engineering | All engineers |
#hardware-engineering | hardwareOS, firmware | Hardware team |
#web-engineering | Store, frontend | Web team |
#open-source | Presence engine, community | OSS team |
#platform | Infrastructure, CI/CD | Platform team |
#incidents | Production issues | All on-call |
Meetings
Section titled “Meetings”| Meeting | Frequency | Attendees |
|---|---|---|
| Engineering Standup | Daily, 9:30 AM PT | All engineers |
| Sprint Planning | Bi-weekly, Monday | Team leads |
| Architecture Review | Monthly | Senior engineers |
| Demo Day | Bi-weekly, Friday | All company |
Knowledge Sharing
Section titled “Knowledge Sharing”- Tech Talks: Monthly presentations on new tech
- Code Reviews: Learning through PR reviews
- Documentation: This intranet!
- Pair Programming: Encouraged for complex tasks
Release Process
Section titled “Release Process”Versioning
Section titled “Versioning”All projects use Semantic Versioning:
MAJOR.MINOR.PATCH
- MAJOR: Breaking changes- MINOR: New features (backwards compatible)- PATCH: Bug fixes (backwards compatible)Release Checklist
Section titled “Release Checklist”-
Prepare
- All tests passing
- CHANGELOG updated
- Version bumped
- Documentation updated
-
Release
- Create git tag
- Push tag to trigger deployment
- Monitor deployment
-
Verify
- Production health checks pass
- Smoke tests complete
- No error rate increase
-
Communicate
- Announce in Slack
- Update status page if needed
- Notify stakeholders
Security Practices
Section titled “Security Practices”Secrets Handling
Section titled “Secrets Handling”- Never commit secrets to git
- Use environment variables
- Rotate secrets regularly
- Use GitHub Secrets for CI/CD
Dependency Management
Section titled “Dependency Management”- Keep dependencies updated
- Review security advisories
- Use
npm audit/cargo audit - Pin versions in production
Code Security
Section titled “Code Security”- Input validation on all boundaries
- Parameterized queries (no SQL injection)
- Output encoding (no XSS)
- Authentication on all sensitive endpoints
Getting Help
Section titled “Getting Help”Documentation
Section titled “Documentation”- Check this intranet first
- Search repository READMEs
- Check
/docsfolders in repos
People
Section titled “People”- Ask in relevant Slack channel
- Reach out to project owner
- Schedule a pairing session
Escalation
Section titled “Escalation”- Technical issues → Engineering Lead
- Access issues → IT Support
- Security concerns → Security Lead
Onboarding Checklist
Section titled “Onboarding Checklist”New engineers should:
- Complete general onboarding
- Set up development environment
- Clone relevant repositories
- Join appropriate Slack channels
- Meet with team lead
- Complete first PR (documentation or small fix)
- Shadow an on-call rotation