Skip to content

bug:ENG-20249 fix counter index in getLineInformation - #47

Merged
ryan2445 merged 7 commits into
mainfrom
ENG-20249_PR-files-for-review-line-expansion-shows-incorrect-lines
Aug 6, 2026
Merged

bug:ENG-20249 fix counter index in getLineInformation#47
ryan2445 merged 7 commits into
mainfrom
ENG-20249_PR-files-for-review-line-expansion-shows-incorrect-lines

Conversation

@ryan2445

@ryan2445 ryan2445 commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Description

We were incrementing counter regardless of if isRetrieveNext was true or false. isRetrieveNext is only true when the current diff line is 'removed' and the next diff line is 'added' => we then look ahead to try to line up the added/removed lines instead of displaying them on top of each other. Incrementing counter when isRetrieveNext is true causes the "Show x lines ..." button to end up below the added/removed lines when it should be above.

Checklist

  • Links to Clickup
  • Follows PR title convention (<label>:ENG-XXXX <description>)
  • Introduces new tests on the code paths changed
  • Has been manually verified
  • Generates no new console or log warnings/errors (manual check)
  • Documentation added/updated as applicable

Screenshots

Before

image

After

Screenshot 2026-08-06 at 11 01 28 AM

Summary by CodeRabbit

  • Bug Fixes

    • Corrected line indexing during diff processing.
    • Fixed misplaced “Expand x lines” indicators in modified sections.
    • Improved accuracy for character, word, and line-offset differences.
  • Documentation

    • Updated code examples and formatting guidance.
    • Added guidance for automated package releases.
  • Tests

    • Updated diff behavior coverage for corrected line indexing.
  • Chores

    • Updated the package to version 4.0.7.
    • Improved automated build and release workflows.
    • Standardized the Node.js version used by project tooling.

@ryan2445 ryan2445 added the bug Something isn't working label Aug 6, 2026
@coderabbitai

coderabbitai Bot commented Aug 6, 2026

Copy link
Copy Markdown

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

The change corrects modification-line indexing during lookahead processing. It adds automated package publication, centralizes the Node.js version, updates package metadata, and documents the release process.

Changes

Line Index Correction

Layer / File(s) Summary
Lookahead index and validation
src/compute-lines.ts, test/compute-lines.test.ts
getLineInformation no longer increments counter during lookahead processing. Related tests expect changed lines [0, 1].

Release Automation

Layer / File(s) Summary
Runtime and package metadata
.github/workflows/build-test.yml, .nvmrc, package.json
CI reads Node.js from .nvmrc. The package version and repository metadata are updated.
Release validation and publication
.github/workflows/publish.yml
The workflow installs dependencies, runs lint, build, and tests, then publishes with the next or latest tag.
Release documentation and examples
README.md
Examples use semicolon-free formatting. Release instructions describe automated package publication.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Release as Published release
  participant Workflow as Publish workflow
  participant Package as GitHub Packages
  Release->>Workflow: Trigger publication
  Workflow->>Workflow: Install dependencies, lint, build, and test
  Workflow->>Package: Publish with next or latest tag
Loading
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies the bug fix and the affected getLineInformation counter index.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch ENG-20249_PR-files-for-review-line-expansion-shows-incorrect-lines

Warning

Review ran into problems

🔥 Problems

Errors were encountered while retrieving linked issues.

Errors (1)
  • ENG-20249: Entity not found: Issue - Could not find referenced Issue.

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🧹 Nitpick comments (1)
README.md (1)

378-382: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Use a version placeholder in the release instructions.

The release procedure is reusable, but Line 381 hardcodes v4.0.7. After the next version bump, this text can direct maintainers to create the wrong tag. Use v<version> and <version> instead.

Proposed change
-   targeting `main` with a new tag matching the version you just merged — `v4.0.7` or `4.0.7` both
+   targeting `main` with a new tag matching the version you just merged — `v<version>` or `<version>` both
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@README.md` around lines 378 - 382, Update the release instructions around the
GitHub release tag examples to replace the hardcoded 4.0.7 values with version
placeholders, using v&lt;version&gt; or &lt;version&gt; while preserving the
existing guidance.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/publish.yml:
- Around line 50-54: Remove the cache and cache-dependency-path settings from
the actions/setup-node step in the publication job, while retaining
node-version-file and leaving caching enabled only in build-test.yml.
- Around line 25-28: Set persist-credentials: false on all checkout steps in
.github/workflows/publish.yml (lines 25-28) and both checkout steps in
.github/workflows/build-test.yml (lines 16 and 35). Update the publish
workflow’s git fetch --no-tags origin main authentication to use a scoped step
or API request after checkout credentials are disabled.

In @.nvmrc:
- Line 1: Update the Node.js version in .nvmrc from the EOL 20.19.4 release to a
currently supported Node.js LTS release so CI and publication workflows using
this file run on the supported version.

---

Nitpick comments:
In `@README.md`:
- Around line 378-382: Update the release instructions around the GitHub release
tag examples to replace the hardcoded 4.0.7 values with version placeholders,
using v&lt;version&gt; or &lt;version&gt; while preserving the existing
guidance.
🪄 Autofix

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: QUIET

Plan: Pro

Run ID: 2c0e0b54-cbe4-41d3-9223-2341502a5b78

📥 Commits

Reviewing files that changed from the base of the PR and between 6d00369 and f1b70c8.

📒 Files selected for processing (5)
  • .github/workflows/build-test.yml
  • .github/workflows/publish.yml
  • .nvmrc
  • README.md
  • package.json

Comment thread .github/workflows/publish.yml
Comment thread .github/workflows/publish.yml Outdated
Comment thread .nvmrc Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Caution

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

⚠️ Outside diff range comments (2)
.github/workflows/publish.yml (2)

23-49: 🔒 Security & Privacy | 🟠 Major | ⚡ Quick win

Bind checkout to the release event commit.

github.event.release.tag_name can resolve a moved or recreated tag. The ancestry check does not detect this. Use ref: ${{ github.sha }} and verify that refs/tags/${TAG_NAME}^{commit} equals $GITHUB_SHA, or restrict release-tag updates with a tag ruleset.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/publish.yml around lines 23 - 49, Update the checkout step
to use ref: ${{ github.sha }} instead of the release tag name, then extend the
tag verification around TAG_NAME to resolve refs/tags/${TAG_NAME}^{commit} and
require it to equal GITHUB_SHA before publishing. Keep the existing version and
main-ancestry checks intact.

51-59: 🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

Configure registry authentication after dependency installation.

The repository uses a Yarn v1 lockfile. setup-node writes ${NODE_AUTH_TOKEN} to .npmrc, but the workflow sets NODE_AUTH_TOKEN only for Publish. Yarn Classic can fail while reading this configuration during yarn install.

Move registry-url and scope to a second setup-node step immediately before Publish. Keep NODE_AUTH_TOKEN scoped to Publish.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/publish.yml around lines 51 - 59, Update the workflow’s
setup-node configuration so the initial step before Install dependencies only
selects the Node version from .nvmrc. Add a second setup-node step immediately
before Publish containing registry-url and scope, while keeping NODE_AUTH_TOKEN
scoped exclusively to Publish.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In @.github/workflows/publish.yml:
- Around line 23-49: Update the checkout step to use ref: ${{ github.sha }}
instead of the release tag name, then extend the tag verification around
TAG_NAME to resolve refs/tags/${TAG_NAME}^{commit} and require it to equal
GITHUB_SHA before publishing. Keep the existing version and main-ancestry checks
intact.
- Around line 51-59: Update the workflow’s setup-node configuration so the
initial step before Install dependencies only selects the Node version from
.nvmrc. Add a second setup-node step immediately before Publish containing
registry-url and scope, while keeping NODE_AUTH_TOKEN scoped exclusively to
Publish.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: QUIET

Plan: Pro

Run ID: fc6876fd-19fc-42b1-9e67-f45b4ea38d45

📥 Commits

Reviewing files that changed from the base of the PR and between f1b70c8 and 6f0f125.

📒 Files selected for processing (4)
  • .github/workflows/build-test.yml
  • .github/workflows/publish.yml
  • .nvmrc
  • README.md

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/publish.yml:
- Line 6: Update the publish workflow’s workflow_dispatch and prerelease
publication paths to require a prerelease package.json version before publishing
to the next tag. For manual runs that only retag an existing version, replace
npm publish with npm dist-tag add, while preserving the normal publish flow for
creating prerelease packages and preventing stable versions from being published
as next.
🪄 Autofix

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: QUIET

Plan: Pro

Run ID: b2fe16ef-c86c-43bf-9daa-6ded008adf1a

📥 Commits

Reviewing files that changed from the base of the PR and between 6f0f125 and adbab9f.

📒 Files selected for processing (1)
  • .github/workflows/publish.yml

Comment thread .github/workflows/publish.yml

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/publish.yml:
- Around line 53-64: Move the VERSION extraction before the PUBLISH_NEXT branch,
then reject versions with a SemVer prerelease suffix when PUBLISH_NEXT is not
true before running npm publish --tag latest. Preserve the existing rejection of
stable versions for the next tag, or replace both checks with equivalent
bidirectional validation.
🪄 Autofix

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: QUIET

Plan: Pro

Run ID: 2f860c84-1e0f-42ab-8d3a-73d0a8a24ade

📥 Commits

Reviewing files that changed from the base of the PR and between adbab9f and 38133a3.

📒 Files selected for processing (1)
  • .github/workflows/publish.yml

Comment thread .github/workflows/publish.yml
@ryan2445
ryan2445 merged commit abb1df7 into main Aug 6, 2026
4 checks passed
@ryan2445
ryan2445 deleted the ENG-20249_PR-files-for-review-line-expansion-shows-incorrect-lines branch August 6, 2026 21:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants