Skip to content

Conversation

@mwbrooks
Copy link
Member

@mwbrooks mwbrooks commented May 5, 2025

Summary

This pull request renames the function clients.APIInterface() to clients.API().

The motivation is that the name is shorter and more accurate. The clients.API() returns an instance of api.Client that implements the api.APIInterface interface. It doesn't return an interface. Alternatively, we could name it clients.APIClient() but I think we're trying to move away from this naming pattern.

There was no change functionality was changed.

Requirements

@mwbrooks mwbrooks added this to the Next Release milestone May 5, 2025
@mwbrooks mwbrooks self-assigned this May 5, 2025
@mwbrooks mwbrooks added code health M-T: Test improvements and anything that improves code health semver:patch Use on pull requests to describe the release version increment labels May 5, 2025
@codecov
Copy link

codecov bot commented May 5, 2025

Codecov Report

Attention: Patch coverage is 69.93007% with 43 lines in your changes missing coverage. Please review.

Project coverage is 63.17%. Comparing base (249fb52) to head (efbba6a).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
cmd/triggers/access.go 63.33% 11 Missing ⚠️
cmd/function/access.go 62.50% 6 Missing ⚠️
cmd/triggers/triggers.go 40.00% 6 Missing ⚠️
internal/pkg/platform/deploy.go 0.00% 5 Missing ⚠️
internal/pkg/auth/login.go 0.00% 4 Missing ⚠️
internal/shared/clients.go 25.00% 3 Missing ⚠️
internal/pkg/apps/install.go 77.77% 2 Missing ⚠️
cmd/externalauth/remove.go 80.00% 1 Missing ⚠️
cmd/function/prompt.go 0.00% 1 Missing ⚠️
cmd/openformresponse/export.go 50.00% 1 Missing ⚠️
... and 3 more
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #77      +/-   ##
==========================================
+ Coverage   63.16%   63.17%   +0.01%     
==========================================
  Files         210      210              
  Lines       22187    22186       -1     
==========================================
+ Hits        14014    14016       +2     
  Misses       7086     7086              
+ Partials     1087     1084       -3     

☔ View full report in Codecov by Sentry.
📢 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.

Copy link
Member Author

@mwbrooks mwbrooks left a comment

Choose a reason for hiding this comment

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

A few comments to help clear up some noisy diffs! 🧘🏻

Comment on lines +47 to +56
API func() api.APIInterface
AppClient func() *app.Client
AuthInterface func() auth.AuthInterface
CLIVersion string
Config *config.Config
EventTracker tracking.TrackingManager
HookExecutor hooks.HookExecutor
IO iostreams.IOStreamer
Runtime runtime.Runtime
SDKConfig hooks.SDKCLIConfig
Copy link
Member Author

Choose a reason for hiding this comment

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

There are 3 changes here:

  1. Renamed APIInterface → API
  2. Alphabetically ordered these fields
  3. Removed newline breaks and unnecessary comments so indentation aligns

Copy link
Member

Choose a reason for hiding this comment

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

Meant to send this with the review prior, but thank you so very much! This is a great PR to make such a change 😌 🎉

@mwbrooks mwbrooks marked this pull request as ready for review May 5, 2025 17:30
@mwbrooks mwbrooks requested a review from a team as a code owner May 5, 2025 17:30
Copy link
Member

@zimeg zimeg left a comment

Choose a reason for hiding this comment

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

@mwbrooks Less code is better so often! 🏆

While we're updating this would it be best to make a similar change to tests?

APIInterface *api.APIMock

type ClientsMock struct {
mock.Mock
APIInterface *api.APIMock
API *api.APIMock
Copy link
Member Author

Choose a reason for hiding this comment

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

note: Update ClientsMock.APIInterface to ClientsMock.API in commit 54da648

@mwbrooks
Copy link
Member Author

mwbrooks commented May 5, 2025

@mwbrooks Less code is better so often! 🏆

While we're updating this would it be best to make a similar change to tests?

APIInterface *api.APIMock

@zimeg Great catch! I'm a little disappointed in myself for not catching this - I looked through the test and mocks, but overlooked this change.

Commit 54da648 updates the ClientsMock.APIInterface to ClientsMock.API. I used a Find/ReplaceAll on clientsMock.APIInterface, cm.APIInterface, and a few manual changes in the clients_mock.go. It's a MASSIVE change list, but an easy scroll. I didn't notice anything amuck, but I'd appreciate it if you could take a look as well! 🙇🏻

@mwbrooks mwbrooks requested a review from zimeg May 5, 2025 20:32
@mwbrooks
Copy link
Member Author

mwbrooks commented May 5, 2025

@zimeg Sorry to keep adding more to this PR, but commit efbba6a also updates a defaultAPIInterfaceFunc reference (and removes a TODO comment).

Copy link
Member

@zimeg zimeg left a comment

Choose a reason for hiding this comment

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

@mwbrooks You are so fast! 👾 ✨

All of these changes look great and I'm super excited to be using a more refined comments and clients in calling code 👁️‍🗨️

@mwbrooks
Copy link
Member Author

mwbrooks commented May 5, 2025

Back at you @zimeg! Thanks for taking the time to review these tedious changes! Ever-so-slowly, things look and feel better.

I'll merge this PR and follow-up with one that updates clients.AuthInterface() to clients.Auth() (should be a lot smaller)

@mwbrooks mwbrooks merged commit 0526485 into main May 5, 2025
6 checks passed
@mwbrooks mwbrooks deleted the mwbrooks-api-interface-refactor branch May 5, 2025 21:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

code health M-T: Test improvements and anything that improves code health semver:patch Use on pull requests to describe the release version increment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants