Skip to content

feat(roadmap): name each repository's resources from one RepoRef #4533

Closed
1 of 1 issue completed
Closed

Description

@dan-petty

Problem or Motivation

The roadmap Service works on 7 repositories of 1 owner. The move of Service work into Jobs, Workflows and Valkey adds many objects and keys for each repository: unit Jobs, Workflows, mutexes, Valkey keys, labels and telemetry values. Today each part builds names in its own way:

  • 7 ad hoc .split("/") calls parse owner/name.
  • is_name_segment and is_repository_name (src/devops_cli/roadmap/stores/store.py:516-527), repository_label and job_name (src/devops_cli/k8s/cluster_job.py:53-65) and _resolve_roadmap_repo_path (src/devops_cli/roadmap/run.py:322-340) each use their own rule.
  • No collision is live today, but six gaps lose the identity of the repository, and three collisions are latent (two need a repository name that no live repository has).

Without one rule, the Jobs and Workflows steps will each make their own names, and two spellings of one repository go into Valkey keys and telemetry.

Proposed Solution & Architectural Design

Add src/devops_cli/github/repo_ref.py with one value type, RepoRef. It parses owner/name one time, at the edge (settings, command options, webhook payloads). key is the casefolded owner/name; display is the GitHub spelling; id is the first 16 hex characters of sha256(key), the value of the implement-repo label today, so live labels stay valid.

Builders (one function each):

  • Label values for the owner and the repository: the casefolded part, or a cut value plus - and 8 hex of the hash when the part is not a valid label value. The pair is exact.
  • DNS slug: casefold, change runs outside [a-z0-9] to -, cut to the budget.
  • Ad hoc names (random suffix): devops-cli-<what>-<slug(name)>[-<item>]-<6 hex>, only for devops k8s run-job Jobs and the runner Job until feat(roadmap): Run implement as Argo Workflow with per-group resubmit #3105.
  • Unit names: devops-cli-<row>-<slug(name)>-<n>-<10 hex of sha256(key, n, input key)>, 63 characters or fewer. The prefix keeps each unit inside the Argo CD orphan glob devops-cli-*.
  • Mutex and ConfigMap keys: <row>-<owner>.<name>[-<n>], casefolded.
  • Valkey keys: roadmap:v1:<kind>:<owner>/<name>[:<id>] for state of one repository, roadmap:v1:<kind>[:<id>] for state of the installation, and the two SCAN MATCH patterns that find all keys of one repository.
  • The metric repo value (the key, or other for a repository outside service.repos), the OpenTelemetry VCS span attributes (vcs.provider.name, vcs.owner.name, vcs.repository.name) and the path parts of a clone.

Also in this item:

  • A label value regex in src/devops_cli/config/constants.py.
  • The service.repos check refuses a bad form and two entries with the same key. The error names service.repos.
  • is_name_segment and is_repository_name move into the module, and their callers change in the same pull request (no shim). Each other helper moves in the item that changes its consumer.
  • Correct the comment of CONST_CACHE_NAMESPACE_ROOT (constants.py:2312-2314): the root prefixes only the workstation run index, and each Valkey instance has one owner.
  • A naming ADR (next free number) owns the rules: object names, labels (one prefix roadmap.devops-cli/ with keys owner, repo, item; app.kubernetes.io/component: roadmap-<row>; app.kubernetes.io/name: devops-cli-job unchanged; implement-repo kept until no code lists by it), the annotation roadmap.devops-cli/repository with the key, OTEL_SERVICE_NAME=roadmap-<row>, Valkey key forms, mutex names, metric, log and trace values, and the cleanup of a removed repository after 7 days. Namespaces do not change. The ADR links to the ADR of the move.

Target Subsystem

SDLC, Git & PR Governance (roadmap Service: src/devops_cli/github/, src/devops_cli/config/, docs/adr/).

