|
| 1 | +# Design & Implementation Plan: PR #381 GitHub Runner Integration Merge |
| 2 | + |
| 3 | +**Status:** Ready for Review |
| 4 | +**PR:** #381 - feat: Add DevOps/CI-CD role configuration and GitHub runner integration |
| 5 | +**Date:** 2025-12-31 |
| 6 | + |
| 7 | +--- |
| 8 | + |
| 9 | +## 1. Summary of Target Behavior |
| 10 | + |
| 11 | +After merging PR #381, the system will: |
| 12 | + |
| 13 | +1. **Support self-hosted Terraphim-based GitHub runners** with Firecracker VM orchestration |
| 14 | +2. **Provide DevOps/CI-CD role configurations** for specialized knowledge graph queries |
| 15 | +3. **Enable sub-200ms command execution** via pre-warmed VM pools |
| 16 | +4. **Maintain all recent CI fixes** (Tauri builds, cross-compilation, signing) |
| 17 | + |
| 18 | +--- |
| 19 | + |
| 20 | +## 2. Key Invariants and Acceptance Criteria |
| 21 | + |
| 22 | +### Invariants |
| 23 | + |
| 24 | +| Invariant | Guarantee | |
| 25 | +|-----------|-----------| |
| 26 | +| I1 | Recent CI fixes (Tauri v1, cross-compilation, signing) are preserved | |
| 27 | +| I2 | All existing workflows continue to function | |
| 28 | +| I3 | New DevOps role config doesn't break existing roles | |
| 29 | +| I4 | Claude log analyzer maintains backward compatibility | |
| 30 | + |
| 31 | +### Acceptance Criteria |
| 32 | + |
| 33 | +| ID | Criterion | Testable | |
| 34 | +|----|-----------|----------| |
| 35 | +| AC1 | CI workflows pass after merge | Yes - CI runs | |
| 36 | +| AC2 | DevOps role config loads successfully | Yes - server startup | |
| 37 | +| AC3 | Tauri desktop builds work on Ubuntu 22.04 | Yes - release workflow | |
| 38 | +| AC4 | Cross-compilation with feature flags works | Yes - musl/ARM builds | |
| 39 | +| AC5 | macOS signing and notarization works | Yes - release workflow | |
| 40 | + |
| 41 | +--- |
| 42 | + |
| 43 | +## 3. High-Level Design and Boundaries |
| 44 | + |
| 45 | +### Components to Merge (Keep from PR #381) |
| 46 | + |
| 47 | +| Component | Purpose | Risk | |
| 48 | +|-----------|---------|------| |
| 49 | +| `devops_cicd_config.json` | New role configuration | Low - additive | |
| 50 | +| `.docs/github-runner-ci-integration.md` | Integration documentation | Low - docs only | |
| 51 | +| Claude log analyzer updates | Enhanced analysis | Low - isolated crate | |
| 52 | +| Blog posts/marketing | Content | None | |
| 53 | +| Test data files | Test fixtures | Low | |
| 54 | + |
| 55 | +### Components to Carefully Merge (Review for Conflicts) |
| 56 | + |
| 57 | +| Component | PR #381 Changes | Main Changes | Resolution Strategy | |
| 58 | +|-----------|-----------------|--------------|---------------------| |
| 59 | +| `ci-native.yml` | Whitespace cleanup | Tauri/webkit fixes | Take main's version | |
| 60 | +| `ci-pr.yml` | Minor updates | Recent fixes | Take main, cherry-pick non-conflicting | |
| 61 | +| `release.yml` | Slack->Discord | Signing fixes | Merge both changes | |
| 62 | +| `ci-main.yml` | Updates | Recent fixes | Take main, cherry-pick runner integration | |
| 63 | + |
| 64 | +### Components to Skip (Already Superseded) |
| 65 | + |
| 66 | +| Component | Reason | |
| 67 | +|-----------|--------| |
| 68 | +| `floor_char_boundary` changes | Already in main with MSRV-compatible version | |
| 69 | +| Old lesson-learned entries | Main has more recent entries | |
| 70 | + |
| 71 | +--- |
| 72 | + |
| 73 | +## 4. File/Module-Level Change Plan |
| 74 | + |
| 75 | +### Phase 1: Resolve Conflicts (Take Main's Version) |
| 76 | + |
| 77 | +| File | Action | Conflict Type | Resolution | |
| 78 | +|------|--------|---------------|------------| |
| 79 | +| `crates/terraphim_middleware/src/indexer/ripgrep.rs` | Resolve | floor_char_boundary | Keep main's version | |
| 80 | +| `terraphim_server/src/lib.rs` | Resolve | floor_char_boundary | Keep main's version | |
| 81 | +| `crates/terraphim_settings/test_settings/settings.toml` | Resolve | Config values | Review and merge | |
| 82 | +| `lessons-learned.md` | Resolve | Appended content | Keep both (main + PR additions) | |
| 83 | + |
| 84 | +### Phase 2: Workflow Files (Selective Merge) |
| 85 | + |
| 86 | +| File | Action | Strategy | |
| 87 | +|------|--------|----------| |
| 88 | +| `.github/workflows/ci-native.yml` | Skip PR changes | Main has critical Tauri fixes | |
| 89 | +| `.github/workflows/ci-pr.yml` | Skip PR changes | Main has recent fixes | |
| 90 | +| `.github/workflows/ci-main.yml` | Skip PR changes | Main has recent fixes | |
| 91 | +| `.github/workflows/ci-optimized-main.yml` | Skip PR changes | Keep main | |
| 92 | +| `.github/workflows/release.yml` | Manual merge | Keep main's signing fixes, add Discord notification | |
| 93 | +| `.github/workflows/deploy.yml` | Review | May contain useful changes | |
| 94 | +| `.github/workflows/test-ci.yml` | Accept PR | New file for testing | |
| 95 | +| `.github/workflows/test-firecracker-runner.yml` | Accept PR | New file for runner testing | |
| 96 | + |
| 97 | +### Phase 3: New Files (Accept All) |
| 98 | + |
| 99 | +| File | Action | Purpose | |
| 100 | +|------|--------|---------| |
| 101 | +| `terraphim_server/default/devops_cicd_config.json` | Create | DevOps role config | |
| 102 | +| `.docs/github-runner-ci-integration.md` | Create | Integration docs | |
| 103 | +| `.docs/*.md` (other docs) | Create | Design/research docs | |
| 104 | +| `blog-posts/*.md` | Create | Marketing content | |
| 105 | +| `blog/*.md` | Create | Social media drafts | |
| 106 | +| `crates/claude-log-analyzer/tests/test_data/*.jsonl` | Create | Test fixtures | |
| 107 | + |
| 108 | +### Phase 4: Modified Files (Careful Review) |
| 109 | + |
| 110 | +| File | Action | Notes | |
| 111 | +|------|--------|-------| |
| 112 | +| `Cargo.lock` | Auto-merge | Let git handle | |
| 113 | +| `crates/claude-log-analyzer/Cargo.toml` | Review | Check for version bumps | |
| 114 | +| `crates/claude-log-analyzer/src/*.rs` | Accept | Isolated crate | |
| 115 | +| `Earthfile` | Review | May have runner integration | |
| 116 | +| `.gitignore` | Accept | Additional ignores | |
| 117 | +| `HANDOVER-2025-01-31.md` | Accept | Historical document | |
| 118 | + |
| 119 | +--- |
| 120 | + |
| 121 | +## 5. Step-by-Step Implementation Sequence |
| 122 | + |
| 123 | +### Step 1: Abort Current Merge State |
| 124 | +- Purpose: Clean slate |
| 125 | +- Deployable: N/A |
| 126 | + |
| 127 | +### Step 2: Resolve Code Conflicts |
| 128 | +- Resolve `ripgrep.rs` - take main's `floor_char_boundary` |
| 129 | +- Resolve `lib.rs` - take main's version |
| 130 | +- Resolve `settings.toml` - review and merge |
| 131 | +- Resolve `lessons-learned.md` - append PR content after main |
| 132 | +- Deployable: Yes |
| 133 | + |
| 134 | +### Step 3: Skip Workflow Conflicts |
| 135 | +- `git checkout --ours` for workflow files that main has fixed |
| 136 | +- Keep recent CI fixes intact |
| 137 | +- Deployable: Yes |
| 138 | + |
| 139 | +### Step 4: Accept New Files |
| 140 | +- Stage all new documentation files |
| 141 | +- Stage DevOps role config |
| 142 | +- Stage test fixtures |
| 143 | +- Stage blog content |
| 144 | +- Deployable: Yes |
| 145 | + |
| 146 | +### Step 5: Review and Test |
| 147 | +- Run `cargo check --workspace` |
| 148 | +- Run `cargo clippy -p terraphim_server` |
| 149 | +- Verify DevOps config loads |
| 150 | +- Deployable: Yes |
| 151 | + |
| 152 | +### Step 6: Commit and Push |
| 153 | +- Single merge commit |
| 154 | +- Push to PR branch |
| 155 | +- Wait for CI |
| 156 | +- Deployable: Yes (after CI passes) |
| 157 | + |
| 158 | +--- |
| 159 | + |
| 160 | +## 6. Testing & Verification Strategy |
| 161 | + |
| 162 | +| Acceptance Criteria | Test Type | Verification | |
| 163 | +|---------------------|-----------|--------------| |
| 164 | +| AC1: CI passes | Integration | GitHub Actions | |
| 165 | +| AC2: DevOps config loads | Manual | `cargo run -- --config devops_cicd_config.json` | |
| 166 | +| AC3: Tauri builds | CI | Release workflow on test tag | |
| 167 | +| AC4: Cross-compilation | CI | Matrix build jobs | |
| 168 | +| AC5: macOS signing | CI | Release workflow | |
| 169 | + |
| 170 | +--- |
| 171 | + |
| 172 | +## 7. Risk & Complexity Review |
| 173 | + |
| 174 | +| Risk | Mitigation | Residual Risk | |
| 175 | +|------|------------|---------------| |
| 176 | +| Workflow conflicts override recent fixes | Skip PR's workflow changes, keep main | Low | |
| 177 | +| DevOps config breaks existing roles | Config is additive, separate file | None | |
| 178 | +| Claude log analyzer changes break tests | Run tests before merge | Low | |
| 179 | +| Merge commit too large to review | Step-by-step approach with clear phases | Low | |
| 180 | + |
| 181 | +--- |
| 182 | + |
| 183 | +## 8. Open Questions / Decisions for Human Review |
| 184 | + |
| 185 | +| Question | Options | Recommendation | |
| 186 | +|----------|---------|----------------| |
| 187 | +| Keep PR's workflow changes? | Yes / No / Selective | **No** - main has critical fixes | |
| 188 | +| Discord vs Slack notifications? | Discord / Slack / Both | **Discord** - from PR | |
| 189 | +| Include blog posts? | Yes / No | **Yes** - marketing value | |
| 190 | +| Include test-firecracker-runner.yml? | Yes / No | **Yes** - useful for runner testing | |
| 191 | + |
| 192 | +--- |
| 193 | + |
| 194 | +## 9. Recommended Merge Command Sequence |
| 195 | + |
| 196 | +```bash |
| 197 | +# Step 1: Reset merge state |
| 198 | +git merge --abort |
| 199 | + |
| 200 | +# Step 2: Start fresh merge |
| 201 | +git merge origin/main --no-commit |
| 202 | + |
| 203 | +# Step 3: Resolve conflicts by keeping main's versions |
| 204 | +git checkout --theirs crates/terraphim_middleware/src/indexer/ripgrep.rs |
| 205 | +git checkout --theirs terraphim_server/src/lib.rs |
| 206 | + |
| 207 | +# Step 4: Manually resolve settings.toml and lessons-learned.md |
| 208 | + |
| 209 | +# Step 5: Skip workflow changes (keep main's fixes) |
| 210 | +git checkout --theirs .github/workflows/ci-native.yml |
| 211 | +git checkout --theirs .github/workflows/ci-pr.yml |
| 212 | +git checkout --theirs .github/workflows/ci-main.yml |
| 213 | +git checkout --theirs .github/workflows/ci-optimized-main.yml |
| 214 | + |
| 215 | +# Step 6: Stage resolved files |
| 216 | +git add -A |
| 217 | + |
| 218 | +# Step 7: Commit merge |
| 219 | +git commit -m "Merge branch 'main' into feat/github-runner-ci-integration" |
| 220 | + |
| 221 | +# Step 8: Push and verify CI |
| 222 | +git push origin feat/github-runner-ci-integration |
| 223 | +``` |
| 224 | + |
| 225 | +--- |
| 226 | + |
| 227 | +**Do you approve this plan as-is, or would you like to adjust any part?** |
0 commit comments