feat(P0-A): 整合第一版并冻结最终发布 #1

Open
tuyixuan wants to merge 115 commits from codex/wp7-07 into codex/wp0-09
2 changed files with 22 additions and 4 deletions
Showing only changes of commit e0e101ef28 - Show all commits
+3 -3
View File
@@ -24,11 +24,11 @@ export function loadCandidateRecord(path) {
if (!Array.isArray(record.browsers) || record.browsers.length !== 2) {
return blocked('candidate_browser_record_incomplete');
}
const names = new Set(record.browsers.map((browser) => browser.name));
if (names.size !== 2 || !names.has('Chrome') || !names.has('Edge')) {
const brands = new Set(record.browsers.map((browser) => browser.brand));
if (brands.size !== 2 || !brands.has('Google Chrome') || !brands.has('Microsoft Edge')) {
return blocked('candidate_browser_pair_invalid');
}
if (record.windows?.build == null || !record.artifact?.sha256 || !record.fixed_port) {
if (record.windows?.build == null || !record.candidate_package?.sha256 || !record.candidate_package?.fixed_port) {
return blocked('candidate_identity_incomplete');
}
if (record.browsers.some((browser) => !browser.full_version || !browser.major)) {
+19 -1
View File
@@ -1,6 +1,24 @@
import test from 'node:test';
import assert from 'node:assert/strict';
import { validateCoverageEvidence, runWp705Gate, REQUIRED_COVERAGE_UNITS } from '../../scripts/lib/wp7-05-ui-gate.mjs';
import fs from 'node:fs';
import os from 'node:os';
import path from 'node:path';
import { loadCandidateRecord, validateCoverageEvidence, runWp705Gate, REQUIRED_COVERAGE_UNITS } from '../../scripts/lib/wp7-05-ui-gate.mjs';
test('WP7-05 accepts the WP7-01 candidate record schema', () => {
const directory = fs.mkdtempSync(path.join(os.tmpdir(), 'wp7-05-'));
const file = path.join(directory, 'release-candidate.json');
fs.writeFileSync(file, JSON.stringify({
browsers: [
{ brand: 'Google Chrome', full_version: '150.0.0', major: 150 },
{ brand: 'Microsoft Edge', full_version: '151.0.0', major: 151 },
],
windows: { build: '26200.8875' },
candidate_package: { fixed_port: 43121, sha256: 'A'.repeat(64) },
}));
assert.equal(loadCandidateRecord(file).status, 'ready');
fs.rmSync(directory, { recursive: true, force: true });
});
test('WP7-05 requires all 22 coverage units and both exact candidate viewports', () => {
const result = validateCoverageEvidence({ coverage_units: [], viewports: [] });