Skip to content

Inspect communication between Ydoc and Language Server#14950

Open
4e6 wants to merge 16 commits intodevelopfrom
wip/db/ydoc-inspect
Open

Inspect communication between Ydoc and Language Server#14950
4e6 wants to merge 16 commits intodevelopfrom
wip/db/ydoc-inspect

Conversation

@4e6
Copy link
Copy Markdown
Contributor

@4e6 4e6 commented Apr 9, 2026

Pull Request Description

PR adds ydoc-inspect tool that connects to ydoc-server and provides debug information

Changelog:

  • add: ydoc-inspect can be started with pnpm run dev:inspect
  • add: ydoc-inspect connects to ydoc-server running in debug mode (controlled by ENSO_IDE_YDOC_LS_DEBUG environment variable and enabled by default in dev mode pnpm run dev:gui)
  • add: ydoc-inspect runs with node --inspect option allowing to use chrome://inspect interactive console (see available commands below)
  • update: ydoc-server in debug mode starts InspectManager that registers YjsChannels for further inspection by ydoc-inspect
  • update: YjsChannel allows observing exchanged messages

Important Notes

Example output after starting pnpm run dev:gui and opening the project:

$ pnpm run dev:inspect

> root@ dev:inspect /home/dbushev/projects/luna/enso
> corepack pnpm run -r --filter ydoc-inspect compile && node --inspect app/ydoc-inspect/dist/main.js


> ydoc-inspect@0.1.0 compile /home/dbushev/projects/luna/enso/app/ydoc-inspect
> tsc -p tsconfig.build.json

Debugger listening on ws://127.0.0.1:9229/b87fd0cb-aada-4d2e-a542-365c0d874551
For help, see: https://nodejs.org/en/docs/inspector

ydoc-inspect: connecting to ws://localhost:30617/project/inspect
Open chrome://inspect to attach DevTools

Available commands:
  channels()                   - List all registered channels
  messages(channelId?, n?)     - Get messages (optionally for a channel, last n)
  filter(channelId?, pattern?) - Filter messages by regex (string or RegExp)
  send(channelId, msg)         - Send a message to the client as Language Server
  receive(channelId, msg)      - Send a message to Language Server as client
  watch(channelId?)            - Watch live messages (returns stop function)
  unwatch()                    - Stop watching live messages

Waiting for ydoc-server at ws://localhost:30617/project/inspect ... (retrying in 2s)
Waiting for ydoc-server at ws://localhost:30617/project/inspect ... (retrying in 2s)
Waiting for ydoc-server at ws://localhost:30617/project/inspect ... (retrying in 2s)
Connected. Syncing inspect data...
Found 3 channel(s):
  json-0 (json) - gui-rpc-06770e83-ac04-4a8a-805b-b179a09936b5
  json-1 (json) - backend-gui-rpc-06770e83-ac04-4a8a-805b-b179a09936b5
  data-2 (data) - gui-data-a975254e-644b-411a-9706-0e4185e2ccc1
