Skip to content

Restructure data editor messaging with Message Registry#1647

Open
stricklandrbls wants to merge 1 commit intoapache:mainfrom
ctc-oss:data-editor-message-registry
Open

Restructure data editor messaging with Message Registry#1647
stricklandrbls wants to merge 1 commit intoapache:mainfrom
ctc-oss:data-editor-message-registry

Conversation

@stricklandrbls
Copy link
Copy Markdown
Contributor

@stricklandrbls stricklandrbls commented Mar 26, 2026

Closes #1659
Closes #1058
Closes #669

Description

  • Implemented a Message Registry which provides type-safe message content inspection for messages sent between the data editor, dfdl extension, and the Svelte UI.
  • Restructured some legacy Svelte stores into Svelte v5 runes.
  • Resolved issues related to message content mismathcing and message content being processed by multiple data editors when the message was intended for a single data editor instance.

Wiki

  • I have determined that no documentation updates are needed for these changes
  • I have added the following documentation for these changes

Review Instructions including Screenshots

Developer Perspective Reviews

  1. In any portion of the data editor's extension source, verify that message content is appropriately inspected and the VSCode intellisense engine emits correct types when invoking this.panel.postMessage(...).
Screenshots ( dataEditorClient.ts -> 'fileInfo') image image
  1. In any portion of the data editor's Svelte UI source, verify that message content is appropriately inspected and the VSCode intellisense engine emits correct types when invoking addListener(...).
Screenshots ( DataEditorLineFeed.svelte -> 'viewportRefresh') image
  1. In any portion of the data editor's Svelte UI source, verify that message content is appropriately inspected and the VSCode intellisense engine emits correct types when invoking vscode.postMessage(...).
Screenshots ( App.svelte -> 'requestEditedData') image

Functionality Review

Verify that all message traffic behaves as expected. Message content can be identified within the ./src/ext_types/message.ts & ./src/ext_types/messageContent.ts

@stricklandrbls stricklandrbls added this to the 1.6.0 milestone Mar 26, 2026
@stricklandrbls stricklandrbls self-assigned this Mar 26, 2026
@stricklandrbls stricklandrbls added typescript code quality Issues related to code quality data editor Issues related to the Data Editor capability extension Issues releated to the VSCode Extension labels Mar 26, 2026
@stricklandrbls stricklandrbls force-pushed the data-editor-message-registry branch 3 times, most recently from 65b3fd8 to 8404e0c Compare March 26, 2026 18:11
@stricklandrbls stricklandrbls force-pushed the data-editor-message-registry branch 2 times, most recently from dc8d15a to 55d963f Compare March 31, 2026 01:40
Copy link
Copy Markdown
Contributor

@CoverRyan CoverRyan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CI seems to be failing consistently and it doesn't appear to be an issue with the CI.

@stricklandrbls
Copy link
Copy Markdown
Contributor Author

CI seems to be failing consistently and it doesn't appear to be an issue with the CI.

#1659 is the issue I created for fixing the CI

@shanedell
Copy link
Copy Markdown
Contributor

@stricklandrbls Will the updates to fix #1659 be added to this PR? My personal input would be, to add those changes here. I would rather have additional changes in this PR and a working CI then to merge this PR and introduce broken CI into main which requires another PR to fix.

@stricklandrbls
Copy link
Copy Markdown
Contributor Author

@stricklandrbls Will the updates to fix #1659 be added to this PR? My personal input would be, to add those changes here. I would rather have additional changes in this PR and a working CI then to merge this PR and introduce broken CI into main which requires another PR to fix.

Yeah those changes would fix the CI I created the separate issue because it required multiple additional dev dependencies.

I can add that issue as one that will close this PR.

@stricklandrbls stricklandrbls force-pushed the data-editor-message-registry branch 4 times, most recently from e5d837d to d3e7b54 Compare April 13, 2026 21:42
@stricklandrbls stricklandrbls dismissed CoverRyan’s stale review April 24, 2026 22:48

This PR resolved the CI failing jobs.

@scholarsmate scholarsmate requested a review from Copilot April 25, 2026 02:15
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 50 out of 55 changed files in this pull request and generated 13 comments.

Comments suppressed due to low confidence (1)

