Directly constructing a DSN is incorrect, since the user may have just
specified a DSN. Instead we need to copy over from the same format that
the user specified for connecting to frontend. This is the same approach
use by codeintel.
Test Plan: sg start enterprise-codeinsights works on my machine (did not
before).
* adding originalReferrer to our events
adding original referrer which is cookie name "_mkto_referrer" as our original referrer
* updated to remove omitEmpty clause
* new name reference fix
* refactored code
* fix to maintain string type (flagged by buildkite)
* fixed undefined value issue for originalReferrer
* refactoring to make sg lint happy
* Creating cookie `originalReferrer` and updated getOriginalReferrer func
* Update client/web/src/tracking/eventLogger.ts
Co-authored-by: Brett Hayes <bretthayes@users.noreply.github.com>
* run sg-prettier :D
* adding SessionReferrer as a field we collect
* Satisfied Sg Lint 🚀
* Update client/web/src/tracking/eventLogger.ts
Co-authored-by: Brett Hayes <bretthayes@users.noreply.github.com>
* Update client/web/src/tracking/eventLogger.ts
Co-authored-by: Brett Hayes <bretthayes@users.noreply.github.com>
* adding `sessionFirstUrl` to our events
* code cleanup
* logic fixes to make sure cookies are being set and values returned properly
* sg lint
* fix `sessionFirstUrl` to `sessionFirstURL`
* bug fix
Co-authored-by: Brett Hayes <bretthayes@users.noreply.github.com>
As Quinn noted in an earlier PR, if `/data` is not writable by the container
then we encounter these errors:
- `failed to create bucket: operation error S3: CreateBucket, https response error StatusCode: 403` from the precise-code-intel-worker service
- `sendSimpleErrorResponse: 403 AccessDenied Forbidden` in the blobstore Docker container logs
Docker inherits the permissions of the folder if it is created in the Dockerfile
and I forgot to include the creation of the `/data` folder previously. Fixing
this means we don't e.g. have to manually correct permissions in Docker Compose
or pure-docker deployment types.
Signed-off-by: Stephen Gutekanst <stephen@sourcegraph.com>
* db schema and graphql schema updates
* default contexts backend
* query for stars
* backend for settings stars and defaults
* sg generate
* fixes?
* add foreign keys
* idempotent constraints
* again
* search contexts: remove autodefined contexts from frontend, add to normal query (#44875)
* search contexts: remove autodefined contexts from frontend, add to normal query
* generate
* remove real global context, use union with dummy row instead
* fix some tests
* fix CountSearchContexts
* add test for CountSearchContexts
* search contexts: order contexts list by default first, then starred, then others (#44876)
* search contexts: order contexts list by default first, then starred, then others
* generate mocks
* Add test for new order
* explicit select and remove unused scan var
* simplify getting authenticated user
* fix go lint
* unit test for default contexts
* tests for starred contexts
* change graphql api to take user as param, add tests for this
* update db schema to make contraints prettier
* clean up db keys
* search contexts: update header in list page (#44966)
* search contexts: update header
* add back tab
* fix spacing
* fix action button width
* search contexts: table view in management page (#45001)
* search contexts: update header
* search contexts: table view in management page
* add menu
* fix build failure
* add back tab
* fix spacing
* fix action button width
* address minor issues from figma
* search contexts: card view for mobile (#45040)
* search contexts: card view for mobile
* fix build failure
* give up on sr-only mixin
This PR implements (finally) the no cache flag on the execute endpoint. This means that we can finally allow not refreshing the workspace preview when the checkbox is toggled. For long-running workspace resolutions (like our scaletesting) this is a gamechanger to me (maybe just me who almost always runs without cache because I test execution a lot, but hopefully also someone else 😬).
This also changes a bit how we handle this flag as well:
We don't skip cache checking when no_cache is set anymore, so that the UI always reflects the cache status and you can simply say "don't use it" - this feels more expected to me than some checkbox that lives outside the spec that would modify the workspaces list.
So now the only thing that the workspace resolution does is setting the no_cache flag on the batch spec.
When the batch spec is executed, we check that field, or optionally overwrite it, if set in the mutation arguments.
The field on the createFromRaw,replaceInput mutations is now mostly there to forward that flag to the execute step once we have implemented autoApply and is not used from the UI for now.
The panic was unnecessary (and prevents us from running multiple services in the same process, which is an experimental goal of mine as part of creating a single Go static binary distribution of Sourcegraph).
We can reduce code duplication here since we have the same handler copy
pasted 4 times. Motivated by an open PR which wanted to add a new
condition to the handler.
Test Plan: go test
* bazel: move generateGraphQlSchema.js to client/shared/dev and share code with legacy gulp build
* bazel: move generateSchema.js to client/shared/dev and share code with legacy gulp build
Why:
The docs currently suggest to comment out the docker pull command for
the syntax-highlighter image if OFFLINE=true. Instead of making devs go
through this process, skip the docker pull command if OFFLINE=true is
already set.
Better DevX. Win win.
[1]: https://docs.sourcegraph.com/dev/background-information/sg#offline-development
In a few places we have different patterns around pagination:
- Passing a closure in
- Returning a cursor for the client to use
- Just collect everything into a big slice
Other go libraries often will setup pagination patterns / use
interfaces. The API I quite like is the stripe-go one which is minimal
and reminds me a lot of Scanner from the stdlib. You just do something
like
for it.Next() {
doSomething(it.Current())
}
if it.Err() != nil {
handle
}
I imagine if we had this interface a few useful methods like
Map[A,B](func(A() B, Iterator[A]) Iterator[B]
Collect(Iterator[T]) ([]T, error)
etc. Basically could implement the same functions as present in
https://pkg.go.dev/golang.org/x/exp/slices
* Add complete call stack generation on the back end
* Add complete call stack display on the front end
* Sort headers alphabetically on the front end
* Add changelog item
This introduces a new progress message for when a zoekt backend goes
down. Previously we silently ignored this event, but now we atleast
communicate it. The first target for this is to let code insights retry
when this occurs.
Test Plan: updated unit tests
This is a copy-and-paste of the enterprise/cmd/repo-updater enterprise service constructors to a shared package so that the enterprise repo-updater can be invoked from a different entrypoint. There are no logic changes.
The `search.index.enabled` site config setting defaults to true for all deployment types (and has for ~2 years). It was possible to set `"search.index.enabled": false` in site config.
But this was broken; searches with `index:no` would show no results, and normal searches would show an error about index search being disabled. This setting made the instance completely unusable, so it is highly unlikely any instances were actually using it.
The need for this setting has also gone down dramatically with many more years of experience running indexed search at scale on many instances. If we need to bring back the ability to disable indexed search, we should reimplement it (because many code paths did not properly respect this setting).