chore: enforce *Create classes as package-internal - #47
Merged
Conversation
Member
Author
|
@kevmoo If you have time please take a look at my use of Dart Language features to enforce creation of API (and SDK) objects via |
The Create classes were internal by doc-comment convention only — public classes in part files of barrel-exported libraries, so AttributesCreate.create() etc. were callable by any consumer: an open factory-bypass door (the SDK itself used AttributesCreate that way until dartastic_opentelemetry#62). The part-of/private-constructor pattern protects the constructors, not the Create wrappers. - @internal on all 28 Create classes - barrel hides them (invalid_export_of_internal_element enforced) - meta imports added to host libraries Full suite: 753 passed, 0 failures. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
michaelbushe
force-pushed
the
chore/internal-create-classes
branch
from
July 18, 2026 05:41
2e8750a to
5d25709
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.
Companion to MindfulSoftwareLLC/dartastic_opentelemetry#62 (which applied the same lockdown to the SDK's Create classes).
Why
The
*Createclasses were internal by doc-comment convention only. They're public classes inpartfiles of barrel-exported libraries, soAttributesCreate.create()etc. were callable by any consumer — an open factory-bypass door, contradicting the beta.8/9 removal of factory cheat paths. (The SDK itself usedAttributesCreatethat way until #62 removed it.) Thepart of+ private-constructor pattern protects the constructors; the public Create wrappers were exactly a public door to them.What
@internal(package:meta) on all 28*Createclasses — analyzer rejects outside-package use (invalid_use_of_internal_member), dartdoc hides themhides them, enforced byinvalid_export_of_internal_elementmetaimports added to host librariesValidation
dart analyze lib test: no issues🤖 Generated with Claude Code