Monorepo for Aesthetic.Computer aesthetic.computer
4
fork

Configure Feed

Select the types of activity you want to include in your feed.

build-name: add 3-char hex suffix so builds never collide

The old script's header comment advertised names like "swift-otter-7a3"
but the actual code only emitted "swift-otter" with no suffix. Same
commit at a matching epoch-modulo-365 second would produce identical
names (e.g., two rebuilds of the same commit within a minute → two
"sunlit-butte" builds).

Fixes:
- Append a 3-char base-36 suffix derived from git hash bytes + current
nanoseconds. Five back-to-back runs now produce:
sunlit-prism-e83 / f95 / e94 / eb2 / f69
- Also mix git hash into the animal index so two different commits at
the same epoch second pick different animals.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

+17 -3
+17 -3
fedac/native/scripts/build-name.sh
··· 82 82 NUM_ANIMALS=${#ANIMALS[@]} 83 83 NUM_ADJ=${#ADJECTIVES[@]} 84 84 85 - # Mix git hash + epoch for a unique name every build 85 + # Mix git hash + epoch + nanoseconds for a unique name every build 86 86 GIT_HASH=$(git rev-parse HEAD 2>/dev/null || echo "0000000000000000000000000000000000000000") 87 87 EPOCH=$(date +%s) 88 + NANO=$(date +%N 2>/dev/null || echo 0) 88 89 89 90 # Adjective from git hash, animal from epoch (so same commit gets different animals) 90 91 HEX_ADJ="${GIT_HASH:0:8}" 91 92 DEC_ADJ=$(printf '%d' "0x${HEX_ADJ}" 2>/dev/null || echo 0) 92 93 ADJ_IDX=$(( DEC_ADJ % NUM_ADJ )) 93 - ANIMAL_IDX=$(( EPOCH % NUM_ANIMALS )) 94 + # Mix epoch + first 4 hex of git hash into the animal index so the same 95 + # epoch-second but different commits still pick different animals. 96 + HEX_ANIMAL="${GIT_HASH:8:4}" 97 + DEC_ANIMAL=$(printf '%d' "0x${HEX_ANIMAL}" 2>/dev/null || echo 0) 98 + ANIMAL_IDX=$(( (EPOCH + DEC_ANIMAL) % NUM_ANIMALS )) 94 99 95 - echo "${ADJECTIVES[$ADJ_IDX]}-${ANIMALS[$ANIMAL_IDX]}" 100 + # 3-char suffix to prevent name collisions across rebuilds of the same 101 + # commit or near-simultaneous builds. Combine last 3 digits of nanoseconds 102 + # with first 3 hex chars of git hash for a 5-char base-36 stamp. 103 + HEX_SUFFIX="${GIT_HASH:12:3}" 104 + NANO_TAIL="${NANO: -3}" 105 + # Compose into a 3-char base-36 suffix 106 + SUFFIX_NUM=$(( (0x${HEX_SUFFIX} + 10#${NANO_TAIL}) % 46656 )) # 36^3 107 + SUFFIX=$(printf '%03x' "$SUFFIX_NUM") 108 + 109 + echo "${ADJECTIVES[$ADJ_IDX]}-${ANIMALS[$ANIMAL_IDX]}-${SUFFIX}"