Skip to content

Doubao-powered voice input for Linux, Wayland and Omarchy

fix(workflow): preserve summaries after shard failures

quanrue8b7c56af7ef
diff --git a/.github/workflows/deploy-midscene-report.yml b/.github/workflows/deploy-midscene-report.yml
index 037275e..fdee4c4 100644
--- a/.github/workflows/deploy-midscene-report.yml
+++ b/.github/workflows/deploy-midscene-report.yml
@@ -38,21 +38,16 @@ on:
type: string
jobs:
- deploy:
- name: Publish HTML report history
+ prepare:
+ name: Build report and Markdown summary
runs-on: ubuntu-latest
timeout-minutes: 10
- concurrency:
- group: pages-report-deploy
- cancel-in-progress: false
permissions:
actions: read
contents: read
pages: write
- id-token: write
- environment:
- name: github-pages
- url: ${{ steps.deployment.outputs.page_url }}
+ outputs:
+ pages-base-url: ${{ steps.pages.outputs.base_url }}
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
@@ -69,6 +64,7 @@ jobs:
uses: actions/configure-pages@45bfe0192ca1faeb007ade9deae92b16b8254a0d # v6.0.0
- name: Restore history and prepare the Pages site
+ id: build-report
env:
REPORT_RETENTION: ${{ vars.REPORT_RETENTION || '30' }}
PAGES_BASE_URL: ${{ steps.pages.outputs.base_url }}
@@ -100,35 +96,70 @@ jobs:
fi
node scripts/build-pages-report.mjs "${arguments[@]}"
+ - name: Add complete evidence table to the run summary
+ if: always() && steps.build-report.outcome == 'success'
+ env:
+ PAGES_BASE_URL: ${{ steps.pages.outputs.base_url }}
+ PRODUCER_RESULT: ${{ inputs.run-result }}
+ SUMMARY_TITLE: ${{ inputs.summary-title }}
+ run: |
+ node scripts/render-ci-report-summary.mjs \
+ --manifest "$RUNNER_TEMP/pages-site/reports/manifest.json" \
+ --pages-url "$PAGES_BASE_URL" \
+ --producer-result "$PRODUCER_RESULT" \
+ --run-id "$GITHUB_RUN_ID" \
+ --summary-title "$SUMMARY_TITLE" \
+ --output "$GITHUB_STEP_SUMMARY"
+
- name: Upload the restricted Pages payload
uses: actions/upload-pages-artifact@fc324d3547104276b827a68afc52ff2a11cc49c9 # v5.0.0
with:
path: ${{ runner.temp }}/pages-site
+ - name: Upload the manifest for deployment verification
+ uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
+ with:
+ name: ${{ inputs.artifact-name }}-manifest
+ path: ${{ runner.temp }}/pages-site/reports/manifest.json
+ if-no-files-found: error
+ retention-days: 1
+
+ deploy:
+ name: Publish HTML report history
+ needs: prepare
+ runs-on: ubuntu-latest
+ timeout-minutes: 10
+ concurrency:
+ group: pages-report-deploy
+ cancel-in-progress: false
+ permissions:
+ actions: read
+ contents: read
+ pages: write
+ id-token: write
+ environment:
+ name: github-pages
+ url: ${{ steps.deployment.outputs.page_url }}
+ steps:
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
+ with:
+ persist-credentials: false
+
- name: Deploy report history to GitHub Pages
id: deployment
uses: actions/deploy-pages@368f82528645a54fb793d4d04e342629a3f51346 # v5.0.1
+ - name: Download the manifest for deployment verification
+ uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
+ with:
+ name: ${{ inputs.artifact-name }}-manifest
+ path: ${{ runner.temp }}/pages-site/reports
+
- name: Verify every published report endpoint
env:
- PAGES_BASE_URL: ${{ steps.pages.outputs.base_url }}
+ PAGES_BASE_URL: ${{ needs.prepare.outputs.pages-base-url }}
run: |
node scripts/verify-pages-report.mjs \
--manifest "$RUNNER_TEMP/pages-site/reports/manifest.json" \
--pages-url "$PAGES_BASE_URL" \
--run-id "$GITHUB_RUN_ID"
-
- - name: Add report links to the run summary
- if: always() && steps.deployment.outcome == 'success'
- env:
- PAGES_BASE_URL: ${{ steps.pages.outputs.base_url }}
- PRODUCER_RESULT: ${{ inputs.run-result }}
- SUMMARY_TITLE: ${{ inputs.summary-title }}
- run: |
- node scripts/render-ci-report-summary.mjs \
- --manifest "$RUNNER_TEMP/pages-site/reports/manifest.json" \
- --pages-url "$PAGES_BASE_URL" \
- --producer-result "$PRODUCER_RESULT" \
- --run-id "$GITHUB_RUN_ID" \
- --summary-title "$SUMMARY_TITLE" \
- --output "$GITHUB_STEP_SUMMARY"
diff --git a/.github/workflows/midscene-omarchy-4.0.3.yml b/.github/workflows/midscene-omarchy-4.0.3.yml
index 6cf295c..fed21d3 100644
--- a/.github/workflows/midscene-omarchy-4.0.3.yml
+++ b/.github/workflows/midscene-omarchy-4.0.3.yml
@@ -10,6 +10,7 @@ on:
- "scripts/build-pages-report.mjs"
- "scripts/report-cases.mjs"
- "scripts/render-ci-report-summary.mjs"
+ - "scripts/write-ci-shard-status.mjs"
- "scripts/verify-pages-report.mjs"
- "scripts/verify-omarchy-evidence.mjs"
- "scripts/omarchy-shell-evidence.mjs"
@@ -133,11 +134,13 @@ jobs:
exit 1
- name: Run real Omarchy Midscene project
+ id: midscene-test
env:
PROJECT: ${{ matrix.project }}
run: tests/e2e/run-omarchy-midscene.sh "$PROJECT"
- name: Capture report evidence
+ id: capture-report
if: always() && steps.test-dependencies.outcome == 'success'
env:
PROJECT: ${{ matrix.project }}
@@ -146,6 +149,19 @@ jobs:
--report-dir tests/e2e/midscene_run \
--projects "$PROJECT"
+ - name: Record shard result for report aggregation
+ if: always()
+ env:
+ PROJECT: ${{ matrix.project }}
+ TEST_OUTCOME: ${{ steps.midscene-test.outcome }}
+ CAPTURE_OUTCOME: ${{ steps.capture-report.outcome }}
+ run: |
+ node scripts/write-ci-shard-status.mjs \
+ --output "tests/e2e/midscene_run/ci-shard-status-$PROJECT.json" \
+ --project "$PROJECT" \
+ --test-outcome "${TEST_OUTCOME:-skipped}" \
+ --capture-outcome "${CAPTURE_OUTCOME:-skipped}"
+
- name: Upload installer evidence
if: always()
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
@@ -161,7 +177,7 @@ jobs:
with:
name: omarchy-midscene-${{ matrix.project }}
path: tests/e2e/midscene_run/
- if-no-files-found: warn
+ if-no-files-found: error
retention-days: 7
- name: Verify Omarchy shell visual evidence
@@ -176,6 +192,11 @@ jobs:
outputs:
report-artifact-id: ${{ steps.report.outputs.artifact-id }}
steps:
+ - name: Create bundle even when every shard failed early
+ run: |
+ mkdir -p "$RUNNER_TEMP/midscene-report-shards"
+ printf '%s\n' '{"bundle":"omarchy-4.0.3"}' > "$RUNNER_TEMP/midscene-report-shards/ci-bundle-status.json"
+
# Keep shard directories separate. Native report filenames can share a
# timestamp, while the Pages builder locates reports by project identity.
- name: Download every shard report
@@ -183,6 +204,7 @@ jobs:
with:
pattern: omarchy-midscene-*
path: ${{ runner.temp }}/midscene-report-shards
+ merge-multiple: false
- name: Upload combined report bundle
id: report
diff --git a/.github/workflows/midscene-ubuntu-22.04.yml b/.github/workflows/midscene-ubuntu-22.04.yml
index 3964d83..64532bd 100644
--- a/.github/workflows/midscene-ubuntu-22.04.yml
+++ b/.github/workflows/midscene-ubuntu-22.04.yml
@@ -10,6 +10,7 @@ on:
- "scripts/build-pages-report.mjs"
- "scripts/report-cases.mjs"
- "scripts/render-ci-report-summary.mjs"
+ - "scripts/write-ci-shard-status.mjs"
- "scripts/verify-pages-report.mjs"
- "tests/contracts/test_pages_report_history.mjs"
- "tests/e2e/package.json"
@@ -133,6 +134,7 @@ jobs:
exit 1
- name: Run Midscene project
+ id: midscene-test
working-directory: tests/e2e
env:
PROJECT: ${{ matrix.project }}
@@ -142,6 +144,7 @@ jobs:
npm test -- --project "$PROJECT"
- name: Capture report evidence
+ id: capture-report
if: always() && steps.test-dependencies.outcome == 'success'
env:
PROJECT: ${{ matrix.project }}
@@ -150,13 +153,26 @@ jobs:
--report-dir tests/e2e/midscene_run \
--projects "$PROJECT"
+ - name: Record shard result for report aggregation
+ if: always()
+ env:
+ PROJECT: ${{ matrix.project }}
+ TEST_OUTCOME: ${{ steps.midscene-test.outcome }}
+ CAPTURE_OUTCOME: ${{ steps.capture-report.outcome }}
+ run: |
+ node scripts/write-ci-shard-status.mjs \
+ --output "tests/e2e/midscene_run/ci-shard-status-$PROJECT.json" \
+ --project "$PROJECT" \
+ --test-outcome "${TEST_OUTCOME:-skipped}" \
+ --capture-outcome "${CAPTURE_OUTCOME:-skipped}"
+
- name: Upload Midscene shard report
if: always()
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: midscene-ubuntu-22.04-${{ matrix.project }}
path: tests/e2e/midscene_run/
- if-no-files-found: warn
+ if-no-files-found: error
retention-days: 7
report-bundle:
@@ -167,6 +183,11 @@ jobs:
outputs:
report-artifact-id: ${{ steps.report.outputs.artifact-id }}
steps:
+ - name: Create bundle even when every shard failed early
+ run: |
+ mkdir -p "$RUNNER_TEMP/midscene-report-shards"
+ printf '%s\n' '{"bundle":"ubuntu-22.04"}' > "$RUNNER_TEMP/midscene-report-shards/ci-bundle-status.json"
+
# Keep shard directories separate. Native report filenames can share a
# timestamp, while the Pages builder locates reports by project identity.
- name: Download every shard report
@@ -174,6 +195,7 @@ jobs:
with:
pattern: midscene-ubuntu-22.04-*
path: ${{ runner.temp }}/midscene-report-shards
+ merge-multiple: false
- name: Upload combined report bundle
id: report
diff --git a/scripts/build-pages-report.mjs b/scripts/build-pages-report.mjs
index 390459a..cb5ee2b 100644
--- a/scripts/build-pages-report.mjs
+++ b/scripts/build-pages-report.mjs
@@ -238,6 +238,7 @@ function buildReportEntry({
function buildReportGroup({ label, reports, role }) {
const reportEntries = reports.map((item) =>
+ item.fallbackEntry ??
buildReportEntry({
...item,
includeCaseReportPath: true,
@@ -275,6 +276,78 @@ function buildReportGroup({ label, reports, role }) {
};
}
+function fallbackDescription(project, status) {
+ const result = status?.result;
+ const stage = status?.stage;
+ if (result && stage) {
+ return `${project} stopped during ${stage} (${result}) before Midscene produced a native report.`;
+ }
+ return `${project} did not produce a native Midscene report. Open the Actions run for the failing setup or test step.`;
+}
+
+function buildFallbackEntry({ label, project, reportPrefix, role, status }) {
+ const slug = projectSlug(project);
+ const reportPath = `${reportPrefix}/shard-failure-${slug}.html`;
+ const previewPath = `${reportPrefix}/shard-failure-${slug}.svg`;
+ const description = fallbackDescription(project, status);
+ return {
+ role,
+ project,
+ label,
+ status: 'failed',
+ previewStep: 'last-error',
+ reportPath,
+ previewPath,
+ scenarios: { passed: 0, total: 1 },
+ assertions: { passed: 0, total: 0 },
+ cases: [
+ {
+ caseId: `infrastructure-${slug}`,
+ name: `${project} CI shard`,
+ status: 'failed',
+ selection: 'workflow-failure',
+ description,
+ descriptionKind: 'error',
+ previewPath,
+ reportPath,
+ },
+ ],
+ };
+}
+
+function fallbackSvg(project, description) {
+ return `<svg xmlns="http://www.w3.org/2000/svg" width="1200" height="675" viewBox="0 0 1200 675">
+ <rect width="1200" height="675" fill="#160d12"/>
+ <rect x="70" y="70" width="1060" height="535" rx="28" fill="#26151d" stroke="#ef4444" stroke-width="4"/>
+ <text x="120" y="175" fill="#fca5a5" font-family="system-ui,sans-serif" font-size="34" font-weight="700">CI shard failed before report capture</text>
+ <text x="120" y="255" fill="#ffffff" font-family="system-ui,sans-serif" font-size="30">${escapeHtml(project)}</text>
+ <foreignObject x="120" y="305" width="960" height="210"><div xmlns="http://www.w3.org/1999/xhtml" style="color:#d1d5db;font:26px/1.5 system-ui,sans-serif">${escapeHtml(description)}</div></foreignObject>
+</svg>\n`;
+}
+
+function fallbackHtml(project, description, workflowUrl) {
+ return `<!doctype html><html><head><meta charset="utf-8"><meta name="viewport" content="width=device-width"><title>${escapeHtml(project)} · CI failure</title></head><body style="font-family:system-ui,sans-serif;max-width:850px;margin:4rem auto;padding:0 1rem"><h1>CI shard failed before report capture</h1><h2>${escapeHtml(project)}</h2><p>${escapeHtml(description)}</p><p><a href="${escapeHtml(workflowUrl)}">Open the GitHub Actions run</a></p></body></html>\n`;
+}
+
+async function shardStatuses(directory) {
+ const statuses = new Map();
+ async function visit(current) {
+ for (const entry of await readdir(current, { withFileTypes: true })) {
+ const item = path.join(current, entry.name);
+ if (entry.isDirectory()) await visit(item);
+ else if (entry.isFile() && /^ci-shard-status-.+\.json$/.test(entry.name)) {
+ const status = JSON.parse(await readFile(item, 'utf8'));
+ if (typeof status.project !== 'string') {
+ throw new Error(`${item} does not identify a project`);
+ }
+ statuses.set(status.project, status);
+ }
+ }
+ }
+ await visit(directory);
+ return statuses;
+}
+
function validReportEntry(entry, files) {
const legacyReport =
typeof entry.project === 'string' &&
@@ -313,8 +386,9 @@ function validReportEntry(entry, files) {
typeof testCase.caseId === 'string' &&
typeof testCase.name === 'string' &&
['success', 'failed'].includes(testCase.status) &&
- typeof testCase.stepId === 'string' &&
- ['last-screenshot', 'first-failing-screenshot'].includes(
+ (typeof testCase.stepId === 'string' ||
+ testCase.selection === 'workflow-failure') &&
+ ['last-screenshot', 'first-failing-screenshot', 'workflow-failure'].includes(
testCase.selection,
) &&
(testCase.description === undefined ||
@@ -426,6 +500,7 @@ function formatDuration(durationMs) {
function runStepHref(entry, testCase) {
const reportPath = testCase.reportPath ?? entry.reportPath;
+ if (!testCase.stepId) return path.basename(reportPath);
return `${path.basename(reportPath)}#${new URLSearchParams({
'runner-step': testCase.stepId,
})}`;
@@ -644,6 +719,8 @@ export async function buildPagesReport(options) {
report.run.projects[0].name === projectName,
);
const reportPrefix = `reports/${runId}`;
+ const statuses = await shardStatuses(reportDirectory);
+ const generatedFallbacks = [];
let selectedReports;
let entries;
let baseFiles;
@@ -653,8 +730,20 @@ export async function buildPagesReport(options) {
...group,
reports: group.projects.map((project) => {
const report = reportForProject(project);
- if (!report) {
- throw new Error(`No Midscene Test report found for project ${project}`);
+ const status = statuses.get(project);
+ if (
+ !report ||
+ (status?.captureOutcome && status.captureOutcome !== 'success')
+ ) {
+ const fallbackEntry = buildFallbackEntry({
+ label: group.label,
+ project,
+ reportPrefix,
+ role: group.role,
+ status,
+ });
+ generatedFallbacks.push({ project, entry: fallbackEntry });
+ return { project, fallbackEntry };
}
const slug = projectSlug(project);
return {
@@ -666,11 +755,11 @@ export async function buildPagesReport(options) {
}),
}));
selectedReports = groupedReports.flatMap((group) =>
- group.reports.map((item) => item.report),
+ group.reports.map((item) => item.report).filter(Boolean),
);
entries = groupedReports.map((group) => buildReportGroup(group));
reportCopies = groupedReports.flatMap((group) =>
- group.reports.flatMap((item) => [
+ group.reports.filter((item) => item.report).flatMap((item) => [
{
source: item.report.file,
destination: path.basename(item.reportPath),
@@ -762,8 +851,17 @@ export async function buildPagesReport(options) {
];
}
const selectedFiles = new Set(selectedReports.map((report) => report.file));
+ const declaredProjects = new Set(
+ reportGroups ? reportGroups.flatMap((group) => group.projects) : [],
+ );
const unexpectedProjects = htmlReports
- .filter((report) => !selectedFiles.has(report.file))
+ .filter(
+ (report) =>
+ !selectedFiles.has(report.file) &&
+ !report.run?.projects?.every((project) =>
+ declaredProjects.has(project.name),
+ ),
+ )
.flatMap((report) =>
report.run?.projects?.map((project) => project.name) ?? [path.basename(report.file)],
);
@@ -785,7 +883,7 @@ export async function buildPagesReport(options) {
const casePreviewFiles = entries.flatMap((entry) =>
entry.cases.map((testCase) => testCase.previewPath),
);
- const files = [...baseFiles, ...casePreviewFiles];
+ const files = [...new Set([...baseFiles, ...casePreviewFiles])];
const current = {
runId,
generatedAt,
@@ -818,8 +916,20 @@ export async function buildPagesReport(options) {
(await findUniqueFile(reportDirectory, reportCopy.sourceName));
await copyFile(source, path.join(currentDirectory, reportCopy.destination));
}
+ for (const fallback of generatedFallbacks) {
+ const [testCase] = fallback.entry.cases;
+ await writeFile(
+ path.join(currentDirectory, path.basename(fallback.entry.previewPath)),
+ fallbackSvg(fallback.project, testCase.description),
+ );
+ await writeFile(
+ path.join(currentDirectory, path.basename(fallback.entry.reportPath)),
+ fallbackHtml(fallback.project, testCase.description, workflowUrl),
+ );
+ }
for (const entry of entries) {
for (const testCase of entry.cases) {
+ if (testCase.selection === 'workflow-failure') continue;
await copyFile(
await findUniqueFile(
reportDirectory,
diff --git a/scripts/render-ci-report-summary.mjs b/scripts/render-ci-report-summary.mjs
index f76ba5b..8f2f2d2 100644
--- a/scripts/render-ci-report-summary.mjs
+++ b/scripts/render-ci-report-summary.mjs
@@ -34,6 +34,7 @@ function reportUrl(baseUrl, reportPath) {
function stepUrl(baseUrl, reportPath, stepId) {
const url = new URL(reportPath, normalizedBaseUrl(baseUrl));
+ if (!stepId) return url.href;
url.hash = new URLSearchParams({ 'runner-step': stepId }).toString();
return url.href;
}
@@ -115,7 +116,9 @@ export function renderReportSummary({
const evidence =
testCase.status === 'success'
? 'Last screenshot'
- : 'First failing screenshot';
+ : testCase.selection === 'workflow-failure'
+ ? 'CI failure before node capture'
+ : 'First failing screenshot';
const descriptionLabel = {
ai: '**AI:** ',
error: '**Error:** ',
@@ -139,7 +142,7 @@ ${links}
${caseTables}
-Each image is the original page screenshot used by that node. Click a case name or image to open the exact Midscene Test node and Agent replay.
+Each image is the original page screenshot used by that node. A CI failure card is shown only when a shard stops before Midscene can capture a node. Click a case name or image to open its evidence.
`;
}
diff --git a/scripts/verify-pages-report.mjs b/scripts/verify-pages-report.mjs
index 695b0ed..036ebb7 100644
--- a/scripts/verify-pages-report.mjs
+++ b/scripts/verify-pages-report.mjs
@@ -27,6 +27,7 @@ function expectedContentType(file) {
if (file.endsWith('.png')) return 'image/png';
if (file.endsWith('.jpg')) return 'image/jpeg';
if (file.endsWith('.webp')) return 'image/webp';
+ if (file.endsWith('.svg')) return 'image/svg+xml';
throw new Error(`No expected Content-Type is defined for ${file}`);
}
diff --git a/scripts/write-ci-shard-status.mjs b/scripts/write-ci-shard-status.mjs
new file mode 100644
index 0000000..96c427a
--- /dev/null
+++ b/scripts/write-ci-shard-status.mjs
@@ -0,0 +1,50 @@
+#!/usr/bin/env node
+
+import { mkdir, writeFile } from 'node:fs/promises';
+import path from 'node:path';
+
+const values = Object.fromEntries(
+ process.argv.slice(2).reduce((pairs, value, index, args) => {
+ if (index % 2 === 0) pairs.push([value.replace(/^--/, ''), args[index + 1]]);
+ return pairs;
+ }, []),
+);
+for (const key of ['output', 'project', 'test-outcome', 'capture-outcome']) {
+ if (!values[key]) throw new Error(`Missing --${key}`);
+}
+
+const testOutcome = values['test-outcome'];
+const captureOutcome = values['capture-outcome'];
+const stage =
+ testOutcome === 'failure' || testOutcome === 'cancelled'
+ ? 'Midscene test execution'
+ : testOutcome === 'skipped'
+ ? 'workflow setup before test execution'
+ : captureOutcome === 'failure' || captureOutcome === 'cancelled'
+ ? 'report evidence capture'
+ : 'completed workflow';
+const result =
+ [testOutcome, captureOutcome].includes('failure')
+ ? 'failure'
+ : [testOutcome, captureOutcome].includes('cancelled')
+ ? 'cancelled'
+ : testOutcome === 'success' && captureOutcome === 'success'
+ ? 'success'
+ : 'skipped';
+
+const output = path.resolve(values.output);
+await mkdir(path.dirname(output), { recursive: true });
+await writeFile(
+ output,
+ `${JSON.stringify(
+ {
+ project: values.project,
+ result,
+ stage,
+ testOutcome,
+ captureOutcome,
+ },
+ null,
+ 2,
+ )}\n`,
+);
diff --git a/tests/contracts/test_pages_report_history.mjs b/tests/contracts/test_pages_report_history.mjs
index 86841ee..35adbce 100644
--- a/tests/contracts/test_pages_report_history.mjs
+++ b/tests/contracts/test_pages_report_history.mjs
@@ -37,6 +37,36 @@ test('publishes the Markdown evidence table for same-repository pull requests',
}
});
+test('records every shard and renders the Summary before Pages deployment', async () => {
+ for (const workflow of [
+ 'midscene-ubuntu-22.04.yml',
+ 'midscene-omarchy-4.0.3.yml',
+ ]) {
+ const source = await readFile(
+ new URL(`../../.github/workflows/${workflow}`, import.meta.url),
+ 'utf8',
+ );
+ assert.match(source, /Record shard result for report aggregation/);
+ assert.match(source, /if-no-files-found: error/);
+ assert.match(source, /Create bundle even when every shard failed early/);
+ }
+
+ const deploy = await readFile(
+ new URL('../../.github/workflows/deploy-midscene-report.yml', import.meta.url),
+ 'utf8',
+ );
+ const summary = deploy.indexOf('Add complete evidence table');
+ const deployment = deploy.indexOf('Deploy report history to GitHub Pages');
+ const deployJob = deploy.indexOf('\n deploy:');
+ assert.ok(summary > 0 && summary < deployment);
+ assert.match(
+ deploy.slice(summary, deployment),
+ /steps\.build-report\.outcome == 'success'/,
+ );
+ assert.ok(deployJob > summary);
+ assert.doesNotMatch(deploy.slice(0, deployJob), /environment:/);
+});
+
test('assigns every product case to exactly one balanced shard', async () => {
const shardCounts = new Map();
let caseCount = 0;
@@ -368,6 +398,110 @@ test('combines independently executed shards into one report table', async (cont
);
});
+test('keeps a complete Markdown table when a shard produces no native report', async (context) => {
+ const root = await mkdtemp(path.join(os.tmpdir(), 'pages-partial-shards-'));
+ const reportDirectory = path.join(root, 'reports');
+ const shardDirectory = path.join(reportDirectory, 'ubuntu-shard-1');
+ await mkdir(path.join(shardDirectory, 'report'), { recursive: true });
+ await writeFile(
+ path.join(shardDirectory, 'report', 'test-run-ubuntu-shard-1.html'),
+ runnerScript({
+ project: 'ubuntu-shard-1',
+ startedAt: '2026-09-15T12:00:00Z',
+ }),
+ );
+ await writeFile(
+ path.join(shardDirectory, 'report-preview-ubuntu-shard-1.png'),
+ 'preview',
+ );
+ await writeFile(
+ path.join(
+ shardDirectory,
+ 'case-preview-ubuntu-shard-1-case-ubuntu-shard-1.jpg',
+ ),
+ 'case preview',
+ );
+ await writeFile(
+ path.join(shardDirectory, 'ci-shard-status-ubuntu-shard-2.json'),
+ JSON.stringify({
+ project: 'ubuntu-shard-2',
+ result: 'failure',
+ stage: 'workflow setup before test execution',
+ }),
+ );
+ const siteDirectory = path.join(root, 'site');
+ const server = await startServer((_request, response) =>
+ response.writeHead(404).end(),
+ );
+ context.after(server.close);
+
+ const manifest = await buildPagesReport({
+ ...options(reportDirectory, siteDirectory, server.url),
+ 'report-groups': JSON.stringify([
+ {
+ role: 'primary',
+ label: 'Doubao Say',
+ projects: ['ubuntu-shard-1', 'ubuntu-shard-2'],
+ },
+ ]),
+ });
+ const [entry] = manifest.reports[0].entries;
+ assert.equal(entry.cases.length, 2);
+ assert.equal(entry.cases[1].selection, 'workflow-failure');
+ assert.match(entry.cases[1].description, /workflow setup/);
+ await readFile(
+ path.join(
+ siteDirectory,
+ 'reports',
+ '200',
+ 'shard-failure-ubuntu-shard-2.svg',
+ ),
+ );
+
+ const summary = renderReportSummary({
+ manifest,
+ pagesUrl: 'https://example.test/doubao-say/',
+ producerResult: 'failure',
+ runId: '200',
+ summaryTitle: 'Ubuntu',
+ });
+ assert.match(summary, /ubuntu-shard-1 visual case/);
+ assert.match(summary, /ubuntu-shard-2 CI shard/);
+ assert.match(summary, /CI failure before node capture/);
+ assert.match(summary, /workflow setup before test execution/);
+ assert.doesNotMatch(summary, /runner-step=.*infrastructure-ubuntu-shard-2/);
+});
+
+test('uses a failure row when node evidence extraction fails', async (context) => {
+ const root = await mkdtemp(path.join(os.tmpdir(), 'pages-capture-failed-'));
+ const reportDirectory = await fixtureDirectory(root);
+ await writeFile(
+ path.join(reportDirectory, 'ci-shard-status-ubuntu.json'),
+ JSON.stringify({
+ project: 'ubuntu',
+ result: 'failure',
+ stage: 'report evidence capture',
+ testOutcome: 'success',
+ captureOutcome: 'failure',
+ }),
+ );
+ const siteDirectory = path.join(root, 'site');
+ const server = await startServer((_request, response) =>
+ response.writeHead(404).end(),
+ );
+ context.after(server.close);
+
+ const manifest = await buildPagesReport({
+ ...options(reportDirectory, siteDirectory, server.url),
+ 'report-groups': JSON.stringify([
+ { role: 'primary', label: 'Doubao Say', projects: ['ubuntu'] },
+ ]),
+ });
+ const [testCase] = manifest.reports[0].entries[0].cases;
+ assert.equal(testCase.selection, 'workflow-failure');
+ assert.match(testCase.description, /report evidence capture/);
+});
+
test('publishes the Doubao Say report as the primary CI entrance', async (context) => {
const root = await mkdtemp(path.join(os.tmpdir(), 'pages-omarchy-'));
const reportDirectory = await fixtureDirectory(root);