This adds nogo to lint our code from within bazel.
## Test plan
`bazel build //cmd/frontend`
need to do a full build still
<!-- All pull requests REQUIRE a test plan:
https://docs.sourcegraph.com/dev/background-information/testing_principles
-->
---------
Co-authored-by: Jean-Hadrien Chabran <jh@chabran.fr>
Closes
https://github.com/orgs/sourcegraph/projects/240?pane=issue&itemId=18474973
This PR does a few things:
1. Automates the significant versions (major / minor) src-cli release
2. Automates the src-cli changelog
3. Provides a command to validate all distribution channels have the
updated version
There is some sequencing trouble in how src-cli is released that is
worth explaining here. So when we perform a release of sourcegraph we
also bake in a minimum src-cli version constant, as well as the
documentation for that version of src-cli. This documentation is
actually generated from the src-cli tool itself, and naively requires
the latest version is available on github.
That's something I don't want to interrupt the release process, so in
this PR we do something slightly different. First, we assume that the
head of main is the release commit, which is reasonable since we are the
ones performing the release. Second, we checkout src-cli and use the
local checkout to bake the documentation into the sourcegraph release.
Third, we perform the src-cli release by tagging the build and pushing
the tag.
To do that this PR also adds a new optional flag into the go program
that installs the software to pass a local path instead of downloading
the latest release.
For some quality of life we autodetect the latest src-cli version from
the src-cli repo instead of assuming it's always the same as the
Sourcegraph version. This is just to hedge against any future
divergence.
Here is an example
[PR](https://github.com/sourcegraph/sourcegraph/pull/48573) after
running the update command (the diff won't necessarily reflect a real
diff)
Using the validate command we can check that github, brew, and npm all
have the latest release that matches the expected version.
## Test plan
To test this I had to do a few janky things:
1. replace the clone path with a constant src-cli path (I just cloned it
once, then grabbed the directory)
2. replace the actual ./release.sh script with something that won't
release. I just edited the script to echo and return early after all the
validations in the same repo above
Here is the output showing the diff and the release script
<img width="1112" alt="image"
src="https://user-images.githubusercontent.com/5090588/222289405-bc1a0632-6af0-4e72-b883-a1cf786f0aec.png">
<!-- All pull requests REQUIRE a test plan:
https://docs.sourcegraph.com/dev/background-information/testing_principles
-->
To test verify-src-cli simply run the command:
<img width="953" alt="CleanShot 2023-03-02 at 11 35 35@2x"
src="https://user-images.githubusercontent.com/5090588/222552782-72ae3e9f-03dd-4433-9a2b-7356df33849c.png">
And finally a minified example of the full flow
<img width="944" alt="CleanShot 2023-03-02 at 13 55 11@2x"
src="https://user-images.githubusercontent.com/5090588/222552934-7b49aa80-a2ad-4f54-9f27-ab8bf3d1408a.png">
- Fixes https://github.com/sourcegraph/sourcegraph/issues/48432
We didn't correctly set metadata in all cases.
- POST: It was okay
- GET: Creation and last modification date were missing
- PATCH: Creation and last modification date were missing, also had to
update returned value
- PUT: Creation and last modification date were missing
- DELETE: Not needed
## Test plan
- Was a very quick change, I hope CI passes
- End-to-end: tested the whole CRUD with Postman, and it worked nicely!
Now that we don't have the tricky post processing we can move all the
important logic of discovering repos into the Walk function. I imagine
in the future we will have external callers to Walk so making this
correct will help.
Test Plan: go test
Early feedback we got was that when using the bazel commandsets, if the
user never ran bazel build before, the logs would spam errors because
normal services would come up way earlier and complained about not being
able to reach other services.
While is never happens if you have only a few things to build, the
initial build command on a cold environment is really long. This fixes
this. In essence, it behaves like the old install method for those
services.
## Test plan
<!-- All pull requests REQUIRE a test plan:
https://docs.sourcegraph.com/dev/background-information/testing_principles
-->
Tested locally.
If the root is a repository then we just return that as a repository. We
had some complicated logic here which handled the case when we used to
recurse further into repositories looking for more. But now it can be
simplified so that we don't need to post-process the names.
Test Plan: a test case was added for repository is root. Tested that it
broke in the state where I removed the older post filtering code but not
the new is repo root check.
Previously, we used `SyntaxKind.Identifier` in too many places making
everything look blue. In this commit, we use different colors for
functions and capitalized identifiers (which are normally used for
constants). These small changes greatly improve the quality of the
highlighting.
Currently, a user can create a new team but then cannot further modify
or delete it, as they're not a member of it. This PR changes the access
to "creator can always manage", so that they can modify it further, add members and such.
Also added a go benchmark with some results
## Benchmark results
```
// BenchmarkAuthzQuery_ListMinimalRepos_1000repos_1000users_50reposPerUser/list_repos,_using_unified_user_repo_permissions_table-10 23928 495697 ns/op
// BenchmarkAuthzQuery_ListMinimalRepos_1000repos_1000users_50reposPerUser/list_repos,_using_legacy_user_permissions_table-10 24399 486467 ns/op
// BenchmarkAuthzQuery_ListMinimalRepos_10krepos_10kusers_150reposPerUser/list_repos,_using_unified_user_repo_permissions_table-10 3180 4023709 ns/op
// BenchmarkAuthzQuery_ListMinimalRepos_10krepos_10kusers_150reposPerUser/list_repos,_using_legacy_user_permissions_table-10 2911 4020591 ns/op
// BenchmarkAuthzQuery_ListMinimalRepos_10krepos_10kusers_500reposPerUser/list_repos,_using_unified_user_repo_permissions_table-10 3201 4101237 ns/op
// BenchmarkAuthzQuery_ListMinimalRepos_10krepos_10kusers_500reposPerUser/list_repos,_using_legacy_user_permissions_table-10 2944 4144971 ns/op
// BenchmarkAuthzQuery_ListMinimalRepos_500krepos_40kusers_500reposPerUser/list_repos,_using_unified_user_repo_permissions_table-10 63 186395579 ns/op
// BenchmarkAuthzQuery_ListMinimalRepos_500krepos_40kusers_500reposPerUser/list_repos,_using_legacy_user_permissions_table-10 62 190570966 ns/op
```
The performance of both old and new authzQuery is really similar, the
new query is marginally faster on datasets with lots of repositories per
user. The old query is marginally faster on smaller datasets with not as
many repositories per user.
## Test plan
Unit tests modified, tested locally.
- Simplify fromAccountData()
- Remove unused test case
- Make account_data the source of truth
- Move `convertUserToSCIMResource` to user.go
- Get external ID from attributes
- Slightly improve user displayName getting
- Unwrapping error to return the correct (409) error code
- Remove test logging
- Remove two obsolete TODOs
- Deduplicate data encryption
- Rename a local variable
- Narrow a function interface
- Move a function out of struct
- Fix externalID and serviceID
- Update tests
The reason that `useEffect` is not needed is that when the filter is
selected, component (`PermissionsSyncJobsTable`) state is changed at it
is being re-rendered with new parameters, hence new GraphQL query is
sent.
Also, `refetch` call in `useEffect` was never made with the same reason
-- filters and GraphQL query variables were never different because of
component state update.
Test plan:
Local sg run and manual tests.
This PR mainly does two things to increase the visibility of Own:
- It adds to the landing page examples
(Slightly outdated, now replaces "get advanced" if own is on)
<img width="1299" alt="Screenshot 2023-02-26 at 04 48 53@2x"
src="https://user-images.githubusercontent.com/19534377/221391306-9dd679a9-9906-48fa-9731-84efae9c1122.png">
- And also adds a new banner to the Own panel, with a short description
of it and also more hints towards trying search, too.

I am not sure if we want to merge this ~as is or want to make more
changes, but we need to find _some_ consensus soon so I'm just putting
it out here and I'll let you comment what you think about it, how we
should adjust wording, and I shouldn't have removed another example to
make room for this one.
All of these things only appear when Own is enabled, so no one gets
confused. For non-enabled instances, the visibility should be solved by
an in-app page instead.
Closes https://github.com/sourcegraph/sourcegraph/issues/48518
Co-authored-by: Malo Marrec <malo.marrec@gmail.com>
- GraphQL APIs have to take IDs vs ints, so I adjusted that and also
allowed names now, which makes things a bit easier in src-cli
- Removed a redundant err.Wrap, that was rendering the same content
twice
This PR is autogenerated to update to
sourcegraph/zoekt@a4018300b2
## Test Plan
Testing is done on the zoekt repo. All checks on this PR are sufficient.
Co-authored-by: jhchabran <jhchabran@users.noreply.github.com>
The symbol tree has an input element that is `position: sticky;` which
caused issues when scrolling to elements inside the view.
We fix this by adding a `scroll-margin-top` to the node component.