Commit Graph

35119 Commits

Author SHA1 Message Date
James McNamara
0fd7e9e1da
REALLY ready really means REALLY ready (#60652)
* Added a ping before displaying banner

* added comment about NODE_TLS

* updated typing imports
2024-02-21 12:10:24 -08:00
Julie Tibshirani
c16806485f
Symbol search: support content-based lang detection (#60626)
The symbol service already stores each file's detected language. Now, when the
'search-content-based-lang-detection' feature is enabled, the symbols service
filters directly on the language column.

This PR doesn't update Rockskip, since it doesn't store the detected language.
2024-02-21 10:44:32 -08:00
Julie Tibshirani
4c873f8d0c
Searcher: fix optimization for empty patterns (#60646)
In #59331, we refactored the searcher logic to support AND/ OR patterns in
searcher. While doing so, we accidentally regressed on an optimization that
avoids loading file content when the pattern is empty.

We now have a benchmark for empty patterns, but this benchmark was added
recently and wasn't run during that refactor.
2024-02-21 08:43:58 -08:00
Bolaji Olajide
cd8624b604
release: activate 5.3.1 release (#60672)
activate 5.3.1 release
2024-02-21 11:30:38 -05:00
sourcegraph-buildkite
cd53aac64a
Auto-update Wolfi base images to latest (#60395)
Auto-update Wolfi base image hashes at 2024-02-21 03:10:40 UTC

Co-authored-by: Buildkite <buildkite@sourcegraph.com>
2024-02-21 11:07:06 -05:00
David Veszelovszki
f6cad1b29a
Replace /get-cody links with /cody/manage (#60636)
Replace three links
2024-02-21 07:42:51 -08:00
Varun Gandhi
63e6a6a967
Revert "syntax-highlighter: Turn off Rocket logging with QUIET=true (#60660)" (#60668)
This reverts commit c19a432ab7.
2024-02-21 16:46:01 +02:00
Rafał Gajdulewicz
aeb2a6523e
Store data about profanities and session control phrases (#60666)
* Store data about profanities and session control phrases

* Drop bools

* Extract const
2024-02-21 13:16:24 +00:00
Keegan Carruthers-Smith
3917262d6c
search: log stream.latency for zoekt aggregator (#60667)
Before this commit we only logged it searching actual instances.
However, we only send to honeycomb the aggregator. In practice this will
lead us to logging the time for the very first zoekt to respond.

Test Plan: go test
2024-02-21 14:42:03 +02:00
Varun Gandhi
c19a432ab7
syntax-highlighter: Turn off Rocket logging with QUIET=true (#60660)
With this change, we can remove the extra shell layer around the highlighter.
2024-02-21 17:11:04 +08:00
Varun Gandhi
078da74505
squirrel: Allow .hxx extension for C++ (#60662) 2024-02-21 17:10:50 +08:00
Keegan Carruthers-Smith
c252c33199
sg: bazelisk check skipped on nix develop (#60609)
If using nix develop we can defer to our nix environment correctly
installing bazel. In particular on linux nix directly installs the
correct version of nix and we do not use bazelisk.

Test Plan: "sg start enterprise-bazel" on nixos
2024-02-21 09:19:56 +02:00
Keegan Carruthers-Smith
fff4b48497
lib/output: ForceTTY can be used to disable Isatty (#60640)
For tests we do not want to use the detection on os.Stdout to change
what output we capture and assert against. In particular when running
the sg tests for me under emacs's compilation-mode I get failures due to
extra escape codes.

This is a different take on ensuring tests do not have Isatty enabled.
The previous attempt used the passed in writer to determine this.
However, on further inspection of call sites we somewhat regularly
captures the output and then only show it if something went wrong. In
those cases we should preserve Isatty of stdout so the errors look
prettier.

Test Plan: go test -short ./...
2024-02-21 09:18:06 +02:00
Julie Tibshirani
8379154d11
Searcher: return detected language (#60625)
For searches that hit Zoekt or the symbols backend, we return the file's
detected language through `result.File.PreciseLanguage`. Now, searcher will
also return the detected language whenever it's available. This value is used
in the search results filters panel, so it's important to be as accurate as
possible.

The precise language is only available when these criteria are met:
* The `search-content-based-lang-detection` feature is enabled -- we hope to
enable this by default soon
* The search contains a language filter, so we've already run language
detection

The PR also adds an optimization to run the expensive language detection
only after checking the search pattern.
2024-02-20 15:26:59 -08:00
Warren Gifford
6ac494eae2
Migrator Backfill Override (#60630)
* migrate just the upgrade test tooling from the original branch

* add backfiller override to store init

* address reviewer feedback

* remove testing from PR

* fix backfill unitt ttest to account for overrides
2024-02-20 11:42:04 -08:00
Dan Adler
20248590dc
remove ?utm_source=server for dotcom -> dotcom CTA link (#60648) 2024-02-20 11:31:16 -08:00
James McNamara
f4cf446ee6
Clean dist directory on build (#60629)
* clean dist directory on build

* reverted silly change
2024-02-20 10:26:52 -08:00
Erik Seliger
59a0cd27b5
Remove references to dropped columns (#60645)
These query paths weren't tested so didn't find them initially, although I tried to go over all search results for external_services and external_service_repos.

## Test plan

Went over the results again, these were the only two remnants I found.
2024-02-20 13:07:56 -05:00
Alex Isken
d8f456c1c4
Update Cody Enterprise plan (#60623)
* Update pricing for enterprise availability

* update

* Update client/web/src/cody/subscription/CodySubscriptionPage.tsx

* Fix tooltip

---------

Co-authored-by: Naman Kumar <naman@outlook.in>
2024-02-20 22:52:46 +05:30
Camden Cheek
2b17b1b5ae
Svelte: add display limit and content length limit (#60596) 2024-02-20 09:40:54 -07:00
Erik Seliger
e969d098c7
Remove unused user_id and org_id fields on external services and repos (#57271)
These fields were used in the cloud v1 implementation, but are no longer used. All the records have been removed from Sourcegraph.com. As a precaution, I've added ANOTHER round of deletes here.

Closes #43115
2024-02-20 16:35:59 +01:00
Philipp Spiess
bf6caac99d
Cody Gateway: Switch to unquantized StarCoder for MT (#60604) 2024-02-20 16:12:58 +01:00
Noah S-C
98e0f75d1e
bazel: use transitions to apply cross-compile platform automatically to oci_image (#60569)
Removes the need to pass `--config=docker-darwin` through the following mechanisms:

1. `--enable_platform_specific_config` to enable certain flags on macos only e.g. `--extra_toolchains @zig_sdk//toolchain:linux_amd64_gnu.2.34` and `--sandbox_add_mount_pair=/tmp` (see [.bazelrc change](https://github.com/sourcegraph/sourcegraph/pull/60569/files?file-filters%5B%5D=dotfile&show-viewed-files=true))
2. Apply a transition (using https://github.com/fmeum/with_cfg.bzl, please view [the following great video on it](https://www.youtube.com/watch?v=U5bdQRQY-io)) on `oci_image` targets when on the `@platforms//os:macos` platform to transition to the `@zig_sdk//platform:linux_amd64` platform. 
	- This will start at `oci_image` targets and propagate down to e.g. `go_{binary,library}` etc targets with the "transitioned" platform configuration, resulting in them being built with the transitioned-to platform
3. Remove `darwin_docker_e2e_go` config_setting and `darwin-docker` bool_flag.
	- These aren't necessary anymore, as the places where these were used were not in the transitive closure rooted at an `oci_image` target, meaning they wouldn't be transitioned.

To review, view [the following (filtered) files](https://github.com/sourcegraph/sourcegraph/pull/60569/files?file-filters%5B%5D=.bzl&file-filters%5B%5D=.sh&file-filters%5B%5D=.yaml&file-filters%5B%5D=No+extension&file-filters%5B%5D=dotfile&show-viewed-files=true)  along with [the root BUILD.bazel](https://github.com/sourcegraph/sourcegraph/pull/60569/files#diff-7fc57714ef13c3325ce2a1130202edced92fcccc0c6db34a72f7b57f60d552a3). All the other files are just changing the `load` statements from `@rules_oci` to `//dev:oci_defs.bzl`

## Test plan

CI, checked image locally and `sg test bazel-backend-integration` & `sg test bazel-e2e`
2024-02-20 13:57:56 +00:00
Rafał Gajdulewicz
a9446eee91
Remove unseen product-subscription tokens (#60585)
* rg/preconfigure_detecotr

* Chat only

* Comment

* Add https://github.com/TwiN/go-away/pull/80

* Bazel

* Update go.sum

* Remove

* Use a set

* remove testing overrides

* Log pattern

* bazel

* Latency + comments

* Comment

* Reorder seen

* Comment

* Switch set implementation

* Bazel
2024-02-20 13:37:27 +00:00
Erik Seliger
e9374c72a2
grpc: Bump streamio code to latest version (#60617)
As I dug into why we're allocating a ton of memory in io.Copy when forwarding the stdout from exec calls to the writer, I found that we allocate 128kb every time, while many calls actually only write 40 bytes (a commit SHA).

I then looked at gitaly and noticed that we use a very old version of their implementation.

So here we go, updating it to the latest.
Note that we currently don't need the NewSyncWriter, but I kept it anyways, maybe it reminds us of the importance if we ever need it.

List of commits from gitaly: https://gitlab.com/gitlab-org/gitaly/-/commits/master/streamio/stream.go?ref_type=heads

---

streamio: Implement synchronized writer
Writing to gRPC streams concurrently isn't allowed, which is why we need
to synchronize those writes. Doing so with the `NewWriter()` is
repetitive, so this commit implements a new function `NewSyncWrite()`
which receives a mutex in addition to the callback function. The mutex
is then locked and unlocked previous to invoking the callback.

---

streamio: Simplify implementation of ReadFrom
The ReadFrom implementation is quite hard to read as the loop depends on
state from the previous iteration. This commit refactors the code to not
do so anymore by always sending data if we've read something, even if
there was a read error.

---

streamio: Clarify why read errors are deferred
The implementation of `Read()` only returns read errors in case no data
is left in the buffer. This is required such that we correctly drain any
buffered data and only return the error when no data is left. This may
not be immediately clear, so this commit puts a comment on this and adds
a testcase which exercises this code path.

---

streamio: remove custom ReadFrom and WriteTo
This replaces sendWriter.ReadFrom and receiveReader.WriteTo with
trivial implementations based on io.Copy, to be removed in 14.0.

The purpose of the io.ReaderFrom and io.WriterTo interfaces is to
optimize away a buffer allocation in io.Copy, and/or being able to do
something smart like calling sendfile(2). Without them, io.Copy
allocates a 32KB buffer and reads into / writes from that buffer in a
loop.

The thing is, sendWriter.ReadFrom and receiveReader.WriteTo neither
make a difference for allocations, nor do they do something "smart".

First of all, sendWriter.ReadFrom was not helping the buffer
allocation efficiency because it allocated its own 128KB buffer. In
fact, sendWriter.ReadFrom is equivalent to what io.Copy does on the
inside, so we might as well let io.Copy do that.

That leaves receiveReader.WriteTo as a potentially useful
optimization. It does prevent io.Copy from allocating that 32KB
buffer. However, everytime it calls receiver(), gRPC allocat...

---

Remove streamio ReaderFrom and WriterTo
These were set to be removed in v14.

Changelog: removed

---

streamio.Reader: remember errors
If there has been an error, subsequent calls to Read should keep
returning that error.

Changelog: fixed

## Test plan

Verified locally that sourcegraph still works for basic clickops. CI will verify that archive fetching etc still behaves as previously.
I will take another look at the cloud profiler once this has been rolled out.
2024-02-20 14:32:36 +01:00
Rafał Gajdulewicz
5db9f52795
Instrument Cody Gateway Redis calls (#60637)
* Instrument gateway Redis

* Remove debugging

* Bazel

* No defer
2024-02-20 13:18:24 +00:00
Erik Seliger
9e56e961a9
perforce: Fix changelist host setting (#60628)
This seems to have been accidentally misnamed in the recent refactor to the p4 command pattern.

## Test plan

Code review, we currently cannot write perforce "unit" tests.
2024-02-20 12:22:44 +01:00
Naman Kumar
7cb1844795
Return better error and status code from dotcom refresh limits api (#60635) 2024-02-20 15:24:21 +05:30
Erik Seliger
6e8a2638e6
sg: Fix only flag (#60622)
Oh man.

## Test plan

Code review.
2024-02-19 20:51:19 +00:00
Julie Tibshirani
f2304ce396
Searcher: support precise lang filters (#60496)
This PR adds support for the `search-content-based-lang-detection` feature flag
to unindexed search. It introduces a new type of matcher called `langMatcher`
that uses go-enry to determine a file's language.

The PR is big, but it's broken into commits. Main pieces:
* Refactor `search_regex` to introduce a `fileLoader` object
* Add language matching using go-enry
* Introduce new `IncludeLangs` and `ExcludeLangs` fields so we can pipe
language filters directly to searcher

Most file changes are just due renaming `IncludePatterns` -> `IncludePaths`.
2024-02-19 12:28:41 -08:00
David Veszelovszki
89cf2f43b9
Re-add sign-in redirect with the redirectUrl as absolute URL (#60620) 2024-02-19 21:21:43 +01:00
Erik Seliger
4c6e924d9a
sg: Support only flag in sg ops update-images (#60621)
This adds a new flag that allows us to run `sg ops update-images --only='gitserver'` to update only the image of a specific service.

## Test plan

Code review.
2024-02-19 21:15:33 +01:00
Erik Seliger
b821614de7
Revert PRs that broke dotcom signup page (#60619)
* Revert "Fix redirect (#60614)"

This reverts commit 44c4f2ccf4.

* Revert "Set returnTo when redirecting to a third-party auth provider on dotcom (#60508)"

This reverts commit ab9050fae2.
2024-02-19 19:51:51 +00:00
Erik Seliger
b229de696e
gitserver: Small code cleanup (#60573)
- App is no longer, and janitor really has to run, we shouldn't comment it out
- Tree test double-initialized the gitserver
- Removed duplicate reponame variable

## Test plan

Small code style changes, CI will find issues.
2024-02-19 19:27:34 +01:00
David Veszelovszki
44c4f2ccf4
Fix redirect (#60614) 2024-02-19 19:07:00 +01:00
Taiyab Raja
70cacb867d
Search results: Update filter actions background (#60548)
Update filter actions background.
2024-02-19 16:29:01 +00:00
Noah S-C
7302f01227
executors: fix path to aws_regions.json in ami.push targets (#60612)
Bazel ami.push targets were missing the file and pointing at wrong location

## Test plan

Tested manually on buildkite agent by @jhchabran 

![image](https://github.com/sourcegraph/sourcegraph/assets/18282288/6a269f0e-9d40-45b3-9019-06cc67578953)
2024-02-19 15:42:58 +00:00
Noah S-C
4d76a70fa2
scripts: dont run subshell in for loop (#60611)
For same reason as https://github.com/sourcegraph/sourcegraph/pull/60610, cleaning up the remaining scripts

## Test plan

https://stackoverflow.com/questions/44014857/function-invocation-in-for-loop-does-not-fail-even-with-set-e
2024-02-19 14:48:33 +00:00
Naman Kumar
b771497115
Remove strikethrough (#60606) 2024-02-19 20:10:38 +05:30
Noah S-C
da34d5a2ce
executors: fix AMI push script for when aws_regions.json missing (#60610)
Causing error to not cause the script to fail if the file was missing

## Test plan

https://stackoverflow.com/questions/44014857/function-invocation-in-for-loop-does-not-fail-even-with-set-e
2024-02-19 14:35:27 +00:00
Erik Seliger
a050df2a07
Cleanup internalapi after gRPC migration (#60572)
We no longer need this endpoint. Also found a few other things related to internalapi on the way that could use a cleanup.

## Test plan

Integration tests should verify that conf works just as before.
2024-02-19 14:13:26 +01:00
Keegan Carruthers-Smith
4165adc4de
syntax-highlighter: use tini and entrypoint script (#60607)
All our containers should be using tini as PID 1 to cleanup zombies. In
the case of syntax-highlighter we did not. Additionally we did some
janky inline shell script so we could inject the $WORKERS envvar as an
argument.

This commits moves the janky script into an entrypoint script and calls
it via tini. Additionally it uses exec so we don't have a parent shell
messing with signals.

I picked the name syntect_server_entrypoint since I had some concerns
this file would end up in the server docker image, so wanted to give it
a unique name. This may make it possible for us to use this script as
well in server if we choose to.

Test Plan: built the image and ran it. Then checked we had the process
running with child workers correctly.

  bazel build //docker-images/syntax-highlighter:image_tarball
  docker load --input $(bazel cquery //docker-images/syntax-highlighter:image_tarball --output=files)
  docker run --rm=true syntect-server:candidate

Then on the running container:

  $ docker exec trusting_leavitt ps aux
  PID   USER     TIME  COMMAND
      1 root      0:00 /sbin/tini -- /syntect_server_entrypoint.sh
      7 root      0:00 /usr/local/bin/http-server-stabilizer -listen=:9238 -prometheus-app-name=syntax_highlighter -workers=4 -- env ROCKET_PORT={{.Port}} /syntect_server
     14 root      0:02 /syntect_server
     15 root      0:02 /syntect_server
     17 root      0:02 /syntect_server
     18 root      0:02 /syntect_server
    157 root      0:00 ps aux
2024-02-19 14:48:37 +02:00
Michael Lin
8516943ac9
msp: always route traffic to the latest revision on deploment (#60579) 2024-02-17 02:00:05 +00:00
Noah Berman
17db364ab0
Remove errant comma from scim_postman_collection.json (#60593)
Removed a comma that prevents Postman from importing the collection as valid.
2024-02-16 13:47:16 -05:00
Varun Gandhi
41c5bad478
release: Remove indexer updates from release process (#60578)
The Graph team can handle updating the SHAs on an as-needed
basis, similar to how it is done on the main branch.
2024-02-16 14:17:31 +00:00
Noah S-C
19d9cfc73b
bazel: native go-mockgen in Bazel (#60386)
Adds a new:
- gazelle generator
- rule + rule targets + catchall target
for generating go-mockgen mocks & testing for their being up-to-date.

Each go_mockgen macro invocation adds targets for generating mocks, copying to the source tree, as well as testing whether the current source tree mocks are up-to-date.

How to use this: `bazel run //dev:go_mockgen` for the catch-all, or `bazel run //some/target:generate_mocks` for an individual package, and `bazel test //some/target:generate_mocks_tests` to test for up-to-date-ness. There is no catch-all for testing

This currently uses a fork of go-mockgen, with an open PR for upstream here: https://github.com/derision-test/go-mockgen/pull/50.

Closes https://github.com/sourcegraph/sourcegraph/issues/60099

## Test plan

Extensive testing during development, including the following cases:
- Deleting a generated file and its entry in a go_library/go_test `srcs` attribute list and then re-running `sg bazel configure`
- Adding a non-existent output directory to mockgen.test.yaml and running the bash one-liner emitted to prepare the workspace for rerunning `sg bazel configure`

The existing config tests a lot of existing paths anyway (creating mocks for a 3rd party library's interface, entries for a given output file in >1 config file etc)
2024-02-16 13:26:48 +00:00
William Bezuidenhout
235781a3e7
backcompat: make step non-async (#60582)
* backcompat: make step non-async

* update tag to 5.3.0

* gracefully handle if key is missing in json

* remove removed targets

* fix emoji
2024-02-16 14:05:27 +02:00
Rafał Gajdulewicz
df68d1f23d
Preconfigure NSFW detector + only run for Chat/Commands (#60565)
* rg/preconfigure_detecotr

* Chat only

* Comment

* Add https://github.com/TwiN/go-away/pull/80

* Bazel
2024-02-16 10:53:31 +00:00
Petri-Johan Last
fb8bc1fd1e
Add exclude repo functionality for azure devops and gerrit (#60509) 2024-02-16 11:39:59 +02:00
Varun Gandhi
e78f468b8a
build: Update snapshot outputs when updating SHAs (#60542)
This avoids test failures when updating the SHAs.
2024-02-16 01:54:34 +01:00