Skip to content

if a rule application is found, do not increase the deletion index#133

Merged
georghinkel merged 1 commit intomainfrom
anytext-fixes
Mar 11, 2026
Merged

if a rule application is found, do not increase the deletion index#133
georghinkel merged 1 commit intomainfrom
anytext-fixes

Conversation

@georghinkel
Copy link
Copy Markdown
Contributor

@georghinkel georghinkel commented Mar 11, 2026

Summary by MergeMonkey

  • Fixes & Patches:
    • Fixes incorrect deletion index calculation that was causing wrong entries to be removed during rule application list migrations

@mergemonkeyhq
Copy link
Copy Markdown

mergemonkeyhq bot commented Mar 11, 2026

Risk AssessmentNEEDS-TESTING

Focus areas: ChangeTracker.cs deletion index calculation · List migration entry correctness

Assessment: Bug fix in core list migration logic that affects rule application tracking.

Walkthrough

The PR fixes a bug in the ChangeTracker where the deletion index was incorrectly calculated during list migrations. When processing rule applications, the code was using 'index + indexOffset' instead of just 'index', causing wrong entries to be marked for removal. The fix corrects this and adds additional logic to handle the edge case when index is 0 and there are prior edits.

Changes

Files Summary
Core Bug Fix in List Migration Logic
AnyText/AnyText.Core/ChangeTracker.cs
Fixes deletion index to use 'index' instead of 'index + indexOffset' when rule applications are found, and adds handling for index==0 with prior edits to properly remove obsoleted entries
Test and Changelog
AnyText/Tests/AnyText.Tests/Diffs/DiffParserTests.cs
AnyText/AnyText.history
Adds new test file for DiffParser and records the bug fix in the changelog

Sequence Diagram

sequenceDiagram\n    participant Old as Old List\n    participant Calc as CalculateListMigrations\n    participant Fix as Index Calculation\n    participant Result as Migration Entries\n    Old->>Calc: Process rule applications\n    Calc->>Fix: Calculate deletion index\n    Fix-->>Calc: Use 'index' not 'index+indexOffset'\n    Calc->>Result: Add Remove entries with correct index\n    Note over Calc,Fix: Bug fix: was causing wrong entries to be removed
Loading

Dig Deeper With Commands

  • /review <file-path> <function-optional>
  • /chat <file-path> "<question>"
  • /roast <file-path>

Runs only when explicitly triggered.

@georghinkel georghinkel merged commit bc9dba7 into main Mar 11, 2026
1 check passed
@georghinkel georghinkel deleted the anytext-fixes branch March 11, 2026 06:52
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