feat(tera): add haiku() function for random name generation#7399
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds a new random_name() Tera template function that generates random, human-readable identifiers in the format adjective-noun-number (e.g., flying-rabbit-23). This is useful for creating unique session IDs, temporary names, or test data.
Key Changes:
- Implements
random_name()function with 64 adjectives and 64 nouns, generating numbers from 1-99 - Adds test coverage verifying the output format (3 dash-separated parts with parseable number)
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
src/tera.rs
Outdated
| "water", | ||
| "wildflower", | ||
| "wave", | ||
| "water", |
There was a problem hiding this comment.
Duplicate entry: 'water' appears twice in the NOUNS array (lines 214 and 217). Remove one occurrence to maintain the claimed count of 64 unique nouns.
src/tera.rs
Outdated
| "wave", | ||
| "water", | ||
| "resonance", | ||
| "sun", |
There was a problem hiding this comment.
Duplicate entry: 'sun' appears twice in the NOUNS array (lines 187 and 219). Remove one occurrence to maintain the claimed count of 64 unique nouns.
src/tera.rs
Outdated
| let mut rng = rand::rng(); | ||
| let adj = ADJECTIVES.choose(&mut rng).unwrap(); | ||
| let noun = NOUNS.choose(&mut rng).unwrap(); |
There was a problem hiding this comment.
The ADJECTIVES and NOUNS arrays are recreated on every function call. Consider moving these const arrays outside the closure to avoid repeated allocations and improve performance when this function is called frequently.
src/tera.rs
Outdated
| let mut rng = rand::rng(); | ||
| let adj = ADJECTIVES.choose(&mut rng).unwrap(); | ||
| let noun = NOUNS.choose(&mut rng).unwrap(); | ||
| let num: u32 = rng.random_range(1..100); |
There was a problem hiding this comment.
The range 1..100 generates numbers from 1-99, but the PR description claims this gives ~400k unique combinations. With the current implementation: 64 adjectives × 64 nouns × 99 numbers = ~406k combinations. However, due to the duplicate entries in NOUNS, the actual count is lower. Update either the word lists or the documentation to be accurate.
eafcc04 to
752ec9b
Compare
Hyperfine Performance
|
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
mise-2025.12.12 x -- echo |
15.8 ± 0.5 | 14.8 | 19.6 | 1.00 |
mise x -- echo |
16.3 ± 0.5 | 15.2 | 17.8 | 1.04 ± 0.04 |
mise env
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
mise-2025.12.12 env |
15.3 ± 0.3 | 14.3 | 16.8 | 1.00 |
mise env |
15.9 ± 0.6 | 14.8 | 20.6 | 1.04 ± 0.04 |
mise hook-env
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
mise-2025.12.12 hook-env |
15.7 ± 0.5 | 14.7 | 20.4 | 1.00 |
mise hook-env |
16.1 ± 0.4 | 15.0 | 17.4 | 1.02 ± 0.04 |
mise ls
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
mise-2025.12.12 ls |
14.3 ± 0.4 | 13.4 | 15.7 | 1.00 |
mise ls |
14.8 ± 0.4 | 13.7 | 16.3 | 1.04 ± 0.04 |
xtasks/test/perf
| Command | mise-2025.12.12 | mise | Variance |
|---|---|---|---|
| install (cached) | 82ms | 82ms | +0% |
| ls (cached) | 54ms | 54ms | +0% |
| bin-paths (cached) | 57ms | 57ms | +0% |
| task-ls (cached) | 228ms | 230ms | +0% |
Generates random names like "silent-forest-42". Configurable options:
- words: number of words (default 2)
- separator: string between parts (default "-")
- number: include trailing number (default true)
- number_max: max number value (default 99)
Examples:
{{ haiku() }} -> "ancient-moon-73"
{{ haiku(words=3) }} -> "cold-river-wild-15"
{{ haiku(number=false) }} -> "hidden-butterfly"
{{ haiku(separator="_", number_max=999) }} -> "misty_dawn_847"
Word lists inspired by https://github.com/nishanths/rust-haikunator
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Update to xx 2.3.0 which includes the haiku module - Replace inline word lists and logic with xx::rand::haiku - Change API from number/number_max to digits parameter 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
f2d3b31 to
4a62b3e
Compare
* upstream/renovate/lockfile-maintenance: chore(deps): lock file maintenance fix(ci): improve GHA cache efficiency and fix registry-ci bug (jdx#7404) feat(tera): add haiku() function for random name generation (jdx#7399) feat: implement independent versioning for subcrates (jdx#7402) docs: add comprehensive glossary (jdx#7401) docs: improve installation documentation (jdx#7403) test: add token pool integration for rate limit distribution (jdx#7397) docs: add link to COPR package page for Fedora/RHEL test: rename duplicate 'ci' job names for clarity (jdx#7398) registry: add github backend for swiftformat (jdx#7396) chore: rename mise-tools to mise-versions chore: release 2025.12.12 (jdx#7386) fix(github): use version_prefix when fetching release for SLSA verification (jdx#7391) refactor(vfox): remove submodules, embed plugins directly (jdx#7389) test(registry): add final ci job as merge gate (jdx#7390) test: split unit job to speed up macOS CI (jdx#7388) feat(backend): add security features to github backend (jdx#7387)
### 🚀 Features - **(tera)** add haiku() function for random name generation by @jdx in [#7399](#7399) - implement independent versioning for subcrates by @jdx in [#7402](#7402) ### 🐛 Bug Fixes - **(ci)** improve GHA cache efficiency and fix registry-ci bug by @jdx in [#7404](#7404) - **(ci)** use !cancelled() instead of always() for registry-ci by @jdx in [#7435](#7435) - **(test)** update backend_arg test to use clojure instead of poetry by @jdx in [#7436](#7436) ### 📚 Documentation - add link to COPR package page for Fedora/RHEL by @jdx in [bc8ac73](bc8ac73) - improve installation documentation by @jdx in [#7403](#7403) - add comprehensive glossary by @jdx in [#7401](#7401) ### 🧪 Testing - rename duplicate 'ci' job names for clarity by @jdx in [#7398](#7398) - add token pool integration for rate limit distribution by @jdx in [#7397](#7397) ### 📦 Registry - add github backend for swiftformat by @jdx in [#7396](#7396) - use pipx backend for azure-cli by @jdx in [#7406](#7406) - use pipx backend for dvc by @jdx in [#7413](#7413) - add github backend for zprint by @jdx in [#7410](#7410) - use gem backend for cocoapods by @jdx in [#7411](#7411) - use pipx backend for gallery-dl by @jdx in [#7409](#7409) - add aqua backends for HashiCorp tools by @jdx in [#7408](#7408) - use npm backend for danger-js by @jdx in [#7407](#7407) - use pipx backend for pipenv by @jdx in [#7415](#7415) - use pipx backend for poetry by @jdx in [#7416](#7416) - add github backend for xcodegen ([github:yonaskolb/XcodeGen](https://github.com/yonaskolb/XcodeGen)) by @jdx in [#7417](#7417) - use npm backend for heroku by @jdx in [#7418](#7418) - add aqua backend for setup-envtest by @jdx in [#7421](#7421) - add github backend for xcresultparser ([github:a7ex/xcresultparser](https://github.com/a7ex/xcresultparser)) by @jdx in [#7422](#7422) - add aqua backend for tomcat by @jdx in [#7423](#7423) - use npm backend for serverless by @jdx in [#7424](#7424) - add github backend for daytona ([github:daytonaio/daytona](https://github.com/daytonaio/daytona)) by @jdx in [#7412](#7412) - add github backend for flyway ([github:flyway/flyway](https://github.com/flyway/flyway)) by @jdx in [#7414](#7414) - add github backend for schemacrawler ([github:schemacrawler/SchemaCrawler](https://github.com/schemacrawler/SchemaCrawler)) by @jdx in [#7419](#7419) - add github backend for codeql by @jdx in [#7420](#7420) - use pipx backend for mitmproxy by @jdx in [#7425](#7425) - use pipx backend for sshuttle by @jdx in [#7426](#7426) - add github backend for quarkus by @jdx in [#7428](#7428) - add github backend for smithy by @jdx in [#7430](#7430) - add github backend for xchtmlreport ([github:XCTestHTMLReport/XCTestHTMLReport](https://github.com/XCTestHTMLReport/XCTestHTMLReport)) by @jdx in [#7431](#7431) - add github backend for grails by @jdx in [#7429](#7429) - use npm backend for esy by @jdx in [#7434](#7434) - add github backend for micronaut by @jdx in [#7433](#7433) - add github backend for dome by @jdx in [#7432](#7432) - use vfox backend for poetry by @jdx in [#7438](#7438) ### Chore - **(docker)** add Node LTS to mise Docker image by @jdx in [#7405](#7405) - rename mise-tools to mise-versions by @jdx in [ab3e1b8](ab3e1b8) - s/mise task/mise tasks/g in docs and tests by @muzimuzhi in [#7400](#7400) ### New Contributors - @muzimuzhi made their first contribution in [#7400](#7400)
Summary
Adds a new Tera template function
haiku()that generates random names likesilent-forest-42.Options:
wordsseparator-numbernumber_maxExamples:
Use cases:
Word lists inspired by https://github.com/nishanths/rust-haikunator
🤖 Generated with Claude Code
Note
Introduce
haiku()Tera function for human-readable random names with tests; update key dependencies (e.g.,xx2.3.0,zip6.0.0) and allowCC0-1.0license.haiku()function with optionswords,separator, anddigitsusingxx::rand::haiku.test_haikucovering defaults and custom options.xxto2.3.0; updatezipto6.0.0(addsppmd-rust,lzma-rust2 0.13.0, etc.).windows-sysdowngrades across crates,base64foroauth2).CC0-1.0todeny.tomlallowed licenses.Written by Cursor Bugbot for commit 4a62b3e. This will update automatically on new commits. Configure here.