Skip to content

chore: Add peer package for networking#6

Merged
kylecarbs merged 1 commit into
mainfrom
peer
Jan 5, 2022
Merged

chore: Add peer package for networking#6
kylecarbs merged 1 commit into
mainfrom
peer

Conversation

@kylecarbs

Copy link
Copy Markdown
Member

This package was pulled straight from github.com/coder/m. Nothing has been changed.

It will be used for networking clients<->workspaces, and coderd<->provisionerd.

This package was pulled straight from github.com/coder/m. Nothing has been changed.

It will be used for networking clients<->workspaces, and coderd<->provisionerd.
@kylecarbs kylecarbs requested a review from bryphe-coder January 5, 2022 15:35
@kylecarbs kylecarbs self-assigned this Jan 5, 2022

@bryphe-coder bryphe-coder left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

👍

@bryphe-coder

Copy link
Copy Markdown
Contributor

I hadn't read through the code of this package really - nice to have WebRTC from the get go

@kylecarbs

Copy link
Copy Markdown
Member Author

This got a thorough review from @deansheather before going into the monorepo, so should be good!

@kylecarbs kylecarbs merged commit 8accb81 into main Jan 5, 2022
@kylecarbs kylecarbs deleted the peer branch January 5, 2022 17:18
mafredri added a commit that referenced this pull request Apr 18, 2026
buildReplacementLines' inserted branch inherited cLead from an
arbitrarily-picked paired content line, so a 4sp LLM search
inserting into a tab-indented or 2sp-indented file emitted the
wrong indent depth. The bug fires on every wrap-in-block,
single-to-multi expansion, or insert-new-block edit where the
caller's search/replace whitespace unit differs from the file's.

Scoped fix:

- detectIndentUnit(lines) scans leading whitespace and returns the
  smallest consistent unit (one tab, or N spaces via GCD). Mixed
  tab+space samples return ("", false).
- translateIndentLevel(rLead, sLead, cLead, searchUnit, fileUnit)
  computes the caller's rep_level relative to their search_base and
  emits the same relative level in the file's unit.
- buildReplacementLines computes searchUnit (from search+rep) and
  fileUnit (from matched) once per splice. Inserted lines (rMid
  non-empty, no search pair) call translateIndentLevel and fall
  back to the previous cLead-inheritance path when detection fails
  or a lead is not a clean multiple of its unit.

Pinned contracts (escape hatch, caller-agrees-with-itself,
empty-body carve-out, ending normalization) all stay green: only
the inserted branch changes, and paired lines take neither of the
new helpers.

Flips the 5 reds in TestEditFiles_FuzzyIndent_InsertionLevelAware
from red to green. Lock #7 and #8 update their expected outputs
to reflect partial post-fix correctness (inserted-line bugs
fixed, middle-substitution leakage still present for follow-up).
Lock #6 (Unwrap) and TestEditFiles_ReplaceAll_FuzzyIndentGap are
middle-substitution cases unchanged by this fix.

Addresses DEREM-11 (diff-aligned pairing known-limitation) for
the pure-insertion class. Middle-substitution level-awareness
remains a separate follow-up tracked by the middle-rewrite locks.
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