From 5c08a135f71df3ba7d29ad72726f6f1f12876d88 Mon Sep 17 00:00:00 2001 From: nuno maduro Date: Fri, 1 May 2026 21:30:44 +0100 Subject: [PATCH] wip --- src/Concerns/Testable.php | 2 +- src/Plugins/Tia.php | 2 +- src/Plugins/Tia/Fingerprint.php | 53 --------------------------------- 3 files changed, 2 insertions(+), 55 deletions(-) diff --git a/src/Concerns/Testable.php b/src/Concerns/Testable.php index 6401f8c2..0af01a65 100644 --- a/src/Concerns/Testable.php +++ b/src/Concerns/Testable.php @@ -410,7 +410,7 @@ trait Testable // accurate on replay instead of collapsing to 1-per-test. /** @var Tia $tia */ $tia = Container::getInstance()->get(Tia::class); - $assertions = $tia->getCachedAssertions($this::class.'::'.$this->name()); + $assertions = $tia->getAssertionCount($this::class.'::'.$this->name()); if ($assertions === 0) { $this->expectNotToPerformAssertions(); diff --git a/src/Plugins/Tia.php b/src/Plugins/Tia.php index b83ab402..5e0fccc9 100644 --- a/src/Plugins/Tia.php +++ b/src/Plugins/Tia.php @@ -234,7 +234,7 @@ final class Tia implements AddsOutput, HandlesArguments, Terminable return $result; } - public function getCachedAssertions(string $testId): int + public function getAssertionCount(string $testId): int { return $this->cachedAssertionsByTestId[$testId] ?? 0; } diff --git a/src/Plugins/Tia/Fingerprint.php b/src/Plugins/Tia/Fingerprint.php index 3c685b98..36e5d6ae 100644 --- a/src/Plugins/Tia/Fingerprint.php +++ b/src/Plugins/Tia/Fingerprint.php @@ -9,59 +9,6 @@ namespace Pest\Plugins\Tia; */ final readonly class Fingerprint { - // Bump this whenever the set of inputs or the hash algorithm changes, - // so older graphs are invalidated automatically. - // - // v5: ChangedFiles now hashes via `ContentHash` (normalises PHP - // tokens + Blade whitespace/comments) instead of raw bytes. - // Old graphs' run-tree hashes are incompatible and must be - // rebuilt. - // v6: Graph gained per-test table edges (`$testTables`) powering - // surgical migration invalidation. Worker partial shape - // changed to `{files, tables}`. Old graphs have no table - // coverage, which would leave every DB test invalidated by - // any migration change — force a rebuild so the new edges - // are populated. - // v7: Graph gained per-test Inertia page-component edges - // (`$testInertiaComponents`) for surgical page-file - // invalidation. Worker partial now includes an `inertia` - // section. Old graphs have no component edges; without a - // rebuild Vue/React page edits would fall through to the - // broad watch pattern even when precise matching could have - // worked. - // v8: Graph gained `$jsFileToComponents` — reverse dependency - // map computed at record time from Vite's module graph (or - // the PHP fallback) so shared components / layouts / - // composables invalidate the specific pages they're used - // by, not every browser test. - // v9: `ContentHash` now normalises JS/TS/Vue/Svelte comments + - // whitespace. Old graphs' run-tree hashes for those files - // were raw-byte; mixing formats would flag every JS file as - // changed on first run. - // v10: `vite.config.*` hashed into the structural bucket. A - // Vite config change reshapes the module dependency graph - // that `JsModuleGraph` records; without a graph rebuild - // the stored `$jsFileToComponents` map silently goes stale. - // v11: `composer.json` added (autoload-dev / extra discovery - // changes). `tests/TestCase.php` and `tests/Pest.php` are - // intentionally NOT fingerprinted — they're handled by the - // watch pattern + `Recorder::linkAncestorFiles` reflection - // walk, which gives precise per-test invalidation rather - // than a wholesale rebuild that trashes the entire graph. - // v12: PHP/JS structural inputs (pest_factory*, vite.config.*) - // now hash via `ContentHash::of()` so cosmetic comment + - // whitespace edits don't fire rebuilds. composer.json and - // composer.lock hash a behavioural subset — description, - // keywords, scripts, authors, install timestamps, dist - // URLs etc. no longer drift the structural fingerprint. - // v13: Environment files (`.env`, `.env.testing`, local variants) - // are included in the environmental bucket. They are commonly - // git-ignored, so watch patterns alone cannot reliably notice - // edits; a drift drops cached results and re-executes the suite. - // v14: Node/Vite resolver inputs (`package*.json`, `tsconfig.*`, - // `jsconfig.*`) are included in the structural bucket. They can - // reshape the persisted JS module graph without touching - // `vite.config.*` itself. private const int SCHEMA_VERSION = 14; /**