Skip to content

Remove lots of dead code - #216

Merged
Avni2000 merged 19 commits into
mainfrom
ts-prune
Apr 4, 2026
Merged

Avni2000 merged 19 commits into
mainfrom
ts-prune

Conversation

@Avni2000

@Avni2000 Avni2000 commented Apr 3, 2026 •

Copy link
Copy Markdown
Owner

Motivation

Remove dead code. I've been seeing quite a few unnecessary functions/pieces of metadata/etc. and our CSS was a mess.

Solution

  • Add knip, which detects dead code
  • Go through multiple iterations of testing and finding dead code

Summary by CodeRabbit

  • Refactoring

    • Consolidated module exports and reduced public/internal API surface for a slimmer codebase.
    • Simplified client/server session and resolution flows for more predictable web sessions and conflict payloads.
    • Trimmed UI styles and removed some auxiliary UI elements for a leaner interface.
  • Bug Fixes

    • Removed several conditional branches to make resolution and renumbering paths more consistent.
  • Chores

    • Added a dead‑code detection script and updated tooling dependencies.

@coderabbitai

coderabbitai Bot commented Apr 3, 2026 •

Copy link
Copy Markdown
Contributor

Warning

Rate limit exceeded

@Avni2000 has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 10 minutes and 18 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 10 minutes and 18 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: df2fa2d1-3f23-4daa-bb19-a30004faff2e

📥 Commits

Reviewing files that changed from the base of the PR and between b66beca and 5527394.

📒 Files selected for processing (8)
  • apps/vscode-extension/resolver.ts
  • apps/vscode-extension/tests/settingsFile.ts
  • apps/vscode-extension/tests/testHarness.ts
  • apps/vscode-extension/web/WebConflictPanel.ts
  • packages/web/client/src/styles.ts
  • packages/web/client/src/types.ts
  • packages/web/server/src/webTypes.ts
  • packages/web/tests/fixtures.ts
📝 Walkthrough

Walkthrough

Consolidates imports to package barrels, removes many exported types/functions, prunes legacy helpers/fields, and simplifies session/WebSocket messaging and resolution control flow across web server, web client, and VS Code extension components.

Changes

Cohort / File(s) Summary
Barrel & logger import consolidation
apps/vscode-extension/extension.ts, apps/vscode-extension/gitIntegration.ts, apps/vscode-extension/resolver.ts, apps/vscode-extension/settings.ts, apps/vscode-extension/tests/*, packages/core/src/index.ts, packages/web/client/src/*, packages/web/server/src/*, packages/web/tests/*, test-fixtures/shared/*
Replaced deep submodule imports with package entry-point/barrel imports (e.g., .../core/src, .../web/server/src) and updated many logger imports accordingly.
Export surface reductions
apps/vscode-extension/gitIntegration.ts, apps/vscode-extension/resolver.ts, apps/vscode-extension/settings.ts, apps/vscode-extension/tests/settingsFile.ts, packages/core/src/semanticResolution.ts, packages/core/src/positionUtils.ts, packages/web/client/src/store/resolverStore.ts, packages/web/client/src/styles.ts, packages/web/client/src/components/*, packages/web/server/src/*, packages/web/tests/fixtures.ts, test-fixtures/shared/*, test-fixtures/shared/testHelpers.ts
Removed export from many interfaces/types/consts and deleted several exported helpers/functions, shrinking the public TypeScript API across extension, core, web client, server, tests, and fixtures.
Dead helpers & field removals
packages/core/src/cellMatcher.ts, packages/core/src/notebookUtils.ts, packages/core/src/types.ts, packages/core/src/conflictDetector.ts, packages/web/client/src/utils/*
Deleted unused helpers and legacy types (e.g., computeMatchConfidence, getCellPreview, legacy conflict types); removed matchConfidence from CellMapping and removed description from semantic conflict items.
Session & WebSocket protocol simplification
apps/vscode-extension/web/WebConflictPanel.ts, packages/web/server/src/webServer.ts, packages/web/server/src/webTypes.ts, packages/web/client/src/hooks/useWebSocket.ts
Removed htmlContent param from openSession, stopped sending initial connected message/sessionId, removed fileName/branch/session-version fields from payloads, and simplified WS message shapes and resolution-status lifecycle (no 'pending').
Resolution/control-flow simplifications
apps/vscode-extension/resolver.ts, apps/vscode-extension/tests/testHarness.ts, packages/web/tests/fixtures.ts, packages/web/client/src/utils/mergeRowBuilder.ts
Streamlined renumbering hook signature (removed RenumberPromptContext), always rebuild resolved notebook from resolvedRows, removed semantic-presence checks and related helpers.
UI prop/type & styling changes
packages/web/client/src/components/CellContent.tsx, packages/web/client/src/components/MergeRow.tsx, packages/web/client/src/components/ConflictResolver.tsx, packages/web/client/src/types.ts, packages/web/client/src/styles.ts
Removed/changed exported component internals and props (e.g., notebookPath, baseCell, isReordered, conflictIndex), adjusted render-mime registry inputs, and removed many style rules.
Tests & fixtures updates
apps/vscode-extension/tests/*, packages/web/tests/*, packages/web/tests/fixtures.ts, test-fixtures/*
Updated tests to use barrel imports, removed/adjusted test-only fields (e.g., matchConfidence, description), and made many fixture helpers non-exported.
Tooling / config
package.json, knip.json
Added find-dead-code npm script and knip.json config; added knip dependency and adjusted other deps/devDeps.

Sequence Diagram(s)

mermaid
sequenceDiagram
participant Browser as Web Client
participant Server as WebServer
participant Resolver as Extension/Resolver
Browser->>Server: send { command: "resolve", type: "semantic", resolvedRows, markAsResolved, renumberExecutionCounts, ... }
Server->>Resolver: forward resolve command (no sessionId/htmlContent)
Resolver->>Resolver: buildResolvedNotebookFromRows(resolvedRows, shouldRenumber, preferredSideHint)
Resolver-->>Server: send resolution result / status
Server-->>Browser: emit resolution-success / resolution-error
Browser->>Browser: update UI (conflictData / resolutionStatus)

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

Poem

🐰 I hopped through barrels, pruned a twig or two,

trimmed exports down and made the messages few.
Sessions lighter, payloads neat and small,
codepaths simpler — fewer things to stall.
A tidy burrow, hoppity hooray — well done today!

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 28.21% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Remove lots of dead code' accurately describes the main objective of this changeset, which involves removing unused functions, interfaces, types, and exports across multiple files.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch ts-prune

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
apps/vscode-extension/resolver.ts (2)

212-233: ⚠️ Potential issue | 🟠 Major

Auto-resolve success still leaves the notebook unmerged in Git.

When remainingConflicts.length === 0, this branch writes the merged notebook and fires resolved events, but it never stages the file. The notebook therefore stays unmerged in Git and will still be surfaced by the next findNotebooksWithConflicts() / getUnmergedFiles() scan even though the command just reported success. At minimum this path needs the same mark-resolved decision that the other resolution flows use.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@apps/vscode-extension/resolver.ts` around lines 212 - 233, When
autoResolveResult.remainingConflicts.length === 0 we save and fire the
resolution event but never mark or stage the file, leaving the notebook unmerged
in Git; update this branch (the code around pickRenumberExecutionCounts,
renumberExecutionCounts, saveResolvedNotebook and
onDidResolveConflictWithDetails.fire) to perform the same
"mark-as-resolved/stage" behavior used by the other resolution flows: decide
whether to mark as resolved (reuse the same mark-as-resolved decision logic used
elsewhere), set markAsResolved accordingly in the fired event, and call the same
function that stages/marks the notebook file as resolved so Git no longer treats
it as unmerged.

531-550: ⚠️ Potential issue | 🟠 Major

Treat resolvedRows: [] as a valid resolution result.

An empty row list is a legitimate UI outcome when the user deletes every remaining row. Falling back to autoResolveResult.resolvedNotebook in that case discards the browser’s source of truth, can resurrect cells the user explicitly removed, and bypasses the normal resolved-rows path. The headless flows already always rebuild from resolvedRows; this is the odd one out. Based on learnings: After unmatch, split the row into separate rows allowing manual selection and deletion.

Minimal fix
-        if (!resolvedRows || resolvedRows.length === 0) {
+        if (!resolvedRows) {
             // No resolutions provided
             if (autoResolveResult) {
                 let resolvedNotebook = autoResolveResult.resolvedNotebook;
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@apps/vscode-extension/resolver.ts` around lines 531 - 550, The current branch
treats resolvedRows: [] as "no resolutions" and falls back to
autoResolveResult.resolvedNotebook, which can resurrect deleted cells; change
the check so an explicit empty array is honored. In resolver.ts update the
conditional that checks resolvedRows (replace "if (!resolvedRows ||
resolvedRows.length === 0)" with a null/undefined check like "if (resolvedRows
== null)" or "if (typeof resolvedRows === 'undefined')" so that an empty array
is considered a valid resolution; when resolvedRows is provided (even empty)
rebuild/save using the resolvedRows path (instead of using
autoResolveResult.resolvedNotebook), keep renumberExecutionCounts via
pickRenumberExecutionCounts()/renumberExecutionCounts, call
saveResolvedNotebook(uri, /* notebook built from resolvedRows */) and fire
onDidResolveConflictWithDetails.fire with the actual resolvedRows, then show the
information message with vscode.window.showInformationMessage.
🧹 Nitpick comments (7)
packages/web/client/src/styles.ts (1)

