Updating the `cody-web-experimental` package to the latest version which
- Fixed problems with telemetry (now we send agent level of telemetry
events with `Web.Cody` client name)
- Fixed remote repository context as you switch between chats
- Added support for cody context filters in file and symbols mentions
- Improved link rendering for remote files (no more "remote-file://"
protocol prefixes.
Also, this PR adds some missing CSS token overrides for the LLM picker
on dotcom.
Note: I, by accident, pushed the `0.2.2` version with the same build as
I have published already in `0.2.1`. NPM doesn't allow to override the
build with the same version, so I had to publish 0.2.3 to make it
through to the Sourcegraph repo. This is why we jump from 0.2.1 to 0.2.3
## Test plan
-General manual checks for Cody Web
Closes SRCH-706
Previously the success notice would appear in the commit signing area of
the site admin, even if we create a github app for regular code host
stuff. This PR fixes it.
It also udpates the partial storage key of the notice, so that it will
reappear if we create more apps.
## Test plan
Manual testing
## Changelog
<!-- OPTIONAL; info at
https://www.notion.so/sourcegraph/Writing-a-changelog-entry-dd997f411d524caabf0d8d38a24a878c
-->
We now have the `gitHubApp` field that can be used instead.
`isGitHubApp` was only introduced as part of the batch changes
integration with github app, and is therefore not released yet.
Closes SRCH-704
## Test plan
Manual testing
## Changelog
<!-- OPTIONAL; info at
https://www.notion.so/sourcegraph/Writing-a-changelog-entry-dd997f411d524caabf0d8d38a24a878c
-->
---------
Co-authored-by: Bolaji Olajide <25608335+BolajiOlajide@users.noreply.github.com>
Based on #63677
Closes srch-691
Closes srch-695
This adds the cody button to the repo "home page" so that cody can be
opened from there.
This commit also makes it so that the cody button is hidden when the
sidebar opens (like in the React app) and it adds a fixed height to the
various headers so that they align well with the sidebar header and
don't change size when the cody button is hidden when the sidebar is
open.
## Test plan
Manual testing.
This commit updates cody web, making similar changes as
[ed493c9](ed493c9dd1)
and a81d5e7. I wasn't quite sure about some styles, but I left comments
on the respective PRs and tried to at match the styling.
Most importantly this also fixes cody web in the Svelte app which
currently appears to be broken. I'd like to get this in as quickly as
possible (hence stampers), styles can always be tweaked later.
Additional changes:
- Fixed layout (chat container was overflowing).
- Set font family and size to the same we use in the Svelte app for
consistency.
## Test plan
Manual testing.
This is part of the Keyword GA Project.
Batch Changes uses Sourcegraph queries to define the list of repositories on which the batch change will run.
With this change we default to pattern type "keyword" instead of "standard".
To make this a backward compatible change, we also introduce a version identifier to batch specs. Authors can specify `version: 2` in the spec, in which case we default to pattern type "keyword". Existing specs (without a specified version) and specs with `version: 1` will keep using pattern type "standard".
Notes:
- Corresponding doc update [PR](https://github.com/sourcegraph/docs/pull/477)
- We don't have a query input field, but instead the query is defined in a batch spec YAML. It didn't feel right to edit the YAML and append "patternType: " on save, which is what we do for Code Monitors and Insights.
- I misuse the pattern type query parameter to effectively override the version. Once we introduce "V4" we should come back here and clean up. I left a TODO in the code.
Test plan:
- New and updated unit tests
- manual testing
- new batch changes use `version: 2` by default.
- using an unsupported version returns an error
- I ran various "on:" queries to verify that version 2 uses keyword search and version 1 uses standard search.
This commit adds support for cody ignore settings to the SvelteKit app.
When cody is disabled on the instance or for the user, the cody button
and sidebar are not shown anymore.
Likewise if the repository is excluded from cody, the buttons and
sidebar are not shown.
The implementation was inspired by `useCodyIngore.ts`, but simplified
for use in the SvelteKit app. It seems that the file exclusion logic is
not actually used for the sidebar and thus was omitted. It also seems
that for the sidebar itself we are only checking whether the current
repository is excluded or not, which lets us simplify the whole setup
and simply pass a boolean (store) from the data loader, indicating
whether cody is enabled or not.
Furthermore I introduced zod to validate that the value of
`codyContextFilters.raw`, which is typed as `JSONValue`, has the
expected shape. We've run into issues in the past where such values have
just been cast to the expected Typescript type. zod adds runtime
validation.
Note that we use JSON schema base validation (with `ajv`) in some
places, but that requires importing and sending the whole JSON schema to
the client, which is something I'd like to avoid. The advantage JSON
schema is that we also use it for generating Go code. We should find a
way to use JSON schema but generate specific validators at build time.
There are also other libraries that do runtime validation and are
smaller but they don't necessarily allow asynchronous validation (which
we want to do because we only want to import the `re2js` library when
necessary; of course we could organize the code differently but it's
nice to be able to encapsulate this logic)
## Test plan
Manual testing and new integration tests.
These commits do a few things:
---
46b1303e62ea7e01ba6a441cc55bbe4c166ef5ce corrects a few minor mistakes
with the new site config which I introduced in #63654 - namely fixing
`examples` entries and nullability in a few cases. Nothing controversial
here, just bug fixes.
---
750b61e7dfa661338c9b40042087aed8e795f900 makes it so that the
`/.api/client-config` endpoint returns `"modelsAPIEnabled": true,` if
`"modelConfiguration"` is set in the site config. For context,
`"modelConfiguration"` is a new site config field, which is not used
anywhere before this PR, and has this description:
> BETA FEATURE, only enable if you know what you are doing. If set, Cody
will use the new model configuration system and ignore the old
'completions' site configuration entirely.
I will send a change to the client logic next so that it uses this
`modelsAPIEnabled` field instead of the client-side feature flag
`dev.useServerDefinedModels`.
---
Finally, f52fba342dd2e62a606b885802f7f6bc37f4f4ac and
bde67d57c39f4566dc9287f8793cb5ffd25955b3 make a few site config changes
that @chrsmith and I discussed to enable Self-hosted models support.
Specifically, it makes it possible to specify the following
configuration in the site config:
```
// Setting this field means we are opting into the new Cody model configuration system which is in beta.
"modelConfiguration": {
// Disable use of Sourcegraph's servers for model discovery
"sourcegraph": null,
// Configure the OpenAI-compatible API endpoints that Cody should use to provide
// mistral and bigcode (starcoder) models.
"providerOverrides": [
{
"displayName": "Mistral",
"id": "mistral",
"serverSideConfig": {
"type": "openaicompatible",
"endpoint": "...",
"accessToken": "...",
},
},
{
"displayName": "Bigcode",
"id": "bigcode",
"serverSideConfig": {
"type": "openaicompatible",
"endpoint": "...",
"accessToken": "...",
},
},
],
// Configure which exact mistral and starcoder models we want available
"modelOverridesRecommendedSettings": [
"bigcode::v1::starcoder2-7b",
"mistral::v1::mixtral-8x7b-instruct"
],
// Configure which models Cody will use by default
"defaultModels": {
"chat": "mistral::v1::mixtral-8x7b-instruct",
"fastChat": "mistral::v1::mixtral-8x7b-instruct",
"codeCompletion": "bigcode::v1::starcoder2-7b",
}
}
```
Currently this site config is not actually used, so configuring
Sourcegraph like this should not be done today, but this will be in a
future PR by me.
@chrsmith one divergence from what we discussed.. me and you had planned
to support this:
```
"modelOverrides": [
{
"bigcode::v1::starcoder2-7b"": {
"useRecommendSettings": true,
},
"mistral::v1::mixtral-8x22b-instruct": {
"useRecommendSettings": true,
},
}
],
```
However, being able to specify `"useRecommendSettings": true,` inside of
a `ModelOverride` in the site configuration means that all other
`ModelOverride` fields (the ones we are accepting as recommended
settings) must be optional, which seems quite bad and opens up a number
of misconfiguration possibilities.
Instead, I opted to introduce a new top-level field for model overrides
_with recommended settings_, so the above becomes this instead:
```
"modelOverridesRecommendedSettings": [
"bigcode::v1::starcoder2-7b",
"mistral::v1::mixtral-8x7b-instruct"
],
```
This has the added benefit of making it impossible to set both
`"useRecommendSettings": true,` and other fields.
I will make it a site config error (prevents admins from saving
configuration) to specify the same model in both `modelOverrides` and
`modelOverridesRecommendedSettings` in a future PR.
---
## Test plan
Doesn't affect users yet. Careful review.
## Changelog
N/A
---------
Signed-off-by: Stephen Gutekanst <stephen@sourcegraph.com>
This is a legacy of previous self-serve-billing attempts, and is no
longer used or necessary, with the presence of the dotcom-wide
subscriptions management pages. If we want a self-serve UI for
Enterprises in the future, it should be part of the Enterprise Portal UI
project.
I asked the 3 most active users of this page, as indicated by V2
telemetry, all of whom were internal, about this and they confirmed it's
not used:
https://sourcegraph.slack.com/archives/C05GJPTSZCZ/p1720474215464999https://redash.sgdev.org/queries/854
For now, this is one less thing for us to maintain and migrate for
https://linear.app/sourcegraph/issue/CORE-100
## Test plan
CI, `sg start dotcom` -> user profile page no longer shows the
subscriptions tab
This PR adds the UI changes for SRCH-689
Reviewers, please include in your comments if you have a blocking
change, or if it's something that can be done in a follow-up PR.
## Test plan
- Manual testing: I can create and delete github apps. I can see the
correct one in each place, and there are no problems with PATs.
## Changelog
<!-- OPTIONAL; info at
https://www.notion.so/sourcegraph/Writing-a-changelog-entry-dd997f411d524caabf0d8d38a24a878c
-->
This adds snippets back to the search sidebar, which got missed when it
was redesigned.
This includes some refactoring of the Svelte version to account for
filter types that do not match 1:1 with the backend types. We initially
tried to tie them tightly with the backend types so the backend is the
source of truth, but I think we want to have the ability to introduce
client-side-only filters, which we already sorta hackily do with the
`type:` filters. And it's even more hacky with the `count:` filter in
the React webapp (which doesn't look like it was ever implemented in the
Svelte version).
In the React app, I made the minimum changes to get this working (no
associated refactoring).
We have introduced a dependency on wildcard again, which should not be
an issue in production but will slow down the initial page load during
dev builds.
I also took the time clean up other transitive depdencies on modules
using React (based on file extension). Turns out that some tsx files
should actually be ts files because they don't use React.
## Test plan
The build system should catch any issues with moved exports.
Fixes srch-700
In certain situations SvelteKit tries to load `version.json` to check
whether a new version of the web app is available (see [the SvelteKit
docs](https://kit.svelte.dev/docs/configuration#version) for more
information). This currently doesn't work, accessing this file throws a
404 error.
This is due to how SvelteKit generates the path to access the file. It
uses the value of `appDir` for this, which is currently set to the
default value. We put our assets in `client/web/dist/_sk/*`, which can
then be accessed on the server via `/.assets/_sk/*`. To make that work
properly we've been modifiying the generated `index.html` file to use
the right file path.
This however doesn't work for fetching `version.json` because the path
to that file is generated at runtime.
This commit aims to fix this issue by setting `appDir` to a value that
works with the Sourcegraph server so that `version.json` can be properly
loaded. Incidentally this also makes our "post processing" easier:
Instead of changing the contents of the `index.html` file we instead
have to move the app assets to the proper location. With `appDir` set to
`.assets/_sk/_app`, SvelteKit will put the app assets into
`<out>/.assets/_sk/_app`. But that would mean the full URL path to a
file would be `.assets/_sk/.assets/_sk/_app`. To fix that we now move
the files from `<out>/.assets/_sk/_app` to `<out>/_app`.
## Test plan
Tested that `pnpm dev`, `pnpm preview` and `bazel test
//client/web-sveltekit:e2e_test` work as expected.
Fixes srch-697
This commit makes two important changes:
- The popover component will now only register the ESC key handler when
it is open (und unregister when it closes). This was done by exposing a
new function that creates a hotkey without registering it. The existing
`registerHotkey` function simply wraps the new function so that existing
callsites are not affected by this change.
- The error message was turned into a warning and will now only be
triggered in dev builds.
## Test plan
Existing unit test, manual testing.
Details about the probblem can be found in srch-527 (fixes srch-527).
This commit implements a workaround via the `handleError` hook. If this
function returns an error then SvelteKit is using that instead of its
own error object. So we unwrap the error object ourselves (since
SvelteKit fails to do that due to bazel build issues) and ensure this
way that the correct error is passed to our error template.
## Test plan
Coincidentally we disabled all error related tests in CI, so by enabling
these tests again we should see whether this approach works.
Closes SRCH-663
This is a follow-up to previous PRs, where we added database fields to
support the new github apps integration.
See initiative "Batch Changes using GitHub App auth" on linear.
## Test plan
- Manual testing
## Changelog
<!-- OPTIONAL; info at
https://www.notion.so/sourcegraph/Writing-a-changelog-entry-dd997f411d524caabf0d8d38a24a878c
-->
---------
Co-authored-by: Bolaji Olajide <25608335+BolajiOlajide@users.noreply.github.com>
This commit adds the React version of the cody chat sidebar to the
Svelte web app. I used @vovakulikov's work in the React app as guidance.
I'm sure we'll have to do follow up work, but it's a start.
This PR also fixes `sg start web-sveltekit-standalone` (because I
originally thought that running it from `sourcegraph.test` is necessary
to make auth work).
## Test plan
Manual testing.
https://github.com/sourcegraph/sourcegraph/assets/179026/3fa3f2ea-b23e-44ca-a75a-0089bf07fb2b
Previously, the Batch Changes namespace selector looked at the user's
settings that were loaded on the initial page load. This bypassed the
GraphQL API, which should be the source of truth for "what namespaces
can a user write to" (i.e., their user account and all orgs they are a
member of), and introduced a reliance on non-type-safe `jscontext` data.
Also, adding any other features to this NamespaceSelector would require
changing the data fetched in `jscontext`, so it was brittle.
I intend to use the NamespaceSelector for more things that need these
missing features and a more solid foundation (such as the ability to
transfer saved searches to a different owner), so I started out by
refactoring this to access data from the GraphQL API. I added a new
`viewer { affiliatedNamespaces }` GraphQL API field to support this.
Also adds tests and a storybook for this NamespaceSelector component.
## Test plan
Test plan:
1. Go to the Batch Changes global create page. Create a batch change.
Ensure it works if you use the initial/default selected namespace (your
user account), and if you change it. Ensure the created batch change
exists in the intended namespace.
2. Do the same, but from a user or org batch changes create page. Ensure
the NamespaceSelector's initial option is the namespace you are
visiting, and that creation succeeds.
…grations
This PR adds v2t telemetry infrastructure to the Sourcegraph browser
extensions and native integrations code base.
## Test plan
- Tested locally using instructions at
https://github.com/sourcegraph/sourcegraph/tree/main/client/browser
- CI
## Changelog
---------
Co-authored-by: Dan Adler <5589410+dadlerj@users.noreply.github.com>
Previously, this only listened for resize events. However, shrink/grow
might also be required if the contents of the element _change_. This
adds a `MutationObserver` to `sizeToFit` to recalculate the sizing when
the element (or its children) is mutated.
This PR removes the keyword search toggle as part of making the feature GA. It
removes the keyword search toggle and popover, but keeps the "call to action"
on the search landing page,
Main changes:
* Remove toggle on search results page
* Stop checking `experimentalFeatures.keywordSearch`. (Instead, users should
set `search.defaultPatternType: standard`)
* Remove `LegacyToggles` and all references. This duplicated `Toggles` and is
no longer needed since we unified the implementations.
Closes SPLF-111
Closes srch-673
This disables the inline cody widget when new cody web is enabled. The
widget doesn't work with the new sidebar.
## Test plan
Code inspection, it's a simple code change.
This PR refactors insights to support the upcoming Keyword Search GA.
New insights are always persisted with `patternType:`.
Queries of existing insights are updated with `patternType:standard
<query>` if they don't already specify a pattern type. This reflects the
current default of the Stream API and thus, merely makes the pattern
type explicit.
Notes:
- The Insights UI has a lot of query input fields, but there are only 2
fields which allow the user to freely specify a pattern type: the
interactive insight on the landing page and the query input field in the
"Track Changes" creation form.
Test plan:
- new unit test
- existing tests pass without changes
- manual testing:
- I created a couple of insights and checked that the pattern type is
persisted in the db.
- I experimented with different default pattern types.
- I tested the workflow to create an insight from the search results
page.
- I created a "language" insights and ran the migration to make sure we
don't set pattern type in those cases.
- Renames some types and fields for clarity:
- FilteredConnectionFilter -> Filter
- field name `values` -> `options`
- FilteredConnectionFilterValue -> FilterOption
- Avoids passing around unnecessary data
No behavior change. This makes it easier to use the FilterControl
component.
## Test plan
Use existing filtered connections with filters (see the diff for a list
of pages that contain this component).
Many places used a LazyQueryInput with a focus ring and implemented it
incorrectly:
- The text would overflow
- The tooltips in the query input would be chopped off
This cleans up duplicate code and fixes those bugs.
No visual changes.
## Test plan
View the query input and try overflowing it on:
- search context query input
- saved search query input
- code monitor query input
They are no longer used from settings.json, so they should not appear in
the settings.
## BEFORE
<img width="927" alt="BEFORE"
src="https://github.com/sourcegraph/sourcegraph/assets/129280/60f7f4ae-078c-41a0-b6db-eadab17e10db">
## AFTER
<img width="983" alt="AFTER"
src="https://github.com/sourcegraph/sourcegraph/assets/129280/92d9e5ff-ac9f-479b-8277-03b4fcfba88b">
## Test plan
### Build and run locally
#### Build
```
git switch peterguy/vscode-remove-url-and-token-from-config
cd client/vscode
pnpm build
```
#### Run
- Launch extension in VSCode: open the `Run and Debug` sidebar view in
VS Code, then select `Launch VS Code Extension` from the dropdown menu.
- Navigate to the Settings page (Code --> Settings... or cmd + , on
macOS), search for "sourcegraph" and verify that the access token and
url are no longer present in the results.
## Changelog
- Remove access token and URL from extension settings because they are
managed in the extension now.
- The buttons for resending the verification email, manually verifying a
user's email, and removing a user's email were incorrectly styled and
had no padding.
- The org members page had weird columns where a column that only ever
had a single button took 50% of the width.
## Test plan
View these pages and ensure they look nicer.
## Changelog
- Minor cosmetic improvements to the pages for managing organization
members and user email addresses.
I was getting a weird TypeScript type error on a clean build.
```
$ pnpm -C client/web run build-ts
../testing/src/mockResizeObserver.ts:5:12 - error TS2339: Property 'ResizeObserver' does not exist on type 'never'.
```
Type-checking adds no value here anyway, and this is low risk to ignore.
## Test plan
CI
When our custom `<Label>` element is labelling a contenteditable element
(like a CodeMirror editor), it previously just called `element.focus()`.
This focused the element but put the cursor at the start. The native and
expected behavior of `<label for="...">` is to focus and put the cursor
at the end.
Also fix an issue where this code path would be followed even if the
label had no ID, which could result in it erroneously selecting an
element with an empty `aria-labelledby` attribute.
## Test plan
In the create/update saved search form, click on the label and ensure it
focuses at the end of the CodeMirror component.
De-cluttering the authentication options for the VSCE. Private code is
no longer hosted on sourcegraph.com, so it's confusing to be directed
there.
Addresses (at least partially) #45757
## Test plan
### Build and run locally
#### Build
```
git switch peterguy/vscode-address-confusing-auth-ux
cd client/vscode
pnpm build
```
#### Run
- Launch extension in VSCode: open the `Run and Debug` sidebar view in
VS Code, then select `Launch VS Code Extension` from the dropdown menu.
- See that the "Create an account" links are missing from the sidebar
## Changelog
- Remove links to create an account on sourcegraph.com because it no
longer hosts private code.
This PR refactors notebooks to support the upcoming Keyword Search GA. The main goal is to make it easier to switch to a new default pattern type without breaking existing notebooks.
**Before**
- pattern type and version were hardcoded in several places
**After**
- Each notebook has a read-only pattern type as determined by the new column `notebooks.pattern_type` (defaults to "standard").
**Notes**
- Notebooks call the Stream API via various helper functions. `patternType` and `version` are both required parameters, which is redundant, because version acts as a default pattern type already. I left a TODO in the code for that. I don't want to change this as part of this PR because the change would get very big and affect too much code outside of Notebooks.
- We support rendering notebooks with `.snb.md` extension. Unlike notebooks stored in our db, we cannot migrate those files.
**Q&A**
Q: How does this help for Keyword Search GA?
A: Once we default to keyword search, we can change the default of `notebooks.pattern_type` from "standard" to "keyword". Existing notebooks will still work with "standard". New Notebooks will use "keyword".
Q: How can customers migrate existing notebooks to a new version?
A: Use the existing "Copy to My Notebooks" function of Notebooks. The copied notebook will have the current default pattern type.
Test plan:
- existing tests pass
- manual testing
- I created a couple of notebooks with all the different block types and verified via the network tab that all requests to the Stream API have the proper pattern type. I played around with different values in `notebooks.pattern_type` to make sure that the request parameters change.
The VSCode Search extension does not support file preview, so hide it
from the search results when the search originates from the VSCode
Search extension.
Example showing the file preview links (before this PR):
<img width="1511" alt="Screenshot 2024-06-28 at 09 42 26"
src="https://github.com/sourcegraph/sourcegraph/assets/129280/552cef26-9109-487a-96dd-0789d758c074">
Example without the file preview links (after this PR):
<img width="1511" alt="Screenshot 2024-06-28 at 09 43 46"
src="https://github.com/sourcegraph/sourcegraph/assets/129280/c53a1c8e-c27e-4958-808b-e5469745d182">
## Test plan
### Automated tests still pass
Including visual and functional tests of the file preview functionality.
### Build and run locally
#### Build
```
git switch peterguy/vscode-hide-preview-file-link
cd client/vscode
pnpm run build
```
#### Run
- Launch extension in VSCode: open the `Run and Debug` sidebar view in
VS Code, then select `Launch VS Code Extension` from the dropdown menu.
- Run a search using the search bar.
- See that the file preview link
### Check that the file preview link exists in the web app
The web app uses the branded components also, so run `sg start` or `sg
start web-standalone`, do a search and see that the file preview link
still exists.
If you want to be an over-achiever, you can edit
`client/branded/src/search-ui/results/StreamingSearchResultsList.tsx`,
changing `hideFilePreviewButton = false,` to `hideFilePreviewButton =
true,` and reload the search results to see that the file preview link
disappears.
This implements the debug view for code intel ranges. Since we're doing
work here, it's very useful to be able scan the info while exploratory
testing and debugging.
Note that this does _not_ use the snapshot API. After #63473, everything
uses occurrences, so rather than rely on another API request, the only
argument to the debug extension is a set of occurrences. This is
particularly nice because it would be very easy to do things like:
- Show the occurrences as calculated from syntax highlighting data
- Show the occurrences before and after we make them non-overlapping
This commit fixes an issue with layout shifting while loading data in
the reference. The class/style was incorrectly applied causing
additional padding to be added while data was loading. This commit fixes
that and
- adds a divider between the last list item and the loader
- changes the default proxy to be S2. Dotcom didn't make sense anymore
now that `pnpm dev:dotcom` does that explicitly.
## Test plan
Manual testing
Description:
This PR introduces support for counting tokens within the Azure code and
updating these counts in Redis. The token counting logic is embedded
directly in the Azure code rather than using a standardized point for
all token counting logic.
Reasoning:
• Azure does not currently support obtaining token usage from their
streaming endpoint, unlike OpenAI.
• To enable immediate functionality, the token counting logic is placed
within the Azure code itself.
• The implementation supports GPT-4o.
Future Considerations:
• When Azure eventually adds support for token usage from the streaming
endpoint, we will migrate to using Azure’s built-in capabilities.
• This will ensure full utilization of Azure OpenAI features as they
achieve parity with OpenAI.
Changes:
• Added token counting logic to the Azure code.
• Updated Redis with the token counts.
Testing:
• Verified the implementation works with GPT-4o.
Conclusion:
This is a temporary solution to enable token counting in Azure. We will
adapt our approach as Azure enhances its feature set to include token
usage from their streaming endpoint.
## Test plan
Tested locally with debugger
<!-- All pull requests REQUIRE a test plan:
https://docs-legacy.sourcegraph.com/dev/background-information/testing_principles
-->
## Changelog
<!--
1. Ensure your pull request title is formatted as: $type($domain): $what
2. Add bullet list items for each additional detail you want to cover
(see example below)
3. You can edit this after the pull request was merged, as long as
release shipping it hasn't been promoted to the public.
4. For more information, please see this how-to
https://www.notion.so/sourcegraph/Writing-a-changelog-entry-dd997f411d524caabf0d8d38a24a878c?
Audience: TS/CSE > Customers > Teammates (in that order).
Cheat sheet: $type = chore|fix|feat $domain:
source|search|ci|release|plg|cody|local|...
-->
<!--
Example:
Title: fix(search): parse quotes with the appropriate context
Changelog section:
## Changelog
- When a quote is used with regexp pattern type, then ...
- Refactored underlying code.
-->
Fixes srch-646
This commit fixes how tokens are decorated in the query input. The
"chip" style needs to have lower presedence than the syntax highlighting
so that it doesn't get split across the individual parts of e.g. a repo
filter.
This commit also removes the activeFilter extension. It was conflicting
a bit with the filter decoration. This should be fine since it wasn't
used for quite a while in the main search input either.
I also noticed an issue with the size of the CodeMirror input in the
saved searches form. I couldn't enter any query actually because the
input was too "narrow". Adding `flex:1` fixes that.
## Test plan
Manual testing.

Contributes to srch-529
This commit refactors the main navigation and search home page code to
make it more configurable. In particular we now only show navigation
entries for features that are enabled (as determined by
`window.context`) and only show the cody upsell banner when cody is
enabled.
I extended the dev HTML template and .env files to support this.
## Test plan
Manual testing.
I found it annoying that it took 2 clicks to go to Cody chat: click
**Cody** in the global navbar, then click **Web Chat**. Users rarely
will visit their dashboard, and that's associated with their user
anyway, so it should be under their user. Same 2-click annoyance applies
to going to Code Search.
Moves some other links:
- Contexts, Search Jobs, Code Monitors, Notebooks --> moved to "Tools"
global navbar item
- Cody dashboard --> moved to user nav item (in top right)



## Test plan
With minimize nav on and off, and with all states of dotcom and
user-has-Cody-enabled, ensure matches expectations. The expectations are
codified in the tests/
## Changelog
- Code Search and Cody now are one-click links in the global navbar.
Other features are in the new "Tools" menu: search contexts, code
monitors, search jobs, and notebooks. Your Cody dashboard is linked from
your user menu (in the top right).
This is a bit of refactoring as a followup to #63217. The goal is to
unify how we use `Occurrences` so that we can use the same interface for
both syntax highlighting data and occurrence data from the new API. An
additional goal is to encode more of the invariants in the type system
so it's more difficult to use incorrectly.
This integrates the new occurrences API into the Svelte webapp. This
fixes a number of issues where the syntax highlighting data is not an
accurate way to determine hoverable tokens. It is currently behind the
setting `experimentalFeatures.enablePreciseOccurrences`
Due to changes in the code base, the search extension code when run from
`main` shows file names only in the search results page - no matches in
the files. This is a regression from the behavior in the deployed
extension.
Deployed extension:
<img width="1504" alt="Screenshot 2024-06-27 at 10 04 37"
src="https://github.com/sourcegraph/sourcegraph/assets/129280/edd97903-d03f-4612-98c8-c8f286f0cb3b">
Running from `main`:
<img width="1502" alt="Screenshot 2024-06-27 at 10 11 17"
src="https://github.com/sourcegraph/sourcegraph/assets/129280/d7aefcfe-3a25-4486-9fa6-a5e6bc7c6a8e">
Turns out the reason is because some shared code expects chunk matches,
while the search queries were all returning line matches.
Added support for line matches in the shared code, and then fixed an
issue with the search results display not keeping up with `MatchGroups`.
## Test plan
Build and run locally.
### Build
```
git switch peterguy/vscode-bring-back-matched-lines-in-search-results
cd client/vscode
pnpm run build
```
### Run
- Launch extension in VSCode: open the `Run and Debug` sidebar view in
VS Code, then select `Launch VS Code Extension` from the dropdown menu.
- Run a search using the search bar.
- See that the results contain matched lines in the files and not just a
list of file names. Compare to the currently-deployed extension - the
search results should look generally the same.
This is part of the Keyword GA Project.
Instead of hardcoding the pattern type to "standard" we use the default pattern type. This really only affects highlighting, because users are already forced to explicity state a pattern type by the GraphQL API.
Test plan:
- new unit test
- manual testing:
I tested the following workflows:
Creating a saved search from search results page
Creating a saved search from the user menu
Editing an existing saved search after the default patternType had changed
I noticed that the regexp toggle doesn't work anymore if `"search.defaultPatternType": "regexp"`. This is related to a recent change #63410.
We also append `patternType:keyword` in that case which I don't think we want, because we have an UI element to indicate that keyword search is active.
The question I don't know how to answer is: What should happen if `regexp` is the default and the user toggles keyword search off. Should we go back to `regexp` or to `standard`?
Test plan:
- new unit test
- manual testing with default pattern type set to "keyword" and "regexp".
Turn off 2 low-value eslint rules that add a lot of noise:
- `@typescript-eslint/no-explicit-any` because if you mean to use `any`
then you probably mean to. We still have eslint warnings for `any`
member access, which is indeed riskier.
- `@typescript-eslint/no-non-null-assertion` because if you type `!`
then you mean it.
Both of these have hundreds of warnings in our current codebase, so this
significantly reduces the eslint noise and makes it so that the
higher-value eslint rules are more noticeable.
At a high level, we don't want to show annoying ads/upsells for Cody
that are not useful. And if Cody is disabled, we don't want to show
*any* links to Cody.
### Detailed desired behavior
- Dotcom
- Navbar
- Unauthed: "Cody" single link to /cody (marketing page)
- Authed: "Cody" dropdown with "Dashboard" (/cody/manage) and "Chat"
(/cody/chat)
- Routes
- /cody: always the marketing page
- /cody/manage: requires sign-in, shows Cody PLG subscription status for
the user (Free plan is auto-opted-into by default)
- /cody/chat: requires sign-in
- Enterprise with Cody enabled on instance
- Navbar
- Cody NOT enabled for current user: "Cody" single link to
/cody/dashboard
- Cody enabled for current user: "Cody" dropdown with "Dashboard"
(/cody/manage) and "Chat" (/cody/chat)
- Routes
- /cody: this link should not be present anywhere, but redirect to
/cody/dashboard
- /cody/manage: informational page, with editor/web links for
Cody-enabled users and a "contact admin to get access" message for
Cody-disabled users
- /cody/chat: chat for Cody-enabled users, redirect to /cody/manage for
Cody-disabled users
- Enterprise with Cody NOT enabled on instance (`"cody.enabled": false`
in site config)
- Navbar: no Cody link or dropdown
- Routes: all Cody routes 404
- All
- Do not show a Cody upsell on the /search page
This is an example of what we will KEEP for users on instances with Cody
enabled but who do not themselves yet have access to Cody. This is
useful because it informs users how to get access to Cody, and
presumably their site admin wants people to request it who want to use
it.

Fixes
https://linear.app/sourcegraph/issue/SRCH-529/hide-cody-ai-tab-and-cody-upsell-if-cody-is-not-enabled
### Unexpected code changes needed
This ended up being a much bigger change than I expected because I found
error-prone code that needed cleaning up:
- Improve how we determine if Cody is enabled in the frontend code.
Previously, we checked the license features in some places,
`cody.enabled` site config in others, and the user's current RBAC
permissions for Cody in yet others. The most error-prone was checking
the license features, since a license may entitle the instance to Cody
but the site admin may still choose to disable it. There were no places
in the frontend code where checking the license's entitlements was
actually correct, so I changed everything to checking either
`window.context.codyEnabledOnInstance` or
`window.context.codyEnabledForCurrentUser`.
- Did the same for `window.context.codeSearchEnabledOnInstance` for
symmetry.
- Removed "helper" functions that just checked 1 or 2 boolean values on
`window.context` related to this, in favor of accessing `window.context`
directly. Globals aren't great, and we should use React context or
something similar, but now that the JSContext has the right fields
(i.e., enabled instead of licensed), it's simpler and there is no need
for helper functions.
- Removed prop drilling of the `licenseFeatures` that was unnecessary
since these values are available in globals and were being set from
globals at some arbitrary point in the React component hierarchy anyway.
- Updated the GlobalNavbar test snapshots.
## Test plan
Run in 3 modes: (1) dotcom mode, (2) `"cody.enabled": false` in site
config, (3) normal `sg start`.
## Changelog
- When Cody is disabled in site config (with `"cody.enabled": false`),
all links and UI elements about Cody are hidden from all users.
Previously, when Cody was disabled, users would see some links informing
them about Cody.
Historically, sourcegraph.com has been the only instance. It was
connected to GitHub.com and GitLab.com only.
Configuration should be as simple as possible, and we wanted everyone to
try it on any repo. So public repos were added on-demand when browsed
from these code hosts.
Since, dotcom is no longer the only instance, and this is a special case
that only exists for sourcegraph.com.
This causes a bunch of additional complexity and various extra code
paths that we don't test well enough today.
We want to make dotcom simpler to understand, so we've made the decision
to disable that feature, and instead we will maintain a list of
repositories that we have on the instance.
We already disallowed several repos half a year ago, by restricting size
of repos with few stars heavily.
This is basically just a continuation of that.
In the diff, you'll mostly find deletions. This PR does not do much
other than removing the code paths that were only enabled in dotcom mode
in the repo syncer, and then removes code that became unused as a result
of that.
## Test plan
Ran a dotcom mode instance locally, it did not behave differently than a
regular instance wrt. repo cloning.
We will need to verify during the rollout that we're not suddenly
hitting code paths that don't scale to the dotcom size.
## Changelog
Dotcom no longer clones repos on demand.
The New Cody Web client doesn't work for non-auth users, we should never
render
new Cody web client for signed-out users and show cody landing page
instead.
## Test plan
- Run local instance and sign out
- Check that Cody Web page shows the welcome landing page
This PR turns on the new Cody Web by default for everyone. It's still
possible to opt-out to the old Cody Web with `"newCodyWeb": false` in
your experimental features in settings.
I forgot that the dot com instance seeds its global settings and site
configuration from files and
doesn't allow us to override specific settings there;
## Test plan
- Check that the new Cody Web client is available to you without any
feature flag by default
This upgrades SvelteKit for good measure. I think a lot of the fixes are
not relevant to us but
https://github.com/sveltejs/kit/releases/tag/%40sveltejs%2Fkit%402.5.8
is interesting and makes navigating around in the app after a dev server
start less jarring.
## Test plan
`pnpm dev`, `pnpm build` and `bazel test
//client/web-sveltekit:svelte-check`
Part of https://github.com/sourcegraph/sourcegraph/issues/62448
Linear issue
[SRCH-573](https://linear.app/sourcegraph/issue/SRCH-573/integrate-cody-web-package-into-the-sourcegraph-ui)
This is highly experimental usage of the new (not currently merged but
published in NPM `cody-web-experimental`) package
## How to run it
- (Optional) if you previously linked any local packages make sure they
don't exist in your node_modules anymore, `rm -rf node_modules` in the
root then `pnpm install`
- Run standard `sg start web-standalone`
- Turn on `newCodyWeb: true` in your `experimentalFeatures`
## How to run it locally with prototype PR in Cody repository
- Open Cody repository on the `vk/integrate-cody-web-chat-2` branch
- At the root of the repo, run `pnpm install` to make sure you're up to
date with all of the dependencies.
- Go to the web package (`cd web`)
- Build it with `pnpm build`
- Create a global link with `pnpm link --global` (Ignore the warning
message about no binary)
- Open sourcegraph/sourcegraph repository on this PR branch
- Make sure you are in the root of the repo.
- Run `pnpm link --global cody-web-experimental`
- Run `sg start web-standalone` to bundle the web app and launch an
instance that uses S2 for the backend. You'll need to create a login on
S2 that is not federated by GitHub.
- Turn on `newCodyWeb: true` in your `experimentalFeatures`
- Have fun experimenting!
## Test plan
- Check that old version of Cody has got no regressions
There are two kinds of repository pages: Those who depend on the
revision possibly present in the URL and those who are not.
This commit re-arranges the routes to better distinguish between these
two types. It also adds a visual indication to the commits that the
history at a specific revision is shown. Additionally it removes the
revision from links to revision agnostic pages.
Overall this should make it clearer to the user when and when not the
revision in the URL is relevant.
Note: I originally added a redirect for revision agnostic pages that
would remove the revision if it was present in the URL. I decided to
not do that for now because that redirect introduces an additional
history entry which makes it difficult to navigate back.
Closes srch-600
## Test plan
Manual testing.
This is part of the Keyword Search GA project (see background below).
The core change is that we use the default pattern type consistently for
the query input field and preview. Before, we hardcoded `literal` as the
default and used `standard` for previews.
This is does not affect existing code monitors.
Other fixes:
- highlight keyword queries correctly
Background:
- "keyword" will soon be the new default pattern type
- the default pattern type can be overridden in the user/global settings
- query fields in all of our products should respect the default
Test Plan:
- The unit test is currently "skipped" with the following comment
```
// TODO: these tests trigger an error with CodeMirror, complaining about being
// loaded twice, see https://github.com/uiwjs/react-codemirror/issues/506
```
- Manual testing:
- I created several code monitors with and without pattern type and
checked in the DB that the correct pattern type was appended.
- I configured a new default pattern type in my user settings and
verified that the setting changes the default pattern type for code
monitors.
Co-authored-by: Felix Kling <felix@felix-kling.de>
The current "name" thing is not used anywhere for subscriptions - all
internal capabilities and APIs depend use the UUID, and Enterprise
Portal will use the UUID as well.
This change replaces all name/IDs with the UUID, prefixed in Enterprise
Portal format, as we prepare to launch Enterprise Portal in more places
(such as Cody Analytics: https://linear.app/sourcegraph/issue/CORE-101).
This is particularly relevant for Cody Analytics so I can document how
to find the UUID in a way that isn't "get it from the URL".
It's not super beautiful in the subscriptions list, but as we progress
on the migration to Enterprise Portal I plan to replace the ID in the
list with "Display name", which is a first-class citizen in Enterprise
Portal.
## Test plan
<img width="953" alt="image"
src="https://github.com/sourcegraph/sourcegraph/assets/23356519/30c4ae6b-e50b-485c-a2c8-e4ab6445fc01">

Previously, enabling then disabling the regexp toggle would always set the
patterntype to `keyword`, even when the user has set
`search.defaultPatternType: standard`. Now, toggles always revert back to the
default pattern type.
To support this, this PR adds `defaultPatternType` to the nav bar query state,
which is updated every time there's a settings update. Having
`defaultPatternType` available also lets us fix another bug: when
the default pattern type has been set to `standard` we no longer awkwardly show
`patterntype: standard` in the search bar. (This confusing behavior was
introduced recently in #63326.)
**Overall, this PR set us up to remove `experimentalFeatures.keywordSearch`,
along with the keyword search toggle.** To opt out of keyword search, users can
just set `search.defaultPatternType`, and have it work everywhere.
Codeintel v1 telemetry/event logging was broken in
https://github.com/sourcegraph/sourcegraph/pull/62586 due to the lack of
parens around a ternary operator. This simply fixes that issue.
## Test plan
CI
## Changelog
Co-authored-by: Dan Adler <5589410+dadlerj@users.noreply.github.com>
…orduct analytics)
As part of the v1 -> v2 telemetry transition, in product analytics
("IPA") aka admin analytics pages need to all be updated as well.
The codeintel IPA page shows codeintel actions by language. We aren't
capturing this metadata for v2 events. This PR adds it to private
metadata (since this is only needed on the instance itself).
## Test plan
CI
---------
Co-authored-by: Dan Adler <5589410+dadlerj@users.noreply.github.com>
Co-authored-by: Aditya Kalia <32119652+akalia25@users.noreply.github.com>
The general principle here is that we want to remove non-functional
upsells in our product. They add clutter and complexity and sometimes
annoy admins and users. As we unify the products, we will be adding a
lot more functional CTAs in the product to the same effect.
## Test plan
n/a; removal only
This page (at `/cody/search`) let you type in a natural-language
description of what to search for, and then it used an LLM to rewrite
that to Sourcegraph search query syntax. This was enabled using the
`cody-web-search` feature flag, which has been disabled on dotcom for a
while and was never documented or shared with customers, so it's safe to
remove.
It was a cool idea, but we decided to focus on making Cody's search in
the editor better, and we haven't seriously improved this for ~12
months.
## Test plan
n/a; removed feature
Repository embeddings were removed in Feb 2024 as part of the Cody
Enterprise GA. They have not been used since. Some Sourcegraph instances
still running an older pre-GA version may still rely on Cody Gateway
(deployed by us) for embeddings generation, but they do not rely on this
UI code at all, so it is safe to remove.
No changelog entry needed since this code's UI has been disabled since
Feb 2024.
## Test plan
Existing tests suffice since this is removing functionality.
Adds `dotcom.codyProConfig.useEmbeddedUI` site config param.
This param defines whether the Cody Pro subscription and team management
UI should be served from the connected instance running in the dotcom
mode. The default value is `false`. This change allows us to enable the
SSC proxy on the instance without enabling the new embedded Cody Pro UI.
Previously whether the embedded Cody Pro UI is enabled was defined by
the `dotcom.codyProConfig` being set, which prevented us from enabling
the SSC proxy without enabling the embedded UI:
> Whether the SSC proxy is enabled is [defined based on
`dotcom.codyProConfig`](41fb56d619/cmd/frontend/internal/ssc/ssc_proxy.go (L227-L231))
being set in the site config. This value is also partially
[propagated](41fb56d619/cmd/frontend/internal/app/jscontext/jscontext.go (L481))
to the frontend via jscontext. And the frontend [uses this
value](41fb56d619/client/web/src/cody/util.ts (L8-L18))
to define whether to use new embedded UI or not.
For more details see [this Slack
thread](https://sourcegraph.slack.com/archives/C05PC7AKFQV/p1719010292837099?thread_ts=1719000927.962429&cid=C05PC7AKFQV).
<!-- 💡 To write a useful PR description, make sure that your description
covers:
- WHAT this PR is changing:
- How was it PREVIOUSLY.
- How it will be from NOW on.
- WHY this PR is needed.
- CONTEXT, i.e. to which initiative, project or RFC it belongs.
The structure of the description doesn't matter as much as covering
these points, so use
your best judgement based on your context.
Learn how to write good pull request description:
https://www.notion.so/sourcegraph/Write-a-good-pull-request-description-610a7fd3e613496eb76f450db5a49b6e?pvs=4
-->
## Test plan
- CI
- Tested manually:
- Run Sourcegraoh instance locally in dotcom mode
- Set `dotcom.codyProConfig` in the site config
- Type `context. frontendCodyProConfig` that it returns the [correct
values from the site
config](184da4ce4a/cmd/frontend/internal/app/jscontext/jscontext.go (L711-L715))
<!-- All pull requests REQUIRE a test plan:
https://docs-legacy.sourcegraph.com/dev/background-information/testing_principles
-->
## Changelog
<!--
1. Ensure your pull request title is formatted as: $type($domain): $what
2. Add bullet list items for each additional detail you want to cover
(see example below)
3. You can edit this after the pull request was merged, as long as
release shipping it hasn't been promoted to the public.
4. For more information, please see this how-to
https://www.notion.so/sourcegraph/Writing-a-changelog-entry-dd997f411d524caabf0d8d38a24a878c?
Audience: TS/CSE > Customers > Teammates (in that order).
Cheat sheet: $type = chore|fix|feat $domain:
source|search|ci|release|plg|cody|local|...
-->
<!--
Example:
Title: fix(search): parse quotes with the appropriate context
Changelog section:
## Changelog
- When a quote is used with regexp pattern type, then ...
- Refactored underlying code.
-->
The name of the product is "Cody", not "Cody AI". Also, "AI" just looks
dumb and hype-y.
## Test plan
View the navbar and ensure it reads "Cody" not "Cody AI".
## Changelog
- In the navbar, Cody is now just "Cody" not "Cody AI".
This reverts commit 5cf81e0210
(https://github.com/sourcegraph/sourcegraph/pull/63378).
This PR intorduced a call to the SSC backend via proxy on the
Sourcegraph backend (see `cmd/frontend/internal/ssc/ssc_proxy.go`). It
appeared that proxy is not properly configured on dotcom, causing
requests to fail with 503 "proxy not configured" errors.
Reverting this PR until we fix the configuration.
<!-- 💡 To write a useful PR description, make sure that your description
covers:
- WHAT this PR is changing:
- How was it PREVIOUSLY.
- How it will be from NOW on.
- WHY this PR is needed.
- CONTEXT, i.e. to which initiative, project or RFC it belongs.
The structure of the description doesn't matter as much as covering
these points, so use
your best judgement based on your context.
Learn how to write good pull request description:
https://www.notion.so/sourcegraph/Write-a-good-pull-request-description-610a7fd3e613496eb76f450db5a49b6e?pvs=4
-->
## Test plan
- CI
<!-- All pull requests REQUIRE a test plan:
https://docs-legacy.sourcegraph.com/dev/background-information/testing_principles
-->
## Changelog
<!--
1. Ensure your pull request title is formatted as: $type($domain): $what
2. Add bullet list items for each additional detail you want to cover
(see example below)
3. You can edit this after the pull request was merged, as long as
release shipping it hasn't been promoted to the public.
4. For more information, please see this how-to
https://www.notion.so/sourcegraph/Writing-a-changelog-entry-dd997f411d524caabf0d8d38a24a878c?
Audience: TS/CSE > Customers > Teammates (in that order).
Cheat sheet: $type = chore|fix|feat $domain:
source|search|ci|release|plg|cody|local|...
-->
<!--
Example:
Title: fix(search): parse quotes with the appropriate context
Changelog section:
## Changelog
- When a quote is used with regexp pattern type, then ...
- Refactored underlying code.
-->
Currently the fuzzy finder filters and ranks results received from the
server locally. This was done to improve performance since local
filtering is much faster.
However it can introduce inconsistencies (as reported) because the local
filtering logic works differently that the one on the server. That means
the shown results is depedent on on the local cache, which is not
obvious to the user.
This commit removes the client side filtering and ranking and instead
relies only on the server for this. This makes things more consistent
and predictable, at the expense of being a little slower. However it
still feels quite fast to me.
Note that I didn't implement some aspects due to the limitations of the
GraphQL-based search API:
- No match highlighting. Personally I didn't miss is it so far. I don't
know if the highlighting actually provides a lot of value.
- No total result count. It seems since we are adding `count:50`, the
server cannot actually give use an approximate total count. But we
should probably still convey somehow that we are limiting results to the
top 50.
Because we don't have locally cached data anymore that can be shown
immediately I decided to increase the throttle time to prevent the
result list flickering in and out when typing with a moderate speed.
This change enables three additional features: 'search all' mode, multi
word search and regex search via `/.../` literals (just like for normal
search queries). This is consistent with our existing search query
language (currently regex literals are not syntax highlighted, but we
should consider doing that).
Fixes srch-139
Fixes srch-133
Fixes srch-134
Fixes srch-543
https://github.com/sourcegraph/sourcegraph/assets/179026/81e24345-9e06-4df6-bb4a-8a55e433bfd1
## Test plan
Manual testing.
## Changelog
- Add 'search all' tab
- Support multi-word search
- Support regular expression patterns
- Fix matching reliability
When moving to ESBuild, the filenames for extension bundles changed,
which led to broken bitbucket plugins for example.
See
[discussion](https://sourcegraph.slack.com/archives/C04MYFW01NV/p1718902092493689)
## Test plan
<!-- All pull requests REQUIRE a test plan:
https://docs-legacy.sourcegraph.com/dev/background-information/testing_principles
-->
Inspected the relevant target to see the paths in their proper location.
## Changelog
<!--
1. Ensure your pull request title is formatted as: $type($domain): $what
2. Add bullet list items for each additional detail you want to cover
(see example below)
3. You can edit this after the pull request was merged, as long as
release shipping it hasn't been promoted to the public.
4. For more information, please see this how-to
https://www.notion.so/sourcegraph/Writing-a-changelog-entry-dd997f411d524caabf0d8d38a24a878c?
Audience: TS/CSE > Customers > Teammates (in that order).
Cheat sheet: $type = chore|fix|feat $domain:
source|search|ci|release|plg|cody|local|...
-->
<!--
Example:
Title: fix(search): parse quotes with the appropriate context
Changelog section:
## Changelog
- When a quote is used with regexp pattern type, then ...
- Refactored underlying code.
-->
Closes https://github.com/sourcegraph/sourcegraph/issues/63234
[Design](https://www.figma.com/design/FMSdn1oKccJRHQPgf7053o/Cody-PLG-GA?node-id=5556-13856&t=f13ek1ZSgoUdrH6z-0)
Adds a button to remove the remaining invites from a subscription.
https://github.com/sourcegraph/sourcegraph/assets/25318659/679e19dd-0e0e-4561-8ac1-af1b6979ee73
**Known deviation from design (cc: @rrhyne)**
The “Remove User” success message and the “Remove Seats from
Subscription” alerts are positioned differently than in the design. The
“Remove User” banner, along with other user and invite list alerts, is
placed above the users list, below the page title or the invites textbox
if rendered. The “Remove Seats from Subscription” banner, along with
other invite textbox alerts, is located above the invites textbox
instead of above the page title and all the page content. These issues
will be addressed in follow-up PRs, as we need to refactor the existing
Team Members page layout.
Created an issue to address it:
- https://github.com/sourcegraph/sourcegraph/issues/63411
<!-- 💡 To write a useful PR description, make sure that your description
covers:
- WHAT this PR is changing:
- How was it PREVIOUSLY.
- How it will be from NOW on.
- WHY this PR is needed.
- CONTEXT, i.e. to which initiative, project or RFC it belongs.
The structure of the description doesn't matter as much as covering
these points, so use
your best judgement based on your context.
Learn how to write good pull request description:
https://www.notion.so/sourcegraph/Write-a-good-pull-request-description-610a7fd3e613496eb76f450db5a49b6e?pvs=4
-->
## Test plan
- Run a Sourcegraph instance in dotcom mode
- Sign in as a team admin
- Ensure there are free seats on your team (invites remaining)
- Ensure "Remove invites from plan" button is rendered
- Check the number of invites remaining
- Click the button
- Ensure the subscription has been updated and now the max seats reduced
by the number of remaining invites
- Ensure the success banner is rendered
<!-- All pull requests REQUIRE a test plan:
https://docs-legacy.sourcegraph.com/dev/background-information/testing_principles
-->
## Changelog
<!--
1. Ensure your pull request title is formatted as: $type($domain): $what
2. Add bullet list items for each additional detail you want to cover
(see example below)
3. You can edit this after the pull request was merged, as long as
release shipping it hasn't been promoted to the public.
4. For more information, please see this how-to
https://www.notion.so/sourcegraph/Writing-a-changelog-entry-dd997f411d524caabf0d8d38a24a878c?
Audience: TS/CSE > Customers > Teammates (in that order).
Cheat sheet: $type = chore|fix|feat $domain:
source|search|ci|release|plg|cody|local|...
-->
<!--
Example:
Title: fix(search): parse quotes with the appropriate context
Changelog section:
## Changelog
- When a quote is used with regexp pattern type, then ...
- Refactored underlying code.
-->
Closes https://github.com/sourcegraph/sourcegraph/issues/63240
Adds a confirmation modal before revoking admin or removing user.
<!-- 💡 To write a useful PR description, make sure that your description
covers:
- WHAT this PR is changing:
- How was it PREVIOUSLY.
- How it will be from NOW on.
- WHY this PR is needed.
- CONTEXT, i.e. to which initiative, project or RFC it belongs.
The structure of the description doesn't matter as much as covering
these points, so use
your best judgement based on your context.
Learn how to write good pull request description:
https://www.notion.so/sourcegraph/Write-a-good-pull-request-description-610a7fd3e613496eb76f450db5a49b6e?pvs=4
-->
<img width="549" alt="Screenshot 2024-06-20 at 19 50 28"
src="https://github.com/sourcegraph/sourcegraph/assets/25318659/361bce61-b2c3-42da-8d3c-5389a7ba9bd2">
<img width="549" alt="Screenshot 2024-06-20 at 19 50 36"
src="https://github.com/sourcegraph/sourcegraph/assets/25318659/f0bbc9c7-2097-46af-a290-74551d99896e">
## Test plan
- Run Sourcegraph instance in dotcom mode
- Sign in as Cody Pro team site admin
- Navigate to "/cody/team/manage" page
- Click on remove button next to the team member
- Ensure the confirmation modal is visible
- Ensure clicking the cancel button closes the confirmation modal and
user is not removed
- Ensure clicking the confirm button removes the user and closes the
confirmation modal
- Click on the revoke admin button next to the team admin
- Repeat steps for the user removal
<!-- All pull requests REQUIRE a test plan:
https://docs-legacy.sourcegraph.com/dev/background-information/testing_principles
-->
## Changelog
<!--
1. Ensure your pull request title is formatted as: $type($domain): $what
2. Add bullet list items for each additional detail you want to cover
(see example below)
3. You can edit this after the pull request was merged, as long as
release shipping it hasn't been promoted to the public.
4. For more information, please see this how-to
https://www.notion.so/sourcegraph/Writing-a-changelog-entry-dd997f411d524caabf0d8d38a24a878c?
Audience: TS/CSE > Customers > Teammates (in that order).
Cheat sheet: $type = chore|fix|feat $domain:
source|search|ci|release|plg|cody|local|...
-->
<!--
Example:
Title: fix(search): parse quotes with the appropriate context
Changelog section:
## Changelog
- When a quote is used with regexp pattern type, then ...
- Refactored underlying code.
-->
Fixes srch-553
This commit changes the "selectline" handler to open the correct file
when the file view is embedded.
## Test plan
Manual testing. Open reference panel, click on reference to open preview
panel, click on line number in review panel.
- Updates enry to include languages from Linguist v7.29.0 such as Mojo etc.
- Updates auto-complete filters in frontend code.
- Updates Zoekt to pick up newer version with bumped enry dep.
- Updates language extension overrides to avoid ambiguity for `.json` and `.yml`.
- Updates snapshot tests.
Closes https://github.com/sourcegraph/sourcegraph/issues/63264
1. Adds Cody Pro section to the user nav dropdown on dotcom:
- team admins have links to "cody/subscription/manage" and
"cody/team/manage" pages
- team members have only link only to the "cody/team/manage" page
2. Makes subscription management page only available for team admins. If
team members try to navigate this page by changing the URL, they will be
redirected to the "/cody/manage" page.
- Makes "Manage subscription" link on the "/cody/manage" available only
for the team admins (previously - any Pro user)
3. Lifts `QueryClientProvider` (wrapper around react-query
`ClientProvider` higher in the component tree so that Cody Pro API query
and mutations can be used not only on the Cody Pro routes.
[Design](https://www.figma.com/design/FMSdn1oKccJRHQPgf7053o/Cody-PLG-GA?node-id=5351-19126&t=LfNQR7vUCJhlNvyT-4)
| Role | Screenshot |
|--|--|
|Admin|<img width="1605" alt="Screenshot 2024-06-20 at 12 57 13"
src="https://github.com/sourcegraph/sourcegraph/assets/25318659/e7b995fd-4322-4f7f-86bb-c7027cacd644"><img
width="1605" alt="Screenshot 2024-06-20 at 13 10 28"
src="https://github.com/sourcegraph/sourcegraph/assets/25318659/84be111c-76e2-4b14-9b73-ebdd5f8cbb9a">|
|Member|<img width="1605" alt="Screenshot 2024-06-20 at 12 56 50"
src="https://github.com/sourcegraph/sourcegraph/assets/25318659/aefd8b3b-29fe-4957-87ee-b493eb489922"><img
width="1605" alt="Screenshot 2024-06-20 at 13 09 51"
src="https://github.com/sourcegraph/sourcegraph/assets/25318659/8209e7a0-4deb-4681-9f6b-3cfde8110842">|
<!-- 💡 To write a useful PR description, make sure that your description
covers:
- WHAT this PR is changing:
- How was it PREVIOUSLY.
- How it will be from NOW on.
- WHY this PR is needed.
- CONTEXT, i.e. to which initiative, project or RFC it belongs.
The structure of the description doesn't matter as much as covering
these points, so use
your best judgement based on your context.
Learn how to write good pull request description:
https://www.notion.so/sourcegraph/Write-a-good-pull-request-description-610a7fd3e613496eb76f450db5a49b6e?pvs=4
-->
## Test plan
- Start Sourcegraph instance in dotcom mode
- sign in as a Cody Pro team admin
- ensure that "Manage subscription" and "Manage team" links are present
in the user nav dropdown
- ensure "/cody/manage" page has "Manage subscription" link
- sign in as a Cody Pro team member (not admin)
- ensure "Manage team" link is present in the user nav dropdown
- navigate to "/cody/subscription/manage/ page by changing the URL
- ensure you've been redirected to the "/cody/manage" page
- ensure "/cody/manage" page doesn't have "Manage subscription" link
- start Sourcegraph in the enterprise mode
- ensure the mentioned links are not rendered
<!-- All pull requests REQUIRE a test plan:
https://docs-legacy.sourcegraph.com/dev/background-information/testing_principles
-->
## Changelog
<!--
1. Ensure your pull request title is formatted as: $type($domain): $what
2. Add bullet list items for each additional detail you want to cover
(see example below)
3. You can edit this after the pull request was merged, as long as
release shipping it hasn't been promoted to the public.
4. For more information, please see this how-to
https://www.notion.so/sourcegraph/Writing-a-changelog-entry-dd997f411d524caabf0d8d38a24a878c?
Audience: TS/CSE > Customers > Teammates (in that order).
Cheat sheet: $type = chore|fix|feat $domain:
source|search|ci|release|plg|cody|local|...
-->
<!--
Example:
Title: fix(search): parse quotes with the appropriate context
Changelog section:
## Changelog
- When a quote is used with regexp pattern type, then ...
- Refactored underlying code.
-->
Closes srch-458
This implements the new fuzzy finder design, specifically:
- Backdrop and dropshadow
- Border radius
- Tab header (affects all tab headers)
- Options
Note 1: Some aspects of the options UI (such as how paths are rendered
and highlighted), and the "footer" depend on how the highlighted parts
are computed. This will change when the local matching and ranking logic
is removed and will be updated when that happens.
Note 2: The symbol icon coloring was broken by #63288 and will be fixed
in a separate PR.
## Test plan
Manual testing
We plan to remove the 'Keyword Search' toggle as part of bringing the feature
to GA. Once the toggle is removed, the search UX will only represent `keyword`
(the default pattern type) and `regexp` (through the regex toggle), with no
visual indication for other pattern types. So if a user clicks on a link using
`patterntype:standard`, the search will just behave differently, without any
indication in the UX as to why.
This PR surfaces the `patterntype` filter in the search bar whenever it's not
`keyword` or `regexp`. That way, users can see an old pattern type is being
used and understand why the search behavior may be different.
Relates to SPLF-68
Whether or not the app is in "dotcom mode" is determined by
`window.context.sourcegraphDotComMode`. In development we use a stub
`window.context` object defined in `app.html`.
This commit extends that object to set `sourcegraphDotComMode` depending
on an environment varible. The environment variable is set by using vite
modes (https://vitejs.dev/guide/env-and-mode.html).
The whole setup can be started with `pnpm dev:dotcom`.
## Test plan
Ran `pnpm dev:dotcom` and saw the dotcom specific header and footer.
Two followups from implementing the repo menu:
1) Remove the rounded corners from the trigger button to match the rest
of the header
2) Add an external link icon to the code host link
VSCode extensions can use authentication providers to enable
authentication actions from the Accounts menu, and to allow for
federated authentication. The Sourcegraph Search extension needs neither
of those - it can meet all of its authentication needs with the existing
actions in is side panel.
On top of that, the authentication provider isn't implemented quite
correctly, which leads to issues like #43608.
This PR removes the authentication provider.
It retains all of the expected behavior of the extension: the user can
still authenticate against sourcegraph.com or private instances using an
access token, and log out.
## Test plan
### First
Build and run locally.
```
git switch peterguy/vscode-remove-auth-provider
cd client/vscode
pnpm run build
```
### Then
- Launch extension in VSCode: open the `Run and Debug` sidebar view in
VS Code, then select `Launch VS Code Extension` from the dropdown menu.
- Note that the Accounts icon does not display a "1" badge and "Sign in
with SOURCEGRAPH_AUTH" is not present in the menu.
- Click on `Have an account?` to open the login dialog.
- Enter an access token and the URL of the Sourcegraph instance to which
you would like to connect.
- Click `Authenticate account`.
- Check the Accounts icon and menu - should not be anything there that's
a result of Sourcegraph Search.
- In the Help and Feedback section, click your username to open the
logout panel, then log out.
- Note again, the lack of modifications to the Accounts icon and menu
from the Sourcegraph Search extension.
## Changelog
- Remove interaction between the Sourcegraph Search extension and the
Accounts menu.
Marks the `web-sveltekit:e2e_test` as flaky (tries them up to three
times). It just failed main on this build
db7a268c34
## Test plan
ci
<!-- All pull requests REQUIRE a test plan:
https://docs-legacy.sourcegraph.com/dev/background-information/testing_principles
-->
## Changelog
<!--
1. Ensure your pull request title is formatted as: $type($domain): $what
2. Add bullet list items for each additional detail you want to cover
(see example below)
3. You can edit this after the pull request was merged, as long as
release shipping it hasn't been promoted to the public.
4. For more information, please see this how-to
https://www.notion.so/sourcegraph/Writing-a-changelog-entry-dd997f411d524caabf0d8d38a24a878c?
Audience: TS/CSE > Customers > Teammates (in that order).
Cheat sheet: $type = chore|fix|feat $domain:
source|search|ci|release|plg|cody|local|...
-->
<!--
Example:
Title: fix(search): parse quotes with the appropriate context
Changelog section:
## Changelog
- When a quote is used with regexp pattern type, then ...
- Refactored underlying code.
-->
The search console page is broken, is not used or maintained, and is
only referenced by a series of blog posts years ago. We have product
support to remove it.
Fixes srch-507
The panels code prevents event propagation of mouse move events, which
in turn seems to prevent SvelteKit from its own preloading logic.
Looking at the event handlers it seems they are global only (per
document), so I don't think that stopping the propagation is necessary
for the panel itself to work. However, I think it makes sense to stop
any of default event behavior when the mouse is currently pressed, since
that means the user is currently dragging a resize handler. Would love
to get @vovakulikov's confirmation that my understanding is correct.
## Test plan
Manual testing. Changing the size of a panel (e.g. repo page) seems to
work as expected. Hovering over a file tree entry preloads data and code
now, as visible in the network tab.
The tags page contains a `:global` selector at the root level, which
affects all elements that match the selector, even those not part of the
page.
`:global` selectors always need to be scoped one way or the other.
## Test plan
Code inspection, trivial change.
Fixes srch-545
We are hiding suggestions until the user has interacted with the input
(e.g. by clicking or typing), but, as it is not, it does not include
clicking on the history button.
This commit changes that.
## Test plan
Manual testing. Clicking the history button without having interacted
with the search input in any other way will now show history suggestions
and focus in the input.
In response to some customer feedback that multiple users thought this
meant their user's license was expiring, this updates the wording to
clarify that it's the sourcegraph instance license that's expiring.
Contributes to srch-578
Currently we keep showing the loading indicator even if no references
have been found. This commit moves the info messages into the layout
because the layout has information we need to properly distinguish the
different states.
I think more refactoring is necessary to make this API better but that
will be done as part of adding search-based code intel support.
## Test plan
Manual testing.
This patch does a few things:
- Adds `go-enry` packages to depguard, so that people do not
accidentally use enry APIs instead of the corresponding APIs
in the `languages` package.
- Adds more tests for different functions in the languages package
to ensure mutual consistency in how language<->extension mappings
are handled.
- Adds tests for enry upgrades
- Adds comments with IDs so that related parts in the code can be
pieced together easily
We didn't support secrets for bitbucket cloud so far, but the code host
does support them. They use the same mechanism as Bitbucket and GitHub
so that was easy to add.
Closes SRC-393
Test plan:
Set up a webhook locally and tested that with a wrong secret it fails,
and with the correct secret it passes. Also wrote a test.
Removes "/cody/invites/accept" page.
Invite processing is handled on the "/cody/manage" page and
"/cody/invites/accept" is used only to redirect to the former.
Backend counterpart:
https://github.com/sourcegraph/self-serve-cody/pull/886
<!-- 💡 To write a useful PR description, make sure that your description
covers:
- WHAT this PR is changing:
- How was it PREVIOUSLY.
- How it will be from NOW on.
- WHY this PR is needed.
- CONTEXT, i.e. to which initiative, project or RFC it belongs.
The structure of the description doesn't matter as much as covering
these points, so use
your best judgement based on your context.
Learn how to write good pull request description:
https://www.notion.so/sourcegraph/Write-a-good-pull-request-description-610a7fd3e613496eb76f450db5a49b6e?pvs=4
-->
## Test plan
- Tested manually
- checkout branch
fromhttps://github.com/sourcegraph/self-serve-cody/pull/886 and run SSC
backend locally
- run Sourcegraoh instance in dotcom mode locally
- log in as a Cody Pro team admin and send an invite to another user
- log in as an invited user and follow the link from the email
- ensure link navigates to the "/cody/manage/" page and is hanled as
expected (see test plan from
https://github.com/sourcegraph/sourcegraph/pull/63231)
<!-- All pull requests REQUIRE a test plan:
https://docs-legacy.sourcegraph.com/dev/background-information/testing_principles
-->
## Changelog
<!--
1. Ensure your pull request title is formatted as: $type($domain): $what
2. Add bullet list items for each additional detail you want to cover
(see example below)
3. You can edit this after the pull request was merged, as long as
release shipping it hasn't been promoted to the public.
4. For more information, please see this how-to
https://www.notion.so/sourcegraph/Writing-a-changelog-entry-dd997f411d524caabf0d8d38a24a878c?
Audience: TS/CSE > Customers > Teammates (in that order).
Cheat sheet: $type = chore|fix|feat $domain:
source|search|ci|release|plg|cody|local|...
-->
<!--
Example:
Title: fix(search): parse quotes with the appropriate context
Changelog section:
## Changelog
- When a quote is used with regexp pattern type, then ...
- Refactored underlying code.
-->
It seems many of our doc links for code hosts are broken in production
due to a url changed from external_services to code_hosts. I did a find
an replace to update all the ones I could find.
This fixes the alignment of the icons in the dynamic filters sidebar by
mvoing the icon out of the `label` span and directly under the section
item flexbox. I did this by creating an `icon` slot, which also allowed
me to simplify a bunch of other complex slot interactions.
A glob that doesn't match any files got introduced in
4077b3ec22 (diff-f7c1ab1acb5e753bccdd4b092b0098fa58855899e8764b68829ada2ba9cea760R147)
which appears to confuse Gazelle, leading to `sg bazel configure` not
updating ts files.
Fixes https://github.com/sourcegraph/devx-support/issues/1029
## Test plan
Locally tested:
1. Dropped the offending glob
2. rm'ed `client/web/src/cody/subscription/subscriptionSummary.ts`
3. `sg bazel configure`
4. Observed the build file being updated accordingly.
<!-- All pull requests REQUIRE a test plan:
https://docs-legacy.sourcegraph.com/dev/background-information/testing_principles
-->
## Changelog
<!--
1. Ensure your pull request title is formatted as: $type($domain): $what
5. Add bullet list items for each additional detail you want to cover
(see example below)
6. You can edit this after the pull request was merged, as long as
release shipping it hasn't been promoted to the public.
7. For more information, please see this how-to
https://www.notion.so/sourcegraph/Writing-a-changelog-entry-dd997f411d524caabf0d8d38a24a878c?
Audience: TS/CSE > Customers > Teammates (in that order).
Cheat sheet: $type = chore|fix|feat $domain:
source|search|ci|release|plg|cody|local|...
-->
<!--
Example:
Title: fix(search): parse quotes with the appropriate context
Changelog section:
## Changelog
- When a quote is used with regexp pattern type, then ...
- Refactored underlying code.
-->
Currently queries are assumed to be 'literal', but in the current apps
we mostly use 'keyword' and 'standard'. Ideally we could pass the
pattern type that was used for each history entry, but we don't have
that information and cannot pass it easily.
Defaulting to the 'standard' or 'keyword' type is the next best option
to ensure that regex literal in the query are properly highlighted.
I defaulted to 'standard' in the React app because it's still possible
to opt out of keyword search.
Fixes bug intorduced in
https://github.com/sourcegraph/sourcegraph/pull/63231
Encode the URL search params added to `returnTo` search param value.
Previously the search param value hasn't been encoded resulting in URLs
with broken search params , e.g.
*"/sign-in?returnTo=/cody/manage?teamID=1&inviteID=2"* (note the second
"?" making the search params invalid).
<!-- 💡 To write a useful PR description, make sure that your description
covers:
- WHAT this PR is changing:
- How was it PREVIOUSLY.
- How it will be from NOW on.
- WHY this PR is needed.
- CONTEXT, i.e. to which initiative, project or RFC it belongs.
The structure of the description doesn't matter as much as covering
these points, so use
your best judgement based on your context.
Learn how to write good pull request description:
https://www.notion.so/sourcegraph/Write-a-good-pull-request-description-610a7fd3e613496eb76f450db5a49b6e?pvs=4
-->
## Test plan
- CI
- Tested manually:
- Make `signOutAndRedirectToSignIn` available in the window object, e.g.
`window.signOutAndRedirectToSignIn = signOutAndRedirectToSignIn` in the
*client/web/src/cody/management/api/react-query/callCodyProApi.ts*
- On "/cody/manage" page (any page works actually) ensure that a few
search params are added to the URL
- call `signOutAndRedirectToSignIn` in the browser console
- ensure you have been sign out, signed back in and the search params
are still in the URL
<!-- All pull requests REQUIRE a test plan:
https://docs-legacy.sourcegraph.com/dev/background-information/testing_principles
-->
## Changelog
<!--
1. Ensure your pull request title is formatted as: $type($domain): $what
2. Add bullet list items for each additional detail you want to cover
(see example below)
3. You can edit this after the pull request was merged, as long as
release shipping it hasn't been promoted to the public.
4. For more information, please see this how-to
https://www.notion.so/sourcegraph/Writing-a-changelog-entry-dd997f411d524caabf0d8d38a24a878c?
Audience: TS/CSE > Customers > Teammates (in that order).
Cheat sheet: $type = chore|fix|feat $domain:
source|search|ci|release|plg|cody|local|...
-->
<!--
Example:
Title: fix(search): parse quotes with the appropriate context
Changelog section:
## Changelog
- When a quote is used with regexp pattern type, then ...
- Refactored underlying code.
-->
Closes https://github.com/sourcegraph/sourcegraph/issues/63078
Part of https://github.com/sourcegraph/self-serve-cody/issues/804 (see
also its backend counterpart
https://github.com/sourcegraph/self-serve-cody/pull/858)
[Figma](https://www.figma.com/design/FMSdn1oKccJRHQPgf7053o/Cody-PLG-GA?node-id=4042-4927&t=Ob2UbemEkft4ofJZ-0)
### Summary
1. Moved the accept invite UI to the "/cody/manage" page.
2. Handled cases where the invited user is already a Cody Pro user.
3. Fixed styles in the CodyAlert component to ensure images are visible.
### Implementation Details
1. Added the `useInviteState` hook, which returns `initialInviteStatus`
and `initialUserStatus`.
We track the initial statuses to determine the appropriate UI variant to
display. For example, if the initial invite status is "sent" (indicating
the invite can be accepted) and the initial user status is
`UserInviteStatus.NoCurrentTeam` (indicating the user is not a member of
any team), a confirmation banner is shown for the user to accept or
decline the invite. After the user responds, the invite query is
invalidated, updating the status to "accepted", "canceled", or "errored"
based on their action. Depending on the result, a success or error
banner is displayed, or the banner is hidden if the invite is canceled.
More configuration examples can be found in the Screenshots section. All
possible states are detailed in the `AcceptInviteBannerContent`.
2. For users who are the sole admin of their current team, the banner is
shown on the "/cody/manage" page.
The design requires showing a banner on the "/cody/team/manage" page to
suggest transferring the admin role to another team member. However,
this page is not yet ready. To sync the banner state with user role
changes or deletion actions, the members list query must be invalidated
after each action. The current implementation of the "cody/manage/team"
page does not support refetching with the `useSSCQuery` hook. To resolve
this, we need to migrate the "cody/manage/team" page to use React Query
to allow query invalidation after each action. For now, users who are
sole admins see a banner on the "cody/manage" page suggesting
transferring the admin role, with a link to the "/cody/manage/team"
page.
<!-- 💡 To write a useful PR description, make sure that your description
covers:
- WHAT this PR is changing:
- How was it PREVIOUSLY.
- How it will be from NOW on.
- WHY this PR is needed.
- CONTEXT, i.e. to which initiative, project or RFC it belongs.
The structure of the description doesn't matter as much as covering
these points, so use
your best judgement based on your context.
Learn how to write good pull request description:
https://www.notion.so/sourcegraph/Write-a-good-pull-request-description-610a7fd3e613496eb76f450db5a49b6e?pvs=4
-->
### Screenshots
| Description | Screenshot |
|--|--|
| Failed to define user state OR invite status is not "sent" (thus can't
be accepted) | <img width="1516" alt="Screenshot 2024-06-14 at 14 39 41"
src="https://github.com/sourcegraph/sourcegraph/assets/25318659/cf712239-6a8e-4a66-a4a2-c1932ba70ffd">
|
| User is not on a Cody Pro team | <img width="1516" alt="Screenshot
2024-06-14 at 14 34 30"
src="https://github.com/sourcegraph/sourcegraph/assets/25318659/d6b53dc4-c7df-45eb-a743-9baddfdd8aa3"><img
width="1516" alt="Screenshot 2024-06-14 at 14 34 40"
src="https://github.com/sourcegraph/sourcegraph/assets/25318659/617957cf-8259-4056-a117-8b806ece6efe">|
|on the team they've been invited to|<img width="1516" alt="Screenshot
2024-06-14 at 14 35 41"
src="https://github.com/sourcegraph/sourcegraph/assets/25318659/eaa871ce-acd3-4a7e-a25c-74011a42af58">|
| User is the sole admin of another team |<img width="1516"
alt="Screenshot 2024-06-14 at 14 38 42"
src="https://github.com/sourcegraph/sourcegraph/assets/25318659/1382e5a0-4375-4002-93a4-ec25d354317f">|
| User is on another team |<img width="1516" alt="Screenshot 2024-06-14
at 14 36 38"
src="https://github.com/sourcegraph/sourcegraph/assets/25318659/2bf20073-f49b-4fb1-9996-6143671c1727"><img
width="1516" alt="Screenshot 2024-06-14 at 14 36 43"
src="https://github.com/sourcegraph/sourcegraph/assets/25318659/349e9445-b2ec-402d-ac0a-6b2517abde9c">|
## Test plan
- Checkout the branch from
https://github.com/sourcegraph/self-serve-cody/pull/858 and run SSC
locally
- Run Sourcegraph in dotcom mode
- As a Cody Pro team admin send invites to users that have different
statuses (are not on a team, are members of the team they were invited
to, are members of another team, are sole admins of their teams)
- As the invited user:
- click the invite link from the email
- modify the hostname in the URL so that it points to the local
Sourcegraph instance
- ensure the correct banner is displayed
- ensure user can accept/decline the invite (if applicable for the
banner type)
<!-- All pull requests REQUIRE a test plan:
https://docs-legacy.sourcegraph.com/dev/background-information/testing_principles
-->
## Changelog
<!--
1. Ensure your pull request title is formatted as: $type($domain): $what
5. Add bullet list items for each additional detail you want to cover
(see example below)
6. You can edit this after the pull request was merged, as long as
release shipping it hasn't been promoted to the public.
7. For more information, please see this how-to
https://www.notion.so/sourcegraph/Writing-a-changelog-entry-dd997f411d524caabf0d8d38a24a878c?
Audience: TS/CSE > Customers > Teammates (in that order).
Cheat sheet: $type = chore|fix|feat $domain:
source|search|ci|release|plg|cody|local|...
-->
<!--
Example:
Title: fix(search): parse quotes with the appropriate context
Changelog section:
## Changelog
- When a quote is used with regexp pattern type, then ...
- Refactored underlying code.
-->
This PR appends a trailing slash to org and directory suggestions so
that we don't search in repos or directories that are a prefix of the
current org/directory.
## Test plan
Manual testing.
This PR adds a new suggestions source to the repository search input. It
currently offers the following suggestions:
- Repository group/org (on every repo page)
- Current file and/or directory (on blob and tree pages)
- Language of current file (on blob pages)
When on a commit page it adds the revision of the commit to the repo
filter.
A new context store is introduced to propagate those values to the
search input. I also had to update our query processing logic to
preserve pattern and filter token ranges (first commit) so that we can
also replace filters, not just add the.
NOTE: I'm not convinced the way the information is propagated via
context is the best way to do, but it's the simplest I could think of
now. I can imagine in the future that individual pages create/register
suggestions directly.
https://github.com/sourcegraph/sourcegraph/assets/179026/7c1b78e3-061b-4dc8-a1ee-fb3273e633ba
## Test plan
Manual testing.
---------
Co-authored-by: Camden Cheek <camden@ccheek.com>
Closes srch-467
tl;dr: This commit switches all remaining mdi icons to lucide.
This commit does a couple of things to make the migration to lucide
icons and to the `Icon2` (now `Icon` again) component complete:
- Use lucide icons instead of mdi icons
- Turn custom icons back to SVG files and use `unplugin-icon`s custom
collections support to reference them
- Rename `Icon` component to `SVGIcon`. We still need it for integrating
with shared web app code.
- Rename `Icon2` component to `Icon`.
- Update to svelte@4.2.18 to [bring in a fix for
`<svelte:component`](https://github.com/sveltejs/svelte/releases/tag/svelte%404.2.12)
which is used by (now) `Icon`.
I put our generic icons in `assets/icons/` and the specific symbol icons
in `assets/symbol/icons`. They can be referenced via `ISgName` and
`ISymbolName`. I'm open to changes to the location and the naming.
If the same icon wasn't available in lucide I tried to find one that
made sense semantically. I expect we'll make another pass (in a separate
PR) to adjust icons and tweak icon sizes/colors.
## Test plan
`pnpm build` and svelte check
PR #49682 made some CSS changes to hide the caret as well as bracket
matching for this input. I assume that seeing those in a read-only input
was confusing.
However, hiding the textarea element also breaks copying the input's
value. Instead of hiding the textarea, we are now hiding the visiual
representation of the caret.
A noteable difference in behavior now is that it's possible to focus the
input via tab, but there is no visual indiciation that the editor has
focus (since we hide the caret, as before).
## Test plan
Manual tested on
https://sourcegraph.test:3443/site-admin/external-services/RXh0ZXJuYWxTZXJ2aWNlOjky
This adds Roboto Mono as the default monospace font for the Svelte
webapp. Previously, we were nominally using SF Mono, but that is not
installed by default and we were not fetching it, so the figma designs
looked different than what was being rendered in the web app. This uses
FontSource packages for the font for easy self-hosting (no external
requests).
Fixes srch-516
Using vite's inspect plugin I found out that we are importing a lot of
unnecessary components again, including `@sourcegraph/wildcard` and
`@sourcegraph/branded`.
By removing those dependencies we speed up the development build significantly.
## Test plan
`pnpm build`
Fixes the issues requiring the workaround described in [this
video](https://www.loom.com/share/10a4a66a19b548c7b0866fe2cc358daa).
Closes#60710
No more manual editing of `settings.json`.
The endpoint URL and access code can now all be managed from the UI
<!-- 💡 To write a useful PR description, make sure that your description
covers:
- WHAT this PR is changing:
- How was it PREVIOUSLY.
- How it will be from NOW on.
- WHY this PR is needed.
- CONTEXT, i.e. to which initiative, project or RFC it belongs.
The structure of the description doesn't matter as much as covering
these points, so use
your best judgement based on your context.
Learn how to write good pull request description:
https://www.notion.so/sourcegraph/Write-a-good-pull-request-description-610a7fd3e613496eb76f450db5a49b6e?pvs=4
-->
## Test plan
### First
Build and run locally.
```
git switch peterguy/vscode-sourcegraph-extension-fix-auth
cd client/vscode
pnpm run build
```
### Then
Launch extension in VSCode: open the `Run and Debug` sidebar view in VS
Code, then select `Launch VS Code Extension` from the dropdown menu.
Click on `Have an account?` to open the login dialog.
Enter an access token and the URL of the Sourcegraph instance to which
you would like to connect.
Click `Authenticate account`.
In the Help and Feedback section, click your username to open the logout
panel, then log out.
Repeat the login process.
You can check `settings.json` if you'd like to confirm that it's no
longer being used.
If you're logging in to dotcom, you'll probably se a SQL error. The
login process still works; the SQL error does not have long to live.
## Changelog
- Entering the URL and access token in the UI now works - no more manual
editing of `settings.json`
Closes SRCH-452
Until this commit both the React and Svelte apps have used the same code
to determine the correct file icon. That code however still held
separate logic for the two apps with the result that our file icon set
for the Svelte app was a lot smaller.
This commit separates the logic and now makes use of `unplugin-icons` in
the Svelte app.
I tried to use `unplugin-icons` in the React so that the code could
continued to be shared but I couldn't get it to work.
Note that I didn't use the exact same icons as in the React app. I
wanted to minimize the number of different icon sets we are using.
## Test plan
Builds without error, manual testing.
This adds `Inter` as the preferred for `--font-family-base` in the
Svelte webapp. Previously, we were using system fonts for our base font,
which meant our web app looked different depending on the OS+browser.
Instead of depending on the Google Fonts CDN, this uses Fontsource,
which let us easily self-host Google Fonts (and other OSS fonts) just by
importing an NPM package. No committing font files to git, and no
dependency or connection to a 3rd-party server. The font itself weighs
~40KB for the full, variable-weight font.
Contributes to SRCH-445
Adds support to the lang file filter for Magik language (`lang: Magik`).
In order to do that we add wrappers around go-enry and update search
code to use them. This provides flexibility for us in the future to
support other languages that are not in Linguist as well.
Closes SRCH-496
#63128 added a dedicated button for closing the bottom panel but
clicking the button didn't cause the diff view to close. This commit
fixes that.
## Test plan
Manual testing.
I disabled a few tests to get #62560 merged. This just goes back and fixes the ones I disabled. There are still a handful skipped, but the fixes were non-trivial.
This updates the `Popover` component to accept a passed-in target rather
than setting the target via an action. This allows us to pass in targets
not owned by the `Popover` component, which is important for things like
the file tree where the logical target is a wrapper around what the
consumer has access to.
Closes SRCH-450
This commit adds a button to the right hand side of the tabs that allows
closing the bottom panel.
For this I
- extended the Tabs.svelte component to allow rendering something to the
right hand side of the tabs.
- added a new `text` variant to button that renders an unstyled button
and shows a background on hover
Note that the icon as shown in the figma design doesn't exist in lucide.

## Test plan
Visual/manual inspection in light and dark mode
## Changelog
- Added bottom panel close button
- Added 'text' variant to Button component
- Added 'actions' slot to Tabs component
- Added Button component stories
Fixes SRCH-484. See that issue for more information about the problem.
Instead of hardcoding the routes that can contain file paths, I'm using
the generated list of routes in `routes.ts` and extract any route that
ends with a `[...path]` segment (which, so far at least, is used as the
file path parameter).
This list is then used to hook into the routing process and encode the
file path when any of the routes match. As mentioned in the `reroute`
documentation, this does not affect the URL displayed in the browser.
Because the file path is now URL encoded we need to decode it before we
can process it further (I grepped for all occurrences of `params.path`).
## Test plan
Manual testing, integration test.
This runs playwright tests with bazel. This changes how the
app is served in the tests, specifically playwright will intercept all
network calls to the local server and serve the static assets directly
or serve root index.html file if nothing is matched.
---------
Co-authored-by: bahrmichael <michael.bahr@sourcegraph.com>
Co-authored-by: Jean-Hadrien Chabran <jh@chabran.fr>
Co-authored-by: Michael Bahr <1830132+bahrmichael@users.noreply.github.com>
Co-authored-by: Jean-Hadrien Chabran <jean-hadrien.chabran@sourcegraph.com>
Co-authored-by: Camden Cheek <camden@ccheek.com>
This modifies our pattern for shipping a svelte-enabled HTML document by
injecting the svelte-specific things into our primary `app.html` rather
than trying to make `app.prod.html` match the behavior of the frontend
`app.html`.
I could not figure out a "blessed" way to integrate this into the build
system, so I went for the hacky way: render `app.prod.html` in a format
that's easily parseable, then parse it in `frontend` and inject it into
our `app.html` with the standard go template patterns.
This one is straightforward: changing the spelling of a variable.
As I poked around in the vscode extension looking for what's going on
with the authentication errors, the misspelling of `scretTokenKey`
became difficult to ignore. So I fixed it. :-D
## Test plan
1. Build and run locally.
```
cd client/vscode
pmpn run build
```
2. Launch extension in VSCode: open the `Run and Debug` sidebar view in
VS Code, then select `Launch VS Code Extension` from the dropdown menu.
Verify expected behavior.
Sandbox escapes be-gone
## Test plan
Tested in CI and locally with `bazel build //client/...` as well as a
lot of blood, sweat n tears tearing through failed sandboxes
## Changelog
This applies the `sizeToFit` action to the file header, allowing us to
collapse the header in multiple steps:
- First, collapse the actions down to icons
- Next, collapse elements one by one from the front of the path and put
them in an overflow dropdown
CLOSE https://github.com/sourcegraph/cody-issues/issues/211 &
https://github.com/sourcegraph/cody-issues/issues/412 &
https://github.com/sourcegraph/cody-issues/issues/412
UNBLOCK https://github.com/sourcegraph/cody/pull/4360
* Add support for Google Gemini AI models as chat completions provider
* Add new `google` package to handle Google Generative AI client
* Update `client.go` and `codygateway.go` to handle the new Google
provider
* Set default models for chat, fast chat, and completions when Google is
the configured provider
* Add gemini-pro to the allowed list
<!-- 💡 To write a useful PR description, make sure that your description
covers:
- WHAT this PR is changing:
- How was it PREVIOUSLY.
- How it will be from NOW on.
- WHY this PR is needed.
- CONTEXT, i.e. to which initiative, project or RFC it belongs.
The structure of the description doesn't matter as much as covering
these points, so use
your best judgement based on your context.
Learn how to write good pull request description:
https://www.notion.so/sourcegraph/Write-a-good-pull-request-description-610a7fd3e613496eb76f450db5a49b6e?pvs=4
-->
## Test plan
<!-- All pull requests REQUIRE a test plan:
https://docs-legacy.sourcegraph.com/dev/background-information/testing_principles
-->
For Enterprise instances using google as provider:
1. In your Soucegraph local instance's Site Config, add the following:
```
"accessToken": "REDACTED",
"chatModel": "gemini-1.5-pro-latest",
"provider": "google",
```
Note: You can get the accessToken for Gemini API in 1Password.
2. After saving the site config with the above change, run the following
curl command:
```
curl 'https://sourcegraph.test:3443/.api/completions/stream' -i \
-X POST \
-H 'authorization: token $LOCAL_INSTANCE_TOKEN' \
--data-raw '{"messages":[{"speaker":"human","text":"Who are you?"}],"maxTokensToSample":30,"temperature":0,"stopSequences":[],"timeoutMs":5000,"stream":true,"model":"gemini-1.5-pro-latest"}'
```
3. Expected Output:
```
❯ curl 'https://sourcegraph.test:3443/.api/completions/stream' -i \
-X POST \
-H 'authorization: token <REDACTED>' \
--data-raw '{"messages":[{"speaker":"human","text":"Who are you?"}],"maxTokensToSample":30,"temperature":0,"stopSequences":[],"timeoutMs":5000,"stream":true,"model":"gemini-1.5-pro-latest"}'
HTTP/2 200
access-control-allow-credentials: true
access-control-allow-origin:
alt-svc: h3=":3443"; ma=2592000
cache-control: no-cache
content-type: text/event-stream
date: Tue, 04 Jun 2024 05:45:33 GMT
server: Caddy
server: Caddy
vary: Accept-Encoding, Authorization, Cookie, Authorization, X-Requested-With, Cookie
x-accel-buffering: no
x-content-type-options: nosniff
x-frame-options: DENY
x-powered-by: Express
x-trace: d4b1f02a3e2882a3d52331335d217b03
x-trace-span: 728ec33860d3b5e6
x-trace-url: https://sourcegraph.test:3443/-/debug/jaeger/trace/d4b1f02a3e2882a3d52331335d217b03
x-xss-protection: 1; mode=block
event: completion
data: {"completion":"I","stopReason":"STOP"}
event: completion
data: {"completion":"I am a large language model, trained by Google. \n\nThink of me as","stopReason":"STOP"}
event: completion
data: {"completion":"I am a large language model, trained by Google. \n\nThink of me as a computer program that can understand and generate human-like text.","stopReason":"MAX_TOKENS"}
event: done
data: {}
```
Verified locally:

#### Before
Cody Gateway returns `no client known for upstream provider google`
```sh
curl -X 'POST' -d '{"messages":[{"speaker":"human","text":"Who are you?"}],"maxTokensToSample":30,"temperature":0,"stopSequences":[],"timeoutMs":5000,"stream":true,"model":"google/gemini-1.5-pro-latest"}' -H 'Accept: application/json' -H 'Authorization: token $YOUR_DOTCOM_TOKEN' -H 'Content-Type: application/json' 'https://sourcegraph.com/.api/completions/stream'
event: error
data: {"error":"no client known for upstream provider google"}
event: done
data: {
```
## Changelog
<!--
1. Ensure your pull request title is formatted as: $type($domain): $what
2. Add bullet list items for each additional detail you want to cover
(see example below)
5. You can edit this after the pull request was merged, as long as
release shipping it hasn't been promoted to the public.
6. For more information, please see this how-to
https://www.notion.so/sourcegraph/Writing-a-changelog-entry-dd997f411d524caabf0d8d38a24a878c?
Audience: TS/CSE > Customers > Teammates (in that order).
Cheat sheet: $type = chore|fix|feat $domain:
source|search|ci|release|plg|cody|local|...
-->
<!--
Example:
Title: fix(search): parse quotes with the appropriate context
Changelog section:
## Changelog
- When a quote is used with regexp pattern type, then ...
- Refactored underlying code.
-->
Added support for Google as an LLM provider for Cody, with the following
models available through Cody Gateway: Gemini Pro (`gemini-pro-latest`),
Gemini 1.5 Flash (`gemini-1.5-flash-latest`), and Gemini 1.5 Pro
(`gemini-1.5-pro-latest`).