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
9 changes: 8 additions & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,14 @@ updates:
- "dependencies"
- "automerge"
versioning-strategy: "increase"

ignore:
# PHPStan 2.3.6 removed AnalyserResult::getCollectedData(), which pest-plugin-type-coverage 3.x
# still calls: `pest --type-coverage` fails with "Call to undefined method" (#667), so composer.json
# caps phpstan/phpstan below 2.3.6. The fix is only in the plugin 4.0.6+ (Pest 4) and 5.x; lift this
# ignore, and the cap, when the framework moves to Pest 4 or later.
- dependency-name: "phpstan/phpstan"
versions: [">=2.3.6"]

- package-ecosystem: "github-actions"
directory: "/"
schedule:
Expand Down
9 changes: 8 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,14 @@ All notable changes to the Pollora framework will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased](https://github.com/Pollora/framework/compare/v13.43.4...develop)
## [Unreleased](https://github.com/Pollora/framework/compare/v13.44.0...develop)

## [v13.44.0](https://github.com/Pollora/framework/compare/v13.43.4...v13.44.0) - 2026-11-24

### Changed

- **Built on Laravel 13.44.** The `illuminate/*` packages are required at `^13.44` (they were `^13.43`), and the framework follows Laravel's line again. The test suite and static analysis pass against Laravel 13.44.0.
- **`pollora/object-cache` is required at `^0.3.1`.** 0.3.1 fixes the drop-in when the Composer autoloader it names cannot be read by the web server: it used to stop the whole site with a fatal error when the file existed but could not be opened, and stayed off without a word otherwise. It now stays inert and writes the path to the PHP error log, and `pollora:object-cache:status` has an `Autoloader` line (the path, whether this user can read it, and a flag for a path in the home directory). Run `pollora:object-cache:enable` again to update the drop-in file.

## [v13.43.4](https://github.com/Pollora/framework/compare/v13.43.3...v13.43.4) - 2026-11-24

Expand Down
14 changes: 7 additions & 7 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@
"require": {
"php": "^8.3",
"pollora/helper-overrider": "^1.2",
"illuminate/auth": "^13.43",
"illuminate/support": "^13.43",
"illuminate/database": "^13.43",
"illuminate/routing": "^13.43",
"illuminate/console": "^13.43",
"illuminate/auth": "^13.44",
"illuminate/support": "^13.44",
"illuminate/database": "^13.44",
"illuminate/routing": "^13.44",
"illuminate/console": "^13.44",
"pollora/abilities": "^1.0",
"pollora/ajax": "^1.3",
"pollora/assets": "^0.2",
Expand All @@ -38,7 +38,7 @@
"pollora/entity": "^2.0",
"pollora/media": "^0.8 || ^0.9 || ^0.10",
"pollora/meta": "^0.1",
"pollora/object-cache": "^0.3",
"pollora/object-cache": "^0.3.1",
"pollora/hook": "^2.0.1",
"pollora/i18n": "^0.1.1",
"pollora/option": "^1.1",
Expand All @@ -56,7 +56,7 @@
"coduo/php-humanizer": "5.0.3",
"nwidart/laravel-modules": "^13.3",
"symfony/process": "^7.4 || ^8.0",
"illuminate/config": "^13.43",
"illuminate/config": "^13.44",
"laravel/prompts": "^0.3.27"
},
"autoload": {
Expand Down
50 changes: 50 additions & 0 deletions tests/e2e/fixtures/perf/calibration.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<?php

declare(strict_types=1);

/**
* Time two fixed pieces of work that do not depend on the framework, run through `wp eval`.
*
* The nightly timings (boot, thumbnail) move with the machine the job lands on: the same commit
* measured 40 ms one night and 73 ms the next. These two numbers say how fast the machine was:
* `cpu_ref_ms` is a chain of hashes (processor), `fs_ref_ms` writes and reads a few hundred small
* files (disk and file system). They are recorded with the metrics and printed by the comparison,
* never judged: they exist to learn whether the timings can be told apart from the machine.
*/
$start = hrtime(true);
$digest = '';

for ($i = 0; $i < 250_000; $i++) {
$digest = hash('sha256', $digest.$i);
}

$cpu = (hrtime(true) - $start) / 1_000_000;

$directory = sys_get_temp_dir().'/e2e-perf-calibration-'.bin2hex(random_bytes(4));
mkdir($directory);

$start = hrtime(true);

for ($i = 0; $i < 400; $i++) {
file_put_contents($directory.'/'.$i.'.txt', str_repeat('x', 2048));
}

$read = 0;

for ($i = 0; $i < 400; $i++) {
$read += strlen((string) file_get_contents($directory.'/'.$i.'.txt'));
}

$disk = (hrtime(true) - $start) / 1_000_000;

for ($i = 0; $i < 400; $i++) {
unlink($directory.'/'.$i.'.txt');
}

rmdir($directory);

if ($read !== 400 * 2048) {
throw new RuntimeException('The calibration read back less than it wrote: the measure would be of nothing.');
}

echo json_encode(['cpu_ref_ms' => round($cpu, 1), 'fs_ref_ms' => round($disk, 1)], JSON_THROW_ON_ERROR);
25 changes: 24 additions & 1 deletion tests/e2e/specs/perf-metrics.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,19 @@ import { artisan, homeUrl, runId, wp } from '../support/site';
* boot_ms time from the start of the request to wp_loaded, warm (REST index)
* cold_boot_ms the same, on the first request after `discovery:clear`
* thumbnail_ms wp_generate_attachment_metadata() for one 2400x1600 JPEG, every size
*
* Next to them the report carries `calibration`: how fast this machine ran two fixed pieces of work
* (cpu_ref_ms, fs_ref_ms). The shared runners differ by up to a factor of two from one night to the
* next, which the comparison cannot tell from a regression; these are recorded to find out how the
* timings follow the machine. They are printed, never judged.
*/
const out = process.env.E2E_PERF_OUT ?? './test-results/perf-metrics.json';
const warmRuns = 7;
const coldRuns = 3;
const thumbnailRuns = 3;
const calibrationRuns = 5;
const metrics: Metrics = {};
const calibration: Metrics = {};

test.skip(process.env.E2E_PERF !== '1', 'set E2E_PERF=1 to measure');
test.describe.configure({ mode: 'serial' });
Expand All @@ -43,7 +50,7 @@ test.afterAll(() => {
}

mkdirSync(join(out, '..'), { recursive: true });
writeFileSync(out, `${JSON.stringify({ measuredAt: new Date().toISOString(), run: runId, metrics }, null, 2)}\n`);
writeFileSync(out, `${JSON.stringify({ measuredAt: new Date().toISOString(), run: runId, metrics, calibration }, null, 2)}\n`);
});

/** One REST index request, and the boot time the framework reported for it. */
Expand Down Expand Up @@ -96,3 +103,19 @@ test('thumbnail generation', () => {

metrics.thumbnail_ms = median(samples);
});

test('calibration', () => {
const script = readFileSync(join(import.meta.dirname, '..', 'fixtures', 'perf', 'calibration.php'), 'utf8').replace(/^<\?php\s*/, '');
const cpu: number[] = [];
const disk: number[] = [];

for (let run = 0; run < calibrationRuns; run++) {
const result = JSON.parse(wp('eval', script)) as { cpu_ref_ms: number; fs_ref_ms: number };

cpu.push(result.cpu_ref_ms);
disk.push(result.fs_ref_ms);
}

calibration.cpu_ref_ms = median(cpu);
calibration.fs_ref_ms = median(disk);
});
38 changes: 38 additions & 0 deletions tests/e2e/support/perf.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import assert from 'node:assert/strict';
import { describe, it } from 'node:test';
import {
compareMetrics,
describeCalibration,
describeComparison,
judgeRun,
type Diagnostics,
Expand Down Expand Up @@ -189,3 +190,40 @@ describe('judgeRun', () => {
assert.equal(judgeRun(run({ boot_ms: 109 }), run({ boot_ms: 100 })).failed, false);
});
});

