seed: built-in value sets for conventional enum-ish columns (priority, status, …) #34
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
seeddeliberately does not guess values for choice-like ("enum-ish")column names —
status,role,type,priority, … — because there is"no sensible generic value" (ADR-0048 D12). They fall to generic lorem
text and trigger the post-seed advisory (D13).
For a few of those names, though, there is a near-canonical small value
set. Filling
prioritywithlow/medium/highreads far better thaneveniet consequatur consequuntur, and it is what a learner expects. Thisissue proposes built-in value sets for the names where the set is genuinely
conventional, keeping D12's "don't guess" stance for the rest.
Mechanism
A name → default value-set table (a
Generator::PickFrom-style list), keyedby token and type-gated, slotted into the D7 heuristics
(
src/seed/heuristics.rs) ahead of the enum-ish fallthrough. It reuses theexisting
PickFromgenerator, so there is no new generation machinery — onlya curated lookup. Reproducible via the existing
--seedRNG.Proposed names (confirmed scope, 2026-06-12)
priority,priotextlow,medium,highpriority,prioint1,2,3(low→high)severitytextlow,medium,high,criticalseverityint1,2,3,4(low→critical)rating,starsint1–5statustextstatusis the awkward one: its real values are highly domain-specific(
active/inactive,open/closed/pending,draft/published, …). Options:(a) a neutral default like
active/inactive; (b) leavestatusto the advisory (it already names a good repair). Leaning (a) with a short,
clearly-generic set, but flagging for a decision.
statusistextonly(no sensible int mapping);
stateis excluded — it already maps to a USstate-name generator, and overloading it would be ambiguous.
Considered and skipped (2026-06-12)
Other names with a fairly canonical small set were considered and left out
of scope for this issue:
size—small/medium/large— skipped.tier,plan—free/basic/premium— too app-specific, skipped.Deliberately not proposed (too domain-specific — keep the D12 advisory):
type,kind,category,state,stage.genderis excluded onsensitivity grounds unless explicitly requested.
Interaction with the advisory (D13)
Any name that gains a built-in set must be removed from the enum-ish
advisory trigger for that name (it is no longer "filled generically"), so
the advisory keeps pointing only at the names seed still can't guess.
Refs
ADR-0048 D7 (name heuristics) / D9 (named-generator vocabulary) / D12–D13
(enum-ish handling + advisory). Sibling of #33 (year-like int columns), but a
distinct mechanism (fixed pick-list vs bounded numeric range).
Website cross-reference (cast re-record + visual check).
The website docs already ship a
seedcast that exercises aticketstablewith
priorityandstatuscolumns:website/casts-src/casts.mjs(theseedcast)website/public/casts/seed.castReference → Generating sample data(
website/src/content/docs/reference/generating-sample-data.mdx)It's authored as if this issue is already done — a plain
seed tickets 8 set status in (...)withpriorityleft to auto-generation.Until the value sets land, a fresh recording fills
prioritywith loremplaceholder text, which makes the rendered table wrap by a few characters.
When you implement this: re-record the cast (
cd website && pnpm casts seed,needs a
../target/debugbinary) and visually check that theticketstable tightens to fit once
prioritycollapses to a short value(
low/medium/high). Likely redundant — casts get a full re-record sweepbefore publication anyway — but flagging it here so it isn't missed.
Regarding
status- after consideration I think we should skip it. Users will need to specify their own values here for seeding.Fixed in
deb0948.Added a type-gated
PickFromlookup to the D7 catalogue (src/seed/heuristics.rs), placed ahead of the enum-ish fallthrough and reusing the existing generator (no new machinery):priority/priolow/medium/high1/2/3severitylow/medium/high/critical1/2/3/4rating/stars1–5A user-declared
IN-CHECK still wins (resolved before the heuristics).prioritywas removed fromENUM_TOKENS; since the D13 advisory only fires onGenerator::Generic, aPickFromname is excluded either way, but the removal keepsis_enum_ishsemantically "names seed still can't guess".statusis excluded, per your decision on this issue (2026-06-12) — its real values are too domain-specific, so it keeps the D12 "don't guess" stance: generic text + the advisory pointing atset status in (...).Tests: heuristic-selection unit tests (each set, type-gate, CHECK-wins,
status-stays-generic), plus two integration tests — a whole-row seed asserting set membership, and a column-fill (seed Tasks.priority) test that also closes a pre-existing integration gap on that path.Website note: the
seedcast (tickets table withpriority) lives on thewebsitebranch; re-recording so the table tightens onceprioritycollapses to a short value is tracked there (likely subsumed by the pre-publication cast sweep).Decision recorded in ADR-0048 Amendment 1. Full suite green (2433 pass, 1 ignored).