Existing Tool Considered

  • Kubernetes metadata.generateName: rejected for Service work. The claim record names the Job first, a dry run must show the name with no request, and a repeated create must get 409.
  • python-slugify: rejected. GitHub names are ASCII, so one re.sub does it.
  • The Helm trunc 63 | trimSuffix "-" pattern: adopted, plus a hash. hashlib.sha256: adopted.
  • kubernetes==36.0.3 has no public label value validator, so a regex is added.
  • OpenTelemetry VCS semantic conventions: adopted for span attributes.

Build: about 120 lines of code and 150 lines of Hypothesis tests. About 200,000 tokens and 2 hours to build, about 10,000 tokens a month to keep, about 40,000 tokens to fix a defect. No new runtime dependency.

Acceptance Criteria

  • Hypothesis tests: for any valid owner/name, each label value matches the label value rule; each ad hoc and unit name is a DNS label of 63 characters or fewer; the unit name is deterministic; two different key values give two different id and unit names; each mutex name is a valid ConfigMap key; the two Valkey patterns of a repository match all its keys and no key of another repository.
  • The 7 live repositories keep their name as the label value (no hash). RepoRef("o/.github") is accepted.
  • service.repos: [Owner/Repo, owner/repo] fails with an error that names service.repos.
  • No new runtime dependency.
  • The naming ADR is in docs/adr/ and holds no live digest value, hostname or private address.

Dependencies

None. "docs(roadmap): record the roadmap Service move to jobs and Valkey" links to the naming ADR; the pull request that merges second adds the link.

Source: #4517

Proposed design

Problem statement

Each roadmap part builds repository names in its own way: seven .split("/") calls parse owner/name, and four helpers use different rules. Add one RepoRef value type in src/devops_cli/github/repo_ref.py that parses owner/name once and builds labels, DNS names, Job and Workflow names, mutex keys, Valkey keys, metric values and span values from one identity. The item also adds the label value regex, the service.repos validation, the move of the two name helpers with their callers, the corrected cache-root comment and a naming ADR.

Acceptance criteria

Requirement: RepoRef identity

src/devops_cli/github/repo_ref.py SHALL hold RepoRef, which parses owner/name once and exposes key, display and id.

Scenario: Mixed-case repository parse

  • WHEN RepoRef receives Owner/Repo
  • THEN key is owner/repo, display is Owner/Repo, and id is the first 16 hex characters of sha256(owner/repo).

Requirement: Label values

RepoRef SHALL build each label value from the casefolded part, or from a cut part plus - and 8 hex of sha256.

Scenario: Valid and cut label values

  • WHEN the owner or repository part is a valid label value, or it is too long
  • THEN each label value matches the label value regex, and the owner and repository values stay exact.

Requirement: DNS slug

RepoRef SHALL build a DNS slug by casefolding the name, replacing each run outside [a-z0-9] with -, and cutting to the budget.

Scenario: Name with separators

  • WHEN the repository name is My.Repo_Name
  • THEN the slug is my-repo-name and is a DNS label of 63 characters or fewer.

Requirement: Ad hoc names

RepoRef SHALL build an ad hoc name as devops-cli-<what>-<slug(name)>[-<item>]-<6 hex> for devops k8s run-job and the runner Job until #3105.

Scenario: Ad hoc run-job name

  • WHEN an ad hoc Job is named for repository owner/My.Repo
  • THEN the name starts with devops-cli-, ends with 6 hex characters, and is a DNS label of 63 characters or fewer.

Requirement: Unit names

RepoRef SHALL build a unit name from devops-cli-<row>-<slug(name)>-<n> and 10 hex of sha256(key, n, input key), of 63 characters or fewer.

Scenario: Same unit inputs

  • WHEN the same repository, row, number and input key are named twice
  • THEN the two unit names are equal, start with devops-cli-, and are DNS labels of 63 characters or fewer.

Requirement: Identity uniqueness

Two different key values SHALL give two different id values and two different unit names.

Scenario: Two repositories

  • WHEN RepoRef parses owner/one and owner/two
  • THEN their id values differ and their unit names differ.

Requirement: Mutex keys

RepoRef SHALL build each mutex and ConfigMap key as <row>-<owner>.<name>[-<n>], casefolded.

Scenario: Mutex key

  • WHEN a mutex is named for Owner/Repo at row refine and number 2
  • THEN the key is refine-owner.repo-2 and is a valid ConfigMap key.