describe('describeCalibration', () => {
it('says nothing when the run has no calibration', () => {
assert.deepEqual(describeCalibration(undefined, { cpu_ref_ms: 50 }), []);
});

it("prints this night's numbers alone when the reference night has none", () => {
assert.deepEqual(describeCalibration({ cpu_ref_ms: 60 }, undefined), ['calibration cpu_ref_ms: 60 ms']);
assert.deepEqual(describeCalibration({ cpu_ref_ms: 60, fs_ref_ms: 9 }, { cpu_ref_ms: 0 }), ['calibration cpu_ref_ms: 60 ms', 'calibration fs_ref_ms: 9 ms']);
});

it('compares each number with the reference night', () => {
assert.deepEqual(describeCalibration({ cpu_ref_ms: 75, fs_ref_ms: 8 }, { cpu_ref_ms: 50, fs_ref_ms: 10 }), [
'calibration cpu_ref_ms: 75 ms (reference night 50 ms, +50.0 %)',
'calibration fs_ref_ms: 8 ms (reference night 10 ms, -20.0 %)',
]);
});
});

describe('judgeRun and the calibration', () => {
const report = (metrics: Record<string, number>, calibration?: Record<string, number>) => ({ measuredAt: '2026-11-18T03:30:00Z', run: '1', metrics, calibration });

it('never fails on a calibration that moved: the machine is not the code', () => {
const verdict = judgeRun(report({ boot_ms: 100 }, { cpu_ref_ms: 200 }), report({ boot_ms: 100 }, { cpu_ref_ms: 50 }));

assert.equal(verdict.failed, false);
assert.ok(verdict.lines.includes('calibration cpu_ref_ms: 200 ms (reference night 50 ms, +300.0 %)'));
});

it('still fails on a regression, calibration or not', () => {
assert.equal(judgeRun(report({ boot_ms: 150 }, { cpu_ref_ms: 50 }), report({ boot_ms: 100 })).failed, true);
});

it('prints the calibration on the first night too', () => {
assert.ok(judgeRun(report({ boot_ms: 100 }, { cpu_ref_ms: 50 }), null).lines.includes('calibration cpu_ref_ms: 50 ms'));
});
});
36 changes: 32 additions & 4 deletions tests/e2e/support/perf.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,14 @@ export function median(values: number[]): number {
/** The nightly measures, in milliseconds. Each is the median of several runs. */
export type Metrics = Record<string, number>;

/** What one nightly run writes: the metrics and what they were measured on. */
export type MetricsReport = { measuredAt: string; run: string; metrics: Metrics };
/**
* What one nightly run writes: the metrics, and how fast the machine was.
*
* `calibration` holds fixed pieces of work that do not depend on the framework (see
* fixtures/perf/calibration.php). It is printed next to the verdict and never judged: the
* reports of the nights before it existed have none.
*/
export type MetricsReport = { measuredAt: string; run: string; metrics: Metrics; calibration?: Metrics };

export type MetricFinding = { metric: string; baseline: number; current: number; change: number };

Expand Down Expand Up @@ -226,6 +232,28 @@ export function describeComparison(comparison: Comparison, tolerance = 0.1): str
return lines;
}

