Conversation
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.
Contributor
|
I hadn't read through the code of this package really - nice to have WebRTC from the get go |
Member
Author
|
This got a thorough review from @deansheather before going into the monorepo, so should be good! |
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.