Skip to content

Commit

Permalink
Split ydoc server into separate module (#10735)
Browse files Browse the repository at this point in the history
# Important Notes
The command to run the gui dev environment has been changed. Invoking the old command will print a message about that.
From now on, use `pnpm dev:gui2` in repository root.
  • Loading branch information
Frizi authored Aug 8, 2024
1 parent 12d6900 commit b286ada
Show file tree
Hide file tree
Showing 258 changed files with 2,252 additions and 1,726 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/gui-tests.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# This file is auto-generated. Do not edit it manually!
# Edit the enso_build::ci_gen module instead and run `cargo run --package enso-build-ci-gen`.

name: GUI Tests
name: GUI Check
on:
push:
branches:
Expand All @@ -27,7 +27,7 @@ jobs:
access_token: ${{ github.token }}
permissions:
actions: write
enso-build-ci-gen-job-gui-test-linux-x86_64:
enso-build-ci-gen-job-gui-check-linux-x86_64:
name: GUI tests (linux, x86_64)

This comment has been minimized.

Copy link
@somebody1234

somebody1234 Sep 2, 2024

Contributor

@Frizi was this intentionally not changed?

runs-on:
- self-hosted
Expand Down Expand Up @@ -56,7 +56,7 @@ jobs:
run: ./run git-clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- run: ./run gui test
- run: ./run gui check
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- if: failure() && runner.os == 'Windows'
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/gui.yml
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ jobs:
access_token: ${{ github.token }}
permissions:
actions: write
enso-build-ci-gen-job-new-gui-build-linux-x86_64:
enso-build-ci-gen-job-gui-build-linux-x86_64:
name: GUI build (linux, x86_64)
runs-on:
- self-hosted
Expand Down Expand Up @@ -210,7 +210,7 @@ jobs:
run: ./run git-clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
enso-build-ci-gen-job-new-gui-build-macos-x86_64:
enso-build-ci-gen-job-gui-build-macos-x86_64:
name: GUI build (macos, x86_64)
runs-on:
- macos-12
Expand Down Expand Up @@ -264,7 +264,7 @@ jobs:
run: ./run git-clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
enso-build-ci-gen-job-new-gui-build-windows-x86_64:
enso-build-ci-gen-job-gui-build-windows-x86_64:
name: GUI build (windows, x86_64)
runs-on:
- self-hosted
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ node_modules/
.metals
tools/performance/engine-benchmarks/generated_site
*.tsbuildinfo
vite.config.ts.timestamp-*.mjs
vitest.config.ts.timestamp-*.mjs

############################
## Rendered Documentation ##
Expand Down
21 changes: 21 additions & 0 deletions .pnpmfile.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
const IGNORED_DEPS = ['react-native-url-polyfill', 'react-native-get-random-values']

const unusedIgnores = new Set(IGNORED_DEPS)
module.exports.hooks = {
readPackage: (pkg, context) => {
for (const ignored of IGNORED_DEPS) {
if (pkg.dependencies[ignored]) {
delete pkg.dependencies[ignored]
context.log(`Ignoring dependency ${ignored} in ${pkg.name}`)
unusedIgnores.delete(ignored)
}
}
return pkg
},
afterAllResolved(lockfile, context) {
if (unusedIgnores.size > 0) {
context.log(`Unused dependency ignore declarations: ${Array.from(unusedIgnores).join(', ')}`)
}
return lockfile
},
}
3 changes: 1 addition & 2 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,7 @@ app/ide-desktop/lib/dashboard/playwright-report/
app/ide-desktop/lib/dashboard/playwright/.cache/
app/ide-desktop/lib/dashboard/dist/
app/gui/view/documentation/assets/stylesheet.css
app/gui2/rust-ffi/pkg
app/gui2/rust-ffi/node-pkg
app/rust-ffi/pkg
app/gui2/src/assets/font-*.css
Cargo.lock
build.json
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ resolver = "2"
# path, e.g. `lib/rust/ensogl/examples`, or `app/gui/view/examples`; this is used to optimize the application for
# loading the IDE.
members = [
"app/gui2/rust-ffi",
"app/rust-ffi",
"build/cli",
"build/macros/proc-macro",
"build/ci-gen",
Expand Down
16 changes: 8 additions & 8 deletions app/dashboard/e2e/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,20 @@ Execute all commands from the parent directory.

```sh
# Run tests normally
npm run test:e2e
pnpm run test:e2e
# Open UI to run tests
npm run test:e2e:debug
pnpm run test:e2e:debug
# Run tests in a specific file only
npm run test:e2e -- e2e/file-name-here.spec.ts
npm run test:e2e:debug -- e2e/file-name-here.spec.ts
pnpm run test:e2e -- e2e/file-name-here.spec.ts
pnpm run test:e2e:debug -- e2e/file-name-here.spec.ts
# Compile the entire app before running the tests.
# DOES NOT hot reload the tests.
# Prefer not using this when you are trying to fix a test;
# prefer using this when you just want to know which tests are failing (if any).
PROD=1 npm run test:e2e
PROD=1 npm run test:e2e:debug
PROD=1 npm run test:e2e -- e2e/file-name-here.spec.ts
PROD=1 npm run test:e2e:debug -- e2e/file-name-here.spec.ts
PROD=1 pnpm run test:e2e
PROD=1 pnpm run test:e2e:debug
PROD=1 pnpm run test:e2e -- e2e/file-name-here.spec.ts
PROD=1 pnpm run test:e2e:debug -- e2e/file-name-here.spec.ts
```

## Getting started
Expand Down
2 changes: 1 addition & 1 deletion app/dashboard/e2e/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ export function locateAssetsTable(page: test.Page) {

/** Find assets table rows (if any) on the current page. */
export function locateAssetRows(page: test.Page) {
return locateAssetsTable(page).locator('tbody').getByRole('row')
return locateAssetsTable(page).getByTestId('asset-row')
}

/** Find the name column of the given asset row. */
Expand Down
9 changes: 3 additions & 6 deletions app/dashboard/e2e/assetSearchBar.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,9 @@ test.test('labels', async ({ page }) => {
page,
setupAPI: (api) => {
api.addLabel('aaaa', backend.COLORS[0])
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
api.addLabel('bbbb', backend.COLORS[1]!)
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
api.addLabel('cccc', backend.COLORS[2]!)
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
api.addLabel('dddd', backend.COLORS[3]!)
api.addLabel('bbbb', backend.COLORS[1])
api.addLabel('cccc', backend.COLORS[2])
api.addLabel('dddd', backend.COLORS[3])
},
})
const searchBarInput = actions.locateSearchBarInput(page)
Expand Down
18 changes: 6 additions & 12 deletions app/dashboard/e2e/labels.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,9 @@ test.test('drag labels onto single row', async ({ page }) => {
page,
setupAPI: (api) => {
api.addLabel(label, backend.COLORS[0])
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
api.addLabel('bbbb', backend.COLORS[1]!)
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
api.addLabel('cccc', backend.COLORS[2]!)
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
api.addLabel('dddd', backend.COLORS[3]!)
api.addLabel('bbbb', backend.COLORS[1])
api.addLabel('cccc', backend.COLORS[2])
api.addLabel('dddd', backend.COLORS[3])
api.addDirectory('foo')
api.addSecret('bar')
api.addFile('baz')
Expand All @@ -41,12 +38,9 @@ test.test('drag labels onto multiple rows', async ({ page }) => {
page,
setupAPI: (api) => {
api.addLabel(label, backend.COLORS[0])
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
api.addLabel('bbbb', backend.COLORS[1]!)
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
api.addLabel('cccc', backend.COLORS[2]!)
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
api.addLabel('dddd', backend.COLORS[3]!)
api.addLabel('bbbb', backend.COLORS[1])
api.addLabel('cccc', backend.COLORS[2])
api.addLabel('dddd', backend.COLORS[3])
api.addDirectory('foo')
api.addSecret('bar')
api.addFile('baz')
Expand Down
9 changes: 5 additions & 4 deletions app/dashboard/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,17 @@
},
"scripts": {
"compile": "tsc",
"typecheck": "tsc --noEmit",
"typecheck": "tsc",
"build": "vite build",
"lint": "eslint .",
"dev": "vite",
"dev:e2e": "vite -c vite.test.config.ts",
"dev:e2e:ci": "vite -c vite.test.config.ts build && vite preview --port 8080 --strictPort",
"test": "npm run test:unit && npm run test:e2e",
"test": "corepack pnpm run /^^^^test:.*/",
"test:unit": "vitest run",
"test:unit:debug": "vitest",
"test-dev:unit": "vitest",
"test:e2e": "cross-env NODE_ENV=production playwright test",
"test:e2e:debug": "cross-env NODE_ENV=production playwright test --ui"
"test-dev:e2e": "cross-env NODE_ENV=production playwright test --ui"
},
"dependencies": {
"@aws-amplify/auth": "5.6.5",
Expand Down
2 changes: 1 addition & 1 deletion app/dashboard/playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export default test.defineConfig({
},
},
webServer: {
command: process.env.CI || process.env.PROD ? 'npm run dev:e2e:ci' : 'npm run dev:e2e',
command: `corepack pnpm run ${process.env.CI || process.env.PROD ? 'dev:e2e:ci' : 'dev:e2e'}`,
port: 8080,
reuseExistingServer: false,
},
Expand Down
1 change: 1 addition & 0 deletions app/dashboard/src/components/dashboard/AssetRow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -742,6 +742,7 @@ export default function AssetRow(props: AssetRowProps) {
{!hidden && (
<FocusRing>
<tr
data-testid="asset-row"
tabIndex={0}
ref={(element) => {
rootRef.current = element
Expand Down
3 changes: 2 additions & 1 deletion app/eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ export default [
eslintJs.configs.recommended,
{
// Playwright build cache and Vite build directory.
ignores: ['**/.cache/**', '**/playwright-report', '**/dist'],
ignores: ['**/.cache/**', '**/playwright-report', '**/dist', '**/build.mjs'],
},
{
settings: {
Expand Down Expand Up @@ -403,6 +403,7 @@ export default [
},
{
files: ['**/*.js', '**/*.jsx', '**/*.cjs', '**/*.mjs'],
ignores: ['**/build.mjs'],
rules: {
'@typescript-eslint/no-var-requires': 'off',
// Parameter types must be specified using JSDoc in JS files.
Expand Down
2 changes: 1 addition & 1 deletion app/gui2/e2e/expressionUpdates.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { Page } from '@playwright/test'
import type { ExpressionUpdate, MethodCall } from 'shared/languageServerTypes'
import type { ExpressionUpdate, MethodCall } from 'ydoc-shared/languageServerTypes'

export type ExpressionLocator = string | { binding: string; expr: string }

Expand Down
2 changes: 1 addition & 1 deletion app/gui2/e2e/setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export default function setup() {
id: 'websocket',
udp: true,
ipv6: true,
port: 30535,
port: 30536,
middleware: [],
},
},
Expand Down
1 change: 0 additions & 1 deletion app/gui2/env.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

declare const PROJECT_MANAGER_URL: string
declare const YDOC_SERVER_URL: string
declare const RUNNING_VITEST: boolean
declare const IS_CLOUD_BUILD: boolean

interface Document {
Expand Down
1 change: 0 additions & 1 deletion app/gui2/env.story.d.ts

This file was deleted.

11 changes: 1 addition & 10 deletions app/gui2/eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ const DIR_NAME = path.dirname(url.fileURLToPath(import.meta.url))
const conf = [
{
ignores: [
'rust-ffi/pkg',
'rust-ffi/node-pkg',
'dist',
'shared/ast/generated',
'templates',
Expand All @@ -30,14 +28,7 @@ const conf = [
parserOptions: {
tsconfigRootDir: DIR_NAME,
ecmaVersion: 'latest',
project: [
'./tsconfig.app.json',
'./tsconfig.node.json',
'./tsconfig.server.json',
'./tsconfig.app.vitest.json',
'./tsconfig.server.vitest.json',
'./tsconfig.story.json',
],
project: ['./tsconfig.app.json', './tsconfig.node.json', './tsconfig.app.vitest.json'],
},
},
rules: {
Expand Down
2 changes: 1 addition & 1 deletion app/gui2/mock/MockFSWrapper.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
import { useProjectStore } from '@/stores/project'
import { mockFsDirectoryHandle } from '@/util/convert/fsAccess'
import { MockWebSocket, type WebSocketHandler } from '@/util/net'
import { type Path as LSPath } from 'shared/languageServerTypes'
import { watchEffect } from 'vue'
import { type Path as LSPath } from 'ydoc-shared/languageServerTypes'
import { mockDataWSHandler } from './dataServer'
const projectStore = useProjectStore()
Expand Down
2 changes: 1 addition & 1 deletion app/gui2/mock/MockProjectStoreWrapper.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
import { useProjectStore } from '@/stores/project'
import { Ast } from '@/util/ast'
import { SourceDocument } from 'shared/ast/sourceDocument'
import { reactive, watch } from 'vue'
import { SourceDocument } from 'ydoc-shared/ast/sourceDocument'
const props = defineProps<{ modelValue: string }>()
const emit = defineEmits<{ 'update:modelValue': [modelValue: string] }>()
Expand Down
6 changes: 3 additions & 3 deletions app/gui2/mock/dataServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ import {
type AnyOutboundPayload,
type Offset,
type Table,
} from 'shared/binaryProtocol'
import { LanguageServerErrorCode } from 'shared/languageServerTypes'
import { uuidToBits } from 'shared/uuid'
} from 'ydoc-shared/binaryProtocol'
import { LanguageServerErrorCode } from 'ydoc-shared/languageServerTypes'
import { uuidToBits } from 'ydoc-shared/uuid'

const sha3 = createSHA3(224)

Expand Down
17 changes: 9 additions & 8 deletions app/gui2/mock/engine.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
import { Pattern } from '@/util/ast/match'
import type { MockYdocProviderImpl } from '@/util/crdt'
import type { WebSocketHandler } from '@/util/net'
import type { QualifiedName } from '@/util/qualifiedName'
import * as random from 'lib0/random'
import * as Ast from 'shared/ast'
import * as Ast from 'ydoc-shared/ast'
import {
Builder,
EnsoUUID,
OutboundMessage,
OutboundPayload,
VisualizationContext,
VisualizationUpdate,
} from 'shared/binaryProtocol'
import { ErrorCode } from 'shared/languageServer'
} from 'ydoc-shared/binaryProtocol'
import { ErrorCode } from 'ydoc-shared/languageServer'
import type {
ContextId,
ExpressionId,
Expand All @@ -19,11 +21,10 @@ import type {
Uuid,
VisualizationConfiguration,
response,
} from 'shared/languageServerTypes'
import type { SuggestionEntry } from 'shared/languageServerTypes/suggestions'
import { uuidToBits } from 'shared/uuid'
import type { MockTransportData, WebSocketHandler } from 'src/util/net'
import type { QualifiedName } from 'src/util/qualifiedName'
} from 'ydoc-shared/languageServerTypes'
import type { SuggestionEntry } from 'ydoc-shared/languageServerTypes/suggestions'
import type { MockTransportData } from 'ydoc-shared/util/net'
import { uuidToBits } from 'ydoc-shared/uuid'
import * as Y from 'yjs'
import { mockFsDirectoryHandle, type FileTree } from '../src/util/convert/fsAccess'
import mockDb from '../stories/mockSuggestions.json' assert { type: 'json' }
Expand Down
Loading

0 comments on commit b286ada

Please sign in to comment.