From 75593b6454c6c60fbed68c898488216214de70b3 Mon Sep 17 00:00:00 2001 From: nuno maduro Date: Sun, 3 May 2026 13:37:27 +0100 Subject: [PATCH] wip --- src/Plugins/Tia.php | 36 ++++++++++++++++++++++++++++-------- 1 file changed, 28 insertions(+), 8 deletions(-) diff --git a/src/Plugins/Tia.php b/src/Plugins/Tia.php index 1279d769..803c1142 100644 --- a/src/Plugins/Tia.php +++ b/src/Plugins/Tia.php @@ -139,6 +139,10 @@ final class Tia implements AddsOutput, HandlesArguments, Terminable private bool $filteredMode = false; + private ?string $driftLabel = null; + + private ?string $driftDetails = null; + public function __construct( private readonly OutputInterface $output, private readonly Recorder $recorder, @@ -559,10 +563,7 @@ final class Tia implements AddsOutput, HandlesArguments, Terminable if (! Fingerprint::structuralMatches($stored, $current)) { $drift = Fingerprint::structuralDrift($stored, $current); - $this->renderChild(sprintf( - 'Graph structure outdated (%s).', - $this->formatStructuralDrift($drift), - )); + $this->driftLabel = $this->formatStructuralDrift($drift); if (in_array('composer_lock', $drift, true)) { $branchSha = $graph->recordedAtSha($this->branch); @@ -572,7 +573,7 @@ final class Tia implements AddsOutput, HandlesArguments, Terminable $branchSha, ); if ($summary !== '') { - $this->renderChild($summary); + $this->driftDetails = $summary; } } } @@ -921,7 +922,7 @@ final class Tia implements AddsOutput, HandlesArguments, Terminable } $this->renderChild(sprintf( - 'TIA mode enabled / %d affected test file%s%s.', + 'Experimental TIA mode enabled / %d affected test file%s%s.', count($affected), count($affected) === 1 ? '' : 's', $reasons === [] ? '' : ' ('.implode(', ', $reasons).')', @@ -982,7 +983,7 @@ final class Tia implements AddsOutput, HandlesArguments, Terminable } $this->output->writeln(''); - $this->renderChild('TIA mode enabled / fresh graph.'); + $this->renderFreshGraph(); return $arguments; } @@ -991,7 +992,7 @@ final class Tia implements AddsOutput, HandlesArguments, Terminable $this->recordingActive = true; $this->output->writeln(''); - $this->renderChild('TIA mode enabled / fresh graph.'); + $this->renderFreshGraph(); return $arguments; } @@ -1004,6 +1005,25 @@ final class Tia implements AddsOutput, HandlesArguments, Terminable return $arguments; } + private function renderFreshGraph(): void + { + $headline = 'Experimental TIA mode enabled / fresh graph'; + + if ($this->driftLabel !== null) { + $headline .= sprintf(' (%s changed)', $this->driftLabel); + } else { + $headline .= '.'; + } + + $this->renderChild($headline); + + if ($this->driftDetails !== null) { + foreach (explode(', ', $this->driftDetails) as $detail) { + $this->output->writeln(sprintf(' %s', $detail)); + } + } + } + private function emitCoverageDriverMissing(): void { $this->output->writeln('');