Requirement: Valkey keys

RepoRef SHALL build Valkey keys as roadmap:v1:<kind>:<owner>/<name>[:<id>], installation keys as roadmap:v1:<kind>[:<id>], and the two SCAN MATCH patterns roadmap:v1:*:<owner>/<name> and roadmap:v1:*:<owner>/<name>:*.

Scenario: Repository key scan

  • WHEN the two repository SCAN MATCH patterns scan the keys of owner/repo
  • THEN they match all its keys and no key of another repository.

Requirement: Metric value

RepoRef SHALL set the metric repo value to key, or to other for a repository outside service.repos.

Scenario: Metric label for a listed and an unlisted repository

  • WHEN a metric is recorded for Owner/Repo inside service.repos and for one outside it
  • THEN the first repo label is owner/repo and the second is other.

Requirement: Span and clone values

RepoRef SHALL set the OpenTelemetry VCS span attributes and the clone path parts from the repository identity.

Scenario: Span and clone values

  • WHEN a span and a clone path are built for Owner/Repo
  • THEN vcs.provider.name is github, vcs.owner.name is Owner, vcs.repository.name is Repo, and the path parts are Owner and Repo.

Requirement: Label value regex

src/devops_cli/config/constants.py SHALL hold a regex for a valid label value.

Scenario: Label value regex

  • WHEN the regex is applied to a leading - value and to a valid casefolded name
  • THEN it rejects the leading - value and matches the valid name.

Requirement: service.repos validation

The service.repos check SHALL refuse a bad form and two entries with the same key, and its error SHALL name service.repos.

Scenario: Duplicate entries differ by case

  • WHEN service.repos holds [Owner/Repo, owner/repo]
  • THEN the check fails with an error that names service.repos.

Requirement: Helper move

is_name_segment and is_repository_name SHALL move into src/devops_cli/github/repo_ref.py, and every caller SHALL change in the same pull request with no shim.

Scenario: Callers import the helpers from the new module

  • WHEN the pull request is applied
  • THEN src/devops_cli/roadmap/stores/store.py defines neither helper and exports neither in __all__, and src/devops_cli/roadmap/alternatives.py and src/devops_cli/roadmap/stores/github_store.py import the helpers from the new module.

Requirement: Constant comment

The comment of CONST_CACHE_NAMESPACE_ROOT SHALL state that the root prefixes only the workstation run index and that each Valkey instance has one owner.

Scenario: Constant comment

  • WHEN the constant is read
  • THEN its comment names the workstation run index and states one owner per Valkey instance, with no shared multi-tenant Valkey claim.

Requirement: Naming ADR

A naming ADR SHALL be in docs/adr/ at the next free number and SHALL own the naming rules of the item.

Scenario: ADR contents

  • WHEN the ADR is read
  • THEN it holds object names, labels, the annotation, OTEL_SERVICE_NAME, Valkey forms, mutex names, metric, log and trace values, and the 7-day cleanup, and it links to the Service move ADR.

Requirement: ADR safety

The naming ADR MUST hold no live digest value, hostname or private address.

Scenario: ADR has no live secrets

  • WHEN the ADR is checked
  • THEN it holds no live digest value, hostname or private address.

Requirement: Hypothesis name tests

Hypothesis tests SHALL check label values, ad hoc names, unit names and uniqueness for any valid owner/name.

Scenario: Name property tests run offline

  • WHEN the test suite runs
  • THEN each label value matches the rule, each ad hoc and unit name is a DNS label of 63 characters or fewer, the unit name is deterministic, and different keys give different ids and unit names.

Requirement: Hypothesis key tests

Hypothesis tests SHALL check mutex keys and Valkey patterns for any valid owner/name.

Scenario: Key property tests run offline

  • WHEN the test suite runs
  • THEN each mutex name is a valid ConfigMap key, and the two Valkey patterns match all keys of one repository and no key of another.

Requirement: Live names and .github

The label value builder SHALL keep the casefolded owner and repository part with no hash when the part is a valid label value, so the 7 live repositories keep their label values, and RepoRef SHALL accept o/.github.

