Skip to content

fix(repos): onboard reads the template answers from the repository #7309

Done

Description

@dan-petty

Problem or Motivation

devops repos onboard takes each answer of the repository template from an option or from the default of the template. It does not read the facts that the repository already holds, so a run with no option records wrong answers in .copier-answers.yml.

Read on 2026-11-26, after devops repos onboard dan-petty/devops-cli --confirm --only 0,1,2,3,4,5,6,7,8,9,10,11:

  • The template pull request ci: add the files of the repository template #7307 recorded release_type: simple and added version.txt with 0.0.0. release-please-config.json of devops-cli has "release-type": "python", and the version is in pyproject.toml. The command kept that config file ("Kept as the repository holds them") and still rendered the baseline for the simple type.
  • Each onboarded repository records scopes: '': devops-cli, dan-petty/infra (labels scope/ansible, scope/argocd, scope/helm, scope/infra, scope/k8s, scope/tf), dan-petty/devtools and dan-petty/danielpetty.com (scope/harvester, scope/infra, scope/k8s, scope/pixelfed). The command keeps .github/labels.yml of the repository, so the labels are right today. A later copier update with the empty answer would render a labels file with the scopes ci, deps and docs only.

Proposed Solution

Disposition: change the code.

  • With no --release-type, the command reads release-type of release-please-config.json of the repository, when the file is there, and uses it as the answer.
  • With no --scope, the command reads the scope/* labels of .github/labels.yml of the repository, without the scopes that the template always adds, and uses them as the answer.
  • An option that differs from the fact of the repository stops the run with one line that names the two values.
  • The plan prints each answer and its source (option, repository or default), so a person sees it before --confirm.

Proof: a test over the fake GitHub API with a release-please-config.json of the type python gives release_type: python and a baseline with no version.txt. A second test with a labels file gives the scopes answer.

Existing Tool Considered

Copier, in use: it takes each answer as data (--data). The command already reads the files of the repository through the GitHub API.

Alternatives check of 2026-11-26: in-use.
The repository already uses this tool.
Tool: copier (https://pypi.org/project/copier), MIT, last activity 2026-10-13, maintained.
Reason: Searches found no tool that derives template answers from a repository's own files; the named template engine only accepts answers as data, so the repository reading, conflict check and plan sources stay project code.

Covers:

  • Takes each template answer as data on the command line
  • Renders the template and writes the answers file
  • Updates an onboarded repository from stored answers

Lacks:

  • No read of release-type from release-please-config.json
  • No read of scope labels from .github/labels.yml
  • No refusal when an option differs from the repository
  • No plan that names the source of each answer

Proposed design

Problem statement

The onboard command records template answers that the repository denies. A python repository gets release_type: simple and a version.txt, and a repository with scope labels gets scopes: ''. Merged #7406 now derives the release type and the scopes from repository labels. Two parts remain: read the scopes from .github/labels.yml without the three template scopes, and print the source of each answer in the plan. An explicit option overrides a derived answer, as the merged spec requires.

Acceptance criteria

Requirement: Scopes from the labels file

The onboard command SHALL take the scopes answer from the scope/* labels of the repository's .github/labels.yml when the run gives no --scope option.

Scenario: A labels file that holds the template scopes and the repository scopes

  • WHEN The fake GitHub API holds a .github/labels.yml with scope/ci, scope/deps, scope/docs, scope/infra and scope/k8s, and the run gives no --scope.
  • THEN The recorded answers hold a scopes value that names infra and k8s and names no ci, deps or docs.

Requirement: Plan names the source of each answer

The onboard plan SHALL print each template answer with its source, which is the option, the repository or the default.

Scenario: A plan over a repository that holds a labels file

  • WHEN The run gives no --scope and the repository holds scope/infra in .github/labels.yml.
  • THEN The plan output shows scopes with the value infra and the source repository.

Requirement: An explicit option overrides the derived answer

The onboard command MUST use the value of an explicit --release-type or --scope option in place of the answer that the repository gives.

Scenario: An explicit release type that differs from the repository

  • WHEN The repository holds "release-type": "python" and the run gives --release-type simple.
  • THEN The recorded answers hold release_type: simple and the command exits with status 0.

Existing Tool Considered

Copier (https://pypi.org/project/copier), MIT, last activity 2026-10-13, maintained, verdict in-use: the repository already uses it. The alternatives check of 2026-11-26 in the issue body records what copier covers and lacks. The proposal keeps copier for the render and the answers file. It writes the two steps that copier lacks as project code: the read of the scope/* labels of .github/labels.yml, and the plan line of each answer. That code is about 60 lines in src/devops_cli/github/onboard/ with two tests.

Key questions

  • Which parts of the answer derivation does the merged code already hold?: Merged fix(repos): derive the template answers of an existing repository #7406 reads release-type from release-please-config.json and the scope/* labels when .copier-answers.yml is absent: derive_answers(config_text, labels) at src/devops_cli/github/onboard/baseline.py:168 and _Run.read_baseline at src/devops_cli/github/onboard/run.py:168-190. This proposal does not deliver that part again. [sources: src/devops_cli/github/onboard/baseline.py:168, src/devops_cli/github/onboard/run.py:168-190, openspec/specs/repos-onboard/spec.md:557-566]
  • Does an explicit option that differs from the repository fact stop the run?: No. The merged spec scenario Flag overrides derived answer says explicit --release-type and --scope flags MUST override derived values. The test test_render_answers_prefers_flags_over_derived_and_keeps_unflagged_derived asserts it. This proposal drops the stop that the issue body asks for, because it would break the merged spec and its test. (best practice) [sources: openspec/specs/repos-onboard/spec.md:557-566, tests/github/onboard/test_onboard_baseline.py:64]
  • Which labels form the scopes answer?: Each scope/* label of .github/labels.yml except scope/ci, scope/deps and scope/docs, which the template renders itself. (best practice) [sources: .github/labels.yml]
    • Chosen: The scope/* labels except the three template scopes. The template default answer is ci, deps and docs, so the answer holds only the repository's own scopes.
    • Rejected: All scope/* labels of the repository. A copier update would duplicate the three scopes that the template adds.
  • Does the plan print each answer with its source?: Yes. The plan prints each answer with its source: the option, the repository or the default. (best practice) [sources: AGENTS.md]
    • Chosen: Print each answer with its source. A person can check each answer before --confirm, as rule 2 of AGENTS.md asks.
    • Rejected: Print only the answers that the repository gives. A partial list hides the answers that came from the default.
    • Rejected: Print nothing extra. A person would confirm answers that no line shows.

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

None.

Activity

  1. added
    type/bug
    source/agent
    on Nov 26, 2026
  2. dan-petty commented on Nov 26, 2026

    @dan-petty
    OwnerAuthor
  3. added
    status/new
    value/medium
    effort/medium
    scope/repos
    priority/p2-medium
    on Nov 26, 2026
  4. devops-cli-service commented on Nov 26, 2026

    @devops-cli-service
    Contributor

    The result in the alternatives block of the issue body changed. Before this check: no check. A person decides what the new result means for the item.

    Searches (7)

    Tools considered:

    Searches run:

    • copier template answers from existing repository files automatically, results: 5
    • cookiecutter copier infer answers from repository state instead of prompting, results: 5
    • copier-org copier defaults from existing files, results: 5
    • copier python project template answers data file, results: 5
    • Copier documentation answers, results: 5
    • copier readthedocs .copier-answers.yml update answers, results: 5
    • scaffolding CLI detect existing config and prefill template variables, results: 5

    Sources:

  5. added
    status/ready
    and removed
    status/new
    on Nov 28, 2026
  6. devops-cli-service commented on Nov 28, 2026

    @devops-cli-service
    Contributor

    Next step: the stage job writes the plan of the item. See the section Proposed design of the body.

  7. dan-petty commented on Nov 29, 2026

    @dan-petty
    OwnerAuthor

    Returning #7309 to New because merged #7406 (commit 0b8cf5fef, PR #7638) already implemented template answer derivation for the same incident (#7307) with a directly conflicting specification for CLI flags:

    1. Already implemented by fix(repos): derive the template answers of an existing repository #7406: derive_answers(config_text, labels) (src/devops_cli/github/onboard/baseline.py:168) and _Run.read_baseline (src/devops_cli/github/onboard/run.py:168-190) already read release-type from release-please-config.json and scope/* from repository labels when .copier-answers.yml is absent.
    2. Direct conflict with merged spec: fix(repos): onboard reads the template answers from the repository #7309 specifies that giving an explicit --release-type or --scope flag that differs from the repository fact must stop with a nonzero exit status (An option that differs from the repository stops the run), whereas the merged spec from fix(repos): derive the template answers of an existing repository #7406 (openspec/specs/repos-onboard/spec.md:557-566, Scenario Flag overrides derived answer) explicitly mandates explicit --release-type and --scope flags MUST override derived values, asserted by tests/github/onboard/test_onboard_baseline.py:64 (test_render_answers_prefers_flags_over_derived_and_keeps_unflagged_derived).

    Because implementing #7309 as written would break #7406's merged specification and tests (and #7309's remaining deltas—reading .github/labels.yml while excluding scope/ci, scope/deps, scope/docs and printing plan answer sources—need reconciliation against #7406), returning with evidence per AGENTS.md rule 2.

  8. added
    status/new
    and removed
    status/ready
    on Nov 29, 2026
  9. added
    status/ready
    and removed
    status/new
    on Nov 29, 2026
  10. devops-cli-service commented on Nov 29, 2026

    @devops-cli-service
    Contributor

    Next step: the stage job writes the plan of the item. See the section Proposed design of the body.

  11. added
    owner/agent
    status/in-progress
    status/in-review
    and removed
    status/ready
    status/in-progress
    on Nov 29, 2026
  12. removed
    status/in-review
    owner/agent
    on Nov 29, 2026
  13. devops-cli-service commented on Nov 29, 2026

    @devops-cli-service
    Contributor

    Live since 2026-11-29 16:17 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/mediumpriority/p2-mediumscope/repossource/agenttype/bugvalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions