Skip to content

keep: gate committed k8s/operator/crd.yaml against the generated CRD #14

Open

Description

@chrischeng-c4

Keep-only slice of #5. The other apps and the shared helper stay in #5.

Goal

The committed k8s/operator/crd.yaml must be the exact output of the Rust generator keep::operator::crd_yaml() (crates/keep-operator/src/lib.rs:28). Today no test compares them. The existing tests in crates/keep/tests/operator.rs check crd_yaml() alone, so the committed file can rot. When it rots, the API server prunes the missing fields (this is how spec.backup was dropped, see #5). Also, CI runs cargo test --locked --workspace without --features operator, so crates/keep/tests/operator.rs (#![cfg(feature = "operator")]) never runs in CI. Without the feature, keep k8s crd render prints the committed file itself (crates/keep/src/bin/keep.rs:836-839), so a gate without the feature compares the file with itself.

Acceptance

  • A new test in crates/keep/tests/operator.rs asserts that the committed k8s/operator/crd.yaml is byte-equal to the generator output, with the same trailing-newline handling that keep k8s crd render uses under --features operator (cli_std::artifact::ensure_trailing_newline where needed).
  • The failure message names the exact regeneration command: cargo run -p keep --features operator -- k8s crd render --out k8s/operator/crd.yaml (or the exact --out form that K8sCrdCmd::Render accepts; check it).
  • If the committed file has drift now, regenerate it in the same PR with that command, and say in the PR body which fields changed.
  • .github/workflows/keep-ci.yml "Run Keep gates" step also runs cargo test --locked -p keep --features operator --test operator, so the operator tests run in CI.
  • Negative control: with one line of k8s/operator/crd.yaml changed locally, the new test fails with the regeneration command in its message. Report this in the PR body; do not commit the change.

Never

Gate

cargo fmt --all -- --check
cargo clippy --locked --workspace --all-targets --all-features -- -D warnings
cargo test --locked -p keep --features operator --test operator
cargo test --locked --workspace

Activity

  1. chrischeng-c4 commented on Oct 23, 2026

    @chrischeng-c4
    ContributorAuthor

    issue-plan: set to priority:p3 because open PR #8 (claude/keep-5-crd-drift, mergeable) already does most of this work.

    If the work step does this issue now, it duplicates PR #8 and conflicts with it. Do it after PR #8 merges, and cut it down to the keep-ci.yml step that runs cargo test --locked -p keep --features operator --test operator (if PR #8 has not added it by then).

  2. added
    doingThe work step of the issue loop is on it
    and removed
    todoReady for the work step of the issue loop
    on Oct 23, 2026
  3. chrischeng-c4 commented on Oct 23, 2026

    @chrischeng-c4
    ContributorAuthor

    Work submitted in #16; waiting for required CI on the current head.

  4. added this to the keep@0.5.0 milestone on Oct 24, 2026
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

    doingThe work step of the issue loop is on itpriority:p3Some day

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions