* Chained `test create --run` / `test create --plan-from --run` derive the * trigger idempotency key as ` :run`. Validate that derived key * BEFORE the create POST so a near-limit user-supplied base key fails fast * (exit 5) instead of creating the test and THEN rejecting the 257+ char
( run: boolean | undefined, idempotencyKey: string | undefined, )
| 553 | * `runCreate` / `runCreateFromPlan` when chaining into `runTestRun`. |
| 554 | */ |
| 555 | function assertChainedRunKeyFits( |
| 556 | run: boolean | undefined, |
| 557 | idempotencyKey: string | undefined, |
| 558 | ): void { |
| 559 | if (run !== true || idempotencyKey === undefined) return; |
| 560 | const RUN_SUFFIX = ':run'; |
| 561 | if (idempotencyKey.length + RUN_SUFFIX.length > 256) { |
| 562 | throw localValidationError( |
| 563 | 'idempotencyKey', |
| 564 | `must be at most ${256 - RUN_SUFFIX.length} characters when used with --run ` + |
| 565 | `(the chained trigger derives "<key>${RUN_SUFFIX}", which must stay within the 256-char limit)`, |
| 566 | undefined, |
| 567 | 'flag', |
| 568 | ); |
| 569 | } |
| 570 | } |
| 571 | |
| 572 | /** |
| 573 | * B3 / Fix 4: best-effort duplicate-name advisory shared by `runCreate` |
no test coverage detected