Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 55 additions & 0 deletions .github/workflows/site-preview.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Unpublished site preview

on:
pull_request:
paths:
- "site/**"
- "packages/game-engine/src/scoring.ts"
- "packages/ui/src/assets/**"
- ".github/workflows/site-preview.yml"
- "bun.lock"
push:
branches: [main]
paths:
- "site/**"
- "packages/game-engine/src/scoring.ts"
- "packages/ui/src/assets/**"
- ".github/workflows/site-preview.yml"
- "bun.lock"
workflow_dispatch:

permissions:
contents: read

concurrency:
group: site-preview-${{ github.ref }}
cancel-in-progress: true

jobs:
preview:
name: Validate unpublished pages
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
ref: ${{ github.event.pull_request.head.sha || github.sha }}
persist-credentials: false
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version: "24.21.0"
- uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6
with:
bun-version: "1.4.2"
- run: bun install --frozen-lockfile --ignore-scripts
- run: node --test site/*.test.mjs
- run: node node_modules/playwright/cli.js install --with-deps chromium
- run: node site/browser.mjs reports/site-preview-ci
- name: Retain unpublished preview and rendered evidence
if: always()
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: unpublished-site-${{ github.event.pull_request.head.sha || github.sha }}
path: reports/site-preview-ci
if-no-files-found: error
retention-days: 1
30 changes: 30 additions & 0 deletions .impeccable/surfaces/site-pages-mjs.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
---
version: 1
slug: "site-pages-mjs"
primary_target: "site/pages.mjs"
related_targets: ["site/style.css"]
---

# iOS companion-site preview

Mode: Persuade on the landing page; Read on support and privacy pages. Prepare repository files only. No hosting, public identity, contact publication or legal approval is authorized. The mission delegates reversible design decisions, so this unattended preview does not ask the owner to approve a production identity.

## Direction contract

THESIS: A release-note-first companion makes availability explicit before explaining the game. It refuses fabricated app previews and a fake download button.

OWN-WORLD: Inherit mineral white, evergreen, clay actions and bundled Manrope from DESIGN.md. Use flat sections and actual pip geometry, not a new brand system.

STORY: Understand that this is an unreleased iPhone/iPad dice game, learn its house rules and local-data behavior, then find support or the draft privacy notice.

FIRST VIEWPORT: A broad evergreen title region sits beside a compact release-status column. The primary action opens the rules. A distinct development notice belongs to navigation, never an eyebrow. On phones, the development notice stays before the introduction and rules link; the detailed status panel follows them. This keeps release status first without putting a long facts list ahead of the useful prerelease action.

FORM: Release-note-first, candidate4, seed ec2c46aa. Other grounded candidates were rulebook cover, playmat introduction, chapter opener, scorecard index and pocket guide. The roll dealt4/3/5. The delegated choice keeps4. Code-led, extending the existing world. Native details disclosures provide the signature interaction; no entrance animation hides content.

FINISH: unreviewed and undocumented is unfinished; this build ends with the finish review, the verdict, DESIGN.md, and every shipping raster carrying its provenance

No shipping raster is proposed until owner-approved, privacy-safe native captures exist. Current test captures remain engineering evidence, not website content. Website publication, final name, support contact, privacy copy and verified store URL remain owner gates.

## Finish record

Separate fresh read-only finish and documentation reviewers used the Impeccable rubrics because the named agents were not registered. The finish disposition was `ship` for the unpublished preview only, with no material fixes. All twelve desktop, phone light/dark and 320px/200% text captures were inspected. The documentation review confirmed inheritance and intentional reading typography. No independent QUALITY BAR comparison or publication acceptance was established. The existing DESIGN.md and token record remain unchanged; site-only choices and asset provenance are recorded in site/README.md. The successful pre-commit receipt is reports/site-table-fixed/receipt.json; final PR evidence must identify the committed head.
58 changes: 58 additions & 0 deletions site/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# Unpublished companion-site preview

Repository preparation for [issue #49](https://github.com/HemSoft/yahtzee/issues/49). This is not a deployed website or an approved privacy notice. There is no deployment workflow, public hosting configuration, App Store link or approved contact address.

## Build and inspect

Use Node 24 and the repository's frozen Bun 1.4.2 dependencies. The generated pages themselves need no JavaScript or backend.

```sh
bun install --frozen-lockfile --ignore-scripts
node --test site/*.test.mjs
node site/build.mjs reports/site-preview-local
node site/serve.mjs reports/site-preview-local
```

The server prints a random loopback URL and binds only to `127.0.0.1`. It serves an explicit file allowlist and supports a repository subpath. Stop it with Ctrl+C. The builder refuses existing output rather than deleting it; choose a new directory for another build.

For headless browser qualification:

```sh
node node_modules/playwright/cli.js install chromium
node site/browser.mjs reports/site-review-local
```

This builds its own preview, tests three pages at desktop, phone light/dark and 320px with 200% root text, and retains screenshots, a desktop recording and source-state receipt. Checks cover page overflow, navigation target size, skip-link focus, disclosures, keyboard table scrolling, links, console errors, cookies/storage and unexpected network requests. Solid-background text contrast checks are a spot check, not a WCAG certification or screen-reader acceptance.

Build receipts inventory the exact generated bytes and SHA-256 values. Browser receipts distinguish a clean committed source from a dirty worktree. CI uploads preview/evidence artifacts for review only; it does not deploy them.

## Visual inheritance

This preview extends the desktop/web world recorded in [DESIGN.md](../DESIGN.md) and its [token record](../.impeccable/design.json). It does not replace those files or define native-mobile styling. It retains bundled Manrope, mineral/evergreen themes, clay actions and pip geometry.

Site-only reading choices include a 16px/1.6 body, 70ch paragraph limit, 1328px frame, spacious articles and stacking below 700px. Native HTML disclosures and a keyboard-scrollable mode table support reading without gameplay animation or die shadows. See the [site contract](../.impeccable/surfaces/site-pages-mjs.md).

Fresh read-only finish and documentation reviews found no material issues within the unpublished-preview scope. The named Impeccable agents were unavailable, so separate fresh reviewers used the same rubrics. All twelve desktop/phone/theme/large-text captures were inspected. No independent quality-reference comparison, screen-reader acceptance or publication approval is claimed. Current-head evidence still belongs in the pull request's Validation section.

## Content provenance

- [Shared scoring rules](../packages/game-engine/src/scoring.ts) define the mode counts, bonuses and combinations. Content tests compare the visible mode table with the engine.
- Native save, reset, diagnostics and backup descriptions refer to [PR #57](https://github.com/HemSoft/yahtzee/pull/57), reviewed against source `22d76f2f90dd04d507506bd448ab64a37a1c0375`. That implementation was not merged when this preview was prepared. These statements concern the native development edition, not a released app or the online/Windows adapters. Recheck them against the accepted native source before publication.
- Native simulator evidence is engineering material. No synthetic test screenshots ship on these pages. Genuine privacy-safe captures still need owner approval.
- The font and its unmodified license come from [the shared asset directory](../packages/ui/src/assets/README.md). The small pip SVG is original vector geometry. There are no shipping raster images or remote fonts.
- The site's three external destinations are the public repository, issue list and release tracker. Reporting requires a GitHub account. Private vulnerability reporting was disabled when inspected on September 27, 2026; no private contact is advertised.

No analytics, forms, third-party embeds, scripts, cookie code or browser-storage code ship in the preview. This describes the generated pages, not a future host's logging or an external site's behavior. `noindex`, `robots.txt` and the builder's publication refusal are intent guards, not access controls.

## Before any public deployment

Repository maintainers may prepare and review code. The owner must explicitly authorize publication and resolve the following items first:

1. Approve the public name, rights, responsible publisher, release scope and final copy through [#39](https://github.com/HemSoft/yahtzee/issues/39).
2. Approve a public support destination and a private/security-sensitive reporting route through [#44](https://github.com/HemSoft/yahtzee/issues/44). Do not copy an address from another project or use public issues for private reports.
3. Approve the privacy notice after the app/SDK/traffic review in [#48](https://github.com/HemSoft/yahtzee/issues/48). Record the host's access logs, retention, processing and policy owner. No legal acceptance is inferred from tests.
4. Select hosting and stable HTTPS marketing/support/privacy URLs, and record the deployment owner, credentials owner, rollback procedure and maintenance responsibility. Configure hosting only after approval. This repository currently has no site deploy command.
5. Approve genuine native captures through [#51](https://github.com/HemSoft/yahtzee/issues/51). Add a verified store destination only after it exists. Keep the action honest while prerelease.
6. Recheck the accepted app's behavior, unauthenticated links, mobile layouts, keyboard and assistive-technology behavior. Remove draft notices and indexing restrictions only as part of the approved publication change.

A future deployment change must replace the unpublished-only builder contract deliberately, with review and fresh qualification. Do not upload this draft merely because the files are static. [Issue #49](https://github.com/HemSoft/yahtzee/issues/49) remains open for that acceptance work.
96 changes: 96 additions & 0 deletions site/browser.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
import assert from "node:assert/strict";
import { execFileSync } from "node:child_process";
import { existsSync, mkdirSync, writeFileSync } from "node:fs";
import { join, resolve } from "node:path";
import { chromium } from "playwright";
import { buildSite, repositoryRoot } from "./build.mjs";
import { pages } from "./pages.mjs";
import { serveSite } from "./serve.mjs";
import { visibleContrastFailures } from "./contrast.mjs";

const output = resolve(process.argv[2] ?? join(repositoryRoot, "reports/site-review"));
assert(!existsSync(output), "Existing browser evidence was not overwritten.");
mkdirSync(output, { recursive: true });
const site = join(output, "site"); buildSite(site);
const running = await serveSite(site, "/yahtzee/");
const browser = await chromium.launch({ headless: true });
const failures = [];
const profiles = [
{ name: "desktop-light", width: 1440, height: 1000, colorScheme: "light", textScale: 1 },
{ name: "phone-light", width: 390, height: 844, colorScheme: "light", textScale: 1 },
{ name: "phone-dark", width: 390, height: 844, colorScheme: "dark", textScale: 1 },
{ name: "narrow-large-text", width: 320, height: 700, colorScheme: "light", textScale: 2 },
];
async function holdVideo(page, profile) {
// Presentation pacing only. Readiness and effects are checked separately.
if (profile.name === "desktop-light") await page.waitForTimeout(1000);
}
try {
for (const profile of profiles) {
const context = await browser.newContext({ viewport: { width: profile.width, height: profile.height }, colorScheme: profile.colorScheme, reducedMotion: "reduce", recordVideo: profile.name === "desktop-light" ? { dir: join(output, "video"), size: { width: 1440, height: 1000 } } : undefined });
await context.route("**/*", (route) => {
if (route.request().url().startsWith(running.url)) return route.continue();
failures.push(`Unexpected request: ${route.request().url()}`); return route.abort();
});
const page = await context.newPage();
page.on("pageerror", (error) => failures.push(String(error)));
page.on("console", (message) => { if (message.type() === "error") failures.push(message.text()); });
for (const file of Object.keys(pages)) {
if (file === "index.html") await page.goto(running.url + file);
else {
await page.getByRole("navigation", { name: "Main navigation" }).locator(`a[href="${file}"]`).click();
await page.waitForURL(running.url + file);
}
await page.evaluate(() => document.fonts.ready);
await page.evaluate((scale) => { document.documentElement.style.fontSize = `${16 * scale}px`; }, profile.textScale);
try {
assert.equal(await page.locator("h1").count(), 1);
assert.equal(await page.locator("script,iframe,form").count(), 0);
assert.equal(await page.evaluate(() => localStorage.length + sessionStorage.length), 0);
assert.deepEqual(await context.cookies(), []);
const geometry = await page.evaluate(() => ({ viewport: innerWidth, body: document.documentElement.scrollWidth, outside: [...document.querySelectorAll("nav a,.button,summary")].filter((element) => {
const bounds = element.getBoundingClientRect(); return bounds.left < -1 || bounds.right > innerWidth + 1 || bounds.height < 44;
}).map((element) => element.textContent) }));
assert(geometry.body <= geometry.viewport + 1, `${file}: horizontal overflow ${JSON.stringify(geometry)}`);
assert.deepEqual(geometry.outside, [], `${file}: clipped or undersized navigation`);
assert.deepEqual(await page.evaluate(visibleContrastFailures), [], `${file}: insufficient text contrast`);
for (const href of await page.locator("a[href]").evaluateAll((links) => links.map((link) => link.getAttribute("href")))) {
if (href.startsWith("https:")) continue;
const url = new URL(href, page.url());
assert.equal((await context.request.get(url.href.split("#")[0])).status(), 200, href);
if (url.hash && url.pathname === new URL(page.url()).pathname) assert.equal(await page.locator(url.hash).count(), 1, href);
}
await holdVideo(page, profile);
await page.keyboard.press("Tab");
assert.equal(await page.locator(":focus").textContent(), "Skip to content");
await holdVideo(page, profile);
await page.keyboard.press("Enter");
assert.equal(await page.locator(":focus").getAttribute("id"), "main");
await holdVideo(page, profile);
if (file === "index.html" && profile.textScale === 2) {
const table = page.getByRole("region", { name: "Game mode comparison, horizontally scrollable" });
await table.focus();
for (let step = 0; step < 16; step++) await page.keyboard.press("ArrowRight");
await page.waitForFunction(() => document.querySelector(".table-scroll")?.scrollLeft > 0, undefined, { timeout: 2000 });
assert(await table.evaluate((element) => element.scrollLeft > 0), "Mode table must support keyboard scrolling");
await table.evaluate((element) => { element.scrollLeft = 0; });
}
if (file === "support.html") {
const summary = page.getByText("A save was not confirmed", { exact: true });
await summary.click();
assert.equal(await summary.locator("..").getAttribute("open"), "");
await holdVideo(page, profile);
await summary.click();
}
} catch (error) { failures.push(`${profile.name}/${file}: ${error.message}`); }
await page.evaluate(() => { document.activeElement?.blur(); window.scrollTo(0, 0); });
await page.screenshot({ path: join(output, `${profile.name}-${file.replace(".html", "")}.png`), fullPage: true });
}
await context.close();
}
} finally { await browser.close(); await running.close(); }
const git = (...args) => execFileSync("git", args, { cwd: repositoryRoot, encoding: "utf8" }).trim();
const receipt = { sourceCommit: git("rev-parse", "HEAD"), sourceDirty: git("status", "--porcelain").length > 0, browser: "Chromium", profiles, failures, publicationAuthorized: false };
writeFileSync(join(output, "receipt.json"), JSON.stringify(receipt, null, 2) + "\n");
assert.deepEqual(failures, [], "Website browser checks failed; inspect receipt.json and captures.");
console.log(`Website browser checks passed across ${profiles.length} profiles and ${Object.keys(pages).length} pages.`);
36 changes: 36 additions & 0 deletions site/build.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import assert from "node:assert/strict";
import { createHash } from "node:crypto";
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
import { join, resolve } from "node:path";
import { pathToFileURL } from "node:url";
import { pages } from "./pages.mjs";

