:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
chore(frontend): warn on oversized service icons at commit time (#67056)
posthog[bot]1f88c1235ed4
diff --git a/frontend/bin/check-service-icon-size.mjs b/frontend/bin/check-service-icon-size.mjsnew file mode 100644index 000000000000..2568d4448897--- /dev/null+++ b/frontend/bin/check-service-icon-size.mjs@@ -0,0 +1,44 @@+#!/usr/bin/env node+import fs from 'node:fs'+import path from 'node:path'++// Warns when a service integration icon (frontend/public/services/*) is committed+// oversized. These icons are mapped per IntegrationKind in lib/integrations/utils.ts,+// which is statically reachable from AuthenticatedShell — so each one counts against+// the eager graph budget that every authenticated page pays for (#32479). A+// well-optimized 256x256 PNG logo is comfortably under this budget; anything far above+// it is almost always an unoptimized export. This is a non-blocking nudge at commit+// time; frontend/bin/check-eager-graph.mjs remains the hard CI backstop on the total.+//+// Invoked via lint-staged with the staged icon paths appended as arguments.++const BUDGET_BYTES = 25 * 1024+const RASTER = new Set(['.png', '.jpg', '.jpeg', '.gif'])++const offenders = []+for (const file of process.argv.slice(2)) {+ if (!RASTER.has(path.extname(file).toLowerCase()) || !fs.existsSync(file)) {+ continue+ }+ const bytes = fs.statSync(file).size+ if (bytes > BUDGET_BYTES) {+ offenders.push({ file, bytes })+ }+}++if (offenders.length) {+ const yellow = (s) => `\x1b[33m${s}\x1b[0m`+ const kib = (b) => `${(b / 1024).toFixed(1)} KiB`+ process.stderr.write(+ yellow(+ `\nWarning: service icon${offenders.length > 1 ? 's' : ''} over ${kib(BUDGET_BYTES)} — these are eagerly ` ++ `reachable from AuthenticatedShell and inflate the eager graph budget:\n` ++ offenders.map((o) => ` ${kib(o.bytes).padStart(10)} ${o.file}`).join('\n') ++ `\nCompress before committing (e.g. an octree 256-colour PNG palette keeps logos visually identical at a ` ++ `fraction of the size). If the asset genuinely needs to be this large, it's fine to proceed.\n\n`+ )+ )+}++// Non-blocking: a nudge, not a gate.+process.exit(0)diff --git a/package.json b/package.jsonindex 9f1fc753d59a..347a45eacda4 100644--- a/package.json+++ b/package.json@@ -88,6 +88,7 @@".claude/hooks/**": "sh -c 'printf \"\\n\\033[33mWarning: hooks in .claude/ are reserved for env bootstrapping (SessionStart only).\\nPrefer skills, AGENTS.md instructions, or lint-staged rules. See Agent automation in AGENTS.md.\\033[0m\\n\\n\"'","**/{AGENTS,CLAUDE}.md": "sh -c '.github/scripts/check-agents-md-symlinks.sh'","packages/quill/packages/*/src/**/*.{ts,tsx,css}": "sh -c 'git diff --cached --name-only | grep -q \"^packages/quill/.*AGENTS\\\\.md$\" || printf \"\\n\\033[33mWarning: quill component sources changed without an AGENTS.md update.\\nIf variants, composition, or spacing changed, update the consumer guide (packages/quill/packages/<pkg>/AGENTS.md) in the same PR.\\033[0m\\n\\n\"'",+ "frontend/public/services/*.{png,jpg,jpeg,gif}": "node frontend/bin/check-service-icon-size.mjs","products/**/manifest.tsx": ["bin/hogli format:js","sh -c 'pnpm build:products && git add frontend/src/products.tsx frontend/src/products.json'"