Avoid hassfest manifest collision
Validate / hacs (push) Failing after 8s
Validate / hassfest (push) Failing after 8s
Validate / frontend (push) Successful in 3m52s
Validate / backend (push) Failing after 8m33s
Validate / golden (push) Failing after 6m9s
Validate / smoke (push) Failing after 22m51s

This commit is contained in:
Matysh
2026-08-08 22:03:09 +03:00
parent 9590011ddb
commit b1deb0beab
5 changed files with 16 additions and 4 deletions
+2 -1
View File
@@ -5,6 +5,7 @@ import { dirname, resolve } from 'node:path';
import { fileURLToPath } from 'node:url';
import { sourceFingerprint } from '../../scripts/source-fingerprint.mjs';
import { GOLDEN_MATRIX_VERSION, GOLDEN_SCENARIOS } from './matrix.mjs';
import { GOLDEN_BASELINE_MANIFEST } from './policy.mjs';
const ROOT = resolve(dirname(fileURLToPath(import.meta.url)), '../..');
const reviewed = process.argv.includes('--reviewed');
@@ -45,7 +46,7 @@ for (const scenario of GOLDEN_SCENARIOS) {
// updated baseline directory behind.
for (const { scenario, candidate } of candidates)
copyFileSync(candidate, resolve(baselineRoot, `${scenario.id}.png`));
writeFileSync(resolve(baselineRoot, 'manifest.json'), `${JSON.stringify({
writeFileSync(resolve(baselineRoot, GOLDEN_BASELINE_MANIFEST), `${JSON.stringify({
schema: 1,
matrixVersion: GOLDEN_MATRIX_VERSION,
acceptedAt: new Date().toISOString(),
+2
View File
@@ -1,3 +1,5 @@
export const GOLDEN_BASELINE_MANIFEST = 'baseline-manifest.json';
export const assertGoldenInvocation = (mode, scenarioFilter = '') => {
if (!['capture', 'verify'].includes(mode)) throw new Error(`unknown golden mode: ${mode}`);
if (mode === 'verify' && scenarioFilter)
+2 -2
View File
@@ -7,7 +7,7 @@ import { launch } from '../serve.mjs';
import { assertFreshDemoBundle } from '../bundle-freshness.mjs';
import { goldenClip, prepareGoldenScenario } from './harness.mjs';
import { GOLDEN_MATRIX_VERSION, GOLDEN_SCENARIOS } from './matrix.mjs';
import { assertGoldenInvocation, goldenRunFailed } from './policy.mjs';
import { assertGoldenInvocation, GOLDEN_BASELINE_MANIFEST, goldenRunFailed } from './policy.mjs';
const ROOT = resolve(dirname(fileURLToPath(import.meta.url)), '../..');
const mode = process.argv.find((arg) => arg.startsWith('--mode='))?.slice(7) || 'capture';
@@ -106,7 +106,7 @@ async function comparePng(page, actual, baseline, threshold) {
}
let baselineManifest = null;
const baselineManifestPath = resolve(baselineRoot, 'manifest.json');
const baselineManifestPath = resolve(baselineRoot, GOLDEN_BASELINE_MANIFEST);
if (existsSync(baselineManifestPath)) {
try { baselineManifest = JSON.parse(readFileSync(baselineManifestPath, 'utf8')); }
catch { baselineManifest = { invalid: true }; }
+10 -1
View File
@@ -1,6 +1,15 @@
import assert from 'node:assert/strict';
import test from 'node:test';
import { assertGoldenInvocation, goldenRunFailed } from '../demo/golden/policy.mjs';
import {
assertGoldenInvocation,
GOLDEN_BASELINE_MANIFEST,
goldenRunFailed,
} from '../demo/golden/policy.mjs';
test('golden metadata cannot be mistaken for a Home Assistant integration manifest', () => {
assert.equal(GOLDEN_BASELINE_MANIFEST, 'baseline-manifest.json');
assert.notEqual(GOLDEN_BASELINE_MANIFEST, 'manifest.json');
});
test('golden capture fails on runtime errors but permits missing baselines', () => {
assert.equal(goldenRunFailed('capture', false, [{ status: 'error' }]), true);