Skip to main content

Module identity

Module identity 

Source
Expand description

Artifact identity (decided.core.identity), per PORT-CONTRACT.d/04 §3.

Precedence: frontmatter id -> ## ID section -> spec.id_field (dead today) -> filename-stem ^[A-Za-z]+-\d+ prefix -> whole stem. Pathlib stem semantics and Unicode \d are replicated exactly.

Functions§

artifact_identifier
artifact_identifier(product, spec, path).
artifact_identifiers
artifact_identifiers(product, spec, path): canonical first, then legacy aliases, de-duplicated case-insensitively (casefold).
first_value_list_stripped
identity’s _first_value(body): first non-empty stripped line, one leading list marker stripped, stripped again.
id_prefix
_ID_PREFIX_RE = ^[A-Za-z]+-\d+ (ASCII letters, Unicode digits) — returns the matched prefix (.group(0)) or None.
identity_conflict
identity_conflict(product, spec) -> (frontmatter_id, legacy_id).
path_stem
Path(path).stem — pathlib semantics: final component (trailing slashes and . segments dropped), minus the last suffix, where a suffix exists only when the final dot is neither at index 0 nor the last char.
strip_list_marker
Strip ONE leading well-formed Markdown list marker (^(?:[-*+]|\d+\.)\s+, Unicode \d/\s) from s, or return it as-is.