Watching 3 channel(s). Call unwatch() to stop.
22:34:31.360|json-1 << {"jsonrpc":"2.0","id":"0","method":"session/initProtocolConnection","params":{"clientId":"ca3eba75-c0be-4926-a6db-6bf6a84b3b2a"}}
22:34:31.458|data-2 << <80 bytes>
22:34:31.467|json-0 << {"jsonrpc":"2.0","id":"0","method":"session/initProtocolConnection","params":{"clientId":"b49550c2-1cbb-4599-89c9-f961ba7e3d2c"}}
22:34:31.566|data-2 >> <72 bytes>
22:34:32.288|json-0 >> {"jsonrpc":"2.0","id":"0","result":{"ensoVersion":"0.0.0-dev","currentEdition":"0.0.0-dev","contentRoots":[{"type":"Project","id":"f207ef9e-09d4-43ae-aabf-7b7258d43003"},{"type":"Home","id":"02be22a1-
22:34:32.316|json-0 << {"jsonrpc":"2.0","id":"1","method":"executionContext/create","params":{"contextId":"b34e58bd-5e45-4a22-9dd1-c6396801c885"}}
22:34:32.336|json-0 << {"jsonrpc":"2.0","id":"2","method":"capability/acquire","params":{"method":"search/receivesSuggestionsDatabaseUpdates","registerOptions":{}}}
22:34:32.368|json-1 >> {"jsonrpc":"2.0","id":"0","result":{"ensoVersion":"0.0.0-dev","currentEdition":"0.0.0-dev","contentRoots":[{"type":"Project","id":"f207ef9e-09d4-43ae-aabf-7b7258d43003"},{"type":"Home","id":"02be22a1-
22:34:32.390|json-1 << {"jsonrpc":"2.0","id":"1","method":"capability/acquire","params":{"method":"file/receivesTreeUpdates","registerOptions":{"path":{"rootId":"f207ef9e-09d4-43ae-aabf-7b7258d43003","segments":[]}}}}
22:34:32.431|json-0 >> {"jsonrpc":"2.0","id":"2","result":null}
22:34:32.461|json-1 >> {"jsonrpc":"2.0","id":"1","result":null}

Where

Found 3 channel(s):
  json-0 (json) - gui-rpc-06770e83-ac04-4a8a-805b-b179a09936b5
  json-1 (json) - backend-gui-rpc-06770e83-ac04-4a8a-805b-b179a09936b5
  data-2 (data) - gui-data-a975254e-644b-411a-9706-0e4185e2ccc1
  • gui-rpc-{uuid} JSON-RPC channel between GUI and LS
  • backend-gui-rpc-{uuid} JSON-RPC channel between ydoc-server and LS (ydoc-server manages ast and sends text edits to LS)
  • gui-data-{uuid} - binary channel between GUI and LS (visualizations)

Checklist

Please ensure that the following checklist has been satisfied before submitting the PR:

  • The documentation has been updated, if necessary.
  • Screenshots/screencasts have been attached, if there are any visual changes. For interactive or animated visual changes, a screencast is preferred.
  • All code follows the
    Scala,
    Java,
    TypeScript,
    and
    Rust
    style guides. In case you are using a language not listed above, follow the Rust style guide.
  • Unit tests have been written where possible.
  • If meaningful changes were made to logic or tests affecting Enso Cloud integration in the libraries,
    or the Snowflake database integration, a run of the Extra Tests has been scheduled.
    • If applicable, it is suggested to paste a link to a successful run of the Extra Tests.

@4e6 4e6 self-assigned this Apr 9, 2026
@4e6 4e6 added -tooling Category: tooling CI: No changelog needed Do not require a changelog entry for this PR. labels Apr 9, 2026
@4e6 4e6 marked this pull request as ready for review April 10, 2026 07:58
@4e6
Copy link
Copy Markdown
Contributor Author

4e6 commented Apr 10, 2026

Every time I add new files to npm projects, I get these errors on Windows CI. Is there a workaround?

INFO ide_ci::program::command: pnpm ℹ️ app/ydoc-server compile: src/index.ts(16,32): error TS6307: File 'C:/runner/_work/enso/enso/app/ydoc-server/src/inspect.ts' is not listed within the file list of project 'C:/runner/_work/enso/enso/app/ydoc-server/tsconfig.build.json'. Projects must list all files or use an 'include' pattern.

@farmaazon
Copy link
Copy Markdown
Contributor

Run pnpm install or add a file to tsconfig manually.

@4e6
Copy link
Copy Markdown
Contributor Author

4e6 commented Apr 10, 2026

The file is in config

"./src/inspect.ts",

And the Linux build succeeds. The issue is only with Windows runners

@farmaazon
Copy link
Copy Markdown
Contributor

Uhm, I missed that it was on CI.

Only thing coming to my mind is clean build.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

-tooling Category: tooling CI: No changelog needed Do not require a changelog entry for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants