Skip to content

feat(companies): add retrieve/2, deprecate get/2#99

Open
sgerrand wants to merge 3 commits into
mainfrom
feat/companies-retrieve
Open

feat(companies): add retrieve/2, deprecate get/2#99
sgerrand wants to merge 3 commits into
mainfrom
feat/companies-retrieve

Conversation

@sgerrand
Copy link
Copy Markdown
Owner

@sgerrand sgerrand commented May 4, 2026

💁 These changes normalise Humaans.Companies onto the standard CRUD macro by adding :retrieve to the generated actions list. The custom get/2 now delegates to retrieve/2 and is marked @deprecated.

Summary

  • Add :retrieve to Humaans.Companies's use Humaans.Resource actions list — the macro now generates retrieve/2, removing the hand-rolled implementation
  • Keep get/2 as a deprecated alias that delegates to retrieve/2 for backwards compatibility
  • Update tests: rename retrieve/1 describe block to retrieve/2 and add a small test asserting get/2 still works

Test plan

  • mix test test/humaans/companies_test.exs passes (including the new deprecated-alias test)
  • mix test full suite still passes
  • mix credo clean
  • Compile shows the deprecation warning when calling Humaans.Companies.get/2

Normalises Humaans.Companies onto the standard CRUD macro by adding
:retrieve to the generated actions. The custom get/2 now delegates to
retrieve/2 and is marked @deprecated, preserving backwards compatibility
for existing callers.
Copilot AI review requested due to automatic review settings May 4, 2026 11:34
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Normalizes Humaans.Companies to the standard Humaans.Resource CRUD macro by enabling generated retrieve/2, while keeping get/2 as a deprecated backwards-compatible alias.

Changes:

  • Add :retrieve to Humaans.Companies’s use Humaans.Resource actions list to generate retrieve/2.
  • Replace the hand-rolled get/2 implementation with a deprecated delegation to retrieve/2.
  • Update tests to cover retrieve/2 and add a backwards-compatibility check for get/2.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
lib/humaans/companies.ex Enables macro-generated retrieve/2 and deprecates get/2 to delegate to it.
test/humaans/companies_test.exs Updates retrieval tests to call retrieve/2 and adds a get/2 backwards-compatibility test.

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

Comment thread test/humaans/companies_test.exs Outdated
@sgerrand sgerrand added the enhancement New feature or request label May 4, 2026
sgerrand added 2 commits May 4, 2026 17:32
Call the deprecated `Humaans.Companies.get/2` via `apply/3` so the
compile-time deprecation warning isn't emitted under
`mix test --warnings-as-errors`, while still asserting the alias works.
Extract the `apply/3` call into a `result` binding and add a
`credo:disable-for-next-line` directive so `mix credo --strict` passes
while keeping the indirect call needed to suppress the deprecation
warning.
@coveralls
Copy link
Copy Markdown

Coverage Report for CI Build 25331418957

Warning

Build has drifted: This PR's base is out of sync with its target branch, so coverage data may include unrelated changes.
Quick fix: rebase this PR. Learn more →

Coverage remained the same at 100.0%

Details

  • Coverage remained the same as the base build.
  • Patch coverage: 1 of 1 lines across 1 file are fully covered (100%).
  • No coverage regressions found.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

No coverage regressions found.


Coverage Stats

Coverage Status
Relevant Lines: 211
Covered Lines: 211
Line Coverage: 100.0%
Coverage Strength: 21.07 hits per line

💛 - Coveralls

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants