Skip to content
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

Provide better information through the user agent when querying remote repositories #3526

Closed
2 tasks done
pauby opened this issue Oct 4, 2024 · 1 comment · Fixed by #3460
Closed
2 tasks done

Comments

@pauby
Copy link
Member

pauby commented Oct 4, 2024

Checklist

  • I have verified this is the correct repository for opening this issue.
  • I have verified no other issues exist related to my request.

Is Your Feature Request Related To A Problem? Please describe.

No.

Describe The Solution. Why is it needed?

To provide better feedback and information, we should update the user agent that Chocolatey CLI uses.

Additional Context

None.

Related Issues

N/A

@gep13 gep13 added this to the 2.4.0 milestone Oct 7, 2024
@gep13 gep13 linked a pull request Oct 24, 2024 that will close this issue
11 tasks
@vexx32 vexx32 added Feature Issues that introduce new functionality to the project, instead of updating existing functionality Improvement 3 - Review and removed Feature Issues that introduce new functionality to the project, instead of updating existing functionality labels Oct 28, 2024
vexx32 pushed a commit to AdmiringWorm/choco that referenced this issue Oct 30, 2024
vexx32 pushed a commit to AdmiringWorm/choco that referenced this issue Oct 30, 2024
Work the ProcessTree into a service that can be pulled in to the
NugetCommon library in order to provide a more informative user agent
when querying repositories.
vexx32 added a commit to AdmiringWorm/choco that referenced this issue Oct 30, 2024
The primary method is quickest, but as it is an unstable API, we have a
need to provide a fallback that will be able to be used if the DLL is
missing/removed, or if the entry point is later removed.

Of the stable options, this p/invoke method seems to be the next best
option to work with.

Crucially, these p/invokes need to be provided by different types, so
that if there is a TypeLoadException from a failed p/invoke, we can
still attempt the fallback.
vexx32 added a commit to AdmiringWorm/choco that referenced this issue Oct 30, 2024
vexx32 added a commit to AdmiringWorm/choco that referenced this issue Oct 30, 2024
The primary method is quickest, but as it is an unstable API, we have a
need to provide a fallback that will be able to be used if the DLL is
missing/removed, or if the entry point is later removed.

Of the stable options, this p/invoke method seems to be the next best
option to work with.

Crucially, these p/invokes need to be provided by different types, so
that if there is a TypeLoadException from a failed p/invoke, we can
still attempt the fallback.
vexx32 added a commit to AdmiringWorm/choco that referenced this issue Oct 30, 2024
vexx32 added a commit to AdmiringWorm/choco that referenced this issue Oct 31, 2024
We need to define values for ReleaseOfficial for the benchmark project
or the Cake build complains.

Also added Chocolatey.PowerShell to the slnf in the repo, since that was
missing.
vexx32 added a commit to AdmiringWorm/choco that referenced this issue Oct 31, 2024
RuntimeInformation is shadowed by Mono which means that build breaks and
because all of the namespaces are the same under Mono's version, that
name is not usable in our build currently.

We can reuse our existing Platform.GetPlatform() helper here instead,
rather than trying to disentangle exactly why this build configuration
is not particularly functional.
vexx32 added a commit to AdmiringWorm/choco that referenced this issue Oct 31, 2024
RuntimeInformation is shadowed by Mono which means that build breaks and
because all of the namespaces are the same under Mono's version, that
name is not usable in our build currently.

We can reuse our existing Platform.GetPlatform() helper here instead,
rather than trying to disentangle exactly why this build configuration
is not particularly functional.
vexx32 pushed a commit to AdmiringWorm/choco that referenced this issue Oct 31, 2024
vexx32 pushed a commit to AdmiringWorm/choco that referenced this issue Oct 31, 2024
Work the ProcessTree into a service that can be pulled in to the
NugetCommon library in order to provide a more informative user agent
when querying repositories.
vexx32 added a commit to AdmiringWorm/choco that referenced this issue Oct 31, 2024
The primary method is quickest, but as it is an unstable API, we have a
need to provide a fallback that will be able to be used if the DLL is
missing/removed, or if the entry point is later removed.

Of the stable options, this p/invoke method seems to be the next best
option to work with.

Crucially, these p/invokes need to be provided by different types, so
that if there is a TypeLoadException from a failed p/invoke, we can
still attempt the fallback.

Also, added a couple more exclusions for the choco.exe shim and for
winlogon, which are not useful to include.
vexx32 added a commit to AdmiringWorm/choco that referenced this issue Oct 31, 2024
vexx32 added a commit to AdmiringWorm/choco that referenced this issue Oct 31, 2024
We need to define values for ReleaseOfficial for the benchmark project
or the Cake build complains.

Also added Chocolatey.PowerShell to the slnf in the repo, since that was
missing.
vexx32 added a commit to AdmiringWorm/choco that referenced this issue Oct 31, 2024
RuntimeInformation is shadowed by Mono which means that build breaks and
because all of the namespaces are the same under Mono's version, that
name is not usable in our build currently.

We can reuse our existing Platform.GetPlatform() helper here instead,
rather than trying to disentangle exactly why this build configuration
is not particularly functional.
vexx32 added a commit to AdmiringWorm/choco that referenced this issue Nov 1, 2024
These processes are not particularly useful to note as they are common
terminal emulators, so we can exclude them when looking at the process
tree.
vexx32 pushed a commit to AdmiringWorm/choco that referenced this issue Nov 4, 2024
vexx32 pushed a commit to AdmiringWorm/choco that referenced this issue Nov 4, 2024
Work the ProcessTree into a service that can be pulled in to the
NugetCommon library in order to provide a more informative user agent
when querying repositories.
vexx32 added a commit to AdmiringWorm/choco that referenced this issue Nov 4, 2024
The primary method is quickest, but as it is an unstable API, we have a
need to provide a fallback that will be able to be used if the DLL is
missing/removed, or if the entry point is later removed.

Of the stable options, this p/invoke method seems to be the next best
option to work with.

Crucially, these p/invokes need to be provided by different types, so
that if there is a TypeLoadException from a failed p/invoke, we can
still attempt the fallback.

Also, added a couple more exclusions for the choco.exe shim and for
winlogon, which are not useful to include.
vexx32 added a commit to AdmiringWorm/choco that referenced this issue Nov 4, 2024
vexx32 added a commit to AdmiringWorm/choco that referenced this issue Nov 4, 2024
We need to define values for ReleaseOfficial for the benchmark project
or the Cake build complains.

Also added Chocolatey.PowerShell to the slnf in the repo, since that was
missing.
vexx32 added a commit to AdmiringWorm/choco that referenced this issue Nov 4, 2024
RuntimeInformation is shadowed by Mono which means that build breaks and
because all of the namespaces are the same under Mono's version, that
name is not usable in our build currently.

We can reuse our existing Platform.GetPlatform() helper here instead,
rather than trying to disentangle exactly why this build configuration
is not particularly functional.
vexx32 added a commit to AdmiringWorm/choco that referenced this issue Nov 4, 2024
These processes are not particularly useful to note as they are common
terminal emulators, so we can exclude them when looking at the process
tree.
vexx32 added a commit to AdmiringWorm/choco that referenced this issue Nov 6, 2024
Simplify some naming, also add a constant (and comment) to clarify what
some of the p/invoke nonsense is doing.
vexx32 pushed a commit to AdmiringWorm/choco that referenced this issue Nov 7, 2024
Work the ProcessTree into a service that can be pulled in to the
NugetCommon library in order to provide a more informative user agent
when querying repositories.
vexx32 added a commit to AdmiringWorm/choco that referenced this issue Nov 7, 2024
The primary method is quickest, but as it is an unstable API, we have a
need to provide a fallback that will be able to be used if the DLL is
missing/removed, or if the entry point is later removed.

Of the stable options, this p/invoke method seems to be the next best
option to work with.

Crucially, these p/invokes need to be provided by different types, so
that if there is a TypeLoadException from a failed p/invoke, we can
still attempt the fallback.

Also, added a couple more exclusions for the choco.exe shim and for
winlogon, which are not useful to include.
vexx32 added a commit to AdmiringWorm/choco that referenced this issue Nov 7, 2024
vexx32 added a commit to AdmiringWorm/choco that referenced this issue Nov 7, 2024
We need to define values for ReleaseOfficial for the benchmark project
or the Cake build complains.

Also added Chocolatey.PowerShell to the slnf in the repo, since that was
missing.
vexx32 added a commit to AdmiringWorm/choco that referenced this issue Nov 7, 2024
RuntimeInformation is shadowed by Mono which means that build breaks and
because all of the namespaces are the same under Mono's version, that
name is not usable in our build currently.

We can reuse our existing Platform.GetPlatform() helper here instead,
rather than trying to disentangle exactly why this build configuration
is not particularly functional.
vexx32 added a commit to AdmiringWorm/choco that referenced this issue Nov 7, 2024
These processes are not particularly useful to note as they are common
terminal emulators, so we can exclude them when looking at the process
tree.
vexx32 added a commit to AdmiringWorm/choco that referenced this issue Nov 7, 2024
Simplify some naming, also add a constant (and comment) to clarify what
some of the p/invoke nonsense is doing.
corbob pushed a commit to AdmiringWorm/choco that referenced this issue Nov 7, 2024
corbob pushed a commit to AdmiringWorm/choco that referenced this issue Nov 7, 2024
Work the ProcessTree into a service that can be pulled in to the
NugetCommon library in order to provide a more informative user agent
when querying repositories.
corbob pushed a commit to AdmiringWorm/choco that referenced this issue Nov 7, 2024
The primary method is quickest, but as it is an unstable API, we have a
need to provide a fallback that will be able to be used if the DLL is
missing/removed, or if the entry point is later removed.

Of the stable options, this p/invoke method seems to be the next best
option to work with.

Crucially, these p/invokes need to be provided by different types, so
that if there is a TypeLoadException from a failed p/invoke, we can
still attempt the fallback.

Also, added a couple more exclusions for the choco.exe shim and for
winlogon, which are not useful to include.
corbob pushed a commit to AdmiringWorm/choco that referenced this issue Nov 7, 2024
corbob pushed a commit to AdmiringWorm/choco that referenced this issue Nov 7, 2024
We need to define values for ReleaseOfficial for the benchmark project
or the Cake build complains.

Also added Chocolatey.PowerShell to the slnf in the repo, since that was
missing.
corbob pushed a commit to AdmiringWorm/choco that referenced this issue Nov 7, 2024
RuntimeInformation is shadowed by Mono which means that build breaks and
because all of the namespaces are the same under Mono's version, that
name is not usable in our build currently.

We can reuse our existing Platform.GetPlatform() helper here instead,
rather than trying to disentangle exactly why this build configuration
is not particularly functional.
corbob pushed a commit to AdmiringWorm/choco that referenced this issue Nov 7, 2024
These processes are not particularly useful to note as they are common
terminal emulators, so we can exclude them when looking at the process
tree.
corbob pushed a commit to AdmiringWorm/choco that referenced this issue Nov 7, 2024
Simplify some naming, also add a constant (and comment) to clarify what
some of the p/invoke nonsense is doing.
@corbob corbob added 4 - Done and removed 3 - Review labels Nov 7, 2024
corbob added a commit to corbob/choco that referenced this issue Nov 8, 2024
This updates the tests to validate that the version number is not
output in the Info log messages only. There are some debug log messages
that may contain a similar version number as they report the user agent
being used, this prevents them from being erroneously picked up.
corbob added a commit to corbob/choco that referenced this issue Nov 8, 2024
The debug log is used in a lot of places when we don't want the user to
see the output, but we want it available. At the moment it is not
consistent about what we do when they select debug and limit output. It
has been decided at the moment to remove these tests as they are now
breaking by us emitting the user agent to the debug log. A follow up
issue chocolatey#3555 has been created to determine what we want for behaviour
when limit output and debug is selected.
vexx32 added a commit that referenced this issue Nov 8, 2024
vexx32 added a commit to vexx32/choco that referenced this issue Nov 8, 2024
Licensed does queries in the background before / while normal commands
are running, so we can end up with multiple user-agent debug lines.

Resolve this by just looking at the most recently-outputted user agent,
as these should all look the same (and if not, the last one should be
the one from the actual command run).
corbob added a commit that referenced this issue Nov 8, 2024
@vexx32 vexx32 changed the title Provide better information through the user agent Provide better information through the user agent when querying remote repositories Nov 12, 2024
@vexx32
Copy link
Member

vexx32 commented Nov 12, 2024

🎉 This issue has been resolved in version 2.4.0 🎉

The release is available on:

@vexx32 vexx32 removed the 4 - Done label Nov 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants