|
| 1 | +# Contributing and Local Quality Gates |
| 2 | + |
| 3 | +This guide explains how to install, develop, test, and run the local quality gates before opening a PR. The goal is to help maintainers and contributors answer one question before review: did this change break the core Coding Agent workflow? |
| 4 | + |
| 5 | +## Setup |
| 6 | + |
| 7 | +Install root dependencies with Bun: |
| 8 | + |
| 9 | +```bash |
| 10 | +bun install |
| 11 | +``` |
| 12 | + |
| 13 | +If your change touches `desktop/`, also install desktop dependencies: |
| 14 | + |
| 15 | +```bash |
| 16 | +cd desktop |
| 17 | +bun install |
| 18 | +``` |
| 19 | + |
| 20 | +If your change touches `adapters/`, or if you run `check:adapters` / `check:native`, install adapter dependencies: |
| 21 | + |
| 22 | +```bash |
| 23 | +cd adapters |
| 24 | +bun install |
| 25 | +``` |
| 26 | + |
| 27 | +Do not commit local artifacts such as `artifacts/quality-runs/`, `node_modules/`, or `desktop/node_modules/`. |
| 28 | + |
| 29 | +## Required PR Gate |
| 30 | + |
| 31 | +Before opening a normal PR, run: |
| 32 | + |
| 33 | +```bash |
| 34 | +bun run quality:pr |
| 35 | +``` |
| 36 | + |
| 37 | +This gate does not call real models, so every contributor can run it locally. It writes reports to: |
| 38 | + |
| 39 | +```text |
| 40 | +artifacts/quality-runs/<timestamp>/report.md |
| 41 | +artifacts/quality-runs/<timestamp>/report.json |
| 42 | +``` |
| 43 | + |
| 44 | +Include the commands you ran and the report summary in your PR description. |
| 45 | + |
| 46 | +## Area-Specific Checks |
| 47 | + |
| 48 | +Run the checks that match the files you changed: |
| 49 | + |
| 50 | +```bash |
| 51 | +bun run check:server # Server API, WebSocket, providers, sessions, and related tests |
| 52 | +bun run check:desktop # Desktop lint, Vitest, and production build |
| 53 | +bun run check:adapters # IM adapter tests |
| 54 | +bun run check:native # Desktop sidecars and Tauri native checks |
| 55 | +bun run check:docs # Docs build, using npm ci + docs:build |
| 56 | +``` |
| 57 | + |
| 58 | +Focused tests are fine while developing, but run `bun run quality:pr` before sending the PR. |
| 59 | + |
| 60 | +## Live Model Baseline |
| 61 | + |
| 62 | +`quality:baseline` runs real Coding Agent tasks: it starts the local server, creates isolated fixtures, asks a model through chat to fix code, runs tests, and saves transcripts, diffs, verification logs, and a report. |
| 63 | + |
| 64 | +The default baseline command does not call real models: |
| 65 | + |
| 66 | +```bash |
| 67 | +bun run quality:baseline |
| 68 | +``` |
| 69 | + |
| 70 | +To actually call models, pass `--allow-live` and choose a local provider. |
| 71 | + |
| 72 | +First list your local providers and copyable selectors: |
| 73 | + |
| 74 | +```bash |
| 75 | +bun run quality:providers |
| 76 | +``` |
| 77 | + |
| 78 | +Example output: |
| 79 | + |
| 80 | +```text |
| 81 | +Saved providers: |
| 82 | + MiniMax |
| 83 | + selector: minimax |
| 84 | + main: MiniMax-M2.7-highspeed |
| 85 | + --provider-model minimax:main:minimax-main |
| 86 | +``` |
| 87 | + |
| 88 | +Copy one of the listed values: |
| 89 | + |
| 90 | +```bash |
| 91 | +bun run quality:gate --mode baseline --allow-live --provider-model minimax:main:minimax-main |
| 92 | +``` |
| 93 | + |
| 94 | +You can run multiple models in one pass: |
| 95 | + |
| 96 | +```bash |
| 97 | +bun run quality:gate --mode baseline --allow-live \ |
| 98 | + --provider-model codingplan:main:codingplan-main \ |
| 99 | + --provider-model minimax:main:minimax-main |
| 100 | +``` |
| 101 | + |
| 102 | +Provider selectors come from the providers saved in your local Desktop Settings > Providers page. Contributors do not need the maintainer's provider UUIDs or vendor accounts. They can add their own provider locally, run `bun run quality:providers`, and choose their own model. |
| 103 | + |
| 104 | +## When To Run The Baseline |
| 105 | + |
| 106 | +Run the live baseline for changes touching: |
| 107 | + |
| 108 | +- Desktop chat, session resume, WebSocket, or the CLI bridge |
| 109 | +- Provider, model, or runtime selection |
| 110 | +- Permissions, tool calls, file edits, and task execution |
| 111 | +- agent-browser smoke, Computer Use, Skills, or MCP |
| 112 | +- Release preparation or broad cross-module refactors |
| 113 | + |
| 114 | +If you do not have model access, still run `bun run quality:pr` and state in the PR why the live baseline was not run. |
| 115 | + |
| 116 | +## Release Gate |
| 117 | + |
| 118 | +Before a release, run release mode: |
| 119 | + |
| 120 | +```bash |
| 121 | +bun run quality:gate --mode release --allow-live --provider-model <selector>:main |
| 122 | +``` |
| 123 | + |
| 124 | +Release mode composes PR checks, baseline catalog validation, live baseline cases, desktop smoke, and native checks. Reports are written to `artifacts/quality-runs/<timestamp>/`. |
| 125 | + |
| 126 | +## PR Workflow |
| 127 | + |
| 128 | +1. Create a product branch such as `fix/session-reconnect` or `feat/provider-quality-gate`. |
| 129 | +2. Install dependencies and make the change. |
| 130 | +3. Add tests for behavior changes. |
| 131 | +4. Run focused checks for the affected area. |
| 132 | +5. Run `bun run quality:pr`. |
| 133 | +6. Run the live baseline for high-risk changes. |
| 134 | +7. In the PR description, include user impact, verification commands, report summary, and known risks. |
| 135 | + |
| 136 | +## FAQ |
| 137 | + |
| 138 | +### Can I run checks without a provider? |
| 139 | + |
| 140 | +Yes. Run the normal PR gate: |
| 141 | + |
| 142 | +```bash |
| 143 | +bun run quality:pr |
| 144 | +``` |
| 145 | + |
| 146 | +Only the live baseline needs a real model. Add your provider in Desktop Settings > Providers, then run: |
| 147 | + |
| 148 | +```bash |
| 149 | +bun run quality:providers |
| 150 | +``` |
| 151 | + |
| 152 | +### What if provider selectors conflict? |
| 153 | + |
| 154 | +If two provider names produce the same selector, `quality:providers` falls back to the provider ID. Copy the `--provider-model ...` value it prints. |
| 155 | + |
| 156 | +### What if a model ID contains a colon? |
| 157 | + |
| 158 | +Prefer role selectors: |
| 159 | + |
| 160 | +```bash |
| 161 | +--provider-model custom:haiku:custom-haiku |
| 162 | +``` |
| 163 | + |
| 164 | +The runner resolves `haiku` to the real model ID from your local provider configuration. |
0 commit comments