Commit Graph

8758 Commits

Author SHA1 Message Date
Michael Bahr
b28879a3e7
chore: reword headline from tokens to credentials (#63714)
Updates a headline to better reflect that we now use more than just
tokens.

## Test plan

Existing CI

## Changelog

<!-- OPTIONAL; info at
https://www.notion.so/sourcegraph/Writing-a-changelog-entry-dd997f411d524caabf0d8d38a24a878c
-->
2024-07-09 15:48:56 +00:00
Vova Kulikov
33d6a254c9
Cody Web: bump cody web to 0.2.3 (#63723)
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
2024-07-09 12:48:06 -03:00
Stefan Hengl
2ff4a84bd8
keyword search: remove beta badge (#63720)
This removes the beta badge from the CTA on the main page.

Closes SPLF-131
2024-07-09 08:24:31 -07:00
Michael Bahr
62b0c89dbb
fix: better alignemnt of github credentials and check success notice (#63717)
Closes SRCH-701

Ideally we would use a DismissibleAlert one level up the React component
chain, but that's turning out too tricky for the time we have left:
https://sourcegraph.slack.com/archives/C07A21XEP0T/p1720486350310899

## Test plan

Manual testing

## Changelog

<!-- OPTIONAL; info at
https://www.notion.so/sourcegraph/Writing-a-changelog-entry-dd997f411d524caabf0d8d38a24a878c
-->
2024-07-09 15:02:25 +00:00
Michael Bahr
1261b06e36
fix: show success notice in the correct area (#63721)
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
-->
2024-07-09 15:01:41 +00:00
Michael Bahr
4e510a2fb2
chore: drop isGitHubApp field from batch changes credentials (#63709)
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>
2024-07-09 13:01:33 +02:00
Felix Kling
f007a73134
feat(svelte): Add cody button to repo home page (#63684)
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.
2024-07-09 09:33:57 +00:00
Felix Kling
ec77521b43
fix(svelte): Update cody web (#63710)
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.
2024-07-09 09:17:56 +00:00
Bolaji Olajide
b97563f3ee
feat(batches): Add "check" action to validate Github apps connection (#63705)
Closes SRCH-702

![CleanShot 2024-07-09 at 03 28
15@2x](https://github.com/sourcegraph/sourcegraph/assets/25608335/b6011864-fc4e-429c-b320-51c5a0c7b9e1)

This button adds a check button to the `GitHubApps` control that enables
users to check if their GitHub app connection is accessible.

## Test plan

Manual testing.

## Changelog

<!-- OPTIONAL; info at
https://www.notion.so/sourcegraph/Writing-a-changelog-entry-dd997f411d524caabf0d8d38a24a878c
-->
2024-07-09 04:16:53 -05:00
Stefan Hengl
1af563b614
batches: use "keyword" as default pattern type (#63613)
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.
2024-07-09 10:35:01 +02:00
Bolaji Olajide
2c3d92398d
chore(batches): remove batches-github-app-integration feature flag (#63701)
We want to make the `Batch Changes <> GitHub App` integration available
for everyone.

## Test plan

<!-- REQUIRED; info at
https://docs-legacy.sourcegraph.com/dev/background-information/testing_principles
-->
Manual testing

## Changelog

<!-- OPTIONAL; info at
https://www.notion.so/sourcegraph/Writing-a-changelog-entry-dd997f411d524caabf0d8d38a24a878c
-->
2024-07-09 09:43:01 +02:00
Felix Kling
fb1106be15
fix(svelte): Respect cody ignore settings (#63677)
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.
2024-07-09 07:40:12 +00:00
Stephen Gutekanst
12b0e4e233
site config: minor fixes, make modelConfiguration enable new backend models API, initial self-hosted model config (#63697)
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>
2024-07-08 16:53:05 -07:00
Robert Lin
58a320a611
feat/dotcom: remove per-user Enterprise subscriptions UI (#63698)
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/p1720474215464999
https://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
2024-07-08 16:02:42 -07:00
Camden Cheek
31eedfcf92
Svelte: encode path components in file header (#63695)
While adding a [file with a bunch of special characters in its
name](https://sourcegraph.sourcegraph.com/github.com/sgtest/weird/-/blob/filenames/special-characters-~!%40%23%24%25%5E%26*()_+%3D-%60%7B%7D%5B%5D%5C%7C%22'%3F.%2C%3C%3E)
to sgtest/weird, I noticed that clicking a link to the file is broken.

This URI-encodes the path components so following the link does not
yield a 404.
2024-07-08 16:47:06 -06:00
Vova Kulikov
ed493c9dd1
React app: bump cody web to 0.2.1 (#63694)
Bumps cody web experimental package to 0.2.1 which includes fixes for
https://linear.app/sourcegraph/issue/SRCH-633/links-in-the-prompt-has-incorrect-url-in-cody-web

## Test plan
- Manual testing
- Check that links in cody web context lists work properly 

<!-- REQUIRED; info at
https://docs-legacy.sourcegraph.com/dev/background-information/testing_principles
-->

## Changelog

<!-- OPTIONAL; info at
https://www.notion.so/sourcegraph/Writing-a-changelog-entry-dd997f411d524caabf0d8d38a24a878c
-->
2024-07-08 18:05:20 -03:00
Michael Bahr
79dc39de4f
feat: UI changes for batches github app integration (#63683)
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
-->
2024-07-08 15:02:46 -05:00
Camden Cheek
3a76ec8348
Search: restore snippets to filters sidebar (#63587)
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).
2024-07-08 10:39:21 -06:00
Felix Kling
aa0be2e68e
chore(svelte): Cleanup dependencies (#63691)
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.
2024-07-08 17:54:44 +02:00
Felix Kling
a6d53b5305
fix(svelte): Properly load/serve version.json (#63688)
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.
2024-07-08 16:35:38 +02:00
Felix Kling
5f753455b4
fix(svelte): Fixes excessive 'the hotkey ... has already been registered' messages (#63679)
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.
2024-07-06 22:26:27 +02:00
Vova Kulikov
a81d5e7ae7
Bump code-web-experimental version to 0.2.0 (#63675)
This PR bumps `cody-web-experimental` package to 0.2.0 which includes
- Fixes for UI flashes
- Support openCTX mention providers
- Fixes for cursor jumping
- Fixes for style leaking 

Here as well I included a few minor UI fixes for the chat which close 
- [CODY-2721
](https://linear.app/sourcegraph/issue/CODY-2721/investigate-a-lot-of-empty-chats-being-added-each-time-you-view-a)
-
[SRCH-671](https://linear.app/sourcegraph/issue/SRCH-671/truncate-chat-message-in-history-pane-and-show-new-message-instead-of)
-
[SRCH-674](https://linear.app/sourcegraph/issue/SRCH-674/dont-show-empty-chats-generated-by-cody-blob-ui-view)
-
[SRCH-647](https://linear.app/sourcegraph/issue/SRCH-647/glitches-in-rounded-corners-of-mention-menu)

I will update the package for the Svelte version as a follow-up early
next week.

## Test plan
- Install the most recent deps
- Run sg start web-standalone
- Check chat UI on the standalone chat page and in blob UI
2024-07-05 18:57:38 -03:00
Felix Kling
bacf553ffc
fix(svelte): Render correct error page (#63663)
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.
2024-07-05 21:19:55 +02:00
Quinn Slack
b0f3ba5f35
improve FilteredConnection filter types (#63672)
This gives a bit more type-safety when using FilteredConnection filters.

## Test plan

CI
2024-07-05 08:59:28 -05:00
Michael Bahr
73881aef18
feat: implement functionality to create credential GitHub apps (#63635)
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>
2024-07-05 08:56:41 -05:00
Felix Kling
e7656e55ed
fix(svelte): Use 'pointer' pointer for cody button (#63665)
Fixes srch-686

## Test plan

Manual testing, trivial change.
2024-07-05 10:10:46 +00:00
Felix Kling
f0c9551f56
feat(svelte): Add Cody chat sidebar (#63638)
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
2024-07-04 22:50:03 +02:00
Bolaji Olajide
069db89d9a
fix(batches): display failure alert depending on github app kind (#63633)
The Github failure alert shows up for non-commit signing failures, it
should only show up when the kind is `COMMIT_SIGNING`

## Test plan

<!-- REQUIRED; info at
https://docs-legacy.sourcegraph.com/dev/background-information/testing_principles
-->

Manual testing.

## Changelog

<!-- OPTIONAL; info at
https://www.notion.so/sourcegraph/Writing-a-changelog-entry-dd997f411d524caabf0d8d38a24a878c
-->
2024-07-04 04:15:26 -05:00
Quinn Slack
f2e648bbb5
fetch NamespaceSelector namespaces from GraphQL (viewer { affiliatedNamespaces }) (#63592)
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.
2024-07-04 01:50:50 -05:00
Dan Adler
4c824b4aa8
Add v2 telemetry infrastructure to browser extensions and native inte… (#63458)
…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>
2024-07-03 16:47:37 -07:00
Stephen Gutekanst
239f42947b
Add a better Cody client server-sent configuration mechanism (#63591)
Signed-off-by: Stephen Gutekanst <stephen@sourcegraph.com>
2024-07-03 22:57:31 +00:00
Camden Cheek
aa0eecdc44
Svelte: add mutation observer to sizeToFit (#63620)
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.
2024-07-03 12:49:33 -06:00
Julie Tibshirani
6c6448a127
Search: remove keyword toggle (#63584)
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
2024-07-03 10:53:33 -07:00
Felix Kling
4090f4fd17
feat(svelte): Make diff headers on commit page sticky (#63615)
Small change to make browsing large diffs more ergonomic.

## Test plan

Manual testing.
2024-07-03 18:07:17 +02:00
Felix Kling
9ecc6e9444
fix(search): Don't show inline cody widget when new cody web is enabled (#63608)
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.
2024-07-03 17:56:51 +02:00
Peter Guy
bc7b9a7fe7
vsce: patch release v2.2.17 (#63617)
Releasing the Sourcegraph Search VSCode extension

## Test plan

N/A: release
2024-07-03 14:54:12 +00:00
Quinn Slack
09df420893
remove autocomplete limit from Cody dashboard page (#63609)
Now it always shows "N / unlimited" to all users. For Cody Free users,
it no longer shows a limit. For Cody Pro users, it now shows the actual
number of autocompletes they've done this month.


![image](https://github.com/sourcegraph/sourcegraph/assets/1976/5047b5a6-a804-437a-8eb0-9155bc67fc38)


## Test plan

View page and ensure it shows correctly.
2024-07-03 10:39:08 +00:00
Stefan Hengl
9b4e70face
insights: persist patternType in db (#63579)
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.
2024-07-03 09:51:48 +02:00
Quinn Slack
a73b1b0964
clean up FilteredConnection filter types and code (#63590)
- 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).
2024-07-03 00:13:17 -07:00
Dan Adler
a41edf6126
(chore)analytics: consistent naming of web code copied events (#63550)
Consistent naming of all code copied events. Prompted by a discussion in
Slack:
https://sourcegraph.slack.com/archives/C05BGNBEPKL/p1719562715227509

## Test plan

CI

## Changelog

Co-authored-by: Dan Adler <5589410+dadlerj@users.noreply.github.com>
2024-07-02 10:38:46 -07:00
Felix Kling
babce71852
fix(svelte): Remove rogue console.log statement (#63600)
## Test plan

Code inspection
2024-07-02 14:53:07 +00:00
Bolaji Olajide
2eafe0fcfe
Implement UI for Github Apps <> Batch Changes integration (#63597)
Closes SRCH-660
Closes SRCH-661

This PR adds the UI flow for adding a GitHub app as a Batch Changes
credential. The actual functionality to create the GitHub app and store
it's information will be done in a follow up PR.



https://github.com/sourcegraph/sourcegraph/assets/25608335/1089a363-070d-4fd8-8a03-af63cd378947

## Test plan

<!-- REQUIRED; info at
https://docs-legacy.sourcegraph.com/dev/background-information/testing_principles
-->

Manual testing.

## Changelog

<!-- OPTIONAL; info at
https://www.notion.so/sourcegraph/Writing-a-changelog-entry-dd997f411d524caabf0d8d38a24a878c
-->
2024-07-02 08:56:17 -05:00
Felix Kling
53d95965d4
fix(svelte): Fix unplugin icons usage in storybook (#63594)
Using unplugin icons with storybook results in build failures. This is a
workaround I found in an issue about it.

![2024-07-02_12-26](https://github.com/sourcegraph/sourcegraph/assets/179026/1413f26b-f03d-42ac-86af-0411cc693cc6)


## Test plan

`pnpm storybook` works.
2024-07-02 10:45:01 +00:00
Quinn Slack
1b9459cab7
add LazyQueryInputFormControl, remove duplicated common pattern (#63537)
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
2024-07-01 17:34:51 -07:00
Peter Guy
f6bd07c0a2
Remove url and token from configuration (#63559)
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.
2024-07-01 10:12:45 -06:00
Quinn Slack
d72df67ce0
cosmetic improvements to OrgSettingsMemberPage, UserEmail (#63570)
- 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.
2024-07-01 08:42:24 -07:00
Quinn Slack
841ccfe177
suppress ResizeObserver type error (#63572)
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
2024-07-01 08:42:10 -07:00
Quinn Slack
a0c4f2f7c8
make <Label> element focus & select at end to match native label behavior (#63568)
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.
2024-07-01 08:41:56 -07:00
Peter Guy
e73709e7af
Remove signup link for sourcegraph.com (#63558)
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.
2024-07-01 16:03:44 +02:00
Peter Guy
0a3e340efb
chore(search) VSCode Search extension: Update README and CHANGELOG (#63562)
Update the README and CHANGELOG after recent changes.

## Test plan

Read the README and CHANGELOG
2024-07-01 14:37:37 +02:00
Stefan Hengl
4f79980e0e
notebooks: store default pattern type per notebook (#63472)
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.
2024-07-01 10:45:46 +02:00
Quinn Slack
40ea9132ab
narrow NamespaceProps type (#63571)
Also reduce dependency on the GraphQL result types.


## Test plan

CI
2024-07-01 01:11:54 -07:00
Quinn Slack
d81a9f21f2
remove unused code for org member summary & autocomplete (#63567)
These have been unused for ~2 years. All usage of these APIs was removed
in https://github.com/sourcegraph/sourcegraph/pull/43644 and related
changes.

## Test plan

CI
2024-07-01 07:58:14 +00:00
Quinn Slack
78f4357852
fetch User.id to suppress GraphQL cache warning (#63538)
Fixes `Cache data may be lost when replacing the user field of a Query
object. ...`
2024-06-29 04:07:48 +00:00
Kevin Chen
0e82e717b3 updated models
updated models
2024-06-28 16:43:56 -07:00
Kevin Chen
654620900f Update free tier limits 2024-06-28 16:43:56 -07:00
Peter Guy
bca052634e
fix(search): VSCode Search extension: hide file preview link (#63552)
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.
2024-06-28 15:06:42 -06:00
Camden Cheek
daae1d18d1
Svelte: add debug view for code intel occurrences (#63475)
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
2024-06-28 20:27:33 +00:00
Felix Kling
b25cf26b05
fix(svelte): Reference layout shift while loading data (#63546)
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
2024-06-28 21:29:01 +02:00
Ara
141d2e0cc4
Add Support for Counting Tokens for Azure Code and Update in Redis (#63100)
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.
-->
2024-06-28 12:37:53 +00:00
Felix Kling
8c32333608
fix(search): Token decoration in keyword-enabled query input (#63543)
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.


![2024-06-28_13-12](https://github.com/sourcegraph/sourcegraph/assets/179026/4aff056c-2a18-4a41-9033-94d642c0858b)
2024-06-28 14:30:16 +02:00
Michael Bahr
468a89be5e
feat: remove experimental label from batches merge changesets action (#63542)
Closes SRCH-630

## Test plan

- Manual testing
2024-06-28 11:08:26 +00:00
Felix Kling
d4548b2be5
chore(svelte): Hide cody nav entries and upsell banner when cody isn't enabled (#63463)
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.
2024-06-28 12:23:04 +02:00
Quinn Slack
c6bc1b5181
make Cody and Code Search global navbar items one-click (#63514)
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)


![image](https://github.com/sourcegraph/sourcegraph/assets/1976/6b87ad4a-cb8a-4706-8954-f79e588803cd)

![image](https://github.com/sourcegraph/sourcegraph/assets/1976/b971c2f2-5965-4cd9-b8ac-17dc0ff9921d)

![image](https://github.com/sourcegraph/sourcegraph/assets/1976/933865d9-105f-406f-b88e-62e370896cfd)


## 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).
2024-06-28 02:04:05 -07:00
Camden Cheek
6fd099edda
Chore: refactoring occurrence indexing (#63473)
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.
2024-06-28 02:46:20 +00:00
Camden Cheek
6e57dfec13
Codenav: use new occurrences API for symbol definitions (#63217)
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`
2024-06-28 00:26:17 +00:00
Michael Lin
b572e071bb
cloud: update feature flag warning severity (#63499)
follow up https://github.com/sourcegraph/sourcegraph/pull/63484

got feedback from teammates that it shouldn't be `warning` but `info`

warning usually indicates something is wrong, this is not the case.

<!-- PR description tips:
https://www.notion.so/sourcegraph/Write-a-good-pull-request-description-610a7fd3e613496eb76f450db5a49b6e
-->

## Test plan

<!-- REQUIRED; info at
https://docs-legacy.sourcegraph.com/dev/background-information/testing_principles
-->

## Changelog

<!-- OPTIONAL; info at
https://www.notion.so/sourcegraph/Writing-a-changelog-entry-dd997f411d524caabf0d8d38a24a878c
-->

n/a
2024-06-27 16:38:03 -07:00
Camden Cheek
42990e1c1b
Svelte: rev picker design updates and addition to commits page (#63506)
This cleans up the revision picker design, adds a copy button, and adds
it to the file page.
2024-06-27 22:39:06 +00:00
Quinn Slack
3e283e457e
link to Cody chat on the web from the Cody manage page (#63530)
Improves the Cody PLG management page to have a more prominent link to
Cody Web. Also renames `Ask Cody` to `Cody` for simplicity.

Closes
https://linear.app/sourcegraph/issue/PRIME-396/improve-web-chat-link-on-cody-manage-page

<img width="1226" alt="image"
src="https://github.com/sourcegraph/sourcegraph/assets/1976/8f74f8f6-c5b8-41f1-abb6-2da5e02a25aa">


## Test plan

View in dotcom mode and ensure section looks nice
2024-06-27 21:27:28 +00:00
Peter Guy
72c00d397a
fix(search): VSCode Search extension: bring back matched lines in search results. (#63524)
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.
2024-06-27 13:24:51 -06:00
Stefan Hengl
09992ad92d
saved searches: use default pattern type (#63487)
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
2024-06-27 16:24:49 +02:00
Quinn Slack
dc478c82dd
chore(ci): remove Percy visual tests (#63515)
These are more frequently erroneous than helpful.

See
https://sourcegraph.slack.com/archives/C04MYFW01NV/p1719209633005499.

This eliminates a source of frustration and flakiness in pull requests
and removes a lot of code and Bazel complexity.

If we want to revive them, we can revert this commit. Note that
`client/web-sveltekit` does not use Percy, and if we want it to, we can
always revert this commit or start over from scratch if that's easier.


<!-- PR description tips:
https://www.notion.so/sourcegraph/Write-a-good-pull-request-description-610a7fd3e613496eb76f450db5a49b6e
-->

## Test plan

CI

Co-authored-by: Jean-Hadrien Chabran <jean-hadrien.chabran@sourcegraph.com>
2024-06-27 16:20:06 +02:00
Stefan Hengl
cb41db37cb
search: fix regexp toggle if regexp is default (#63489)
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".
2024-06-27 12:50:12 +02:00
Quinn Slack
4767166e1e
remove unused CTAs (#63512)
These CTAs are all inaccessible on dotcom anyway and would never show
up.


## Test plan

Visit pages where CTAs were deleted and ensure they work.
2024-06-27 08:43:47 +00:00
Quinn Slack
7e7de5ffb1
looser eslint rules (#63511)
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.
2024-06-27 08:42:51 +00:00
Quinn Slack
74f030b3ca
misc wording and UI tweaks to search contexts pages (#63513)
## Test plan

Visit search contexts page and ensure it renders as expected.
2024-06-27 01:33:35 -07:00
Quinn Slack
a82afa8a7d
fix Cody nav link for unauthed dotcom users (#63510)
Previously, this took users to
`https://sourcegraph.com/https://sourcegraph.com/cody`, which was
because it used `<Navigate />` incorrectly. Now it correctly takes you
to https://sourcegraph.com/cody.


## Test plan

Test locally in dotcom mode
2024-06-27 07:56:25 +00:00
Quinn Slack
f729863b58
oops, fix Cody Web enablement (#63508)
Added this during testing and forgot to remove it before merging.


## Test plan

n/a
2024-06-26 22:58:58 -07:00
Quinn Slack
0021f95d6c
remove Cody "upsells"—and all Cody links if Cody is disabled (#63430)
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.


![image](https://github.com/sourcegraph/sourcegraph/assets/1976/c2adb086-44ec-4240-ad44-95981763fb72)


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.
2024-06-27 05:29:54 +00:00
Erik Seliger
83d0f6876c
dotcom: Remove on-demand cloning of repositories (#63321)
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.
2024-06-26 14:53:14 -07:00
Vova Kulikov
94bf178504
Cody Web: Fix Cody page for signed out users (#63498)
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
2024-06-26 17:05:21 -03:00
Vova Kulikov
26c872cb77
Fix initial context for Cody Web on the repository page (#63497)
Closes
https://linear.app/sourcegraph/issue/SRCH-620/cody-web-has-incorrect-initial-context-on-blank-repository-page

## Test plan
- Go to the repository root and open Cody Web, it should have only
repository as the initial context
2024-06-26 16:50:25 -03:00
Camden Cheek
aae480a77b
Svelte: improve contrast for file tree guide line (#63495)
Bumped it up to `--secondary`. Also fixed the visual centering against
the new lucide chevrons.

Fixes SRCH-485
2024-06-26 13:03:40 -06:00
Vova Kulikov
781a421d23
Enable new Cody Web by default (#63493)
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
2024-06-26 15:05:32 -03:00
Felix Kling
6ea958be33
chore(svelte): Upgrade SvelteKit (#63490)
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`
2024-06-26 18:52:26 +02:00
Michael Lin
78a8f6be8a
cloud: add feature flags to show no edit warning (#63484)
ref CLO-380

on Cloud, customer changes to feature flags are overridden by our
automation. let's add a warning message to avoid suprises.

## Test plan

![CleanShot 2024-06-25 at 19 56
04](https://github.com/sourcegraph/sourcegraph/assets/8373004/ebe18608-929d-4d92-92e9-188b6637371c)
2024-06-26 16:27:11 +00:00
Vova Kulikov
a61c881e47
[React]: Add initial usage of the new web worker-based cody web chat (#62792)
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
2024-06-26 12:13:29 -03:00
Felix Kling
70ba49e46a
chore(svelte): Properly route to revision agnostic pages (#63444)
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.
2024-06-26 12:46:56 +00:00
Stefan Hengl
bc49218e6c
code monitors: respect default pattern type (#63333)
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>
2024-06-26 11:59:42 +02:00
Quinn Slack
eacde544f3
add React key to fragments in code monitoring logs (#63479)
Fixes the "missing key" React warning.


## Test plan

Ensure no console warning
2024-06-26 11:06:54 +02:00
Camden Cheek
732c7c8675
Chore: fix repo stars alignment (#63476)
This is the only one I know of that's left from SRCH-551, so saying this fixes SRCH-551.
2024-06-26 11:03:29 +02:00
Felix Kling
617599b66b
fix(svelte): Preserve selected lines in codehost URL (#63334) 2024-06-26 07:08:09 +02:00
Quinn Slack
7396ee0cce
fix chopped-off tooltips in code monitor query input (#63478)
The tooltips for autocomplete and diagnostics in the code monitor query
editor were being chopped off due to an `overflow: hidden`. Now they
show up.

Before (note the tiny vertical border that is part of the tooltip above
the text):

<img width="402" alt="image"
src="https://github.com/sourcegraph/sourcegraph/assets/1976/94523c8c-8e4b-4168-8675-8716b25d4b60">



After:
<img width="622" alt="image"
src="https://github.com/sourcegraph/sourcegraph/assets/1976/9bc4c4f1-ec1c-4172-a4d2-1518bd0bde91">


## Test plan

Hover over a diagnostic at
https://sourcegraph.test:3443/code-monitoring/new and confirm the
tooltip shows.

## Changelog

- Fixed an issue when creating or editing a code monitor that obscured
helpful tooltips in the query editor.
2024-06-26 04:42:04 +00:00
Robert Lin
92c44507f9
feat/dotcom: show subscription UUID in Enterprise Portal format (#63482)
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">


![image](https://github.com/sourcegraph/sourcegraph/assets/23356519/cca8e6d1-2e20-4954-8f72-7694ad1d8bfa)
2024-06-25 17:26:26 -07:00
Quinn Slack
b79cf5b03b
remove beta labels for code monitoring Slack notifs & logs (#63480)
These features have passed the steps needed to take them out of beta.
They have been feature-complete and in widespread use for more than a
year with no outstanding issues, and they work well.

-
https://linear.app/sourcegraph/project/slack-notifications-ga-code-monitoring-7dbb9fa13f62
-
https://linear.app/sourcegraph/issue/SRCH-533/remove-beta-label-from-code-monitor-logs-tab

Closes
https://linear.app/sourcegraph/issue/SRCH-533/remove-beta-label-from-code-monitor-logs-tab



## Test plan

Create a new code monitor with a Slack notif. Ensure it works e2e by
pushing a commit that matches and watching it show up in Slack
(https://sourcegraph.slack.com/archives/C68386Z5Z/p1719357942294309).


## Changelog

- Code monitoring Slack notifications, previously in beta, are now GA.
This feature lets you post matching code changes to a Slack channel.
- Code monitoring logs, previously in beta, are now GA. This feature
lets you see the status of and activity related to code monitors to
troubleshoot issues with finding results and performing configured
actions.
2024-06-25 17:11:57 -07:00
Julie Tibshirani
37b6ded5f1
Search: always respect default pattern type (#63410)
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.
2024-06-25 09:43:14 -07:00
Taras Yemets
dbc8d5b68a
fix(plg): ensure invite flow is enabled only for embedded UI (#63466)
Makes the invite flow on "/cody/manage" page dependent on the
`dotcom.codyProConfig.useEmbeddedUI` site config param.

Previously we didn't have a check for this site config param on this
page (to be precise, it's predecessor, see
https://github.com/sourcegraph/sourcegraph/pull/63442).

<!-- 💡 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
-->

| `useEmbeddedUI` | Plan |  Role  | Screenshot |
| -- | -- | -- | -- |
| `false` | admin | Pro |<img width="1483" alt="Screenshot 2024-06-25 at
13 02 18"
src="https://github.com/sourcegraph/sourcegraph/assets/25318659/8d5687df-43a9-4dbe-b82c-ecc60696da0f">|
| `false` | member | Pro |<img width="1483" alt="Screenshot 2024-06-25
at 13 14 17"
src="https://github.com/sourcegraph/sourcegraph/assets/25318659/cd53550c-5d51-4830-834c-1c233d13e72a">|
| `false` | n/a | Free |<img width="1483" alt="Screenshot 2024-06-25 at
13 17 15"
src="https://github.com/sourcegraph/sourcegraph/assets/25318659/f18720d4-a000-4bfb-b948-bbda29e49911">|
| `true` | admin | Pro |<img width="1483" alt="Screenshot 2024-06-25 at
13 30 03"
src="https://github.com/sourcegraph/sourcegraph/assets/25318659/618675d5-13b9-44b8-be50-4c506b46b702">|
| `true` | member | Pro |<img width="1483" alt="Screenshot 2024-06-25 at
13 25 24"
src="https://github.com/sourcegraph/sourcegraph/assets/25318659/ccac77e8-c7ca-44a5-b033-3c6dad8e5d70">|
| `true` | n/a | Free |<img width="1483" alt="Screenshot 2024-06-25 at
13 31 41"
src="https://github.com/sourcegraph/sourcegraph/assets/25318659/a7373ae9-a440-4282-805f-018d703cf3b0">|


## Test plan
- Tested manually (screenshots attached):
  - Run Sourcegraph instance in dotcom mode
- Tweak `dotcom.codyProConfig.useEmbeddedUI` site config param, log in
with users with different team roles (member/admin) and check results
with the table above.
<!-- All pull requests REQUIRE a test plan:
https://docs-legacy.sourcegraph.com/dev/background-information/testing_principles
-->




<!--
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.
-->
2024-06-25 15:33:53 +00:00
Quinn Slack
6c861d1446
add back /post-sign-up (#63456)
This is needed for the signup flow to work.


## Test plan

Manually test
2024-06-24 16:09:39 -07:00
Quinn Slack
4d69b06d4d
remove extraneous Cody onboarding steps (#63373)
- Remove the "personal or work" step
- Remove the "do you want us to call you?" step
- Cleaner design of the Cody dashboard
- Improve some wording
- Remove CodySurveyToast (unused) and user.CompletedPostSignup. These
have not been used in many months. On Amplitude, the relevant events
have no data.

Fix
https://linear.app/sourcegraph/issue/PRIME-375/remove-personal-or-work-survey-signup-step

<img width="2032" alt="image"
src="https://github.com/sourcegraph/sourcegraph/assets/1976/ef100e60-71b5-479b-ac63-2450cdad0220">


## Test plan

n/a
2024-06-24 20:37:39 +00:00
Dan Adler
5413fd1fd4
fix(analytics): fix broken v1 codeintel event logging (#63449)
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>
2024-06-24 20:35:28 +00:00
Dan Adler
e8742bcf9c
Add language ID to private metadata for v2 codeintel events (for in p… (#63421)
…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>
2024-06-24 11:26:26 -07:00
Quinn Slack
c3ce26f308
remove Code Search upsell from Cody page (#63440)
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
2024-06-24 08:39:15 -07:00
Quinn Slack
673f9e87dd
remove old and unused Cody search page (#63439)
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
2024-06-24 08:39:02 -07:00
Quinn Slack
6f9b7c5d80
remove unused CODY_APP esbuild config and entrypoint (#63438)
Cody App was removed in Dec 2023, and the `app/main.tsx` file has not
existed for a long time.

## Test plan

n/a
2024-06-24 08:38:40 -07:00
Quinn Slack
896819f811
remove disabled web UI code for embeddings (#63432)
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.
2024-06-24 08:38:09 -07:00
Felix Kling
843f703958
fix(svelte): Properly rounded corner for file view hover cards (#63446)
Fixes srch-130

## Test plan

Visual inspection
2024-06-24 15:33:05 +00:00
Taras Yemets
345a06abb1
chore(plg): add useEmbeddedUI site config param (#63442)
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.
-->
2024-06-24 07:49:58 -07:00
Quinn Slack
1ff74b0f27
"Cody" in navbar not "Cody AI" (#63429)
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".
2024-06-22 23:58:20 -06:00
Taras Yemets
dfabe647ba
Revert "fix(plg): Cody Pro routes conditions & add links to the user nav dropdown (#63378) (#63424)
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.
-->
2024-06-22 00:58:32 +03:00
Bolaji Olajide
e707101ebd
chore(batch-changes): remove beta badge from batch changes (#63423) 2024-06-21 21:15:59 +00:00
Felix Kling
ce7531f060
feat(svelte): Make fuzzy finder matching more reliable (#63397)
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
2024-06-21 22:23:48 +02:00
Jean-Hadrien Chabran
19a0c73030
fix(client): restore paths for extension bundles (#63402)
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.
-->
2024-06-21 16:12:34 +02:00
Taras Yemets
2c2ec726ef
feat(plg): remove seats from subscription (#63408)
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.
-->
2024-06-21 02:35:58 +03:00
Bolaji Olajide
c437c21ba6
chore(batch-changes): remove visibility options from create batch changes page (#63393) 2024-06-20 17:23:21 -05:00
Taiyab Raja
9aa5cb850e
Svelte: Make the byline in the fuzzy finder items bigger (#63398)
Tiny change to increase font-size of byline on the items in the fuzzy
finder.

## Before
<img width="1304" alt="CleanShot 2024-06-20 at 18 19 30@2x"
src="https://github.com/sourcegraph/sourcegraph/assets/5337876/8af80041-d64a-4cae-b717-a807b37081e6">

## After 
<img width="1337" alt="CleanShot 2024-06-20 at 18 20 53@2x"
src="https://github.com/sourcegraph/sourcegraph/assets/5337876/53725e1e-2ebd-4b2c-be4d-ca9fa7fb00cb">


## Test plan
Manually tested locally.
2024-06-20 20:37:59 +01:00
Taras Yemets
18f42a7873
feat(plg): require confirmation before removing user or revoking admin (#63388)
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.
-->
2024-06-20 17:00:52 +00:00
Felix Kling
b05bd5bb16
fix(svelte): Open correct file from preview panel line number (#63309)
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.
2024-06-20 17:44:32 +02:00
Varun Gandhi
0505269d54
chore: Bump go-enry and Zoekt to handle new languages (#63281)
- 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.
2024-06-20 22:19:39 +08:00
Taras Yemets
5cf81e0210
fix(plg): Cody Pro routes conditions & add links to the user nav dropdown (#63378)
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.
-->
2024-06-20 11:12:19 +00:00
David Veszelovszki
625e188512
plg(feat): Make page headers the same style (#63380)
**Note:** This PR also makes sure that we use `CodyProRoutes` everywhere
for URLs.
2024-06-20 10:50:33 +00:00
David Veszelovszki
2a02d7c88b
Improve InviteUsers interface (#63383)
Based on @taras-yemets's
[feedback](https://github.com/sourcegraph/sourcegraph/pull/63375#discussion_r1647346730)
on https://github.com/sourcegraph/sourcegraph/pull/63375

## Test plan

Just a refactor
2024-06-20 12:42:53 +02:00
David Veszelovszki
03179a757e
feat(plg): Tweak invite co-workers flow (#63374) 2024-06-20 10:28:36 +00:00
David Veszelovszki
345f6b94a0
feat(plg): Invite users on Cody Dashboard (#63375) 2024-06-20 12:15:00 +02:00
Felix Kling
3b7919501a
chore(svelte): Update fuzzy finder designs (#63354)
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
2024-06-20 08:28:29 +00:00
Julie Tibshirani
5630eef9e9
Search: surface pattern type in query input (#63326)
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
2024-06-19 14:24:10 -07:00
Felix Kling
15ea951e0d
chore(svelte): Simplify development for dotcom (#63341)
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.
2024-06-19 22:55:01 +02:00
Camden Cheek
4087e1a844
Svelte: repo header followups (#63319)
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
2024-06-19 14:02:55 -06:00
Rob Rhyne
d4948d25f6
Cody pro icon was squashed in the upgrade banner (#63356) 2024-06-19 19:29:38 +00:00
Felix Kling
2bdcc36ef7
fix(svelte): Use correct symbol icon color (#63355)
Fixes srch-601

## Test plan

Visual inspection
2024-06-19 19:26:41 +00:00
David Veszelovszki
1a038db04d
feat(plg): Update Cody Pro badge deck (#63352) 2024-06-19 20:47:12 +02:00
Peter Guy
5ee5e8817b
fix(search): VSCode Search extension: remove auth provider (#63262)
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.
2024-06-19 11:23:10 -07:00
Jean-Hadrien Chabran
c521d988ac
chore(ci): mark web-sveltekit:e2e_test as flaky (#63351)
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.
-->
2024-06-19 17:44:09 +00:00
David Veszelovszki
76a1c65d8b
feat(plg): Use react-query for team management (#63267) 2024-06-19 19:05:14 +02:00
Camden Cheek
db7a268c34
Chore: remove search console (#63322)
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.
2024-06-19 11:05:03 -06:00
David Veszelovszki
611dcfa806
feat(plg): Add seats (#63227) 2024-06-19 19:04:00 +02:00
Felix Kling
8b5eec2301
fix(svelte): Data/code preloading doesn't work when using panels (#63339)
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.
2024-06-19 16:33:42 +00:00
Felix Kling
29e07b7f6a
fix(svelte): Properly scope global CSS selector (#63332)
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.
2024-06-19 17:38:21 +02:00
Taras Yemets
e617ca4c76
chore(plg): migrate invoices list to react-query (#63343) 2024-06-19 17:49:08 +03:00
Felix Kling
ec3b6b14a9
chore(svelte): Remove stub logger (#63342)
We've recently added v2 telemetry support and should not use the stub
logger anymore.

## Test plan

Code inspection.
2024-06-19 13:54:31 +00:00
Felix Kling
399525b716
fix(svelte): History suggestions should show immediately when clicking the history button (#63335)
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.
2024-06-19 11:54:46 +00:00
David Veszelovszki
0e3a85f80e
feat(plg): Apply designs to Cody Pro pages (#63244) 2024-06-19 10:58:46 +02:00
Camden Cheek
f9cae73b3f
Minor: update license wording (#63318)
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.
2024-06-18 14:25:49 -06:00
Felix Kling
29aaa71449
fix(svelte): Fix reference panel loading/error state (#63316)
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.
2024-06-18 17:55:37 +02:00
Felix Kling
978cf37f48
fix(svelte): Reference panel width (#63310)
Fixes srch-584

When the reference panel preview opens, the bottom panel extends beyond
its boundaries and ist partially hidden. Allowing it to shrink past it's
content width fixes it.

| Before | Header |
|--------|--------|
|
![2024-06-18_11-22](https://github.com/sourcegraph/sourcegraph/assets/179026/33224c07-946e-4662-bba3-1ce5cf35d834)|
![2024-06-18_11-23](https://github.com/sourcegraph/sourcegraph/assets/179026/3d976506-23e4-4e53-8c8f-e82d189960d9)
|

## Test plan

Manual testing
2024-06-18 16:03:46 +02:00
Varun Gandhi
3437f8253d
chore: Centralize languages package as source-of-truth (#63292)
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
2024-06-18 13:10:24 +00:00
Erik Seliger
3e3ef6e8fa
webhooks: Add support for secrets for Bitbucket Cloud (#63198)
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.
2024-06-18 11:54:01 +02:00
Taras Yemets
9b88b93f2a
feat(plg): remove accept invite page (#63290)
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.
-->
2024-06-18 12:10:21 +03:00
Matthew Manela
92b8ffb8e1
fix(Source): Fix documentation URLs for code hosts help pages (#63274)
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.
2024-06-17 14:32:46 -04:00
Camden Cheek
34368c1dda
Svelte: fix sidebar icon alignment (#63296)
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.
2024-06-17 11:49:15 -06:00
Felix Kling
f716d7aa11
fix(svelte): Fix icon color in search sidebar (#63288) 2024-06-17 18:45:11 +02:00
Taras Yemets
02e9afcbdd
fix(plg): banner styles (#63287)
Adresses [UI
feedback](https://www.figma.com/design/FMSdn1oKccJRHQPgf7053o/Cody-PLG-GA?node-id=5472-12492&t=ndgEZFI57dVTIBpo-4)
on https://github.com/sourcegraph/sourcegraph/pull/63231

|Description|Before|After|
|--|--|--|
| Change dismiss button variant from "secondary" to "link" |<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="1170" alt="Screenshot 2024-06-17 at 12 35 53"
src="https://github.com/sourcegraph/sourcegraph/assets/25318659/6778a4bf-9a03-4c3b-a83c-57777859b7f1">|
| Fix banner content alignment |<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"><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">|<img
width="1165" alt="Screenshot 2024-06-17 at 12 31 14"
src="https://github.com/sourcegraph/sourcegraph/assets/25318659/532930ff-8471-46d8-83c0-f2bbeb1a8bcd">|






<!-- 💡 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 (screenshots attached)
<!-- 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.
-->
2024-06-17 16:27:06 +03:00
Felix Kling
6019de52e2
fix(search): Better diagnostic message for invalid and incomplete select: filter value (#63266) 2024-06-15 10:06:49 +02:00
Jean-Hadrien Chabran
1975c67f06
fix(ci): remove broken glob (#63277)
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.
-->
2024-06-14 21:50:22 +00:00
Felix Kling
32b119ee0c
fix(search): Improve syntax highlighting of search history entries (#63271)
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.
2024-06-14 13:11:54 -06:00
Felix Kling
bfe3e18927
fix(search): Ignore *lock keys for keyboard shortcut matching (#63272) 2024-06-14 20:34:00 +02:00
Camden Cheek
7228b4958d
Svelte: add repo header dropdown menu (#63257)
Adds a dropdown menu when clicking the repo name for common repo-level actions.
2024-06-14 18:11:20 +00:00
Taras Yemets
fadcaa264f
PLG: encode URL search params (#63275)
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.
-->
2024-06-14 20:40:06 +03:00
Taras Yemets
50471a67b1
PLG: Allow users who are already on a team accept invites (#63231)
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.
-->
2024-06-14 16:56:49 +00:00
Felix Kling
919f64b3af
fix(svelte): Add trailing slash to group and directory suggestions (#63273)
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.
2024-06-14 18:04:08 +02:00
Felix Kling
8474caf35f
feat(search/svelte): Add context specific suggestions to repo search input (#62880)
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>
2024-06-14 12:45:55 +00:00
Camden Cheek
bb359cde47
Svelte: implement keyboard shortcut design (#63253) 2024-06-14 00:12:48 -06:00
Camden Cheek
f8bbc3f2d8
fix(svelte): scrolling search input (#63261)
With the change in font, the minimum line-height to fit that font has
also increased. 1.6 seemed to do the job.
2024-06-13 23:55:53 -06:00
Felix Kling
81e5d696e7
chore(svelte): Migrate all icons to Lucide/custom icons (#63246)
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
2024-06-13 18:49:03 +02:00
Camden Cheek
af22bd261f
Chore: disable flaky tests (#63251)
Of the last 10 failures, only two tests were flaking. This disables
those tests until we can figure out why they were flaking.
2024-06-13 18:45:44 +02:00
Felix Kling
0b8d12dcad
fix(search): Copy text from read-only code host configuration input (#63239)
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
2024-06-13 16:16:46 +00:00
Camden Cheek
323034edac
Svelte: use Roboto Mono as monospace font (#63247)
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).
2024-06-13 09:41:31 -06:00
David Veszelovszki
fb0e466ac3
fix(plg): Fix "Remove team member" feature (#63241) 2024-06-13 17:33:56 +02:00
Matthew Manela
a3a6545612
feat(Search): Add icon for the Hack language (#63233)
Fixes GRAPH-620

Adds the icon for the Hack language to the Svelte UI
2024-06-13 07:24:46 -04:00
Felix Kling
498c03d91d
chore(search/svelte): Remove dependencies on barrel files to speed up dev build (#63230)
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`
2024-06-13 08:19:41 +02:00
Camden Cheek
d8d370913c
Svelte: add footer links for dotcom (#63170)
Completes SRCH-493
2024-06-12 09:32:10 -06:00
Camden Cheek
c46bfad20a
Svelte: remove v1 telemetry (#63220)
Fixes SRCH-495
2024-06-12 14:59:38 +00:00
Peter Guy
9d82cd17eb
Fix(search): auth issues with Sourcegraph VSCode extension (#63175)
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`
2024-06-12 07:07:10 -07:00
Camden Cheek
e0e234c509
Svelte: add Cody upsell banner (#63167)
Fixes SRCH-492
2024-06-12 14:01:08 +00:00
Felix Kling
1c28f460ae
feat(search/svelte): Support more file icons (#63181)
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.
2024-06-12 15:59:32 +02:00
Camden Cheek
378977912f
Svelte: use Inter font for --font-family-base (#63221)
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
2024-06-12 13:41:03 +00:00
David Veszelovszki
4774879465
feat(plg): Add new Checkout flow that uses Stripe's createToken API (#63213) 2024-06-12 09:57:10 +00:00
Matthew Manela
949a538654
feat(search): Support Magik language file filter in search (#63110)
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.
2024-06-11 13:41:39 -04:00
Felix Kling
54d94ba450
fix(search/svelte): Hide diff view when closing bottom panel (#63184)
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.
2024-06-11 10:30:54 +02:00
Felix Kling
ce83585b44
fix(search): Contributors page errors with empty date string (#63182) 2024-06-11 06:57:15 +02:00
Vova Kulikov
ab305657ab
[Svelte]: Fix standard click-based popover flow (#63192)
Closes
[SRCH-504](https://linear.app/sourcegraph/issue/SRCH-504/popover-click-triggers-are-no-longer-working-properly)

It seems that this problem was caused by slipped-out showOnHover check
for hover-based trigger event listeners

## Test plan 
Manual testing
2024-06-10 15:38:32 -03:00
David Veszelovszki
8971855d09
SSC: Fix checkout links (#63190) 2024-06-10 20:34:04 +02:00
David Veszelovszki
855dd2cc3e
SSC: Fix "Make admin" and "Revoke admin" button actions (#63188) 2024-06-10 20:23:49 +02:00
Craig Furman
d0506f9300
feat(appliance): deploy frontend (#63158) 2024-06-10 15:55:28 +01:00
Camden Cheek
bebc8277fc
Svelte: fix tests (#63146)
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.
2024-06-07 15:44:26 +00:00
Camden Cheek
929258e8a0
Svelte: add sentry (#63126)
This adds basic sentry support to the Sveltekit webapp.
2024-06-07 15:35:27 +00:00
Camden Cheek
a36b750842
Svelte: allow popovers to have external targets (#63141)
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.
2024-06-07 09:28:21 -06:00
Matthew Manela
c9d391cdec
fix(highlighting): Update JSX/TSX highlighting to more properly label tag delimiters (#63138)
Better highlighting for tags in JSX and TSX
2024-06-07 08:46:34 -04:00
Felix Kling
9341fcf7d2
svelte: Migrate repo sidebar toggle button to use lucide icon (#63129)
See title.

Contributes to SRCH-467

## Test plan

Visual inspection.
2024-06-07 09:29:59 +02:00
Felix Kling
b2f1746844
svelte: Add bottom panel close button (#63128)
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.


![2024-06-06_17-36](https://github.com/sourcegraph/sourcegraph/assets/179026/d3c95784-df02-4534-9fd5-cbe7d0300056)


## 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
2024-06-07 09:07:57 +02:00
Felix Kling
993ed3ae5c
fix(search): Properly handle URLs with file paths that contain route segments (#63123)
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.
2024-06-06 21:29:59 +02:00
James McNamara
4077b3ec22
feat(ci): Adds playwright tests for sveltekit to bazel (#62560)
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>
2024-06-06 12:45:05 -06:00
Camden Cheek
8f4a610c67
Svelte: inject into primary app.html (#63088)
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.
2024-06-06 09:33:39 -06:00
Robert Lin
b574300714
feat/enterprise: make per-subscription model allowlists no-op (#62912)
With #62911, per-enterprise-subscription model allowlists are no longer
respected, so we can safely update the UI to remove mentions of
allowlists, and also update our various allowlist-evaluation mechanisms
in `licensing` and GraphQL resolvers to just provide a wildcard
allowlist instead. It's not strictly required, but will make how the
model allowlists work more clearer/explicit.

Because we have a [planned migration for all this state to Enterprise
Portal](https://linear.app/sourcegraph/project/kr-enterprise-portal-manages-all-enterprise-subscriptions-12f1d5047bd2/overview),
we're not making any database changes.

Part of https://linear.app/sourcegraph/issue/CORE-135

### Context

In https://sourcegraph.slack.com/archives/C05SZB829D0/p1715638980052279
we shared a decision we landed on as part of #62263:

> Ignoring (then removing) per-subscription model allowlists: As part of
the API discussions, we've also surfaced some opportunities for
improvements - to make it easier to roll out new models to Enterprise,
we're not including per-subscription model allowlists in the new API,
and as part of the Cody Gateway migration (by end-of-June), we will
update Cody Gateway to stop enforcing per-subscription model allowlists.
Cody Gateway will still retain a Cody-Gateway-wide model allowlist.
[@chrsmith](https://sourcegraph.slack.com/team/U061QHKUBJ8) is working
on a broader design here and will have more to share on this later.

This means there is one less thing for us to migrate as part of
https://github.com/sourcegraph/sourcegraph/pull/62934, and avoids the
need to add an API field that will be removed shortly post-migration.

As part of this, rolling out new models to Enterprise customers no
longer require additional code/override changes.

## Test plan

Various tests pass.

Visual inspection of `sg start dotcom`:

- **Before:** <img width="947" alt="image"
src="https://github.com/sourcegraph/sourcegraph/assets/23356519/2dc0ab72-c77d-4c0e-a57e-4c336041da4e">
-
**After:**![image](https://github.com/sourcegraph/sourcegraph/assets/23356519/ab2e6d97-38c7-42df-9a5f-2448793db0cc)
2024-06-05 17:08:58 +00:00
Peter Guy
d5a0415e7f
cleanup: fix typo: scretTokenKey --> secretTokenKey (#63101)
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.
2024-06-05 15:12:14 +00:00
Noah S-C
4a93f29755
chore(bazel): enable rules_esbuild sandbox with object-inspect workaround (#61969)
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
2024-06-05 15:34:29 +01:00
Camden Cheek
d61368d2b5
Svelte: collapse path when too long (#63082)
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
2024-06-05 07:54:33 -06:00
David Veszelovszki
23eed1d5ef
Fix Cody onboarding redirect problem (#63096) 2024-06-05 12:07:08 +00:00
Taras Yemets
231c31279d
PLG: use react-query for async state management (#62939) 2024-06-05 07:18:00 +00:00
Beatrix
f2590cbb36
Cody Gateway: Add Gemini models to PLG and Enterprise users (#63053)
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:


![image](https://github.com/sourcegraph/sourcegraph/assets/68532117/2e6c914d-7a77-4484-b693-16bbc394518c)

#### 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`).
2024-06-04 23:46:36 +00:00
Camden Cheek
bf851d4598
Svelte: fix editor button styling (#63080)
The editor button would wrap before the div would overflow, causing weird wrapping. This fixes that and also makes it a proper button.
2024-06-04 12:49:40 -06:00