/**
* The calibration as lines for the CI log: this night's, and the reference night's when it has one.
* Information only: the machine is not the code, so it never fails a run.
*/
export function describeCalibration(current: Metrics | undefined, baseline: Metrics | undefined): string[] {
if (current === undefined) {
return [];
}

return Object.entries(current).map(([name, value]) => {
const before = baseline?.[name];

if (before === undefined || before <= 0) {
return `calibration ${name}: ${value} ms`;
}

const change = (value - before) / before;

return `calibration ${name}: ${value} ms (reference night ${before} ms, ${change >= 0 ? '+' : ''}${(change * 100).toFixed(1)} %)`;
});
}

/** The verdict of a nightly run: what to print and whether the job fails. */
export type Verdict = { failed: boolean; lines: string[] };

Expand All @@ -238,11 +266,11 @@ export type Verdict = { failed: boolean; lines: string[] };
*/
export function judgeRun(current: MetricsReport, baseline: MetricsReport | null, tolerance = 0.1): Verdict {
if (baseline === null) {
return { failed: false, lines: ['No baseline yet: this run becomes the reference.', ...Object.entries(current.metrics).map(([metric, value]) => `${metric}: ${value} ms`)] };
return { failed: false, lines: ['No baseline yet: this run becomes the reference.', ...Object.entries(current.metrics).map(([metric, value]) => `${metric}: ${value} ms`), ...describeCalibration(current.calibration, undefined)] };
}

const comparison = compareMetrics(current.metrics, baseline.metrics, tolerance);
const lines = [`Baseline of ${baseline.measuredAt} (run ${baseline.run})`, ...describeComparison(comparison, tolerance)];
const lines = [`Baseline of ${baseline.measuredAt} (run ${baseline.run})`, ...describeComparison(comparison, tolerance), ...describeCalibration(current.calibration, baseline.calibration)];

return { failed: comparison.regressions.length > 0 || comparison.missing.length > 0, lines };
}
Loading