1029-1032: Drop the no-op border-left-color override.

Line 1031 targets .cm-content, but the green left border is defined on the parent at Lines 1025-1027. This declaration never paints and just leaves dead CSS behind.

♻️ Suggested cleanup
 .resolved-cell.markdown-cell .resolved-content-input .cm-content {
     font-family: var(--font-ui) !important;
-    border-left-color: var(--accent-green);
 }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/web/client/src/styles.ts` around lines 1029 - 1032, The
`border-left-color` declaration inside the `.resolved-cell.markdown-cell
.resolved-content-input .cm-content` rule is a no-op because the left border is
painted on the parent (e.g., `.resolved-cell.markdown-cell
.resolved-content-input`); remove the dead `border-left-color:
var(--accent-green);` line and keep the `font-family: var(--font-ui)
!important;` in the `.cm-content` rule so the styling remains correct.
package.json (1)

129-129: Consider documenting the grep exit code handling.

The || [ $? -eq 1 ] pattern is clever but non-obvious—grep exits 1 when no lines match, so this allows the script to succeed when all dead code is in the excluded files. A brief inline comment in contributing docs or the script itself would help future maintainers understand this behavior.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@package.json` at line 129, The package.json script "find-dead-code" uses the
non-obvious pattern "|| [ $? -eq 1 ]" to treat grep's exit code 1 (no matches)
as success; add a short explanatory note either as a one-line comment near the
script entry in package.json or in the contributing docs explaining that grep
returns 1 when no lines match and that the fallback allows the npm script to
succeed in that case. Reference the "find-dead-code" script and the "|| [ $? -eq
1 ]" pattern in the comment so future maintainers understand the intent.
packages/web/tests/rendermimeOutputs.spec.ts (1)

11-11: Importing entire barrel includes all core exports, not just logger.

The change from import * as logger from '../../core/src/logger' to import * as logger from '../../core/src' now pulls in all 8 modules re-exported by the barrel (types, cellMatcher, conflictDetector, etc.) when only the logger functions are used. This works correctly since logger.info etc. are re-exported, but it's less precise.

This is acceptable for test files where bundle size doesn't matter, and it aligns with the PR's consolidation pattern across the test suite.

Alternative: Import only what's needed

If you prefer explicit imports:

-import * as logger from '../../core/src';
+import { info } from '../../core/src';

Then replace logger.info(...) with info(...).

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/web/tests/rendermimeOutputs.spec.ts` at line 11, The test imports
the whole core barrel via "import * as logger from '../../core/src'" which pulls
in all re-exports instead of only the logger; change the import to the specific
logger module (restore "import * as logger from '../../core/src/logger'") so
only logger functions are imported, or alternatively import just the named
functions used (e.g., "info") and update calls from logger.info(...) to
info(...); update references to logger.info/logger.warn/etc. accordingly (look
for usages of logger.* in rendermimeOutputs.spec.ts).
packages/web/server/src/webTypes.ts (1)

64-88: Make this module the single source of truth for the browser payload.

toWebSemanticConflict() only serializes one field, so callers still hand-roll WebConflictData. That already lets producers drift from the contract defined here. Export a toWebConflictData() helper from this module and reuse it everywhere the browser payload is built.

♻️ Proposed fix
 export function toWebSemanticConflict(conflict: NotebookSemanticConflict): WebSemanticConflict {
     return {
         semanticConflicts: conflict.semanticConflicts.map(c => ({
             type: c.type,
             baseCellIndex: c.baseCellIndex,
             currentCellIndex: c.currentCellIndex,
             incomingCellIndex: c.incomingCellIndex,
             baseContent: c.baseContent,
             currentContent: c.currentContent,
             incomingContent: c.incomingContent
         })),
         cellMappings: conflict.cellMappings,
         base: conflict.base,
         current: conflict.current,
         incoming: conflict.incoming
     };
 }
+
+export function toWebConflictData(conflict: UnifiedConflict, conflictKey: string): WebConflictData {
+    return {
+        filePath: conflict.filePath,
+        conflictKey,
+        type: conflict.type,
+        semanticConflict: conflict.semanticConflict
+            ? toWebSemanticConflict(conflict.semanticConflict)
+            : undefined,
+        autoResolveResult: conflict.autoResolveResult,
+        hideNonConflictOutputs: conflict.hideNonConflictOutputs,
+        showCellHeaders: conflict.showCellHeaders,
+        enableUndoRedoHotkeys: conflict.enableUndoRedoHotkeys,
+        showBaseColumn: conflict.showBaseColumn,
+        currentBranch: conflict.semanticConflict?.currentBranch,
+        incomingBranch: conflict.semanticConflict?.incomingBranch,
+        theme: conflict.theme,
+    };
+}

Based on learnings: Always follow DRY principles — check for duplicated type definitions or logic across packages and consolidate them into a single source of truth.

Also applies to: 136-151

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/web/server/src/webTypes.ts` around lines 64 - 88, The module
currently defines WebConflictData but only provides toWebSemanticConflict which
serializes a single field, causing callers to hand-roll the rest and drift from
the contract; add and export a toWebConflictData(filePath: string, conflict: /*
internal conflict type */) function that builds and returns a complete
WebConflictData object (populate conflictKey, type, semanticConflict via
toWebSemanticConflict, autoResolveResult, display options like
hideNonConflictOutputs/showCellHeaders/enableUndoRedoHotkeys/showBaseColumn,
branch fields currentBranch/incomingBranch, and theme) and replace all sites
that construct WebConflictData manually to call toWebConflictData so this module
becomes the single source of truth for browser payloads.
apps/vscode-extension/tests/settingsFile.ts (1)

10-22: Derive Theme from the shared settings contract.

'dark' | 'light' is already part of MergeNBSettings, so redefining it here will drift the next time the core settings add another theme value.

♻️ Proposed fix
-import { getConfigFilePath } from '../settings';
+import { getConfigFilePath, type MergeNBSettings } from '../settings';
 
-type Theme = 'dark' | 'light';
+type Theme = MergeNBSettings['theme'];

