(a: string, b: string)
| 60 | * work-received check when the ccr_v2_compat_enabled gate is on. |
| 61 | */ |
| 62 | export function sameSessionId(a: string, b: string): boolean { |
| 63 | if (a === b) return true |
| 64 | // The body is everything after the last underscore — this handles both |
| 65 | // `{tag}_{body}` and `{tag}_staging_{body}`. |
| 66 | const aBody = a.slice(a.lastIndexOf('_') + 1) |
| 67 | const bBody = b.slice(b.lastIndexOf('_') + 1) |
| 68 | // Guard against IDs with no underscore (bare UUIDs): lastIndexOf returns -1, |
| 69 | // slice(0) returns the whole string, and we already checked a === b above. |
| 70 | // Require a minimum length to avoid accidental matches on short suffixes |
| 71 | // (e.g. single-char tag remnants from malformed IDs). |
| 72 | return aBody.length >= 4 && aBody === bBody |
| 73 | } |
| 74 | |
| 75 | /** |
| 76 | * Build a CCR v2 session URL from the API base URL and session ID. |
no outgoing calls
no test coverage detected