Expand description
Run identity: minted internal ids, ticket-derived aliases, and the shapes a run reference can take.
A run has two names. The internal id is 128 random bits in lowercase hex;
it is what the store joins on and what names directories on disk. The alias
is <ticket-id>-r<attempt>, derived from two columns that are frozen at
claim time, and it is the only name humans are shown. Nothing here reads the
clock or the store: minting is a trait so the effect stays at the boundary,
and every other function is a pure string judgement.
Structs§
- Fixed
RunIds - A source that hands out a fixed sequence, then refuses. Exists so tests can drive claim-time logic with identities they chose in advance.
- Random
RunIds - The production source: 128 bits straight from the kernel.
Constants§
- ACCEPTED_
RUN_ REFERENCES - The accepted forms, named in every unresolvable-reference error so a dead end carries its own remedy.
- MIN_
PREFIX_ LEN - The shortest prefix accepted as a reference. Below this a prefix says so little that the ambiguity error would be the only likely outcome.
- RUN_
ID_ HEX_ LEN - Internal run ids are 128 bits rendered as lowercase hex.
- SHORT_
RUN_ ID_ LEN - How much of an internal id is shown wherever one surfaces at all, matching Git’s short-object convention.
Traits§
- RunId
Source - Mints internal run ids. Implemented over the operating system CSPRNG in production and over a fixed sequence in tests, so claim-time logic can be exercised with predictable identities.
Functions§
- alias
- The human-facing name of a run. Both components are frozen at claim, so the alias never changes for the life of the run.
- as_
id_ prefix - Whether a reference could name internal ids by prefix. Ticket and project
ids always carry a
-, so they can never be mistaken for one. - parse_
alias - Splits an alias back into the ticket id and attempt it was built from.
Ticket ids may contain
-, so the split is taken from the right. - short
- The displayed form of an internal id. Legacy
R<n>ids are shorter than the window and pass through whole.