Scenario: Valid part and .github

  • WHEN RepoRef parses Owner/Repo and o/.github
  • THEN the owner and repository label values are owner and repo with no hash, and the .github parse succeeds.

Requirement: No runtime dependency

The change SHALL add no new runtime dependency.

Scenario: Dependency files

  • WHEN the change is applied
  • THEN pyproject.toml and uv.lock add no runtime dependency.

Existing Tool Considered

No alternatives check has run. No open, maintained tool or library covers the exact need. python-slugify is open and maintained but covers a DNS slug only and adds a runtime dependency; the archived stage design already rejected it for ten lines of standard library (openspec/changes/archive/2026-10-29-2654-roadmap-stage/design.md:29). Kubernetes metadata.generateName is server-side only: the claim record names the Job first, a dry run must show the name with no request, and a repeated create must get 409, so it cannot serve. kubernetes==36.0.3 has no public label value validator, so the change adds the label value regex. The Helm trunc 63 | trimSuffix "-" pattern and hashlib.sha256 are adopted. Build cost is about 120 lines of code and 150 lines of Hypothesis tests: about 200,000 tokens and 2 hours to build, about 10,000 tokens a month to keep, and about 40,000 tokens to fix a defect. No new runtime dependency is needed.

Key questions

  • Should one RepoRef value type replace the per-caller repository name rules?: Yes. Parse owner/name once at the edge and build each name from RepoRef. (best practice) [sources: src/devops_cli/roadmap/stores/store.py:520-531, src/devops_cli/k8s/cluster_job.py:54-65, src/devops_cli/roadmap/run.py:324-342]
    • Rejected: Keep each helper and add RepoRef beside them. Seven split calls and four rule sets would remain, so two spellings could reach Valkey and telemetry.
    • Chosen: Add one RepoRef value type with builders. One key, display and id serve labels, DNS names, keys, metrics and spans.
  • Which value identifies a repository for labels and hashes?: The casefolded owner/name is key. id is the first 16 hex characters of sha256(key), which is the value of the implement-repo label today, so live labels stay valid. (best practice) [sources: src/devops_cli/k8s/cluster_job.py:60-65]
    • Rejected: Use the GitHub spelling as the key. Case changes would create two identities and two label values.
    • Chosen: Use the casefolded key with sha256 first 16 hex. It keeps the live implement-repo label value valid.
    • Rejected: Use the full sha256 digest. It is too long for a label value and an opaque name part.
  • How should a label value be built when an owner or repository part is not a valid label value?: Use the casefolded part when it is valid. Otherwise cut it and append - and 8 hex of sha256, so the pair stays exact and a valid live part keeps no hash. (best practice) [sources: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/, src/devops_cli/k8s/cluster_job.py:60-65]
    • Rejected: Hash every part. It changes the 7 live label values.
    • Rejected: Use python-slugify. It adds a runtime dependency for ASCII GitHub names.
    • Chosen: Use the casefolded part, or a cut part plus 8 hex. It keeps live values and makes the pair exact.
  • How should a DNS name be built?: Casefold the name, replace each run outside [a-z0-9] with -, and cut to the budget; hashlib.sha256 supplies the hex that keeps the name unique. (best practice) [sources: src/devops_cli/core/dns_names.py:133, src/devops_cli/k8s/cluster_job.py:54-57]
    • Rejected: Use python-slugify. It adds a dependency and GitHub names are ASCII.
    • Chosen: Use one re.sub and a cut. It is small, deterministic and stays inside the DNS label budget.
    • Rejected: Use Kubernetes metadata.generateName. It gives no dry-run name and no deterministic name.
  • Should unit names be deterministic and ad hoc names random?: Unit names are deterministic from key, row, number and input key. Ad hoc run-job and runner Job names use a random 6 hex suffix until feat(roadmap): Run implement as Argo Workflow with per-group resubmit #3105. (best practice) [sources: src/devops_cli/k8s/cluster_job.py:54-65]
    • Rejected: Make every name deterministic. Repeated ad hoc Jobs would collide.
    • Rejected: Make every name random. A unit name must repeat for the same unit.
    • Chosen: Use deterministic unit names and random ad hoc names. Each use gets the property it needs.
  • What form should mutex and ConfigMap keys take?: Use <row>-<owner>.<name>[-<n>], casefolded. (best practice) [sources: k8s/devops/workflowtemplate-rag-ingest.yaml:12, docs/adr/0008-argo-workflows-run-the-roadmap-jobs-after-a-measured-go.md:3]
    • Rejected: Use a DNS slug. It loses the exact owner and repository pair.
    • Rejected: Use a label value pair. A label value pair is not a ConfigMap key.
    • Chosen: Use row plus the dotted key. It is a valid ConfigMap key and names the repository.
  • What form should Valkey keys and scan patterns take?: Use roadmap:v1:<kind>:<owner>/<name>[:<id>] for one repository and roadmap:v1:<kind>[:<id>] for the installation. The two patterns roadmap:v1:*:<owner>/<name> and roadmap:v1:*:<owner>/<name>:* find every key of one repository and no key of another. (best practice) [sources: src/devops_cli/ai/run_store.py:39, src/devops_cli/config/constants.py:2321-2324]
    • Rejected: Keep the devops-cli root. That root prefixes only the workstation run index, not Service state.
    • Rejected: Use the repository id only. An operator cannot read the repository from the key.
    • Chosen: Use roadmap:v1 with the key and an optional id. The key is readable and the two scan patterns find one repository.
  • Should the metric and OpenTelemetry values use key or display?: The metric repo value is key, or other outside service.repos. OpenTelemetry VCS attributes use the GitHub spelling in display. (best practice) [sources: https://opentelemetry.io/docs/specs/semconv/registry/attributes/vcs/, docs/TELEMETRY.md:94]
    • Rejected: Use display for the metric. Case changes would split one repository into two series.
    • Rejected: Use id for the metric. An opaque digest is hard to read in a metric.
    • Chosen: Use key for the metric and display for spans. The metric stays stable and the span shows the GitHub spelling.
  • Should is_name_segment and is_repository_name move now, and should other helpers move now?: Move both now with every caller and no shim: src/devops_cli/roadmap/alternatives.py imports both, and src/devops_cli/roadmap/stores/github_store.py imports is_repository_name. Move each other helper in the item that changes its consumer. (best practice) [sources: src/devops_cli/roadmap/stores/store.py:520-531, src/devops_cli/roadmap/stores/store.py:1169-1170, src/devops_cli/roadmap/alternatives.py:131-132, src/devops_cli/roadmap/stores/github_store.py:83]
    • Rejected: Move every helper now. The item would change consumers that another item owns.
    • Rejected: Keep a re-export shim. Two rules would remain in the tree.
    • Chosen: Move the two helpers with their callers. The item removes the duplicate rule and keeps its scope.
  • Where should the naming rules live?: In a new naming ADR under docs/adr/, at the next free number (0021 when this change starts). It links to the ADR of the Service move. (best practice) [sources: AGENTS.md:39, docs/adr/0016-labels-hold-the-roadmap-items-fields.md:1, docs/adr/0020-a-decision-point-is-a-unit-of-a-workflow-with-a-resolver-chain-and-a-rule-goes-before-a-decision-model.md:1]
    • Rejected: Put the rules in code comments. A comment is not a decision record.
    • Rejected: Extend ADR 0016. ADR 0016 owns the roadmap fields, not resource names.
    • Chosen: Add a naming ADR at the next free number. AGENTS.md sends the reason for a decision to docs/adr/, and the naming rules are a new decision.
  • Should RepoRef("o/.github") be accepted even though the path resolver rejects a leading dot?: Yes. RepoRef accepts .github as a name segment. The leading-dot rule stays only in _resolve_roadmap_repo_path. (best practice) [sources: src/devops_cli/roadmap/stores/store.py:520-531, src/devops_cli/roadmap/run.py:336]
    • Rejected: Reject .github in RepoRef. GitHub has a real repository named .github.
    • Chosen: Keep the leading-dot rule in the path resolver only. The identity rule accepts the name and the path rule still guards a path.
  • Where should the service.repos duplicate check run?: In the service.repos validation of ServiceConfig, so every load and command sees one check. (best practice) [sources: src/devops_cli/config/settings.py:1223, src/devops_cli/config/settings.py:1243]
    • Rejected: Check only inside RepoRef. RepoRef sees one value, not the list.
    • Rejected: Check only at Service startup. A bad config would pass other commands.
    • Chosen: Check in service settings validation. One validation path covers every consumer.
  • What is the next free ADR number?: 0021. docs/adr/ holds 0001 through 0020; a merge that takes 0021 first moves the naming ADR to the next free number. [sources: docs/adr/0020-a-decision-point-is-a-unit-of-a-workflow-with-a-resolver-chain-and-a-rule-goes-before-a-decision-model.md, docs/adr/0001-github-is-the-roadmap-source.md]
  • Which modules call the two name helpers today?: src/devops_cli/roadmap/alternatives.py imports both and calls is_name_segment and is_repository_name; src/devops_cli/roadmap/stores/github_store.py imports and calls is_repository_name. src/devops_cli/roadmap/stores/store.py defines both and exports them in __all__. [sources: src/devops_cli/roadmap/alternatives.py:131-132, src/devops_cli/roadmap/alternatives.py:349, src/devops_cli/roadmap/alternatives.py:399, src/devops_cli/roadmap/stores/github_store.py:83, src/devops_cli/roadmap/stores/github_store.py:1037, src/devops_cli/roadmap/stores/store.py:520-531, src/devops_cli/roadmap/stores/store.py:1169-1170]
  • Should the change add a runtime dependency for slugging or hashing?: No. Use re and hashlib from the standard library; the archived stage design already rejected python-slugify for the same reason. (best practice) [sources: pyproject.toml, openspec/changes/archive/2026-10-29-2654-roadmap-stage/design.md:29, src/devops_cli/k8s/cluster_job.py:65]
    • Rejected: Add python-slugify. GitHub names are ASCII and the dependency is not needed.
    • Chosen: Use the standard library. re.sub and hashlib.sha256 cover the need.

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

None.

Sub-issues

Sub-issues

1 of 1 Issues completed
Loading 1 sub-issues

Activity

  1. added
    source/agent
    on Nov 11, 2026
  2. added
    type/feature
    scope/roadmap
    status/new
    value/high
    effort/high
    on Nov 11, 2026
  3. dan-petty commented on Nov 11, 2026

    @dan-petty
    OwnerAuthor

    Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.

    • Type: type/feature. The feat prefix of the title gives the type.
    • Scope: scope/roadmap. The (roadmap) scope of the title gives the scope.
    • Priority: P2-Medium. No live collision exists today, but six gaps and three latent collisions will break as Jobs and Workflows multiply.
    • Value: High. One rule replaces seven ad hoc parsers and prevents identity loss across labels, Valkey keys, metrics, and telemetry.
    • Effort: High. It adds a new module, rewrites builders for six naming contexts, moves helpers, updates callers, and writes an ADR.
    • Related: feat(roadmap): onboard checks and starts the rag ingestion #3771, which asks for a different change. Both derive a name from repository identity, but #3771 names a RAG project while the candidate centralises all label, Valkey, mutex, and metric names in one RepoRef module.
  4. added
    priority/p2-medium
    on Nov 11, 2026
  5. added
    status/ready
    and removed
    status/new
    on Nov 11, 2026
  6. devops-cli-service commented on Nov 11, 2026

    @devops-cli-service
    Contributor

    Status set to Ready at 5f75d25 (see proposed design in issue body).

  7. added
    owner/agent
    on Nov 11, 2026
  8. added
    status/in-progress
    and removed
    status/ready
    on Nov 11, 2026
  9. removed
    status/in-progress
    owner/agent
    on Nov 11, 2026
  10. devops-cli-service commented on Nov 11, 2026

    @devops-cli-service
    Contributor

    Live since 2026-11-11 14:13 UTC

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    effort/highpriority/p2-mediumscope/roadmapsource/agenttype/featurevalue/high

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions