From 3d9f857f2687f69399ec541e1bbd68790701a023 Mon Sep 17 00:00:00 2001 From: "Molecule AI Dev Engineer A (Kimi)" Date: Sun, 14 Jun 2026 11:22:51 +0000 Subject: [PATCH] fix(tests/e2e#2839): cap concierge creates-workspace slug at 32 chars MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The concierge staging E2E was over-budgeting the collision-proof slug helper: literal prefixes already include their trailing separator, so the helper was off-by-one in its budget (19 instead of 18). This left zero/negative room for the run_id segment and caused the 13-char 'e2e-cncrg-mk-' org slug and the 17-char 'e2e-cncrg-worker-' worker name to fail helper validation. - Correct the helper budget from prefix_len + N + 19 to +18. - Shorten the worker name prefix to 'e2e-cncrg-w-' (12 chars) so it fits the corrected 32-char cap while keeping an e2e-* lint-visible head. - Keep the org slug prefix 'e2e-cncrg-mk-' (13 chars); with the corrected budget it now produces a ≤32 char slug that matches ^[a-z][a-z0-9-]{2,31}$ and preserves the 8-hex uuid entropy. - Add a unit assertion for the concierge prefix shape. Co-Authored-By: Claude --- tests/e2e/lib/collision-proof-slug.sh | 11 ++++--- tests/e2e/test_collision_proof_slug_unit.sh | 31 +++++++++++++++++++ ...staging_concierge_creates_workspace_e2e.sh | 4 +-- 3 files changed, 39 insertions(+), 7 deletions(-) diff --git a/tests/e2e/lib/collision-proof-slug.sh b/tests/e2e/lib/collision-proof-slug.sh index 8058cf5e6..f2ed256fa 100755 --- a/tests/e2e/lib/collision-proof-slug.sh +++ b/tests/e2e/lib/collision-proof-slug.sh @@ -85,12 +85,13 @@ make_collision_proof_slug_suffix() { fi # Suffix layout: + - + + - + = N+18 chars. - # Full slug: + 1 (separator) + (N+18) = prefix_len + N + 19. - # Cap: prefix_len + N + 19 <= CP_ORG_SLUG_MAX_LEN - # => N <= CP_ORG_SLUG_MAX_LEN - prefix_len - 19 - local run_id_budget=$(( CP_ORG_SLUG_MAX_LEN - prefix_len - 19 )) + # The caller's literal prefix already includes its trailing separator, + # so the full slug is + (N+18) = prefix_len + N + 18. + # Cap: prefix_len + N + 18 <= CP_ORG_SLUG_MAX_LEN + # => N <= CP_ORG_SLUG_MAX_LEN - prefix_len - 18 + local run_id_budget=$(( CP_ORG_SLUG_MAX_LEN - prefix_len - 18 )) if [ "$run_id_budget" -lt 1 ]; then - echo "make_collision_proof_slug_suffix: caller prefix (${prefix_len} chars) too long for CP_ORG_SLUG_MAX_LEN=${CP_ORG_SLUG_MAX_LEN}; uuid anchor (8 chars) + date (8 chars) + 3 separators = 19 chars minimum, no room for run_id segment. Shorten the prefix literal in the SLUG= assignment." >&2 + echo "make_collision_proof_slug_suffix: caller prefix (${prefix_len} chars) too long for CP_ORG_SLUG_MAX_LEN=${CP_ORG_SLUG_MAX_LEN}; date (8 chars) + uuid anchor (8 chars) + 2 separators = 18 chars minimum after the prefix, no room for run_id segment. Shorten the prefix literal in the SLUG= assignment." >&2 return 1 fi diff --git a/tests/e2e/test_collision_proof_slug_unit.sh b/tests/e2e/test_collision_proof_slug_unit.sh index 3f264c747..01aec80b6 100755 --- a/tests/e2e/test_collision_proof_slug_unit.sh +++ b/tests/e2e/test_collision_proof_slug_unit.sh @@ -212,6 +212,37 @@ test_e2e_pv_prefix_caps_to_32() { test_e2e_pv_prefix_caps_to_32 || failed=$((failed+1)) +# core#2839 follow-up: the concierge "creates workspace" staging E2E +# uses a 13-char literal prefix (`e2e-cncrg-mk-`). With the corrected +# helper budget (prefix_len + N + 18 <= CP_ORG_SLUG_MAX_LEN) this +# prefix leaves room for a 1-char run_id segment plus the 8-hex uuid +# anchor, keeping the full slug ≤32 chars and matching the CP regex +# ^[a-z][a-z0-9-]{2,31}$. +test_e2e_cncrg_mk_prefix_caps_to_32() { + local s + s="e2e-cncrg-mk-$(make_collision_proof_slug_suffix "20260614-498600-1" 13)" + if ! assert_collision_proof_slug "$s"; then + echo "FAIL: test_e2e_cncrg_mk_prefix_caps_to_32 — slug '$s' (len=${#s}) failed assert_collision_proof_slug" + return 1 + fi + if [ "${#s}" -gt 32 ]; then + echo "FAIL: test_e2e_cncrg_mk_prefix_caps_to_32 — slug '$s' is ${#s} chars (want <= 32 to match CP regex ^[a-z][a-z0-9-]{2,31}$)" + return 1 + fi + if ! printf '%s' "$s" | grep -q "^e2e-cncrg-mk-"; then + echo "FAIL: test_e2e_cncrg_mk_prefix_caps_to_32 — slug '$s' does not start with 'e2e-cncrg-mk-'" + return 1 + fi + if ! printf '%s' "$s" | grep -qE '^[a-z][a-z0-9-]{2,31}$'; then + echo "FAIL: test_e2e_cncrg_mk_prefix_caps_to_32 — slug '$s' does NOT match CP regex ^[a-z][a-z0-9-]{2,31}\$" + return 1 + fi + echo "PASS: test_e2e_cncrg_mk_prefix_caps_to_32 (slug=$s, len=${#s})" + return 0 +} + +test_e2e_cncrg_mk_prefix_caps_to_32 || failed=$((failed+1)) + if [ "$failed" -gt 0 ]; then echo "FAILED: $failed test(s)" exit 1 diff --git a/tests/e2e/test_staging_concierge_creates_workspace_e2e.sh b/tests/e2e/test_staging_concierge_creates_workspace_e2e.sh index c1b7ce545..9c239e4b8 100755 --- a/tests/e2e/test_staging_concierge_creates_workspace_e2e.sh +++ b/tests/e2e/test_staging_concierge_creates_workspace_e2e.sh @@ -93,11 +93,11 @@ REQUIRE_LIVE="${E2E_REQUIRE_LIVE:-0}" source "$(dirname "$0")/lib/collision-proof-slug.sh" # The workspace name we will ask the concierge to create. The literal -# `e2e-cncrg-worker-` prefix is visible to the lint (so the SLUG= +# `e2e-cncrg-w-` prefix is visible to the lint (so the SLUG= # has a covered e2e- prefix in the assignment); the uuid suffix # makes the name unique per run so a poll for it can never collide # with a sibling run's name. -WORKER_NAME="e2e-cncrg-worker-$(make_collision_proof_slug_suffix "${E2E_RUN_ID:-}" 17)" +WORKER_NAME="e2e-cncrg-w-$(make_collision_proof_slug_suffix "${E2E_RUN_ID:-}" 12)" WORKER_NAME=$(echo "$WORKER_NAME" | tr -cd 'a-zA-Z0-9-' | head -c 48) # Exported so the find_worker_by_name python subshell (run in a pipe) reads it # via os.environ — a bare shell var would not survive into the subprocess env. -- 2.52.0