Skip to content

[10/36] Add OC-020 WebSocket support - #44

Open
cjohnsto-nz wants to merge 1 commit into
feature/oc-010-graphql-supportfrom
feature/oc-020-websocket-support
Open

[10/36] Add OC-020 WebSocket support#44
cjohnsto-nz wants to merge 1 commit into
feature/oc-010-graphql-supportfrom
feature/oc-020-websocket-support

Conversation

@cjohnsto-nz

@cjohnsto-nz cjohnsto-nz commented Jun 14, 2026

Copy link
Copy Markdown
Owner

Scope and stack-integrity note

This PR remains the OC-020 WebSocket fixture and baseline support branch at 87caf31.

The review-only transport failure tests originally committed here as 5177b78 are preserved at the stack tip in PR #72 as 3861f90. The full 37-PR sequential composition audit showed that keeping 5177b78 on this historical branch conflicts at PR #51, so this branch was restored to its original implementation head instead of forcing that conflict through the descendants.

Validation:

@cjohnsto-nz
cjohnsto-nz force-pushed the feature/oc-010-graphql-support branch from 5fbe5e7 to fb199a4 Compare June 14, 2026 22:46
@cjohnsto-nz
cjohnsto-nz force-pushed the feature/oc-020-websocket-support branch from a82f7dd to c72c827 Compare June 14, 2026 22:46
@cjohnsto-nz
cjohnsto-nz force-pushed the feature/oc-010-graphql-support branch from fb199a4 to 521fb17 Compare June 14, 2026 22:49
@cjohnsto-nz
cjohnsto-nz force-pushed the feature/oc-020-websocket-support branch from c72c827 to 94f34d6 Compare June 14, 2026 22:49
@cjohnsto-nz
cjohnsto-nz force-pushed the feature/oc-010-graphql-support branch from 521fb17 to 4b199da Compare June 14, 2026 22:50
@cjohnsto-nz
cjohnsto-nz force-pushed the feature/oc-020-websocket-support branch from 94f34d6 to 87caf31 Compare June 14, 2026 22:50
@cjohnsto-nz cjohnsto-nz changed the title Add OC-020 WebSocket demo fixtures and tests [10/21] Add OC-020 WebSocket support Jun 14, 2026
@cjohnsto-nz cjohnsto-nz changed the title [10/21] Add OC-020 WebSocket support [10/27] Add OC-020 WebSocket support Jun 15, 2026
@cjohnsto-nz cjohnsto-nz changed the title [10/27] Add OC-020 WebSocket support [10/36] Add OC-020 WebSocket support Jun 15, 2026
@APKiwi

APKiwi commented Jul 21, 2026

Copy link
Copy Markdown
Collaborator

Verdict: approve with nits, as a test-and-fixtures increment. Which is what this actually is:

  • Major, labeling: the increment contains no implementation. base..head is exactly test/webSocketSupport.test.ts plus six demo fixtures. webSocketClient.ts, the panel/service/CodeLens wiring and the ws dep all live in ancestor branches, so a reviewer reading this diff can't review connect races, socket cleanup or auth where the title claims they land. I checked the implementation out-of-band: the settle guard is idempotent, _onPanelDisposed does disconnect and terminate, activeConnectionCount bookkeeping is right, rejectUnauthorized defaults true. Sound code, wrong PR.
  • Minor: the fixture server implements upgrade rejection (401 route, auth route) and a rejected-upgrade demo exists, but no test asserts client behavior on a server-side upgrade rejection. The only negative test is the pre-connect URL-scheme guard.
  • Minor: makeEnvService injects the test's own interpolate/interpolateJson reimplementations, so the JSON-variant assertions validate the mock's coercion, not production EnvironmentService. A divergence would still pass.
  • Minor: no wss:// + rejectUnauthorized coverage, the one security-relevant knob is untested.
  • Nit: auth headers ride the upgrade request in plaintext over ws://, expected for a dev tool, noting there's no downgrade warning.

Tests otherwise: good, 13 deterministic tests covering connect/echo, frame types, variants, auth, cancellation via a real hold route, cleanup assertions across lifecycle paths.

Deps: none in this increment. For the record ws@8.21 has zero hard dependencies, the lean standard choice, nothing heavier rode along.

@cjohnsto-nz

Copy link
Copy Markdown
Owner Author

Fixed in 5177b78.

The three actionable test gaps are now closed:

  • Added a direct WebSocket client test for an HTTP 401 upgrade rejection and verified the active-connection registry is empty afterward.
  • Removed the test-only interpolation reimplementation. The suite now uses the production EnvironmentService, stubbing only variable resolution.
  • Added a real local wss:// fixture with a self-signed certificate. The tests prove that certificate verification is enforced by default and that missio.tls.rejectUnauthorized=false permits the connection.

Not changing the proposed credential warning for ws://. OC-020 explicitly supports both ws:// and wss://, and the local development fixture intentionally uses ws://. A warning would be new product behaviour, not a missing part of this task's transport contract. Authentication interpolation and handshake headers remain covered by the branch's tests.

The apparent implementation/PR split is a consequence of concurrent work in the stack, not missing WebSocket implementation. src/services/webSocketClient.ts was introduced in 45e5800 on PR #39 (feature/oc-040-runtime-scripting-testing), while protocol dispatch and shared UI/extension wiring were already present in ancestor commits. This PR owns the OC-020 demo fixtures and end-to-end acceptance coverage. Re-homing those ancestor hunks now would rewrite lower stack history and create avoidable conflicts without changing the delivered code.

Validation completed against this PR merged onto the current PR #43 base: TypeScript compile, production build, 390/390 tests, and 35/35 demo collection files. GitHub's build and security checks are green. I also ran the mandatory three-way stack-edge check, and immediate child PR #45 remains MERGEABLE/CLEAN after this push.

@cjohnsto-nz

Copy link
Copy Markdown
Owner Author

Correction to my earlier review response:

The transport-failure coverage in 5177b78 is valid, but the complete 37-PR sequential audit showed that keeping it on PR #44 creates a conflict when the stack reaches PR #51. I therefore restored this branch to its implementation head 87caf31 and preserved the tests at the stack tip in PR #72 as 3861f90.

This is a relocation, not a dropped fix. The final composite runs the WebSocket suite 29/29, both adjacent edges (#43 -> #44 and #44 -> #45) are clean, and GitHub reports this PR MERGEABLE / CLEAN with all checks passing.

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.

3 participants