Skip to content

fix(k8s): check that the example ConfigMap keys are settings #4093

Closed

Description

@dan-petty

Problem

On 2026-11-07 PR #4074 removed the ladder keys plan and review from the settings. Release 0.84.0 rolled the Service image while the live ConfigMap devops-cli-config still held them. Settings validation raised "the ladder names no step class plan, review" (_check_ladder in src/devops_cli/config/settings.py), and roadmap-service went into CrashLoopBackOff until a person applied the ConfigMap by hand. CI did not catch it.

What the code shows today:

  • The example k8s/devops/configmap.example.yaml already loads into Settings. tests/config/test_k8s_devops_runtime.py (test_config_targets_the_in_cluster_gateway_and_holds_no_credential and test_the_implement_step_runs_on_a_hosted_gateway_group_that_fits_its_window) call Settings.model_validate on it. render_devops_configmap_content in src/devops_cli/k8s/configmap.py does the same at each deploy. A branch that re-adds the key plan to the ladder of the example fails these tests now.
  • The example was correct after refactor(roadmap): remove the dead plan and review step classes #4074. The stale file was the live ConfigMap, which the cluster holds and git does not. No test of the repository can read it. Argo CD does not apply this ConfigMap, and devops k8s deploy-stack --stack devops is the only command that does (k8s/README.md, "Argo CD applies the deployment, but not ConfigMap").
  • Most models of Settings set extra="ignore". A key that a PR removes from a model, and that stays in the example, is therefore ignored without an error, and no test reports it. I walked the keys of the current example against the fields of Settings on 2026-11-07, and none is unknown, so this gap is open but has not bitten yet.

Expected

  1. A test that walks every key of the example ConfigMap (rendered by render_active_devops_configmap with fake settings) against the fields of Settings and its nested models, and fails on a key that no model declares. It also loads the rendering with Settings.model_validate.
  2. A rule in k8s/README.md (the paragraph on ConfigMap devops-cli-config, which says to run deploy-stack after a template change merges) and in docs/ROADMAP_WORKFLOW.md: a PR that removes, renames or tightens a setting that the example ConfigMap names must say, in its OpenSpec proposal and in a comment on the pull request, how the live ConfigMap changes first and in which order (apply the ConfigMap, then let the image roll). The pull request body stays as the template sets it, because it becomes the commit message.
  3. The proposal states that a test cannot read the live ConfigMap, and names the check at deploy time (deploy-stack validates the rendering before it applies it) as the part that covers the cluster.

Acceptance criteria

The test file tests/k8s/test_k8s_configmap_keys.py is new.

  • uv run pytest tests/k8s/test_k8s_configmap_keys.py::test_every_key_of_the_example_is_a_setting fails on the current code: the helper that walks the keys does not exist, so the import fails.
  • uv run pytest tests/k8s/test_k8s_configmap_keys.py::test_an_unknown_key_in_a_copy_of_the_example_is_reported fails on the current code for the same reason. The test adds roadmap.implement.not_a_setting: 1 to a copy and expects the report to name it.
  • uv run pytest tests/k8s/test_k8s_configmap_keys.py::test_an_unknown_ladder_step_class_in_a_copy_of_the_example_fails_to_load passes before and after. It adds the key plan to the ladder of a copy and expects the error "the ladder names no step class".
  • grep -n "removes, renames or tightens" docs/ROADMAP_WORKFLOW.md k8s/README.md prints one line in each file after the change; it prints none now. A test in tests/invariants/ asserts that both files hold the phrase.

Existing tool considered

Pydantic already reports a key that no field declares when a model sets extra="forbid". The ConfigMap loader could validate with a strict copy of the models, but that changes a public behavior (extra="ignore" lets old config files load). The walk over model_fields needs no new dependency. kubeconform and kubectl diff check the shape of a manifest, not the meaning of the settings inside the string devops-cli.yaml, so they do not fit.

Cost

  • Build: about 30k tokens (one walk function, three tests, two paragraphs) and about 1 hour.
  • Keep: low. The walk follows model_fields, so a new setting needs no edit.
  • Fix: the crash of 2026-11-07 stopped the roadmap Service until a person applied the ConfigMap. Each repeat costs the same.

Related

Activity

  1. added
    source/agent
    type/bug
    scope/k8s
    status/new
    value/medium
    effort/medium
    on Nov 7, 2026
  2. dan-petty commented on Nov 7, 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/bug. The fix prefix of the title gives the type.
    • Scope: scope/k8s. The (k8s) scope of the title gives the scope.
    • Priority: P2-Medium. The gap caused a CrashLoopBackOff incident but the example is correct now; this is a preventive test and doc rule, not an active break.
    • Value: Medium. It prevents a class of incidents where a removed setting key stays in the example and breaks deployment, but the example is currently valid.
    • Effort: Medium. Requires a new test file with a key-walking helper, two documentation edits, and an invariant test in tests/invariants/.
    • Related: feat(k8s): dynamically generate devops configmap from active config and gitignore #1231, which asks for a different change. Both touch k8s/devops/configmap.example.yaml and the deploy-stack mechanism, but #1231 generates the ConfigMap from active config while this candidate adds a test that validates its keys against Settings.
  3. added
    priority/p2-medium
    owner/agent
    on Nov 7, 2026
  4. removed
    status/new
    owner/agent
    on Nov 8, 2026
  5. devops-cli-service commented on Nov 8, 2026

    @devops-cli-service
    Contributor
  6. devops-cli-service commented on Nov 8, 2026

    @devops-cli-service
    Contributor

    Live since 2026-11-08 05:08 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/k8ssource/agenttype/bugvalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions