Skip to content

fix(core): replace stale entry in RetrySubstore.upsert instead of pushing a duplicate (fixes #896) - #897

Open
meganemura wants to merge 1 commit into
allure-framework:mainfrom
meganemura:fix/retrysubstore-duplicate-retry
Open

fix(core): replace stale entry in RetrySubstore.upsert instead of pushing a duplicate (fixes #896)#897
meganemura wants to merge 1 commit into
allure-framework:mainfrom
meganemura:fix/retrysubstore-duplicate-retry

Conversation

@meganemura

Copy link
Copy Markdown

Context

RetrySubstore.upsert (packages/core/src/store/retrySubstore.ts) always pushed the incoming TestResult onto the retryHash array without checking whether an entry with the same id already existed. When the same result id was upserted twice (see #896 for how this happens and a self-contained repro), the array ended up with two entries sharing one id — one stale, one fresh — and retriesByTr reported the test as having a retry of itself.

DefaultAllureStore already treats a re-visit of the same id as an update, not a new entry: #testResults.set(testResult.id, testResult) is a Map, so the same key replaces the old value. This PR makes RetrySubstore.upsert follow the same rule — if an entry with the same id is already in the array, replace it in place instead of pushing a duplicate.

Added a regression test that upserts the same id twice with a newer start and asserts retriesByTr no longer returns a duplicate.

Fixes #896

Checklist

…hing a duplicate

Re-upserting the same test result id appended a second array entry
instead of replacing the first, so retriesByTr could list a test as
its own retry.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
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.

RetrySubstore.upsert appends a duplicate entry when the same result id is read twice

1 participant