Skip to content

Commit 110e61b

Browse files
committed
fix: add random suffix to IDs to prevent collision in concurrent operations
- phase-minus-one.js: GATE-{timestamp}-{random} - sprint-reporter.js: RPT-{sprintId}-{timestamp}-{random} Fixes flaky tests caused by Date.now() returning same value in rapid succession
1 parent cd3cc33 commit 110e61b

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

src/constitutional/phase-minus-one.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ class PhaseMinusOneGate {
5151
* @returns {Promise<Object>} Gate record
5252
*/
5353
async trigger(options) {
54-
const gateId = `GATE-${Date.now()}`;
54+
const gateId = `GATE-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
5555

5656
const gate = {
5757
id: gateId,

src/dashboard/sprint-reporter.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class SprintReporter {
3737
*/
3838
async generateReport(sprint) {
3939
const report = {
40-
id: `RPT-${sprint.id}-${Date.now()}`,
40+
id: `RPT-${sprint.id}-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`,
4141
sprintId: sprint.id,
4242
sprintName: sprint.name,
4343
featureId: sprint.featureId,

0 commit comments

Comments
 (0)