Fixes GRAPH-751 Fixes GRAPH-636 Reverts sourcegraph/sourcegraph#64046 which itself was a revert of https://github.com/sourcegraph/sourcegraph/pull/63876 due to backwards compatibility concerns. This new PR adds two extra commits which restore the `indexingEnabled` field, and make `syntacticIndexingEnabled` field optional. --- Fixes GRAPH-636 Fixes GRAPH-751 This PR aims to allow admins to enable syntactic indexing on per-policy basis using the existing UI and APIs with the following amendments: - New UI toggle for syntactic indexing – **only visible if the experimental feature is enabled** (see screenshots below) - New field in GraphQL API for syntactic indexing - New Go resolvers to handle the new field To support this on the backend, we also update the policies handling code and SQL queries to ensure we can retrieve and update the `syntactic_indexing_enabled` field. <!-- PR description tips: https://www.notion.so/sourcegraph/Write-a-good-pull-request-description-610a7fd3e613496eb76f450db5a49b6e --> ## Test plan - Backend part covered by updated policies tests - Manual testing of UI With experimental feature **enabled**:  With experimental feature **disabled**:  <!-- REQUIRED; info at https://docs-legacy.sourcegraph.com/dev/background-information/testing_principles --> ## Changelog - In site-admin APIs for updating code intelligence policies: - field `indexingEnabled` is renamed to `preciseIndexingEnabled` - a required `syntacticIndexingEnabled` is added (only takes effect if experimental feature is enabled) - field `forIndexing` is renamed to `forPreciseIndexing` <!-- OPTIONAL; info at https://www.notion.so/sourcegraph/Writing-a-changelog-entry-dd997f411d524caabf0d8d38a24a878c --> |
||
|---|---|---|
| .. | ||
| __mocks__ | ||
| bookmarklet | ||
| dev | ||
| dist | ||
| src | ||
| tests-examples | ||
| .bazelignore | ||
| .eslintignore | ||
| .stylelintrc.json | ||
| BUILD.bazel | ||
| bundlesize.config.js | ||
| package.json | ||
| README.md | ||
| statoscope | ||
| tsconfig.json | ||
| vitest.config.ts | ||
Web Application
Local development
Use sg CLI tool to configure and start local development server. For more information check out the sg documentation.
Our local development server runs by starting both a Caddy HTTPS server and a Node HTTP server. We then can reverse proxy requests to the Node server to serve client assets under HTTPS.
Configuration
Environment variables important for the web server:
WEB_BUILDER_SERVE_INDEXshould be set totrueto enable serving of an index page.SOURCEGRAPH_API_URLis used as a proxied API url. By default it points to the https://k8s.sgdev.org.
It's possible to overwrite these variables by creating sg.config.overwrite.yaml in the root folder and adjusting the env section of the relevant command.
Development server
sg start web-standalone
Public API
To use a public API that doesn't require authentication for most of the functionality:
SOURCEGRAPH_API_URL=https://sourcegraph.com sg start web-standalone
Production server
sg start web-standalone-prod
Web app should be available at https://${SOURCEGRAPH_HTTPS_DOMAIN}:${SOURCEGRAPH_HTTPS_PORT}. Build artifacts will be served from <rootRepoPath>/client/web/dist.
Note: If you are unable to use the above commands (e.g. you can't install Caddy), you can use sg run web-standalone-http instead. This will start a development server using only Node, and will be available at http://localhost:${SOURCEGRAPH_HTTP_PORT}.
API proxy
In both environments, server proxies API requests to SOURCEGRAPH_API_URL provided as the .env variable.