export const siteRoot = import.meta.dirname;
export const repositoryRoot = resolve(siteRoot, "..");
export const contentSecurityPolicy = "default-src 'none'; style-src 'self'; font-src 'self'; img-src 'self'; base-uri 'none'; form-action 'none'; frame-ancestors 'none'";
export function buildSite(output, { publish = false } = {}) {
assert(!publish, "Publication is not authorized or configured. This builder produces an unpublished preview only; see site/README.md.");
assert(!existsSync(output), "Existing site output was not overwritten. Choose a new output directory.");
const files = new Map(Object.entries(pages).map(([name, html]) => [name, Buffer.from(html)]));
files.set("style.css", readFileSync(join(siteRoot, "style.css")));
files.set("assets/manrope-variable.ttf", readFileSync(join(repositoryRoot, "packages/ui/src/assets/manrope-variable.ttf")));
files.set("assets/OFL.txt", readFileSync(join(repositoryRoot, "packages/ui/src/assets/OFL.txt")));
files.set("robots.txt", Buffer.from("User-agent: *\nDisallow: /\n"));
const artifacts = [];
for (const [name, bytes] of files) {
const destination = join(output, name);
mkdirSync(resolve(destination, ".."), { recursive: true });
writeFileSync(destination, bytes);
artifacts.push({ path: name, bytes: bytes.length, sha256: createHash("sha256").update(bytes).digest("hex") });
}
const receipt = { schemaVersion: 1, kind: "unpublished-site-preview", publicationAuthorized: false, artifacts };
writeFileSync(join(output, "preview-manifest.json"), JSON.stringify(receipt, null, 2) + "\n");
return receipt;
}
if (process.argv[1] && import.meta.url === pathToFileURL(resolve(process.argv[1])).href) {
const args = process.argv.slice(2);
assert(args.length <= 1 && !args[0]?.startsWith("-"), "Usage: node site/build.mjs [new-output-directory]. No publication mode is available.");
const output = resolve(args[0] ?? join(repositoryRoot, "reports/site-preview"));
buildSite(output);
console.log(`Unpublished preview: ${output}`);
}
Loading
Loading