Skip to content

: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.

chore(ci): only post the eager graph comment for significant changes (#63143)

Paul D'Ambrad448dfcec6a4
diff --git a/frontend/bin/post-eager-graph-comment.mjs b/frontend/bin/post-eager-graph-comment.mjs
index 507006569688..992f9a67f26d 100644
--- a/frontend/bin/post-eager-graph-comment.mjs
+++ b/frontend/bin/post-eager-graph-comment.mjs
@@ -138,6 +138,30 @@ try {
}
const anyFailure = report.roots.some((r) => r.overBudget || r.forbiddenHits.length > 0) || report.errors?.length > 0
+
+// A comment on every PR teaches people to ignore it — stay silent unless something
+// actually moved (or there is a failure to explain). An existing comment from an
+// earlier significant push is still updated so it never shows stale numbers.
+// A missing baseline is itself significant: with no base report the absolute numbers
+// are the signal, and a root absent from (or zero in) the base report is brand new —
+// the biggest change there is.
+const SIGNIFICANT_CHANGE_PERCENT = 2
+const significantChange =
+ !baseReport ||
+ report.roots.some((r) => {
+ const base = baseBytes[r.root]
+ if (base === undefined || base === 0) {
+ return true
+ }
+ return (Math.abs(r.bytes - base) / base) * 100 >= SIGNIFICANT_CHANGE_PERCENT
+ })
+if (!anyFailure && !significantChange && !existing) {
+ console.info(
+ `No eager graph root changed by >= ${SIGNIFICANT_CHANGE_PERCENT}% vs base and no budget/forbidden failures — not posting a comment.`
+ )
+ process.exit(0)
+}
+
const lines = [
MARKER,
`## ${anyFailure ? '❌' : '🕸️'} Eager graph`,