repositories / smith

smith

There are many coding harnesses - but this one is fast

owned by bugabinga

Point CI research at Luci

7c24441eede225dc4855373d11c70a30780fe0f1

Oliver Jan Krylow <oliver@bugabinga.net> ·

SSH signature · not checked

Browse filesCompare with HEAD

The forge migration removes pull-request and hosted-workflow assumptions; CI guidance now reflects the public Luci dashboard while leaving unproven runner semantics unspecified.

The updated surface is `docs/research/CI-PATTERNS-RESEARCH.md` §1–12.

Changed files (1)

+32 / −149 text lines

Diff layout

docs/research/CI-PATTERNS-RESEARCH.md

Modified

+32 / −149 text lines

33**Date:** 2026-05-21
44**Status:** Research — CI patterns and gating strategies
6This document captures CI/CD patterns, test gating strategies, and agent-gating workflows for smith. It does not prescribe a specific CI technology (GitHub Actions, GitLab CI, Buildkite, etc.) but defines goals independent of platform.
6This document captures test-gating strategy for smith and its deployment on Luci at `ci.bugabinga.net`.
88---
1010## 1. CI Tier Philosophy
12The goal is **fast feedback on commit, thorough validation on merge, exhaustive testing on release**.
12The goal is **fast feedback on commit, thorough validation before trunk integration, exhaustive testing on release**.
1414Coding agents (including smith itself when used for self-improvement) must be gated by the right tests at the right time. Agents should not waste time on slow tests for trivial changes, nor should they skip critical validation for risky changes.
1818| Tier | Trigger | Duration | Tests | Gate |
1919|------|---------|----------|-------|------|
2020| **Fast** | Every commit (local + push) | < 2 min | Unit, property, snapshot, doc | Block push if fail |
21| **Medium** | Every PR | < 10 min | Fast + integration (CLI, TUI, session) | Block merge if fail |
21| **Medium** | Before trunk integration | < 10 min | Fast + integration (CLI, TUI, session) | Block integration if fail |
2222| **Slow** | Nightly + release candidates | < 2 hours | Medium + mutation + benchmarks + full matrix | Block release if fail |
2424### Why tiers matter for agents
2626Agents generate code quickly. Running the full test suite on every agent iteration is wasteful. But skipping integration tests before merging agent-generated code is dangerous.
28**Rule:** Agents run fast tier on every iteration. Medium tier on "ready to merge". Slow tier is CI's responsibility, not the agent's.
28**Rule:** Agents run fast tier on every iteration and medium tier before integration. Luci owns the slow tier.
3030---
7878---
80## 3. Medium Tier: Every PR
80## 3. Medium Tier: Before Trunk Integration
8282### What runs
117117### Coverage gate
119119- **Target:** 85% overall, 100% on `smith/` (types crate)
120- **Advisory on PR** — coverage drop > 2% triggers warning comment
121- **Block on < 80%** — PR cannot merge if coverage falls below threshold
120- **Advisory:** coverage drop > 2% is reported in the run
121- **Block on < 80%:** trunk integration stops below the threshold
123123### Agent behavior
125125- Agent runs medium tier before declaring "ready for review"
126126- If medium tier fails, agent fixes and re-runs
127- Coverage drop > 2% requires agent justification in PR description
127- Coverage drop > 2% requires an explicit justification before integration
129129---
140140cargo mutants --test-tool=nextest
142142# Benchmarks with regression detection
143cargo bench -- --baseline main
143cargo bench -- --baseline trunk
145145# Full platform matrix (if multi-platform CI)
146146# - Linux x86_64
184184### Mutation gate
186186- **Target:** > 80% mutants caught
187- **Advisory on nightly** — report posted to issue/PR
187- **Advisory on nightly:** report retained with the Luci run
188188- **Block release** — release cannot proceed if < 80%
190190### Benchmark gate
192192- **Regression threshold:** ±5% for most benchmarks, ±10% for agent loop
193193- **Block release** — any benchmark regressing > threshold blocks release
194- **Advisory on PR** — benchmark comparison comment posted to PR
194- **Advisory before integration:** benchmark comparison retained with the run
196196### Agent behavior
239239## 6. Agent Gating Strategy
241### Agent types that will use smith
2431. **Self-hosted agent** — smith improving its own codebase
2442. **User agent** — user runs smith on their own projects
2453. **CI agent** — automated agent in CI pipeline
247### Gating per agent type
249| Agent Type | Fast Tier | Medium Tier | Slow Tier | Release |
250|------------|-----------|-------------|-----------|---------|
251| Self-hosted | Every iteration | Before self-PR | Nightly CI | Blocked by slow tier |
252| User | On request | On request | Never | N/A |
253| CI | Every commit | Every PR | Scheduled | Blocked by slow tier |
255### Agent-specific tests
257When an agent modifies smith's own code:
2591. **Run agent on test fixture** — does the agent produce valid output for a known task?
2602. **Regression test** — replay a recorded session with the new code, verify identical output
2613. **Self-test** — agent runs `cargo test` on its own changes
263### Agent safety rules
2651. **Never auto-merge** — agent opens PR, human reviews
2662. **Never skip tests** — agent runs full tier before PR
2673. **Never modify CI config** — agent cannot change `.github/workflows/`, `.config/nextest.toml`, etc.
2684. **Never modify tests to make them pass** — agent cannot change test assertions to match buggy code
241When an agent modifies smith, it runs the fast tier after each iteration and
242the medium tier before requesting trunk integration. Luci owns scheduled slow
243runs. Agents never weaken CI configuration or tests to obtain a passing result.
270245---
272247## 7. Artifact Management
274### What artifacts to keep
276| Artifact | Retention | Purpose |
277|----------|-----------|---------|
278| Test logs | 30 days | Debug failures |
279| Coverage reports (HTML) | 30 days | Review coverage |
280| Coverage reports (LCOV) | 30 days | codecov.io upload |
281| Benchmark results | 90 days | Regression analysis |
282| Mutation reports | 90 days | Test quality tracking |
283| Snapshot diffs | 7 days | Review pending snapshots |
285### Benchmark baselines
287Store benchmark baselines as CI artifacts, keyed by branch:
289```
290artifacts/
291├── benchmarks/
292│ ├── trunk/ # Baseline for trunk branch
293│ ├── release-0.1/ # Baseline for release branch
294│ └── pr-123/ # Baseline for PR (optional)
295```
297### Snapshot artifacts
299Pending snapshots (`.snap.new` files) are CI artifacts for review:
301```bash
302# Download pending snapshots from CI
303cargo insta test
304# Review locally
305cargo insta review
306```
249Luci retains logs, coverage, benchmark results, mutation reports, and snapshot
250diffs only as long as they remain useful for diagnosis. Benchmark baselines are
251keyed by `trunk` or release tag; generated artifacts never enter git.
308253---
310## 8. Notification Strategy
255## 8. Run Visibility
312### Who gets notified when
314| Event | Channel | Recipient |
315|-------|---------|-----------|
316| Fast tier fail | PR comment | Agent + author |
317| Medium tier fail | PR comment + email | Agent + author + reviewers |
318| Coverage drop > 2% | PR comment | Agent + author |
319| Mutation score < 80% | Issue + Slack | Team |
320| Benchmark regression | Issue + PR comment | Agent + author + team |
321| Nightly fail | Email + Slack | Team |
323### Agent notifications
325Agents consume notifications via:
326- PR comments (structured: `<!-- smith-bot: status=fail tier=fast reason=compilation -->`)
327- CI status API (GitHub Checks, GitLab Pipeline Status)
328- Webhook (for self-hosted agents)
257`https://ci.bugabinga.net` is the canonical public run dashboard. Failed gates
258remain failed until a later run passes; forge comments, issue mutation, and
259email delivery are outside the CI contract.
330261---
361292---
363## 10. CI Platform Agnosticism
294## 10. Luci Deployment
365These notes describe goals, not implementation. Any CI platform can implement the three-tier model.
296Smith's CI is Luci at `https://ci.bugabinga.net`. Luci discovers `.ci/*.kdl`
297job definitions from the public `smith` repository on Soft Serve. The KDL is
298orchestration only: every product check delegates to Cargo or xtask, and no
299check logic is duplicated in CI configuration.
367### Platform mapping
369| Concept | GitHub Actions | GitLab CI | Buildkite |
370|---------|---------------|-----------|-----------|
371| Fast tier | `push` trigger + job | `script` in stage | Step in pipeline |
372| Medium tier | `pull_request` trigger + job | `merge_requests` pipeline | PR pipeline |
373| Slow tier | `schedule` (cron) + job | `schedule` pipeline | Scheduled build |
374| Artifacts | `actions/upload-artifact` | `artifacts:` | `artifact_paths` |
375| Caching | `actions/cache` | `cache:` | Built-in |
376| Notifications | Checks API | Pipeline Status | Webhooks |
378### Recommended GitHub Actions structure
380```yaml
381# .github/workflows/ci.yml
382name: CI
384on:
385 push:
386 branches: [main]
387 pull_request:
389jobs:
390 fast:
391 runs-on: ubuntu-latest
392 steps:
393 - uses: actions/checkout@v4
394 - uses: dtolnay/rust-toolchain@stable
395 - uses: taiki-e/install-action@nextest
396 - run: cargo fmt --check
397 - run: cargo clippy --workspace --all-targets --all-features -- -D warnings
398 - run: cargo nextest run --profile fast
400 medium:
401 needs: fast
402 runs-on: ubuntu-latest
403 steps:
404 - uses: actions/checkout@v4
405 - uses: dtolnay/rust-toolchain@stable
406 - uses: taiki-e/install-action@nextest
407 - run: cargo nextest run --profile default
408 - run: cargo nextest run --profile integration
409 - run: cargo tarpaulin --out Lcov
410 - uses: codecov/codecov-action@v3
412 slow:
413 needs: medium
414 if: github.event_name == 'schedule' || startsWith(github.ref, 'refs/tags/')
415 runs-on: ubuntu-latest
416 steps:
417 - uses: actions/checkout@v4
418 - uses: dtolnay/rust-toolchain@stable
419 - run: cargo mutants --test-tool=nextest
420 - run: cargo bench -- --baseline main
421```
301The public dashboard currently exposes repository, job, status, and run time.
302Exact trigger, cache, artifact, and retention semantics remain unproven until
303smith's first Luci job runs; the repository must not encode assumptions about
304them before that proof.
423306---
448331| Goal | Metric | Tier |
449332|------|--------|------|
450333| Fast feedback | < 2 min from push to result | Fast |
451| Merge safety | < 10 min from PR open to green | Medium |
334| Integration safety | < 10 min from request to green | Medium |
452335| Release confidence | < 2 hours from tag to validated release | Slow |
453336| Coverage | ≥ 85% overall | Medium |
454337| Mutation score | ≥ 80% caught | Slow |
455338| Benchmark regression | ±5% threshold | Slow |
456339| Flaky tests | 0 tolerated | All tiers |
457| Agent gating | Fast on every iteration, medium before merge, slow on release | All |
340| Agent gating | Fast on every iteration, medium before integration, slow on release | All |