mirror of
https://github.com/Matysh/houseplan-card
synced 2026-10-01 20:29:00 +00:00
Golden frames carried the card version text (about, version banner, support/export previews), so every beta bump re-accepted up to 20 baselines that had not visually changed. The version now reaches the DOM and stand requests through displayVersion() (src/card-version.ts); the golden harness pins window.__HP_VERSION_OVERRIDE__ = '0.0.0-golden' before the card is created. CARD_VERSION literals stay where the release contract reads them; cache-busting and the console banner keep the literal. Docs screenshots: `npm run docs:accept -- --identical` re-captures locally, compares decoded RGBA pixels with the committed frames inside Chromium (scripts/png-identical.mjs) and, only when every frame is identical, refreshes the manifest fingerprints and captureScriptSha256; bytes stay, any difference refuses with a per-frame count. First run on this tree: 11/11 identical, manifest refreshed. Mutants: version-seam-ignores-override, docs-identical-accepts-any-frame. Issue: #512 User-Visible: no
19 lines
969 B
TypeScript
19 lines
969 B
TypeScript
/**
|
|
* The version the card SHOWS, as opposed to the version it IS (#512).
|
|
*
|
|
* `CARD_VERSION` stays a literal in `houseplan-card.ts` and
|
|
* `houseplan-editor-runtime.ts` — the release contract reads those literals.
|
|
* Everything that puts the version into the DOM or into a request the stand
|
|
* echoes back (about dialog, version-recovery banner, support preview, backup
|
|
* export, PDF footer) goes through this seam, so a visual harness can pin the
|
|
* displayed version and stop every beta bump from invalidating golden frames
|
|
* whose only change was the digits.
|
|
*
|
|
* `globalThis.__HP_VERSION_OVERRIDE__` is a test seam: harnesses only. The
|
|
* product never sets it, and anything but a non-empty string is ignored.
|
|
*/
|
|
export function displayVersion(fallback: string): string {
|
|
const override = (globalThis as { __HP_VERSION_OVERRIDE__?: unknown }).__HP_VERSION_OVERRIDE__;
|
|
return typeof override === 'string' && override.length > 0 ? override : fallback;
|
|
}
|