fix: provider accessors use spec-mandated safe defaults, never throw - #39
Merged
Conversation
michaelbushe
force-pushed
the
fix/spec-provider-safe-defaults
branch
from
July 11, 2026 06:36
4b28838 to
87e410d
Compare
Member
Author
|
Reviews welcome: @harshitt13 @kevmoo @muhammadkamel @rohit482 @cnbleu @yuzurihaaa @robert-northmind @benjaben @danexello — spec-compliance work against the OpenTelemetry specification; the PR description has the normative quotes and the red/green test commits. |
7 tasks
michaelbushe
force-pushed
the
fix/spec-provider-safe-defaults
branch
from
July 11, 2026 12:34
87e410d to
1a5bec5
Compare
michaelbushe
force-pushed
the
fix/spec-provider-safe-defaults
branch
from
July 18, 2026 05:11
1a5bec5 to
0e670b4
Compare
trace/api.md Get a Tracer: an invalid name MUST return a working fallback "rather than returning null or throwing an exception"; error-handling.md: API methods MUST NOT throw on misuse. Current OTelAPI.tracerProvider/meterProvider/loggerProvider throw ArgumentError on empty names, and getTracer/getMeter/getLogger throw StateError after provider shutdown. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Turns the red spec tests green:
- OTelAPI.tracerProvider('')/meterProvider('')/loggerProvider('')
warn and return the global default instead of ArgumentError
- getTracer/getMeter/getLogger after provider shutdown warn and
return a no-op instance instead of StateError
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
michaelbushe
force-pushed
the
fix/spec-provider-safe-defaults
branch
from
July 18, 2026 05:33
0e670b4 to
cc6a377
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Documents and fixes a spec violation found auditing against
specification/trace/api.mdanderror-handling.md. TDD: first commit pins the spec contracts red (6 failing), second turns them green.The violation
OTelAPI.tracerProvider('')/meterProvider('')/loggerProvider('')threwArgumentError; they now warn and return the global default (exactly what the old error message told users to do manually).getTracer/getMeter/getLoggerthrewStateErrorafter provider shutdown; they now warn and return a no-op instance.Merge order
Stacked on #37 (→ #36): merge #36 → #37 → this.
Validation
dart analyze/dart format --set-exit-if-changed .— cleandart test— 766 tests passing🤖 Generated with Claude Code