Skip to content

refactor: replace httpgd-js with built-in transports - #1855

Merged
eitsupi merged 6 commits into
REditorSupport:mainfrom
eitsupi:chore/remove-httpgd-js
Oct 9, 2026
Merged

eitsupi merged 6 commits into
REditorSupport:mainfrom
eitsupi:chore/remove-httpgd-js

Conversation

@eitsupi

@eitsupi eitsupi commented Oct 9, 2026 •

Copy link
Copy Markdown
Member

Replace httpgd-js with an in-tree client using Node’s HTTP(S) transport and native WebSocket notifications, with HTTP polling when WebSocket is unavailable or fails.
Set the minimum VS Code version to 1.98.2, following the discussion in #1850.

Preserve the existing viewer, token authentication and binary exports.
Add TODOs for a future Node 22 baseline and viewer unification.

@eitsupi
eitsupi requested review from Fred-Wu and renkun-ken October 9, 2026 00:17
@eitsupi
eitsupi marked this pull request as ready for review October 9, 2026 00:25

@renkun-ken renkun-ken left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Found one supported-version compatibility regression to address; see the inline comment.

Validation: TypeScript compilation and all 27 focused HTTP/httpgd/CRAN tests passed. Live WebSocket updates, SVG rendering, and PNG export also worked against R httpgd 2.1.4. A separate fixture using the actual httpgd 1.2.0 renderer schema reproduced the failure in the new client while the existing httpgd-js client loaded both renderers and plots successfully. All reported PR CI checks are green.

Comment on lines +133 to +135
if (!record(renderer) || typeof renderer.id !== 'string' || typeof renderer.name !== 'string'
|| typeof renderer.ext !== 'string' || typeof renderer.descr !== 'string') {
throw new Error('Invalid httpgd renderer');

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

[P2] Accept renderer records without descr for httpgd 1.2.0

The extension still supports R httpgd >= 1.2.0, but that version's /renderers response has no descr field. This new check rejects its otherwise valid renderer records. On extension hosts without native WebSocket, connect() consequently never reaches /plots, and every poll fails in loadRenderers() before requesting /state, so the plot viewer never loads. With WebSocket available, plots can recover but the export format picker remains empty. I reproduced this with the 1.2.0 response schema: the new client repeatedly requested only /renderers and retained zero plots, while the existing httpgd-js client loaded both successfully. Please allow an absent description and normalize it to an empty string (with a legacy-schema test), so these supported servers continue working.

@eitsupi

eitsupi commented Oct 9, 2026

Copy link
Copy Markdown
Member Author

@renkun-ken Thanks for pointing out the version requirements.
I think it would be best to explicitly state that we support httpgd version 2.0.1 or later.
It has been years since that version was released, so I don't anticipate any issues arising.

@eitsupi
eitsupi requested a review from renkun-ken October 9, 2026 01:37

@renkun-ken renkun-ken left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The explicit httpgd >= 2.0.1 requirement, backend-selection gate, and standard-viewer fallback address my earlier renderer-schema compatibility finding. I verified that 2.0.1 includes the required renderer description field. The warning gives users an actionable upgrade path when httpgd is explicitly selected, while auto falls back quietly.

No additional actionable issues found in the latest changes. Validation: TypeScript compilation and all 27 focused HTTP/httpgd/CRAN tests passed; the new R version-gate test and related native-plot, plot-notification, and reconnect tests passed with 127 assertions. I also checked backend selection using the real installed httpgd namespace version. All reported PR CI checks are green.

@eitsupi
eitsupi merged commit 2eb96a5 into REditorSupport:main Oct 9, 2026
5 checks passed
@eitsupi
eitsupi deleted the chore/remove-httpgd-js branch October 9, 2026 02:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants