Skip to main content

Module run_ref

Module run_ref 

Source
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§

FixedRunIds
A source that hands out a fixed sequence, then refuses. Exists so tests can drive claim-time logic with identities they chose in advance.
RandomRunIds
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§

RunIdSource
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.