Skip to content

codeSplitter merge: a file both sides added comes out clean but keeps only one side's edit on lines both wrote (#2654, fm-daw net.ts) #4133

Closed

Description

@QuinnsCode

Found by the full #1141 shadow check (run for #3946): the only merge in 69 where codeSplitter's own merge broke tests that pass on what landed.

What happened. PR #2654's merge 17cdbb0 (fm-daw). Both sides created apps/fm-daw/src/ui/net.ts (no base version, so a merge from empty). main's lines report { state: "online", peers, locked }, the branch's lines report { state: "online", peers, floor }. git conflicts on them. codeSplitter calls the file clean, but on each of those lines it keeps one side's version, so the result drops locked from some status calls and floor from others:

-      else if (m.t === "floor") { floor = { state: m.state, host: m.host }; opts.onStatus({ state: "online", peers, floor, locked }); }
+      else if (m.t === "floor") { floor = { state: m.state, host: m.host }; opts.onStatus({ state: "online", peers, floor }); }
-        opts.onStatus({ state: "online", peers, floor, locked });
+        opts.onStatus({ state: "online", peers, locked });

(- is what landed, + is codeSplitter's merge.) What landed keeps both fields. The same merge's Full.tsx also came out clean, with the branch's single-component layout and main's split cards mixed (11 lines off).

Effect. Two fm-daw tests fail on codeSplitter's tree and pass on what landed, still failing on a second run (so not flaky):

  • online: a private sesh lets in only who brings its code, and keeps it through a reset
  • online, the sesh's maker holds the floor, lets it go, and closes it out

What should happen. When both sides add the same file and write the same line differently, that's a card for a person (or a union both sides' changes fit in), never a clean pick of one side. A lost update the user never sees breaks the "hide git" promise worse than a conflict does.

Repro. cd apps/codesplitter && bun scripts/shadow.ts --pr 2654 --check (needs the PR head: git fetch origin refs/pull/2654/head). For a unit case, shadow() in scripts/shadow.ts on net.ts at 17cdbb0^1, 17cdbb0^2 with an empty base; test/conflicts.test.ts holds the earlier shadow-found cases.

Part of #1141.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions