Skip to content

introduces a non-breaking API renaming and alignment for the dart_either package, primarily to match Arrow/Kotlin naming conventions#36

Open
hoc081098 wants to merge 24 commits into
masterfrom
hoc/new-name
Open

introduces a non-breaking API renaming and alignment for the dart_either package, primarily to match Arrow/Kotlin naming conventions#36
hoc081098 wants to merge 24 commits into
masterfrom
hoc/new-name

Conversation

@hoc081098

@hoc081098 hoc081098 commented Mar 1, 2026

Copy link
Copy Markdown
Owner

This pull request introduces a non-breaking API naming alignment for the dart_either package, bringing its public API closer to Arrow/Kotlin conventions while preserving backward compatibility. New API names are added, with the old names retained as deprecated aliases, and all relevant documentation, examples, and tests are updated accordingly. Additionally, the semantics of getOrDefault are clarified to be eager, and a skill document is added to guide future API renames.

API Naming Alignment and Deprecations

  • Introduced new API methods: onLeft (from tapLeft), onRight (from tap), getOrNull (from orNull), getOrDefault (from getOrElse), and isRightAnd (from exists). Old methods are kept as deprecated aliases with clear replacement messages to ensure backward compatibility. (lib/src/dart_either.dart, README.md, test/dart_either_test.dart, [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12]

Documentation and Example Updates

  • Updated all documentation and code examples to use the new API names, including the main API table, code snippets, and usage in README.md and example/lib/dart_either_readme.dart. Deprecated aliases are clearly marked. (README.md, example/lib/dart_either_readme.dart, [1] [2] [3] [4] [5] [6]

Test Coverage Enhancements

  • Expanded and refactored tests to cover both the new API names and the deprecated aliases, ensuring compatibility and correct behavior. Added specific tests for eager vs lazy fallback in getOrDefault and getOrHandle. (test/dart_either_test.dart, [1] [2] [3]

Behavioral Clarification

  • Clarified that getOrDefault uses eager fallback value semantics and updated its signature; users are directed to use getOrHandle for lazy evaluation. (lib/src/dart_either.dart, lib/src/dart_either.dartL755-R834)

Project Process and Guidance

  • Added a repository-local skill document describing the safe, non-breaking workflow for API renames, including steps for migration, testing, and documentation updates. (.github/skills/api-rename-flow/SKILL.md, .github/skills/api-rename-flow/SKILL.mdR1-R62)
  • Updated the changelog and added a naming guidance note for future API changes. (CHANGELOG.md, [1] names.md, [2]

Copilot AI review requested due to automatic review settings March 1, 2026 07:51
@hoc081098 hoc081098 self-assigned this Mar 1, 2026
@codecov

codecov Bot commented Mar 1, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 67.74194% with 10 lines in your changes missing coverage. Please review.
✅ Project coverage is 93.91%. Comparing base (3d7a019) to head (2b287a1).

Files with missing lines Patch % Lines
lib/src/dart_either.dart 62.96% 10 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master      #36      +/-   ##
==========================================
- Coverage   98.07%   93.91%   -4.17%     
==========================================
  Files           5        6       +1     
  Lines         208      230      +22     
==========================================
+ Hits          204      216      +12     
- Misses          4       14      +10     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR aligns dart_either’s public API naming with Arrow/Kotlin conventions by introducing new method names while retaining deprecated aliases for backward compatibility, and updates docs/examples/tests accordingly.

Changes:

  • Added new Either APIs (onLeft, onRight, getOrNull, getOrDefault, isRightAnd) and kept old names as @Deprecated aliases.
  • Updated README + example code to use the new names and documented the alias mapping/migration notes.
  • Expanded unit tests to cover both new APIs and deprecated aliases, including eager vs lazy fallback behavior.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
lib/src/dart_either.dart Introduces new method names and deprecated aliases; updates API docs/examples.
test/dart_either_test.dart Adds/updates tests for new API names and deprecated alias compatibility.
README.md Updates snippets + API table and adds a deprecation/migration note.
example/lib/dart_either_readme.dart Updates example usage to new API names.
CHANGELOG.md Documents the naming alignment and migration guidance under Unreleased.
.github/skills/api-rename-flow/SKILL.md Adds a repo-local workflow guide for non-breaking API renames.
names.md Adds a naming alignment/rollout strategy table.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread README.md Outdated
Comment thread names.md Outdated
Comment thread lib/src/dart_either.dart Outdated

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

…o hoc/new-name

# Conflicts:
#	CHANGELOG.md

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread CHANGELOG.md Outdated
Comment thread CHANGELOG.md Outdated
Comment thread names.md Outdated
@hoc081098 hoc081098 requested a review from Copilot March 7, 2026 14:46
@hoc081098

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Hooray!

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 14 out of 14 changed files in this pull request and generated 4 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread lib/src/internal.dart
Comment thread docs/Either.kt Outdated
Comment thread README.md Outdated
Comment thread test/dart_either_test.dart Outdated
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 14 out of 14 changed files in this pull request and generated 2 comments.

Comment thread lib/src/internal.dart
Comment thread docs/Either.kt Outdated
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