Skip to content

Move span errors to finish#3

Merged
loks0n merged 6 commits intoutopia-php:mainfrom
ChiragAgg5k:codex/move-error-to-finish
Apr 27, 2026
Merged

Move span errors to finish#3
loks0n merged 6 commits intoutopia-php:mainfrom
ChiragAgg5k:codex/move-error-to-finish

Conversation

@ChiragAgg5k
Copy link
Copy Markdown
Member

Summary

  • Move terminal span error capture into Span::finish(?Throwable $error = null)
  • Remove the confusing static Span::error() helper
  • Update tests and README guidance to distinguish error attributes from span failure

Testing

  • composer test
  • composer format
  • vendor/bin/phpstan analyze --memory-limit=512M

@greptile-apps
Copy link
Copy Markdown

greptile-apps Bot commented Apr 27, 2026

Greptile Summary

This PR consolidates span error capture into finish(?string $level = null, ?Throwable $error = null), removes the Span::error() static helper, and changes level to always be written at finish time rather than only when not already set. The README and tests are updated accordingly, and declare(strict_types=1) is added across all source and test files.

Confidence Score: 5/5

Safe to merge — no logic bugs found; all behavioural changes are intentional and well-tested.

No P0 or P1 issues found. The two breaking changes (removal of Span::error() and finish() now always overwriting level) are deliberately introduced, covered by tests, and documented in the README. All other changes are additive or housekeeping.

No files require special attention.

Important Files Changed

Filename Overview
src/Span/Span.php Removes Span::error(), extends finish() with $level/$error params, and changes level to always be set at finish time (no longer preserving pre-set values).
tests/SpanTest.php Replaces old Span::error() tests with finish(error:) equivalents; adds testFinishOwnsLevelAttribute confirming the new always-overwrite level behaviour.
README.md Updated error-handling guidance to use finish(error: $e), removed Span::error() from static-method table, and added prose about setError() for pre-finish error recording.
src/Span/Exporter/Exporter.php Added declare(strict_types=1) only; no logic change.
src/Span/Exporter/Stdout.php Added declare(strict_types=1) only; no logic change.
src/Span/Storage/Memory.php Added declare(strict_types=1) only; no logic change.
src/Span/Storage/Coroutine.php Added declare(strict_types=1) only; no logic change.

Reviews (6): Last reviewed commit: "Fix finish error parameter docs" | Re-trigger Greptile

Comment thread src/Span/Span.php Outdated
Comment thread README.md
Comment thread README.md Outdated
Comment thread README.md Outdated
Comment thread README.md Outdated
Comment thread README.md
@loks0n loks0n merged commit ffba09d into utopia-php:main Apr 27, 2026
7 checks passed
@ChiragAgg5k ChiragAgg5k deleted the codex/move-error-to-finish branch April 27, 2026 07:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants