Problem Summary
When a test-set is recorded with custom metadata ending in a number, that number incorrectly influences the next auto-generated test-set-N ID, causing it to skip ahead unexpectedly.
Example
Code:
pkg.NextID([]string{"test-set-0", "checkout-flow-999"}, "test-set-")
Expected Output:
Actual Output:
Why This Happens
The allocator extracts numeric suffixes from all strings in the input list, not just those matching the requested prefix. When it encounters checkout-flow-999, it treats 999 as a candidate ID for the test-set- sequence, causing the next ID to incorrectly jump to 1000.
User-Level Impact
keploy record -c "<app cmd>" --metadata "name=checkout-flow-999"
keploy record -c "<app cmd>"
The second recording may create:
Instead of the expected:
Root Cause
The ID parsing logic in pkg.NextID() and pkg.LastID() extracts numeric suffixes without first filtering by the requested prefix.
Affected Files
pkg/service/record/record.go
pkg/util.go
Likely Fix Area
pkg.NextID() — Filter candidate IDs to only those starting with the provided prefix before extracting numeric suffixes
pkg.LastID() — Same parsing pattern; requires the same fix
Solution Approach
Modify the ID extraction logic to:
- Filter strings to match
prefix + numeric pattern only
- Extract the numeric part from matching IDs
- Return the next sequential number
Problem Summary
When a test-set is recorded with custom metadata ending in a number, that number incorrectly influences the next auto-generated
test-set-NID, causing it to skip ahead unexpectedly.Example
Code:
Expected Output:
Actual Output:
Why This Happens
The allocator extracts numeric suffixes from all strings in the input list, not just those matching the requested prefix. When it encounters
checkout-flow-999, it treats999as a candidate ID for thetest-set-sequence, causing the next ID to incorrectly jump to1000.User-Level Impact
The second recording may create:
Instead of the expected:
Root Cause
The ID parsing logic in
pkg.NextID()andpkg.LastID()extracts numeric suffixes without first filtering by the requested prefix.Affected Files
pkg/service/record/record.gopkg/util.goLikely Fix Area
pkg.NextID()— Filter candidate IDs to only those starting with the provided prefix before extracting numeric suffixespkg.LastID()— Same parsing pattern; requires the same fixSolution Approach
Modify the ID extraction logic to:
prefix + numeric patternonly