-
-
Notifications
You must be signed in to change notification settings - Fork 9.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use API for description searches #17582
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is looking great so far, nice work @rrotter!
Assuming you agree with suggestions: only thing I think is needed is to get some test coverage and to decide how to message the non-eval-all case if there's other taps.
dcc49cc
to
545f8a7
Compare
Does this change the behavior of cask description searches? I remember previously that it was using both the names and descriptions in search and it looks like it's now only using descriptions. This is useful when people want to surface cask results for alternative names. |
It'd also be nice to get some benchmarks at some point too. |
In my testing this search takes about 1s, and the old method was 0.5s cached and 5s uncached. (M2 Mac Studio) edit, to be more precise:
|
Good catch. This is using exactly the same code to perform a search, but I rewrote the code that generates the hash that is being searched. I didn't realize that the data structure was slightly different for formulae and casks. The cask data structure actually has a third field.
Fixed in my latest commit. |
Here's the current warning language that I'm printing if there are third party taps installed. Can't paste w/ color here, but I'm using
Trying to keep it clear and concise. Could add something about why you might not want to use |
I'm a little stuck on testing:
Any tips would be appreciated. Other than adding tests I should be done pushing on this branch for now. |
The performance looks good and adding cask names was a simple fix which was nice.
In terms of integration tests, nobody's been able to find a good way to mock and sign the API JSON yet. I think it'd make more sense to add unit tests for
|
Pushed a couple of tests, including an API mock. They do pass, but CI is failing on the linter, see comment above. Other than the lint, does this look okay? |
@rrotter Yep, the code looks good. I left an optional nit as well but feel free to ignore that. |
Both `brew search --desc` and `brew desc --search` use API for cask and formula searches unless `--eval-all` or `HOMEBREW_EVAL_ALL` set. Description searches do not use the description cache or eval any formulas/casks. - With `--eval-all`, description search reverts to the old behavior. - Warn if description search exludes any formulae/casks (because `--eval-all` not set). - Enforce `--eval-all` requirement if NO_INSTALL_FROM_API set.
Thanks, @apainintheneck, added your suggestions, squashed and rebased. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks for updating this!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @rrotter!
Both
brew search --desc
andbrew desc --search
use API for cask and formula searches unless--eval-all
orHOMEBREW_EVAL_ALL
set. Description searches do not use the description cache or eval any formulas/casks.With
--eval-all
, description search reverts to the old behavior.This will resolve #16237.
brew style
with your changes locally?brew typecheck
with your changes locally?brew tests
with your changes locally?This is intentionally a draft, looking for comments on this direction.