fix: accurate issue creation date backdating + verify creation dates#131
Conversation
Root cause: resolveLineCount() defaulted to 1 when lines metric unavailable, causing changesetIndexByLine arrays to be 1 element. Per-line date indices were silently dropped, so the CE assigned one date per file. Fix: extend changesetIndexByLine to max(existingLength, maxIssueLine). Each issue's startLine gets its exact creationDate. Non-issue lines default to oldest date (index 0). 99.92% accuracy on Angular Framework (26/31,641 mismatches — all from shared startLines). Also adds creationDate verification to the verify command's issue checker. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
SummaryThis PR fixes the root cause of incorrect issue creation dates during migration: The fix extends Added creation date verification to the What reviewers should knowWhere to start: Review Algorithm changes: The rewrite drops three things:
These simplifications reduce complexity but should be audited if multi-line issue spans matter for accuracy. Verification additions: Review the Why 26 mismatches are acceptable: When two issues share the same
|
|
From Claude's verification by testing with
|
|
Also:
|
Summary
resolveLineCount()defaulted to 1, causingchangesetIndexByLinearrays to be 1 element — per-line date indices were silently droppedstartLinenow gets its exactcreationDatefrom SonarQube via SCM changeset blame dataverifycommand's issue checkerRoot Cause
resolveLineCount()increate-stub-changeset.jsfalls back tolineCount=1when thelinesmetric isn't available. The stub changeset has a 1-elementchangesetIndexByLinearray.backdateChangesets()was constrained by this size — issue lines beyond index 0 were silently ignored, so the CE assigned a single date per file.Fix: Extend
changesetIndexByLinetomax(existingLength, maxIssueLine)so all issue lines are covered.Verification Results (Angular Framework — 31,641 matched issues)
startLinewith an older issue (inherent per-line limitation, not a bug)Test plan
npm run packagebuilds successfully--skipIssueMetadataSynccompletes with zero errorsverify --only issue-metadataconfirms 99.92% creation date accuracy🤖 Generated with Claude Code
Note
Medium Risk
Medium risk because it changes how SCM
changesetsare synthesized (line indexing and revision IDs), which directly affects migrated issue creation dates and could impact large migrations if edge cases remain. Verification now fails on creation-date mismatches, which may cause previously passing runs to fail.Overview
Fixes issue creation date backdating by rebuilding
backdateChangesets()to map SonarQube issuecreationDateonto SCM blame dates per file line and by resizingchangesetIndexByLinetomax(existingLength, maxIssueLine)to avoid silently dropping dates when stub line counts default to 1.Adds creation-date comparison to the
verifyissues checker and surfaces mismatches in console and Markdown reports (newcreationDateMismatchescollection, report section, and fail condition). Also updates.gitignoreto ignore*.backupand refreshes the changelog entry documenting the new algorithm and verification results.Reviewed by Cursor Bugbot for commit 815687e. Bugbot is set up for automated code reviews on this repo. Configure here.