程序员阿江(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

104 lines
3.8 KiB
TypeScript

import { baselineCases } from './baseline/cases'
import type { BaselineTarget, LaneDefinition, QualityGateMode } from './types'
export function lanesForMode(mode: QualityGateMode, baselineTargets: BaselineTarget[] = []): LaneDefinition[] {
const lanes: LaneDefinition[] = [
{
id: 'impact-report',
title: 'Impact report',
description: 'Summarize changed areas, required local checks, and risk notes.',
kind: 'command',
command: ['bun', 'run', 'check:impact'],
requiredForModes: ['pr', 'baseline', 'release'],
},
{
id: 'pr-checks',
title: 'Path-aware PR checks',
description: 'Run the existing local PR gate with stable path-aware checks.',
kind: 'command',
command: ['bun', 'run', 'check:pr'],
requiredForModes: ['pr', 'release'],
},
{
id: 'quarantine',
title: 'Quarantine governance',
description: 'Validate quarantined tests still have owners, exit criteria, and active review windows.',
kind: 'command',
command: ['bun', 'run', 'check:quarantine'],
requiredForModes: ['pr', 'baseline', 'release'],
},
{
id: 'coverage',
title: 'Coverage gate',
description: 'Run unit/component coverage suites and enforce the ratcheted coverage baseline.',
kind: 'command',
command: ['bun', 'run', 'check:coverage'],
requiredForModes: ['pr', 'baseline', 'release'],
},
{
id: 'baseline-catalog',
title: 'Baseline case catalog validation',
description: 'Validate real Coding Agent baseline case definitions and fixture metadata.',
kind: 'command',
command: ['bun', 'test', 'scripts/quality-gate/baseline/cases.test.ts'],
requiredForModes: ['baseline', 'release'],
},
{
id: 'native-checks',
title: 'Native desktop checks',
description: 'Build sidecars and run the Tauri native compile check.',
kind: 'command',
command: ['bun', 'run', 'check:native'],
requiredForModes: ['release'],
},
]
const targets = baselineTargets.length > 0
? baselineTargets
: [{ providerId: null, modelId: 'current', label: 'current-runtime' }]
for (const testCase of baselineCases) {
for (const target of targets) {
const targetSlug = target.label.replace(/[^a-zA-Z0-9._-]+/g, '-')
lanes.push({
id: `baseline:${testCase.id}:${targetSlug}`,
title: `${testCase.title} (${target.label})`,
description: testCase.description,
kind: 'baseline-case',
baselineCaseId: testCase.id,
baselineTarget: target,
requiredForModes: ['baseline', 'release'],
live: true,
})
}
}
for (const target of targets) {
const targetSlug = target.label.replace(/[^a-zA-Z0-9._-]+/g, '-')
lanes.push({
id: `provider-smoke:${targetSlug}`,
title: `Provider live/proxy smoke (${target.label})`,
description: 'Validate live provider connectivity. Saved or active OpenAI-compatible providers also exercise the local non-stream and streaming proxy endpoints; env-only targets validate upstream connectivity and transform pipeline.',
kind: 'provider-smoke',
baselineTarget: target,
requiredForModes: ['baseline', 'release'],
live: true,
})
}
for (const target of targets) {
const targetSlug = target.label.replace(/[^a-zA-Z0-9._-]+/g, '-')
lanes.push({
id: `desktop-smoke:agent-browser-chat:${targetSlug}`,
title: `Desktop agent-browser chat smoke (${target.label})`,
description: 'Open the desktop web app with agent-browser, send a real chat task, and verify the model edits a fixture project through the UI.',
kind: 'desktop-smoke',
baselineTarget: target,
requiredForModes: ['baseline', 'release'],
live: true,
})
}
return lanes.filter((lane) => lane.requiredForModes.includes(mode))
}