Commit Graph

33498 Commits

Author SHA1 Message Date
Jean-Hadrien Chabran
5cc0ebefd7
sg: disable docsite from default start target (#57823) 2023-10-23 19:29:40 +00:00
Jason Hawk Harris
50bc4e8494
Code Navigation: remove extra column in gutter (#57816)
remove extra column in gutter
2023-10-23 14:06:05 -05:00
Quinn Slack
de613e92b6
use esbuild for client/web builds (#57365)
Use [esbuild](https://esbuild.github.io/) instead of Webpack for builds of `client/web`, for faster builds (dev and prod) and greater dev-prod parity. This PR completely removes all use of Webpack in this repository.

`client/web` is the last build target that still uses Webpack; all others have been recently migrated to esbuild. Most devs here have been using esbuild for local dev of `client/web` for the last 6-12 months anyway. The change here is that now our production builds will be built by esbuild.

All sg commands, integration/e2e tests, etc., continue to work as-is. The bundlesize report will take a while to stabilize because the new build products use different filenames.

## Benchmarks

Running `pnpm run generate && time pnpm -C client/web run task:gulp webBuild` and taking the `time` output from the last command:

- Webpack: 62.5s
- esbuild: 6.7s

Note: This understates esbuild's victory for 2 reasons: (1) because esbuild is building both the main and embed entrypoints, whereas Webpack only builds the main entrypoint in this benchmark) and (2) because a lot of it is in the fixed startup time of `gulp`; esbuild incremental rebuilds during local dev only take ~1s.

## Notes

We no longer use Babel to produce web builds (we use esbuild), so we don't need any Babel plugins that optimize the output or improve browser compatibility. Right now, Babel is only used by Jest (for tests) and by Bazel as an intermediate step.
2023-10-23 10:59:06 -07:00
William Bezuidenhout
7d4ba7f4c9
ci: let runtype.ManuallyTriggered execute the same build as PR (#57811) 2023-10-23 19:29:42 +02:00
Matt Leathes
49b60e2b2f
Updates to 'Installing Cody in VS Code' (#57036)
Update install-vscode.md

To:
- fix typo 'sugsgestions'
- add missing word 'extension' to 'set up the Cody within your VS Code environment'
- fix indentation

Co-authored-by: Justin Dorfman <justin.dorfman@sourcegraph.com>
2023-10-23 16:27:08 +00:00
Erik Seliger
ccb14e2039
Add changelog entries about removal of GitHub proxy (#57753)
Closes https://github.com/sourcegraph/sourcegraph/issues/55290
2023-10-23 16:15:39 +02:00
Jean-Hadrien Chabran
e8919ada26
bzl: rework how we populate the database schemas for migrator (#57591)
Co-authored-by: William Bezuidenhout <william.bezuidenhout@sourcegraph.com>
2023-10-23 15:40:09 +02:00
Quinn Slack
dc5fc43d22
fix storybook inferred default export types (#57785)
Fixes `tsc --build` errors of the form:

```
error TS2742: The inferred type of 'default' cannot be named without a reference to '.pnpm/@storybook+types@7.4.6/node_modules/@storybook/types'. This is likely not portable. A type annotation is necessary.
```
2023-10-23 05:12:16 +00:00
Quinn Slack
0452361969
fix storybook types (#57784)
Use StoryFn instead of Story (which is deprecated and unresolvable, causing a type error).
2023-10-22 21:59:45 -07:00
sourcegraph-bot-devx
9a787d9e35
chore: update third-party licenses (#57783)
Co-authored-by: bobheadxi <bobheadxi@users.noreply.github.com>
2023-10-23 06:59:30 +02:00
Varun Gandhi
a599dec3fa
client: Link to glob syntax for tags/branches/repos (#57356) 2023-10-23 01:59:52 +00:00
Quinn Slack
a2e9b12cc9
disable eslint rule etc/no-deprecated for massive file save speedup (#57782)
With this rule enabled, saving a file in VS Code often takes 2-5 seconds or longer. With it disabled, saving a file is usually instant.

This rule is identified as the biggest culprit in slow eslint analysis by running `TIMING=1 pnpm exec eslint --fix client/web/dev/server/development.server.ts`.
2023-10-21 12:37:49 -10:00
Quinn Slack
10d0224bbc
fix passing multiple args to jest --testPathIgnorePatterns (#57780)
To pass multiple ignore patterns to Jest, you need to use `--testPathIgnorePatterns pattern1 --testPathIgnorePatterns pattern2 ...`. Otherwise, `--testPathIgnorePatterns pattern1 pattern2` treats `pattern2` as a test pattern to run, not to ignore.

The consequence of this is that some npm scripts and CI steps were running tests that they didn't need to run.
2023-10-21 21:40:10 +00:00
Quinn Slack
746dd5e863
un-hardcode $DISPLAY for e2e tests to support non-headless local e2e test running (#57781)
This makes it possible to run e2e tests locally on Linux and use the current $DISPLAY for the non-headless browser.
2023-10-21 11:29:35 -10:00
Quinn Slack
4aa1a1df47
add sg test bazel-web-integration (#57779) 2023-10-21 11:29:09 -10:00
Quinn Slack
d83b9eee38
rename “experimental query input” to v2 and remove beta flag (#57590)
The “v1” query input remains the default. But now the code and settings refer to the new (formerly “experimental”) query input as “v2”. If `experimentalFeatures.searchQueryInput` is set to `experimental`, it will behave as though it is set to `v2`.
2023-10-20 20:56:21 -10:00
Vova Kulikov
c8a1011e80
[Repository Pages]: Fix Cody chat sidebar layout (#57772)
* Fix Cody chat sidebar layout

* Fix eslint problems
2023-10-20 15:38:02 -07:00
Keegan Carruthers-Smith
298ec6008c
release: 5.2.2 config and CHANGELOG for 5.2.1 (#57716) 2023-10-20 17:42:47 -04:00
Aditya Kalia
329d3b1fc9
update url redaction logic for cloud vs dotcom (#57384)
* remove redaction from cookie urls

removes redaction from url cookies as we no longer host private code on sourcegraph.com

* Update eventLogger.ts

* Update eventLogger.ts

* Update eventLogger.ts

* Update eventLogger.ts

* expand the logic to all marketing fields

* add additional subdomain regex filtering since isSourcegraphDotComMode is flagged on customer instance's too

* if the site_id is anything other than sourcegraphWeb, have all urls go through redaction

* update tests to test logic between cloud instances and dotcom

* add list of approved hosts where we do not redact from

* sg lint

* update redaction to only happen in one place, send redacted urls to BQ for extra measure and add tests

* sg lint

* add more test cases + re-add URL redaction on cookie side

* bazel fix

* revert referrer logic since referrer is not captured on events_usage

* updated logic to handle referrers on cloud instances + redact session_first_url as a safe measure

* add redaction to sesion_referrer and to originial_referrer to future-proof against ELE

* Migrate URL redaction to backend

refactor: Remove frontend URL redaction
Removed the frontend URL redaction logic in eventLogger.ts for firstSourceURL, lastSourceURL, originalReferrer, sessionReferrer, and sessionFirstURL. This redaction will now be handled in the backend.

Removed calls to redactSensitiveInfoFromAppURL and related cookie logic in eventLogger.ts. URL redaction is now consolidated in the backend.

* Update event_handlers_test.go

Update redaction test for referrer logic. Should only apply to managed instances since we have this clause in the function:

```
	if envvar.SourcegraphDotComMode() {
		return rawURL, nil
	}

* fix ineffectual assignment to err

* remove `redactSensitiveInfoFromAppURL` + update dotComModeVariable

since migrating redaction to backend, can remove this function + update ref to dotComVariable

* the `redactSensitiveInfoFromCloudURL` now only takes the first part of the path and redacts all query parameters except UTM

* undo redaction for referrer values + add comment on redaction

* Apply suggestions from code review

Co-authored-by: Dan Adler <dadlerj@users.noreply.github.com>

* update url path redaction logic and associated tests

* read cookie value only when its confirmed to be dotcom mode (optimization)

---------

Co-authored-by: Dan Adler <dadlerj@users.noreply.github.com>
2023-10-20 12:36:34 -04:00
Erik Seliger
819e8c6fc1
Bump p4-fusion to latest version in gitserver (#57754)
---------

Co-authored-by: ggilmore <geoffrey@sourcegraph.com>
2023-10-20 18:14:42 +02:00
Dan Adler
de3f1cd2ec
Add service type to auth event logs (#57646)
* Add service type tracking to auth related events to identify gaps
2023-10-20 08:42:27 -07:00
Erik Seliger
c4557864e5
Revert "Make sub-repo permissions integration test functional (#57764)" (#57771)
This reverts commit 7f3e4755bd.

It seems to time out.
2023-10-20 14:39:02 +00:00
Erik Seliger
fd13638706
Remove repoRefresh endpoint (#57730)
In an attempt to simplify the set of ways a repo might be scheduled for an update, I found this endpoint and believe it isn't used and that it shouldn't be needed. We have all this in the UI as well, no need to expose a separate HTTP endpoint that doesn't even seem to have admin restrictions.
2023-10-20 16:07:32 +02:00
Erik Seliger
7d8cfe09ef
Remove dead code path that triggered EnqueueRepoUpdate (#57733)
Found that we always pass true here, so no need to keep this code and this perceived dependency on repo-updater.
2023-10-20 16:07:21 +02:00
Erik Seliger
b843deab41
gopackages: Don't keep zip file in memory (#57736)
This aligns what we do for Go with what we do for python, writing a zip file to disk.
This should prevent big memory spikes when large go modules are downloaded.
2023-10-20 16:07:11 +02:00
Erik Seliger
d311834a8f
p4fusion: Use better default values (#57737)
These numbers have proven much more performant in local testing, so I propose that we modify the defaults here.
2023-10-20 16:06:56 +02:00
Petri-Johan Last
7f3e4755bd
Make sub-repo permissions integration test functional (#57764) 2023-10-20 13:27:17 +00:00
Will Dollman
0d1cbc9626
Fork p4-fusion package and update in server + gitserver (#57762)
Combine #57751 and #57756 to fork p4-fusion into a separate package, and update relevant images.

We've forked the tool and are now ready to try some of the fixes out in a more production enviroment, so bundling this temporarily from a specific commit from the fork repo.

Next up, I'll open a PR to use the newly generated base image in bazel and add the new --noBaseCommit flag to the perforce syncer.

---------

Co-authored-by: Erik Seliger <erikseliger@me.com>
2023-10-20 15:23:51 +02:00
Will Dollman
c14cfdfe9f
docs: Document Sourcegraph Secret Formats (#57722)
Document sourcegraph secret formats
2023-10-20 14:05:28 +02:00
Felix Kling
a4ff8b0040
web: Consolidate server and client side feature flag overrides (#57663)
It turned out that we have two different ways of overriding feature
flags:
- `?feat=foo` overrides the feature flag on the server for this request
- `?feature-flag-key=foo&feature-flag-value=true` overrides the feature
  flag on the client side only and persists the setting in local storage

This commit does three things:

1. It consolidates the two systems. `feature-flag-{key,value}` have been
   removed in favor of `feat`. The client side logic will now use the
   same parameter. An additional prefix has been added, `~` to indicate
   the client to remove the override.
2. The header logic for GraphQL queries has been reworked to include
   headers for overridden feature flags. This ensures that the server
   uses the same overrides as the client.
3. The developer settings dialog and navbar entry now feature a reload
   button which appends `flag` to the current URL for overridden feature
   flags and reloads the page. Additionally the keyboard shortcut for
   reloading the page (`Mod-r`) is hijacked to perform the same action.
   NOTE: Unlike the first two, this functionality is only available in
   development builds.
2023-10-20 12:34:19 +02:00
Will Dollman
6d604319bc
security: Update access token format (#56772)
Implement RFC 837 https://docs.google.com/document/d/1aC4gHB8Q5lurwVhc8SCxznR0blNJMKo7yIkpP7WShno/edit.

This change will update our access token format to `sgp_<instance_identifier>_<40_char_access_token>`, allowing access tokens to be securely tied back to instances

This will initially be disabled behind a feature flag until Cody extension updates have been rolled out to users.
2023-10-20 11:29:07 +01:00
Will Dollman
69bb847bd9
sg: fix sg wolfi image builds (#57760)
Pass workdir to docker apko image

This previously defaulted to /work, but seems to have changed in a recent image update
2023-10-20 09:02:08 +00:00
Jean-Hadrien Chabran
1f60607c16
local: exclude generated files from pre-commit (#57761) 2023-10-20 08:19:40 +00:00
Anton Sviridov
39a12bcd7b
Java queries for local navigation (#57620) 2023-10-20 08:07:33 +01:00
Varun Gandhi
7258c7779c
chore: Delete cmd/sitemap (unused code) (#57361)
In the future, if we want to generate and upload these automatically,
we can restore the code from git history.
2023-10-20 14:16:43 +08:00
Quinn Slack
d1ae5ab487
fix extra args handling in sg (#57758)
When running `sg test <target> extra-arg1 extra-arg2 ...`, the extra args are generally appended to the `<target>` command on a new line, which means the extra args are interpreted by the shell as their own command. The user's intent is for them to be appended to the last command in the `<target>` command string, which this commit achieves by trimming trailing whitespace.
2023-10-19 21:11:59 -07:00
Erik Seliger
7fd4554d91
Remove github-proxy docker build (#56650)
We're not distributing this any longer as it's unused, so let's remove it!
2023-10-20 05:07:20 +02:00
Erik Seliger
d338753551
Bump p4-fusion to version of our fork (#57751)
We've forked the tool and are now ready to try some of the fixes out in a more production enviroment, so bundling this temporarily from a specific commit from the fork repo.

Next up, I'll bump it in the gitserver image and add the new `--noBaseCommit` flag to the perforce syncer.
2023-10-20 01:50:44 +02:00
Erik Seliger
8d292b33f2
Remove unused field in site config (#57734)
This has been removed long ago, but seems like we forgot to remove this field from site config.
2023-10-19 23:36:47 +02:00
Erik Seliger
288c58fed4
Revert "Add temporary logging to dotcom sudo handler (#56429)" (#57749)
This reverts commit aa8c53f43b.
2023-10-19 20:54:56 +00:00
Jason Hawk Harris
43bf93c68a
Search: enable repo:has.topic() for GitLab (#57649)
* add has.topic support for gitlab
* doc and changelog update
* fix hover predicate to include gitlab
* schema updates
2023-10-19 20:46:56 +00:00
Maedah Batool
f57ce17238
Add follow-up feedback to Core Concepts (#57752) 2023-10-19 13:24:28 -07:00
Robert Lin
a9f2ba5e46
telemetrygateway: support arbitrary privateMetadata types from graphqlbackend (#57741)
The bug fix in #57719 (backported in #57720) fixed support for the common case, a JSON object `privateMetadata`, but the GraphQL schema describes that any valid JSON should be accepted, and GraphQL validation permits primitives like `string`:

![image](https://github.com/sourcegraph/sourcegraph/assets/23356519/657a023c-876a-46dc-a768-eba3af820ef2)

This change improves on #57719 with support for arbitrary types in case they get submitted. Similar to #57719, this is not a customer-affecting bug today as there are no usages, but it is important we land this fix to minimize the impact of this bug as we introduce usages like https://github.com/sourcegraph/cody/pull/1192.

The diff is mostly tests, as the fix is fairly minimal.

## Test plan

- [x] Updated unit tests assert that the GraphQL library we use does indeed accept incoming types as the equivalent Go type in `JSONValue.Value`
- [x] Updated unit tests assert that marshalling of arbitrary types to proto works as expected
- [x] Manual testing with `sg start` demonstrates GraphQL requests with arbitrary `privateMetadata` types are accepted: 
![image](https://github.com/sourcegraph/sourcegraph/assets/23356519/946b9ca2-8afd-479a-833b-85478542454c)
![image](https://github.com/sourcegraph/sourcegraph/assets/23356519/59aea94a-02f5-4ad6-8d1e-633ee091dd37)
![image](https://github.com/sourcegraph/sourcegraph/assets/23356519/fe62e257-1c70-4e46-ab88-4eb445f9009e)
2023-10-19 13:08:59 -07:00
Robert Lin
9009bb3d04
monitoring/telemetry: un-hide panels, improve docstrings (#57740) 2023-10-19 12:52:21 -07:00
Erik Seliger
29fbcfb868
Make repo settings pages available for uncloned repos (#57609)
The repo settings pages contain a bunch of useful information for repos even when they aren't cloned yet - like log outputs, corruption logs, and ways to exclude the repo from cloning.
Thus, it should be visible before the repo is cloned successfully.
This also consolidates mirroring and options into one menu, like discussed.
2023-10-19 21:15:16 +02:00
Geoffrey Gilmore
8acc71a840
conf: enable Prometheus to sample the lastUpdateTime metric concurrently with the actual config update process (#57747) 2023-10-19 19:14:43 +00:00
Erik Seliger
a3ac809415
goroutine: Don't silently stop after panic (#57675)
If the handler function of a periodic goroutine panics, the handler silently dies. I don't see a panic error log, and it is never invoked again.

After discussing this on Slack, we concluded that periodic routines are most often part of a background job and that they shouldn't take down entire services when a single component misbehaves. Instead we treat them as an error in that component, which will surface in logs and the background jobs UI.

See https://sourcegraph.slack.com/archives/C02UC4WUX1Q/p1696960510011339 for the discussion to go with this behavior.
2023-10-19 20:57:27 +02:00
Erik Seliger
e0dfb08b81
uploadstore: Don't read AWS config for blobstore backend (#57431)
Before this change, we would try to read AWS config files on disk and talk to the metadata server to get a role assumption. That was super unnecessary and meant that Sourcegraph wouldn't start up properly when AWS was misconfigured locally, although we never actually needed to talk to AWS.

Closes https://github.com/sourcegraph/sourcegraph/issues/56599
2023-10-19 20:37:18 +02:00
Felix Kling
b16f8adf32
bext: Fix SG button in file page header (#57695)
For reasons unknown I looked at the browser extension. This seems to fix the issues of showing the "open in sourcegraph" button in the file header.

I modified the E2E test to make hovercard testing optional so that we can at least test the toolbar button.

Addendum: I also updated the pipline generate to run browser extension tests when code inside client/browser/ changes.
2023-10-19 17:04:50 +02:00
Will Dollman
7c413be89b
docs: add how-to for revoking access tokens (#57708)
Document how to revoke an access token
2023-10-19 11:26:12 +00:00