Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

fix: don't fail a release on import growth summed across the whole cycle

[._.]/ Adam Eivy2a6fa259dba7
diff --git a/scripts/lib/importGrowth.js b/scripts/lib/importGrowth.js
index c7b24f70ac..fd81db2d2f 100644
--- a/scripts/lib/importGrowth.js
+++ b/scripts/lib/importGrowth.js
@@ -245,6 +245,7 @@ export function compareImportGrowth(base, head, { limit = EXISTING_SUITE_GROWTH_
}
export function formatImportGrowthReport(report) {
+ if (report.skipped) return `Import growth not measured: ${report.skipped}.`;
const lines = [
PROXY_NOTE,
`Base ${report.baseTestCount} suites, proxy total ${report.baseTotal}.`,
@@ -354,6 +355,19 @@ function defaultBaseRef(repoRoot) {
return 'origin/main';
}
+/**
+ * Why this run should not measure growth, or null when it should.
+ * The limit is sized for ONE change. A pull request into `release`, and the
+ * push that lands it, compare against the previous release, so they sum every
+ * pull request of the cycle — each of which already passed this guard against
+ * main. Measuring that aggregate fails a release on growth no change owns.
+ */
+export function importGrowthSkipReason(env = process.env) {
+ if (env.GITHUB_BASE_REF === 'release') return 'pull request into release aggregates a whole release cycle';
+ if (env.GITHUB_EVENT_NAME === 'push' && env.GITHUB_REF_NAME === 'release') return 'push to release aggregates a whole release cycle';
+ return null;
+}
+
/**
* The commit head is compared against.
* `CI_BASE_SHA` wins when it is set (CI pull requests and pregate, which
@@ -554,6 +568,8 @@ export function evaluateWorkingTreeImportGrowth({
limit = EXISTING_SUITE_GROWTH_LIMIT,
now = () => performance.now(),
} = {}) {
+ const skipped = importGrowthSkipReason(env);
+ if (skipped) return { ok: true, skipped };
const baseRef = resolveImportGrowthBase({ repoRoot, env });
const headStart = now();
const head = measureWorkingTree(repoRoot);
diff --git a/scripts/lib/importGrowth.test.js b/scripts/lib/importGrowth.test.js
index 9d671c63d4..180ae5af68 100644
--- a/scripts/lib/importGrowth.test.js
+++ b/scripts/lib/importGrowth.test.js
@@ -28,6 +28,7 @@ import {
measureClosures,
measureGitTree,
measureWorkingTree,
+ importGrowthSkipReason,
resolveImportGrowthBase,
resolveRepoSpecifier,
} from './importGrowth.js';
@@ -227,6 +228,24 @@ describe('missing base history', () => {
});
});
+describe('release aggregates', () => {
+ // A release PR's base is the previous release, so the delta is a whole cycle
+ // of individually-gated changes (v2.79.0 summed to 2882 against 2500).
+ it('skips a pull request into release and the push that lands it', () => {
+ expect(importGrowthSkipReason({ GITHUB_BASE_REF: 'release' })).toMatch(/release cycle/);
+ expect(importGrowthSkipReason({ GITHUB_EVENT_NAME: 'push', GITHUB_REF_NAME: 'release' })).toMatch(/release cycle/);
+ expect(evaluateWorkingTreeImportGrowth({ repoRoot: REPO_ROOT, env: { GITHUB_BASE_REF: 'release' } }))
+ .toEqual({ ok: true, skipped: expect.stringMatching(/release cycle/) });
+ expect(formatImportGrowthReport({ ok: true, skipped: 'x' })).toMatch(/not measured/);
+ });
+
+ it('still measures pull requests into main and pushes to other branches', () => {
+ expect(importGrowthSkipReason({ GITHUB_BASE_REF: 'main' })).toBeNull();
+ expect(importGrowthSkipReason({ GITHUB_EVENT_NAME: 'push', GITHUB_REF_NAME: 'main' })).toBeNull();
+ expect(importGrowthSkipReason({})).toBeNull();
+ });
+});
+
describe('git base versus worktree head', () => {
const roots = [];
afterEach(() => {