cc-haha/CONTRIBUTING.md
程序员阿江(Relakkes) 9719726cd2 feat: make quality gates observable and enforceable
The repository now has a measurable PR quality path instead of a loose set of
manual checks. Coverage, quarantine governance, provider smoke, desktop smoke,
and workflow wiring all produce durable reports that contributors and maintainers
can inspect without reconstructing terminal output.

This also fixes the desktop smoke current-runtime path so browser-driven smoke
runs use the desktop default active provider instead of forcing the official
current model, and records that runtime decision as an artifact.

Constraint: Default PR gates must remain non-live and contributor-safe while live model checks stay explicit.
Constraint: Release packaging is still GitHub Actions based, so release preflight must run before the build matrix.
Rejected: Make live provider or desktop smoke mandatory on every PR | secrets, quotas, and model availability are maintainer-controlled.
Rejected: Let PRs lower coverage baselines in the same change | base-branch ratchet comparison must remain authoritative.
Confidence: high
Scope-risk: moderate
Directive: Do not relax coverage or quarantine policy without a maintainer approval label and a fresh quality report.
Tested: ALLOW_CLI_CORE_CHANGE=1 ALLOW_COVERAGE_BASELINE_CHANGE=1 bun run quality:gate --mode pr
Tested: bun run quality:gate --mode baseline --allow-live --only provider-smoke:* --provider-model nvidia-custom:main:nvidia-custom-main --artifacts-dir /tmp/quality-gate-live-smoke
Tested: bun run quality:gate --mode baseline --allow-live --only desktop-smoke:* --provider-model current:current:current-runtime --artifacts-dir /tmp/quality-gate-desktop-smoke-fixed
Tested: git diff --check
Not-tested: Full live release mode with multiple providers in hosted CI; provider credentials and quota remain maintainer-controlled.
2026-05-06 16:25:10 +08:00

51 lines
1.8 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 贡献指南
感谢你帮助改进 Claude Code Haha。
完整贡献指南包含本地检查、真实模型 baseline、质量门禁报告和 PR 要求:
- 中文:[docs/guide/contributing.md](docs/guide/contributing.md)
- English[docs/en/guide/contributing.md](docs/en/guide/contributing.md)
大多数贡献者在提交 PR 前应先运行:
```bash
bun install
bun run quality:pr
```
这个门禁现在会同时生成质量报告和覆盖率报告:
```text
artifacts/quality-runs/<timestamp>/report.md
artifacts/quality-runs/<timestamp>/report.json
artifacts/quality-runs/<timestamp>/junit.xml
artifacts/quality-runs/<timestamp>/logs/*.log
artifacts/coverage/<timestamp>/coverage-report.md
```
覆盖率 baseline/threshold 变更需要维护者加 `allow-coverage-baseline-change`。CI 会优先用 base branch 的 baseline 做 ratchet 对比,避免 PR 自己降低 baseline 后绕过门禁。
被 quarantine 的测试必须保留 owner、reviewAfter 和 exitCriteria过期后 `check:quarantine``check:server``check:coverage` 都会阻断。
如果你在全新 clone 中运行 adapter 或 native 相关检查,还需要安装 adapter 依赖:
```bash
cd adapters
bun install
```
如果改动涉及桌面端聊天路径、provider/runtime 选择、CLI bridge、权限、工具、文件编辑或发布打包还需要用你本地可用的模型提供商跑真实 baseline
```bash
bun run quality:providers
bun run quality:gate --mode baseline --allow-live --provider-model <selector>:main
```
只想跑真实 provider/desktop smoke 时,可以使用:
```bash
bun run quality:smoke --provider-model <selector>:main
```
发版前使用 `quality:gate --mode release --allow-live`live lane 不允许静默跳过;如果缺 provider、额度或外部账号要在报告里明确写 blocker。