Based on learnings: Always follow DRY principles — check for duplicated type definitions or logic across packages and consolidate them into a single source of truth.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@apps/vscode-extension/tests/settingsFile.ts` around lines 10 - 22, Replace
the local Theme literal type with the shared setting from the core contract:
import the MergeNBSettings type from the shared settings package and set Theme =
MergeNBSettings['ui.theme'] (or the appropriate path inside MergeNBSettings)
instead of declaring 'dark' | 'light'; then remove the duplicated local Theme
definition and ensure SettingsState (and any uses in SettingKey where Theme
appears) continue to reference this Theme alias so your tests follow the single
source of truth.
packages/web/client/src/types.ts (1)

83-95: Import the shared resolve-message type instead of redefining it here.

This resolve branch is another local copy of the browser↔extension wire contract that already lives in packages/web/server/src. Keeping both definitions in sync by hand is brittle, and this file will drift again the next time the websocket payload changes. Please re-export/import the shared protocol type here rather than maintaining a second copy in the client. Based on learnings: When reviewing TypeScript code, look for interface/type definitions (and related duplicated business logic) that are repeated across multiple packages. If the same shape/contract is defined in more than one package, flag it and consolidate into a single shared source of truth (e.g., a common types/util module) and re-export/import it, rather than duplicating the definitions in multiple packages.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/web/client/src/types.ts` around lines 83 - 95, The local 'resolve'
branch inside the WSMessage union duplicates the shared resolve-message type;
remove this local definition and import/re-export the shared resolve-message
type from the server package instead (replace the union member that includes
command: 'resolve', type: 'semantic', resolvedRows, etc. with the imported
type). Update the file to import the shared type (e.g., the server package's
resolve-message type) and include it in the WSMessage union so WSMessage uses
the canonical resolve message shape rather than a locally redefined one.
packages/web/tests/fixtures.ts (1)

48-76: Move the duplicated headless test harness into shared test helpers.

ConflictSession / ApplyOptions / NotebookMatchOptions and the headless setup/apply/assert helpers here now mirror apps/vscode-extension/tests/testHarness.ts almost verbatim. This PR already had to update both copies for the same websocket/session changes, so the next protocol tweak will create another parallel fix. Please extract the common types/helpers into test-fixtures/shared/ and keep only the Playwright-specific wrapper here. Based on learnings: Always follow DRY principles — check for duplicated type definitions or logic across packages and consolidate them into a single source of truth.

Also applies to: 124-342, 311-519

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/web/tests/fixtures.ts` around lines 48 - 76, This file duplicates
common types and headless test helpers (ConflictSession, ApplyOptions,
NotebookMatchOptions and the headless setup/apply/assert helpers) already used
elsewhere; extract those common types and helper functions into a single shared
test fixtures module and export them, then replace the duplicated definitions
here by importing the shared symbols; keep only the Playwright-specific
wrapper/adapters in this file (i.e., retain Playwright-only wiring while
removing duplicated logic/types) and update tests to import the shared fixtures
instead of the local copies so future protocol changes require only a single
update.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@apps/vscode-extension/web/WebConflictPanel.ts`:
- Around line 14-15: The WebConflictPanel is sending the raw
NotebookSemanticConflict instead of the slim web shape; update all places that
populate WebConflictData.semanticConflict (e.g., in WebConflictPanel and the
other instances around the 108-121 region) to call toWebSemanticConflict(...)
and pass that result instead of the raw semantic conflict object so the producer
emits the canonical web shape; search for uses of
WebConflictData.semanticConflict in this file and replace direct assignments of
NotebookSemanticConflict with calls to toWebSemanticConflict to normalize the
payload.

In `@package.json`:
- Line 176: The dependency "ts-prune" is archived and incompatible with
TypeScript 5.9.3; replace it with "knip" by removing "ts-prune": "^0.10.3" from
package.json devDependencies, add "knip" (latest stable) instead, and update any
npm scripts or CI steps that reference the ts-prune command to use knip (e.g.,
replace usage of the "ts-prune" CLI with the "knip" CLI and its equivalent
flags); ensure package-lock/yarn.lock is regenerated and CI scripts (if any)
calling the old package are updated to the new "knip" command.

---

Outside diff comments:
In `@apps/vscode-extension/resolver.ts`:
- Around line 212-233: When autoResolveResult.remainingConflicts.length === 0 we
save and fire the resolution event but never mark or stage the file, leaving the
notebook unmerged in Git; update this branch (the code around
pickRenumberExecutionCounts, renumberExecutionCounts, saveResolvedNotebook and
onDidResolveConflictWithDetails.fire) to perform the same
"mark-as-resolved/stage" behavior used by the other resolution flows: decide
whether to mark as resolved (reuse the same mark-as-resolved decision logic used
elsewhere), set markAsResolved accordingly in the fired event, and call the same
function that stages/marks the notebook file as resolved so Git no longer treats
it as unmerged.
- Around line 531-550: The current branch treats resolvedRows: [] as "no
resolutions" and falls back to autoResolveResult.resolvedNotebook, which can
resurrect deleted cells; change the check so an explicit empty array is honored.
In resolver.ts update the conditional that checks resolvedRows (replace "if
(!resolvedRows || resolvedRows.length === 0)" with a null/undefined check like
"if (resolvedRows == null)" or "if (typeof resolvedRows === 'undefined')" so
that an empty array is considered a valid resolution; when resolvedRows is
provided (even empty) rebuild/save using the resolvedRows path (instead of using
autoResolveResult.resolvedNotebook), keep renumberExecutionCounts via
pickRenumberExecutionCounts()/renumberExecutionCounts, call
saveResolvedNotebook(uri, /* notebook built from resolvedRows */) and fire
onDidResolveConflictWithDetails.fire with the actual resolvedRows, then show the
information message with vscode.window.showInformationMessage.

---

Nitpick comments:
In `@apps/vscode-extension/tests/settingsFile.ts`:
- Around line 10-22: Replace the local Theme literal type with the shared
setting from the core contract: import the MergeNBSettings type from the shared
settings package and set Theme = MergeNBSettings['ui.theme'] (or the appropriate
path inside MergeNBSettings) instead of declaring 'dark' | 'light'; then remove
the duplicated local Theme definition and ensure SettingsState (and any uses in
SettingKey where Theme appears) continue to reference this Theme alias so your
tests follow the single source of truth.

In `@package.json`:
- Line 129: The package.json script "find-dead-code" uses the non-obvious
pattern "|| [ $? -eq 1 ]" to treat grep's exit code 1 (no matches) as success;
add a short explanatory note either as a one-line comment near the script entry
in package.json or in the contributing docs explaining that grep returns 1 when
no lines match and that the fallback allows the npm script to succeed in that
case. Reference the "find-dead-code" script and the "|| [ $? -eq 1 ]" pattern in
the comment so future maintainers understand the intent.

In `@packages/web/client/src/styles.ts`:
- Around line 1029-1032: The `border-left-color` declaration inside the
`.resolved-cell.markdown-cell .resolved-content-input .cm-content` rule is a
no-op because the left border is painted on the parent (e.g.,
`.resolved-cell.markdown-cell .resolved-content-input`); remove the dead
`border-left-color: var(--accent-green);` line and keep the `font-family:
var(--font-ui) !important;` in the `.cm-content` rule so the styling remains
correct.

In `@packages/web/client/src/types.ts`:
- Around line 83-95: The local 'resolve' branch inside the WSMessage union
duplicates the shared resolve-message type; remove this local definition and
import/re-export the shared resolve-message type from the server package instead
(replace the union member that includes command: 'resolve', type: 'semantic',
resolvedRows, etc. with the imported type). Update the file to import the shared
type (e.g., the server package's resolve-message type) and include it in the
WSMessage union so WSMessage uses the canonical resolve message shape rather
than a locally redefined one.

In `@packages/web/server/src/webTypes.ts`:
- Around line 64-88: The module currently defines WebConflictData but only
provides toWebSemanticConflict which serializes a single field, causing callers
to hand-roll the rest and drift from the contract; add and export a
toWebConflictData(filePath: string, conflict: /* internal conflict type */)
function that builds and returns a complete WebConflictData object (populate
conflictKey, type, semanticConflict via toWebSemanticConflict,
autoResolveResult, display options like
hideNonConflictOutputs/showCellHeaders/enableUndoRedoHotkeys/showBaseColumn,
branch fields currentBranch/incomingBranch, and theme) and replace all sites
that construct WebConflictData manually to call toWebConflictData so this module
becomes the single source of truth for browser payloads.

In `@packages/web/tests/fixtures.ts`:
- Around line 48-76: This file duplicates common types and headless test helpers
(ConflictSession, ApplyOptions, NotebookMatchOptions and the headless
setup/apply/assert helpers) already used elsewhere; extract those common types
and helper functions into a single shared test fixtures module and export them,
then replace the duplicated definitions here by importing the shared symbols;
keep only the Playwright-specific wrapper/adapters in this file (i.e., retain
Playwright-only wiring while removing duplicated logic/types) and update tests
to import the shared fixtures instead of the local copies so future protocol
changes require only a single update.

In `@packages/web/tests/rendermimeOutputs.spec.ts`:
- Line 11: The test imports the whole core barrel via "import * as logger from
'../../core/src'" which pulls in all re-exports instead of only the logger;
change the import to the specific logger module (restore "import * as logger
from '../../core/src/logger'") so only logger functions are imported, or
alternatively import just the named functions used (e.g., "info") and update
calls from logger.info(...) to info(...); update references to
logger.info/logger.warn/etc. accordingly (look for usages of logger.* in
rendermimeOutputs.spec.ts).
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 7ca92606-8bc6-4be6-8b2f-8c0ad00c56ed

📥 Commits

Reviewing files that changed from the base of the PR and between 39fb836 and b55423a.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (55)
  • apps/vscode-extension/extension.ts
  • apps/vscode-extension/gitIntegration.ts
  • apps/vscode-extension/resolver.ts
  • apps/vscode-extension/settings.ts
  • apps/vscode-extension/tests/auUaPickOneRegression.test.ts
  • apps/vscode-extension/tests/duUdPickOneRegression.test.ts
  • apps/vscode-extension/tests/e2eResolution.test.ts
  • apps/vscode-extension/tests/logicRegression.test.ts
  • apps/vscode-extension/tests/nbdimeGuard.test.ts
  • apps/vscode-extension/tests/runNbdimeGuardTest.ts
  • apps/vscode-extension/tests/settingsFile.ts
  • apps/vscode-extension/tests/statusIndicatorsRegression.test.ts
  • apps/vscode-extension/tests/testHarness.ts
  • apps/vscode-extension/tests/unmergedStatusMatrix.test.ts
  • apps/vscode-extension/tests/vscodeRegression.test.ts
  • apps/vscode-extension/web/WebConflictPanel.ts
  • package.json
  • packages/core/src/cellMatcher.ts
  • packages/core/src/conflictDetector.ts
  • packages/core/src/index.ts
  • packages/core/src/notebookParser.ts
  • packages/core/src/notebookUtils.ts
  • packages/core/src/positionUtils.ts
  • packages/core/src/types.ts
  • packages/web/client/src/components/CellContent.tsx
  • packages/web/client/src/components/ConflictResolver.tsx
  • packages/web/client/src/components/MergeRow.tsx
  • packages/web/client/src/hooks/useWebSocket.ts
  • packages/web/client/src/index.tsx
  • packages/web/client/src/store/resolverStore.ts
  • packages/web/client/src/styles.ts
  • packages/web/client/src/types.ts
  • packages/web/client/src/utils/markdown.ts
  • packages/web/client/src/utils/mergeRowBuilder.ts
  • packages/web/client/src/utils/reorderUtils.ts
  • packages/web/server/src/index.ts
  • packages/web/server/src/webServer.ts
  • packages/web/server/src/webTypes.ts
  • packages/web/tests/fixtures.ts
  • packages/web/tests/globalSetup.ts
  • packages/web/tests/globalTeardown.ts
  • packages/web/tests/incomingNonConflictRegression.spec.ts
  • packages/web/tests/perCellResolution.spec.ts
  • packages/web/tests/rendermimeOutputs.spec.ts
  • packages/web/tests/reorderUnmatch.spec.ts
  • packages/web/tests/reorderUnmatchApplyDisk.spec.ts
  • packages/web/tests/settingsMatrix.spec.ts
  • packages/web/tests/syntaxHighlighting.spec.ts
  • packages/web/tests/takeAllButtons.spec.ts
  • packages/web/tests/undoRedoActions.spec.ts
  • packages/web/tests/unmatchGuardNoReorder.spec.ts
  • test-fixtures/shared/integrationUtils.ts
  • test-fixtures/shared/repoSetup.ts
  • test-fixtures/shared/testHelpers.ts
  • test-fixtures/shared/testRunnerShared.ts
💤 Files with no reviewable changes (3)
  • packages/core/src/notebookUtils.ts
  • packages/web/client/src/utils/reorderUtils.ts
  • packages/core/src/cellMatcher.ts

Comment thread package.json Resolved

@coderabbitai coderabbitai Bot 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.

🧹 Nitpick comments (1)
apps/vscode-extension/web/WebConflictPanel.ts (1)

183-185: Consider extracting magic number to a named constant.

The 500ms delay is a magic number. A named constant would improve readability and make it easier to tune if needed.

♻️ Suggested improvement
+const MESSAGE_DELIVERY_DELAY_MS = 500;
+
 export class WebConflictPanel {
-                        await new Promise(resolve => setTimeout(resolve, 500));
+                        await new Promise(resolve => setTimeout(resolve, MESSAGE_DELIVERY_DELAY_MS));
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@apps/vscode-extension/web/WebConflictPanel.ts` around lines 183 - 185,
Replace the magic number 500 used in the wait Promise (await new Promise(resolve
=> setTimeout(resolve, 500))) with a clear named constant (e.g.,
BROWSER_MESSAGE_DELIVERY_DELAY_MS or MESSAGE_DELIVERY_DELAY_MS) defined near the
top of WebConflictPanel.ts or the containing class; update the Promise to use
that constant so the intent and tuning point are explicit and easier to
maintain, and keep the constant’s name and placement consistent with other
timing constants in the file.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@apps/vscode-extension/web/WebConflictPanel.ts`:
- Around line 183-185: Replace the magic number 500 used in the wait Promise
(await new Promise(resolve => setTimeout(resolve, 500))) with a clear named
constant (e.g., BROWSER_MESSAGE_DELIVERY_DELAY_MS or MESSAGE_DELIVERY_DELAY_MS)
defined near the top of WebConflictPanel.ts or the containing class; update the
Promise to use that constant so the intent and tuning point are explicit and
easier to maintain, and keep the constant’s name and placement consistent with
other timing constants in the file.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: f20773b2-e0b8-4515-bbe8-d2b18012e357

📥 Commits

Reviewing files that changed from the base of the PR and between 7aee342 and b66beca.

📒 Files selected for processing (1)
  • apps/vscode-extension/web/WebConflictPanel.ts

- resolver.ts: auto-resolve path doesn't stage file
- resolver.ts: empty resolvedRows falls back incorrectly
- settingsFile.ts: duplicate Theme type
- styles.ts: dead border-left-color declaration
- types.ts: WSMessage duplicates BrowserToExtensionMessage

Add toWebConflictData to webTypes.ts and update 3 callers
@Avni2000
Avni2000 merged commit b92166b into main Apr 4, 2026
5 checks passed
@Avni2000
Avni2000 deleted the ts-prune branch April 4, 2026 02:50
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