Repository navigation
Add opt-in --rev-deps check to pr-check using dart pub unpack - #171
Merged
Merged
Conversation
- Add `lib/src/pr_check_rev_deps.dart` (`part of 'pr_check.dart'`) to detect newly exported top-level symbols and extension members from `api.txt` or `lib/*.dart` when a publishable package prepares a non-major release. - Query `pub.dev` reverse-dependency tarballs and `~/.pub-cache` packages whose version constraint admits the target release, flagging consumers that import the package entrypoint without a guarding `show`/`hide`/`as` clause while declaring a colliding top-level symbol or extension member. - Add unit tests in `test/pr_check_test.dart` covering `api.txt` and `lib/` symbol extraction, declaration-aware collision detection, `.tar.gz` extraction, and `runPrCheck` integration.
…unpack - Add `--rev-deps` flag to `pr-check` (skipped by default with `pass --rev-deps to run` when a publishable package modifies `lib/` in a non-major release). - Use `dart pub unpack <consumer> --no-resolve --output=<tempDir>`, `YamlEditor` (removing `resolution`, `workspace`, `dev_dependencies`, and `dependency_overrides` plus deleting `analysis_options.yaml`), `pubspec_overrides.yaml`, `dart pub get`, and `dart analyze lib` with zero regexps or custom tar/AST parsers. - Query `pub.dev` (`dependency:<pkg>` and `dependency:<pkg> publisher:kevmoo.com`) alongside `~/.pub-cache/hosted/pub.dev` to build the candidate reverse-dependency list.
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.
Adds an opt-in
--rev-depsflag tokscripts pr-checkthat validates touched publishable packages against already-published downstream consumers onpub.devbefore a non-major release.Why
dart_apitool,api_summary) classify adding public top-level symbols orextensionmembers as backwards-compatible minor changes, even when downstream consumers onpub.devalready import the package entrypoint withoutshowand declare colliding extension members (ambiguous_extension_member_access) or top-level helpers (ambiguous_import), as occurred in feat: add class-model helpers for code generators (1.4.0) google/source_helper.dart#78 (1.4.0).HEADbranches misses these collisions when donor helpers have already been deleted on the consumer's feature branch.Non-Obvious Callouts
pr-checkruns make zero network calls and recordSkipped: rev-deps:<pkg> (pass --rev-deps to run)when a publishable package modifieslib/in a non-major release (VersionConstraint.compatibleWith(baseRelease).allows(targetRelease)).--rev-depsis passed,pr-checkqueriespub.dev(dependency:<pkg>anddependency:<pkg> publisher:kevmoo.com) plus~/.pub-cache/hosted/pub.dev, unpacks each compatible consumer viadart pub unpack <consumer> --no-resolve, stripsanalysis_options.yaml,resolution,workspace, anddev_dependenciesviaYamlEditor, writespubspec_overrides.yamlpointing<pkg>to the local checkout, and runsdart pub get+dart analyze lib.Verification
source_helper1.4.0:[email protected]failsdart analyze libwith11real compile errors (ambiguous_importonconstructorByName/createSortedFieldSetandambiguous_extension_member_accessontoStringNonNullable/qualifiedName), while[email protected],[email protected], and[email protected]pass cleanly.