src/svelte/src/components/ServerMetrics/ServerMetrics.svelte:31

  • heartbeat is initialized with omegaEditPort, but later code assigns/uses heartbeat.port (e.g., in the heartbeat listener and template). This adds a new property at runtime and leaves the declared omegaEditPort unused/incorrect. Rename the state field to match the payload (port) or keep using omegaEditPort consistently.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/svelte/src/components/ServerMetrics/ServerMetrics.svelte
Comment thread src/svelte/vite.config.mjs
Comment thread src/svelte/vitest.config.mjs
Comment thread src/svelte/svelte.config.mjs Outdated
Comment thread src/ext_types/messages.ts Outdated
Comment thread src/ext_types/messageContent.ts
Comment thread src/svelte/src/utilities/vscode.ts
Comment thread src/svelte/src/components/Header/fieldsets/FileMetrics.svelte
@stricklandrbls stricklandrbls force-pushed the data-editor-message-registry branch 5 times, most recently from 72c22db to ed1adec Compare April 25, 2026 06:44
@scholarsmate scholarsmate requested a review from Copilot April 26, 2026 14:39
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 50 out of 55 changed files in this pull request and generated 10 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/svelte/tsconfig.json
Comment thread src/svelte/vite.config.mjs
Comment thread src/ext_types/messageContent.ts Outdated
Comment thread src/svelte/tests/stores/fileMetricsState.svelte.test.ts
Comment thread src/dataEditor/ui/svelteWebviewInitializer.ts Outdated
Comment thread src/dataEditor/dataEditorClient.ts Outdated
Comment thread src/svelte/tsconfig.json
Comment thread src/svelte/src/App.svelte Outdated
Comment thread src/dataEditor/ui/svelteWebviewInitializer.ts Outdated
Comment thread src/dataEditor/include/utils.ts
@stricklandrbls stricklandrbls force-pushed the data-editor-message-registry branch 4 times, most recently from e290c32 to c59b811 Compare April 29, 2026 03:49
@scholarsmate scholarsmate requested a review from Copilot April 29, 2026 12:39
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 54 out of 59 changed files in this pull request and generated 8 comments.

Comments suppressed due to low confidence (1)

src/svelte/src/stores/index.ts:265

  • These derived(...) stores call isRegularSizedFile(), but isRegularSizedFile is backed by a Svelte v5 $derived rune (not a Svelte store). Because it isn’t listed in the dependency array, changes to fileMetricsState.computedSize won’t trigger recomputation, so editMode can become stale when file size changes (e.g. on initial counts message). Consider reintroducing a Svelte-store regularSizedFile dependency, or migrate these derived stores to runes so reactivity stays consistent.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/svelte/src/components/ServerMetrics/ServerMetrics.svelte Outdated
Comment thread src/svelte/src/components/Header/fieldsets/FileMetrics.svelte Outdated
Comment thread src/dataEditor/include/server/heartbeat/index.ts Outdated
Comment thread src/svelte/src/utilities/messages.ts Outdated
Comment thread src/svelte/src/components/DataMetrics/DataMetrics.svelte Outdated
Comment thread src/dataEditor/dataEditorClient.ts
Comment thread src/ext_types/messageContent.ts
@stricklandrbls stricklandrbls force-pushed the data-editor-message-registry branch 3 times, most recently from b305f25 to 59f444c Compare May 2, 2026 22:32
@scholarsmate scholarsmate requested a review from Copilot May 2, 2026 23:12
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 56 out of 61 changed files in this pull request and generated 7 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/svelte/src/components/DataDisplays/CustomByteDisplay/DataLineFeed.svelte Outdated
Comment thread src/svelte/src/App.svelte
Comment thread src/svelte/src/components/DataMetrics/DataMetrics.svelte Outdated
Comment thread build/package/LICENSE
Comment thread src/dataEditor/dataEditorClient.ts
Comment thread src/svelte/src/components/Header/fieldsets/Settings.svelte Outdated
Comment thread src/svelte/src/App.svelte
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 57 out of 62 changed files in this pull request and generated 9 comments.

Comments suppressed due to low confidence (3)

src/svelte/src/stores/index.ts:263

  • editMode no longer depends on fileMetricsState.computedSize; it only reruns when the selection changes. If counts/save events flip the file between the special 1-byte case and a regular file, the editor mode stays stale and the UI keeps using the wrong single-vs-multiple-byte path.
    src/svelte/src/stores/states.svelte.ts:24
  • formatMsgId() prefixes debug-attached editors with dfdl-, but this check uses includes() instead of startsWith(). Any normal file whose basename happens to contain dfdl- will be misclassified as debug-attached and start reacting to debugger byte-position events.
    src/svelte/src/stores/index.ts:418
  • applicable has the same dependency hole as editMode and originalDataSegment: it reads isRegularSizedFile() but never subscribes to fileMetricsState.computedSize. After a size-changing edit/save, the Apply button can stay enabled/disabled for the wrong editing mode until some unrelated store update happens.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +119 to +123
formatMsgId(id: string, isDFDLDebugAttached: boolean = false) {
let idStr = id.substring(0, UI_MSG_ID_MAX_LEN)
idStr = idStr.replaceAll(' ', '_')
return isDFDLDebugAttached ? 'dfdl-' + idStr : idStr
}
Comment on lines +161 to +164
.replace('__extension_msg_id__', msgId)

vsWebview.html = indexHTML
}
Comment on lines +49 to +50
) {
vscode.window.onDidChangeActiveColorTheme((newTheme) => {
Comment on lines 373 to +377
export const originalDataSegment = derived(
[viewport, selectionDataStore, regularSizedFile],
([$viewport, $selectionData, $regularSizedFile]) => {
[viewport, selectionDataStore],
([$viewport, $selectionData]) => {
if (!$viewport.data) return []
if (!$regularSizedFile) return $viewport.data
if (!isRegularSizedFile()) return $viewport.data
Comment on lines 388 to 392
<Button
fn={replace}
description="Replace the current match"
disabledBy={!replaceable || replaceErrDisplay}
isDisabled={!replaceable || replaceErrDisplay}
>
Comment on lines +71 to +83
addListener('heartbeat', (data) => {
const {
latency,
port,
serverCpuLoadAverage,
serverTimestamp,
serverUptime,
serverUsedMemory,
sessionCount,
serverInfo,
} = data
heartbeat.latency = latency
heartbeat.port = port
Comment on lines +704 to 725
const languageResponse = await getLanguage(
this.omegaSessionId,
startOffset,
length,
characterCount!.getByteOrderMark()
)
await this.panel.postMessage('profile', {
startOffset: startOffset,
length: length,
byteProfile: byteProfile,
numAscii: numAscii(byteProfile),
language: languageResponse.getLanguage(),
contentType: contentTypeResponse.getContentType(),
characterCount: {
byteOrderMark: characterCount!.getByteOrderMark(),
byteOrderMarkBytes: characterCount!.getByteOrderMarkBytes(),
singleByteCount: characterCount!.getSingleByteChars(),
doubleByteCount: characterCount!.getDoubleByteChars(),
tripleByteCount: characterCount!.getTripleByteChars(),
quadByteCount: characterCount!.getQuadByteChars(),
invalidBytes: characterCount!.getInvalidBytes(),
},
Comment thread build/package/LICENSE
Comment on lines +2210 to +2219
Most of the open source code in the Saxon product is governed by the Mozilla Public
License version 2.0, which is reproduced below.

- 'sax' in extension/dist/ext/extension.js
- 'sax' in node_modules/vite
This product bundles 'sax' from the above files.
These files are available under the BlueOak-1.0.0 license:

Most of the open source code in the Saxon product is governed by the Blue Oak Model License
version 1.0.0, which is reproduced below.
Comment thread build/package/LICENSE
Comment on lines +2210 to +2219
Most of the open source code in the Saxon product is governed by the Mozilla Public
License version 2.0, which is reproduced below.

- 'sax' in extension/dist/ext/extension.js
- 'sax' in node_modules/vite
This product bundles 'sax' from the above files.
These files are available under the BlueOak-1.0.0 license:

Most of the open source code in the Saxon product is governed by the Blue Oak Model License
version 1.0.0, which is reproduced below.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

code quality Issues related to code quality data editor Issues related to the Data Editor capability extension Issues releated to the VSCode Extension typescript

Projects

Status: In Review

Development

Successfully merging this pull request may close these issues.

Task: Replace mocha with vitest for SVelte tests Implement Cross Service Message Registry Implement MessageCommand Interfaces per Enumeration

5 participants