EPMRPP-113709 || Introduce the retry_of property for JS agents#265
EPMRPP-113709 || Introduce the retry_of property for JS agents#265maria-hambardzumian wants to merge 1 commit into
Conversation
WalkthroughThe PR adds retry linking to the ReportPortal JavaScript client. Test items can now be marked as retries with ChangesRetry Item Linking
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
index.d.tsParsing error: ESLint was configured to run on
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. Comment |
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 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 `@index.d.ts`:
- Around line 203-207: StartTestItemOptions is missing the optional uniqueId
property required for retry chaining; add an optional uniqueId: string field to
the StartTestItemOptions type declaration in index.d.ts and document it (JSDoc)
as the discriminator used for retry chaining so TypeScript callers can pass the
same uniqueId that lib/report-portal-client.js reads via testItemDataRQ.uniqueId
(used in the retry-chain key).
In `@lib/report-portal-client.js`:
- Around line 574-579: The current branch unconditionally overwrites
StartTestItemOptions.retryOf using previousRetryEntry->previousItem->realId,
breaking callers that explicitly set retryOf; change the logic around
previousRetryEntry (the block that assigns testItemData.retryOf) to only set
testItemData.retryOf = previousRealId when testItemData.retryOf is not already
provided (e.g., undefined/null/empty), preserving any caller-supplied
StartTestItemOptions.retryOf while still falling back to previousItem.realId
when absent.
🪄 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: de1f676b-08b7-4db7-bc89-1db563ad1e5f
⛔ Files ignored due to path filters (1)
package-lock.jsonis excluded by!**/package-lock.json
📒 Files selected for processing (4)
CHANGELOG.md__tests__/report-portal-client-retry-of.spec.jsindex.d.tslib/report-portal-client.js
| /** | ||
| * Marks the test item as a retry of a previous attempt with the same | ||
| * `name`/`uniqueId` under the same parent. The client uses this flag to | ||
| * link the new attempt to the previous one via the `retryOf` field. | ||
| */ |
There was a problem hiding this comment.
Expose uniqueId if retry chaining depends on it.
The new JSDoc says retries are matched by name/uniqueId, and lib/report-portal-client.js Line 554-559 already uses testItemDataRQ.uniqueId in the retry-chain key. StartTestItemOptions still doesn't declare that field, so TS consumers can't pass the discriminator the implementation relies on without escaping the type system.
🤖 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 `@index.d.ts` around lines 203 - 207, StartTestItemOptions is missing the
optional uniqueId property required for retry chaining; add an optional
uniqueId: string field to the StartTestItemOptions type declaration in
index.d.ts and document it (JSDoc) as the discriminator used for retry chaining
so TypeScript callers can pass the same uniqueId that
lib/report-portal-client.js reads via testItemDataRQ.uniqueId (used in the
retry-chain key).
| if (previousRetryEntry) { | ||
| const previousItem = this.map[previousRetryEntry.tempId]; | ||
| const previousRealId = previousItem && previousItem.realId; | ||
| if (previousRealId) { | ||
| testItemData.retryOf = previousRealId; | ||
| } |
There was a problem hiding this comment.
Preserve an explicit retryOf.
StartTestItemOptions.retryOf is public now, but this branch overwrites any caller-supplied value whenever a previous retry entry exists. That breaks the new API contract for agents that already know the previous UUID and need to send it even when local retry state is stale or reconstructed.
Proposed fix
- if (previousRetryEntry) {
+ if (!testItemData.retryOf && previousRetryEntry) {
const previousItem = this.map[previousRetryEntry.tempId];
const previousRealId = previousItem && previousItem.realId;
if (previousRealId) {
testItemData.retryOf = previousRealId;
}
}🤖 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 `@lib/report-portal-client.js` around lines 574 - 579, The current branch
unconditionally overwrites StartTestItemOptions.retryOf using
previousRetryEntry->previousItem->realId, breaking callers that explicitly set
retryOf; change the logic around previousRetryEntry (the block that assigns
testItemData.retryOf) to only set testItemData.retryOf = previousRealId when
testItemData.retryOf is not already provided (e.g., undefined/null/empty),
preserving any caller-supplied StartTestItemOptions.retryOf while still falling
back to previousItem.realId when absent.
EPMRPP-113709 — Introduce the retry_of property for JS agents
Verdict: PASS_WITH_NOTES
Branch:
feat/EPMRPP-113709→developAuto-generated by ai-workflow pipeline.
Summary by CodeRabbit
New Features
retryandretryOfoptions to test item configuration, enabling server-side linking of test retry attempts.Tests