Skip to content

cn-fixes: Bridge: a transient explanation instead of a comment thread, and discovery that tries every address - #63

Open
tomeyer97 wants to merge 1 commit into
cnb/bridgefrom
cnb/bridge-polish
Open

tomeyer97 wants to merge 1 commit into
cnb/bridgefrom
cnb/bridge-polish

Conversation

@tomeyer97

Copy link
Copy Markdown
Owner

Two improvements to the bridge (docs/bridge.md). Stacked on the bridge PR (cnb/bridge).

  • reveal {file, start, end, text} lights the range and shows the text as a transient inline hint (an after-line decoration plus a hover on the lines) instead of a comment thread. It ends on an edit in the file, on the caret leaving the lines, on Esc, or on the next reveal. Nothing is written to .code-notes/.
  • bridge.json may list several addresses in urls (in addition to url). The client dials each in order, keeps the one that connected, and after a drop waits the existing backoff and tries that one first, then the others. This helps when a controller is reachable on several addresses, e.g. from a WSL guest.

Version 0.27.1; CHANGELOG.md updated.

Acceptance criteria

AC Status How
AC-1 transient hint, no comment thread / CodeLens, ends on edit / caret / Esc / next reveal, nothing written done src/core/bridge/hint.ts (lifecycle), src/bridge/hint.ts (decoration + hover), Esc keybinding when codeNotes.explanationShown; src/bridge/callout.ts removed. Unit: test/bridgeHint.test.ts, test/keybindings.test.ts. Integration (added, not run here): test/integration/main/bridge.ts
AC-2 urls in bridge.json, tried in order, keep the one that connected, retry all with backoff; documented done src/core/bridge/discovery.ts, src/core/bridge/client.ts, docs/bridge.md. Unit: test/bridgeClient.test.ts (fake server on the second address only, preferred-first after a drop, one wait per round, silent address timed out), test/bridgeDiscovery.test.ts
AC-3 URI handler, .request.json, commands and existing tests keep working done untouched; unit suite and gate pass
AC-4 the code reads well manual see Manual checks

Manual checks

  • AC-4: a visual code review of the slice's files: src/core/bridge/hint.ts, src/bridge/hint.ts, src/core/bridge/client.ts, src/core/bridge/discovery.ts, src/core/bridge/wslHost.ts, src/bridge/machine.ts and the tests listed above.
  • Optional for a person: run the VS Code integration suite's bridge chapter (npm run test:integration; it is not part of this gate). Then send a reveal with text and check the hint in a light and a dark theme, and in a narrow editor (the label is one line, at most 120 characters).

Deviations

  • Non-loopback address inside WSL. A WSL guest that sees Windows on a gateway address can't connect while only loopback URLs are accepted. Inside WSL, the extension also accepts the default gateway from /proc/net/route (src/core/bridge/wslHost.ts, src/bridge/machine.ts). That address is the Windows host, so the token never leaves the computer. No other non-loopback address is accepted.
  • Dial timeout (3 s, only with more than one address). Without it, a wrong address whose packets are dropped would hold up the right one for the system's TCP timeout. With a single address, behaviour is unchanged.
  • The hint's label sits after the first lit line (in view where the reveal centres the lines); the hover covers all lines.
  • The recipe URLs in docs/understanding-check.md follow the new version, because test/docs.test.ts pins them to it.

…overy that tries every address

A reveal's text is now a transient inline hint (an after-line decoration and a
hover) that ends on an edit, on the caret leaving the range, on Esc or on the
next reveal; nothing is written to .code-notes/. bridge.json may list several
addresses in `urls`; the client dials each in order, keeps the one that
connected and retries all of them with the existing backoff after a drop.
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.

1 participant