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
1 change: 1 addition & 0 deletions apps/desktop/cli/html-overlay-renderer.macos.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,7 @@ test.skipIf(RENDERER_SMOKE_UNAVAILABLE)(
const Renderer = reverse ? ReverseFrameOrderHtmlOverlayRenderer : PlaywrightHtmlOverlayRenderer;
const renderer = new Renderer({
cacheRoot: join(root, "cache"),
browserStepTimeoutMs: 10_000,
// Qualify presentation with the production browser and frame deadlines.
fetch: () => { throw new Error("The presentation fixture has no library downloads"); },
});
Expand Down
54 changes: 26 additions & 28 deletions apps/web/bun.lock

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion apps/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"type": "module",
"packageManager": "bun@1.3.14",
"dependencies": {
"@hraness/design-kit": "github:hraness/design-kit#v0.13.0",
"@hraness/design-kit": "github:hraness/design-kit#v0.22.0",
"@hraness/design-kit-articles": "github:hraness/design-kit#v0.21.0",
"@hraness/design-kit-status": "github:hraness/design-kit#v0.21.0",
"@hraness/site-footer": "github:hraness/site-footer#v0.19.2",
Expand Down Expand Up @@ -51,6 +51,7 @@
"verify:refinement": "bun run ./scripts/verify-site-refinement.ts",
"verify:refinement-copy": "bun run ./scripts/verify-site-refinement-copy.ts",
"verify:examples": "bun run ./scripts/verify-site-examples.ts",
"sync:icons": "bun run ./scripts/sync-icons.ts",
"verify:release-copy": "bun run ./scripts/verify-site-release-copy.ts"
}
}
2 changes: 1 addition & 1 deletion apps/web/scripts/build-site.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import { renderStatusPage } from "../src/status-page-content"
import type { BlogPageContent, SiteAssets } from "../src/site-content"

const packages = [
{ name: "@hraness/design-kit", version: "0.13.0" },
{ name: "@hraness/design-kit", version: "0.22.0" },
{ name: "@hraness/site-footer", version: "0.19.2" },
{ name: "@hraness/ui", version: "0.5.16" },
] as const
Expand Down
2 changes: 1 addition & 1 deletion apps/web/scripts/site-contract.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ function completeFixture() {
const finalCss = artifact(`assets/site-${digest}.css`, ".fixture{display:grid}")
// Deliberately make canonical identity order differ from package name order.
const packages = [
{ manifestSha256: "8".repeat(64), name: "@hraness/design-kit", version: "0.13.0" },
{ manifestSha256: "8".repeat(64), name: "@hraness/design-kit", version: "0.22.0" },
{ manifestSha256: "e".repeat(64), name: "@hraness/site-footer", version: "0.19.2" },
{ manifestSha256: "a".repeat(64), name: "@hraness/ui", version: "0.5.16" },
]
Expand Down
2 changes: 1 addition & 1 deletion apps/web/scripts/site-contract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export const siteSha256 = (value: string | Uint8Array): string => createHash("sh
const foundationRoot = "graphs/site-foundation/"
const maxArtifactBytes = 16 * 1024 * 1024
const releases = [
{ name: "@hraness/design-kit", version: "0.13.0" },
{ name: "@hraness/design-kit", version: "0.22.0" },
{ name: "@hraness/site-footer", version: "0.19.2" },
{ name: "@hraness/ui", version: "0.5.16" },
] as const
Expand Down
52 changes: 52 additions & 0 deletions apps/web/scripts/sync-icons.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import { describe, expect, test } from "bun:test";
import { existsSync, readdirSync, readFileSync } from "node:fs";
import { join, resolve } from "node:path";

const SET = "slopcamera";
const ICONS_OUT = "src/icons";
const MARKS_OUT = "src/marks";

const specUrl = import.meta.resolve(`@hraness/design-kit/icons/sets/${SET}.json`);
const setsDir = decodeURIComponent(new URL(".", specUrl).pathname);
const iconsDir = resolve(setsDir, "..");

interface SetSpec {
members: { slug: string }[];
marks?: { slug: string }[];
references?: { slug: string; svg: string }[];
}

const spec = JSON.parse(readFileSync(`${setsDir}${SET}.json`, "utf8")) as SetSpec;
const expected = new Map<string, string>(); // local path -> package path
for (const member of spec.members) {
expected.set(`${ICONS_OUT}/${member.slug}.svg`, `${SET}/${member.slug}.svg`);
}
for (const mark of spec.marks ?? []) {
for (const dir of [MARKS_OUT, ICONS_OUT]) {
const local = join(dir, `${mark.slug}.svg`);
if (existsSync(local)) expected.set(local, `${SET}/${mark.slug}.svg`);
}
}
for (const reference of spec.references ?? []) {
if (existsSync(`${ICONS_OUT}/${reference.slug}.svg`)) {
expected.set(`${ICONS_OUT}/${reference.slug}.svg`, reference.svg.replace(/^\.\.\//u, ""));
}
}

describe("synced topic icons", () => {
test("public icons and marks carry exactly the vetted design-kit set, byte-for-byte", () => {
expect(expected.size).toBeGreaterThan(0);
for (const [local, packagePath] of expected) {
expect(existsSync(local), `${local} missing — run bun run sync:icons`).toBe(true);
expect(
readFileSync(local).equals(readFileSync(join(iconsDir, packagePath))),
`${local} differs from the pinned package icon`,
).toBe(true);
}
for (const file of readdirSync(ICONS_OUT)) {
if (file.endsWith(".svg")) {
expect(expected.has(`${ICONS_OUT}/${file}`), `${ICONS_OUT}/${file} is not declared by the ${SET} icon set`).toBe(true);
}
}
});
});
65 changes: 65 additions & 0 deletions apps/web/scripts/sync-icons.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
/**
* Sync the vetted aicharts icon set from the pinned @hraness/design-kit
* release into public/icons/ and the product mark into public/marks/ and
* wherever a same-named mark file already exists.
*
* Usage: bun run sync:icons
*/

import { existsSync, mkdirSync, readFileSync, readdirSync, writeFileSync } from "node:fs";
import { join, resolve } from "node:path";

const SET = "slopcamera";
const ICONS_OUT = "src/icons";
const MARKS_OUT = "src/marks";

const specUrl = import.meta.resolve(`@hraness/design-kit/icons/sets/${SET}.json`);
const setsDir = decodeURIComponent(new URL(".", specUrl).pathname);
const iconsDir = resolve(setsDir, "..");

interface SetSpec {
members: { slug: string }[];
marks?: { slug: string }[];
references?: { slug: string; svg: string }[];
}

const spec = JSON.parse(readFileSync(`${setsDir}${SET}.json`, "utf8")) as SetSpec;
const files = new Map<string, string>(); // "<out>/<name>" -> package path
for (const member of spec.members) {
files.set(`${ICONS_OUT}/${member.slug}.svg`, `${SET}/${member.slug}.svg`);
}
for (const mark of spec.marks ?? []) {
const name = `${mark.slug}.svg`;
const dests = [`${MARKS_OUT}/${name}`, `${ICONS_OUT}/${name}`].filter(existsSync);
for (const dest of dests.length > 0 ? dests : [`${MARKS_OUT}/${name}`]) {
files.set(dest, `${SET}/${mark.slug}.svg`);
}
}
for (const reference of spec.references ?? []) {
// References are generation-time family anchors; sync only the ones the
// product actually serves today.
if (existsSync(`${ICONS_OUT}/${reference.slug}.svg`)) {
files.set(`${ICONS_OUT}/${reference.slug}.svg`, reference.svg.replace(/^\.\.\//u, ""));
}
}

const written: string[] = [];
for (const [dest, packagePath] of [...files].sort()) {
mkdirSync(join(dest, ".."), { recursive: true });
writeFileSync(dest, readFileSync(join(iconsDir, packagePath)));
written.push(dest);
}
for (const file of readdirSync(ICONS_OUT)) {
if (file.endsWith(".svg") && !files.has(`${ICONS_OUT}/${file}`)) {
throw new Error(`${ICONS_OUT}/${file} is not declared by the ${SET} icon set — remove it or regenerate the set.`);
}
}
for (const mark of spec.marks ?? []) {
for (const dir of [MARKS_OUT, ICONS_OUT]) {
const stale = join(dir, `${mark.slug}.svg`);
if (existsSync(stale) && !files.has(stale)) {
throw new Error(`${stale} exists but the ${SET} mark is declared elsewhere — reconcile the locations.`);
}
}
}
console.log(`synced ${written.length} icons from @hraness/design-kit (${SET})`);
36 changes: 18 additions & 18 deletions apps/web/site.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ function assertCombinedSiteCssBudget(styles: string, foundation: string): number
// Count both captured artifacts in full, including all three package recipes,
// the required 0.8 foundation, canonical snapshots, and retained product CSS.
const bytes = Buffer.byteLength(styles, "utf8") + Buffer.byteLength(foundation, "utf8")
if (bytes >= 356_000) throw new Error(`Combined site CSS exceeds its 356,000-byte budget: ${bytes}`)
if (bytes >= 450_000) throw new Error(`Combined site CSS exceeds its 450,000-byte budget: ${bytes}`)
return bytes
}

Expand Down Expand Up @@ -283,15 +283,15 @@ test("the 404 status page snapshot is byte-exact design-kit v0.21.0 and its rout
})

test("combined site CSS budget counts both complete UTF-8 artifacts and rejects its exact ceiling", () => {
expect(assertCombinedSiteCssBudget("x".repeat(184_799), "x".repeat(171_200))).toBe(355_999)
expect(() => assertCombinedSiteCssBudget("x".repeat(184_800), "x".repeat(171_200)))
.toThrow("Combined site CSS exceeds its 356,000-byte budget: 356000")
expect(() => assertCombinedSiteCssBudget("x".repeat(184_799), `${"x".repeat(171_200)}é`))
.toThrow("Combined site CSS exceeds its 356,000-byte budget: 356001")
expect(() => assertCombinedSiteCssBudget("x".repeat(356_000), ""))
.toThrow("Combined site CSS exceeds its 356,000-byte budget: 356000")
expect(() => assertCombinedSiteCssBudget("", "x".repeat(356_000)))
.toThrow("Combined site CSS exceeds its 356,000-byte budget: 356000")
expect(assertCombinedSiteCssBudget("x".repeat(278_799), "x".repeat(171_200))).toBe(449_999)
expect(() => assertCombinedSiteCssBudget("x".repeat(278_800), "x".repeat(171_200)))
.toThrow("Combined site CSS exceeds its 450,000-byte budget: 450000")
expect(() => assertCombinedSiteCssBudget("x".repeat(278_799), `${"x".repeat(171_200)}é`))
.toThrow("Combined site CSS exceeds its 450,000-byte budget: 450001")
expect(() => assertCombinedSiteCssBudget("x".repeat(450_000), ""))
.toThrow("Combined site CSS exceeds its 450,000-byte budget: 450000")
expect(() => assertCombinedSiteCssBudget("", "x".repeat(450_000)))
.toThrow("Combined site CSS exceeds its 450,000-byte budget: 450000")
})

function assertThemeBundleBudget(script: string): number {
Expand Down Expand Up @@ -1361,7 +1361,7 @@ describe("static Slopcamera site", () => {
const localLockfile = await readFile(join(appDirectory, "bun.lock"), "utf8")

expect(manifest.dependencies).toEqual({
"@hraness/design-kit": "github:hraness/design-kit#v0.13.0",
"@hraness/design-kit": "github:hraness/design-kit#v0.22.0",
"@hraness/design-kit-articles": "github:hraness/design-kit#v0.21.0",
"@hraness/design-kit-status": "github:hraness/design-kit#v0.21.0",
"@hraness/site-footer": "github:hraness/site-footer#v0.19.2",
Expand Down Expand Up @@ -1390,7 +1390,7 @@ describe("static Slopcamera site", () => {
})
expect(rootManifest.workspaces?.catalog?.["posthog-js"]).toBeUndefined()
expect(rootManifest.workspaces?.catalog?.["@hraness/design-kit"]).toBeUndefined()
expect(localLockfile).toContain('"@hraness/design-kit": "github:hraness/design-kit#v0.13.0"')
expect(localLockfile).toContain('"@hraness/design-kit": "github:hraness/design-kit#v0.22.0"')
expect(localLockfile).toContain(
'"@hraness/site-footer": "github:hraness/site-footer#v0.19.2"',
)
Expand Down Expand Up @@ -1694,12 +1694,12 @@ describe("static Slopcamera site", () => {
// keyboard focus above the fixed footer bar measured 310,206 together, and
// the shared-footer v0.13.x organization-attribution styles measure
// 313,229. The design-kit v0.13.0 union with the shared foil wordmark
// contract measures 346,025. The design-kit v0.21.0 status-page snapshot
// for the shared 404, less the removed 404 shell recipes, measures 354,712.
// Keep a strict ceiling over the full sealed union and captured
// foundation; no import, recipe, snapshot, or repeated layered rule is
// discounted.
expect(assertCombinedSiteCssBudget(stylesAsset, foundationAsset)).toBeLessThan(356_000)
// contract measured 346,025, and the design-kit v0.21.0 status-page
// snapshot for the shared 404 measured 354,712. The design-kit v0.22.0
// union with the icon library and status snapshot measures 434,750. Keep
// a strict ceiling over the full sealed union and captured foundation;
// no import, recipe, snapshot, or repeated layered rule is discounted.
expect(assertCombinedSiteCssBudget(stylesAsset, foundationAsset)).toBeLessThan(450_000)
expect(assertThemeBundleBudget(themeAsset)).toBeLessThan(29_500)
expect(themeAsset).not.toMatch(/react|next-themes|react-aria/i)
expect(themeAsset).not.toMatch(/fetch\(|XMLHttpRequest|WebSocket|EventSource|sendBeacon/)
Expand Down
5 changes: 4 additions & 1 deletion apps/web/src/icons/agent-skill.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 5 additions & 1 deletion apps/web/src/icons/cli.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 3 additions & 1 deletion apps/web/src/icons/diagram.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading