Skip to content

test(k8s): verify the RAG ingest CronJob schedule #4135

Closed

Description

@devops-cli-service

Split from #3949.

The issue asks for a k8s test that reads the ingest schedule from a cluster CronJob. No manifest in k8s/devops defines a CronJob that runs ai rag ingest: devops-cli and devops-cli-runner are suspended templates that never run on a schedule (k8s/devops/cronjob.yaml:1, k8s/devops/cronjob-runner.yaml:2). The test cannot be written until the change that adds the scheduled ingest lands.

Acceptance criteria:

  • The test SHALL read the spec.schedule field of the RAG ingest CronJob from the rendered k8s/devops kustomization and assert that it is a non-empty cron expression.
  • The test SHALL assert that the CronJob's container args run ai rag ingest.
  • The test MUST fail when no such CronJob exists.

Proposed design

Problem statement

The body says that no manifest in k8s/devops schedules ai rag ingest. That is out of date. The scheduled ingest exists as the Argo CronWorkflow rag-ingest (k8s/devops/cronworkflow-rag-ingest.yaml). It is listed in the kustomization and runs */3 * * * *. It holds no container. It points at the WorkflowTemplate rag-ingest through workflowTemplateRef, and that template runs devops ai rag ingest. tests/commands/k8s/test_k8s_rag_ingest_manifests.py already checks that the schedule equals */3 * * * * and that concurrencyPolicy is Forbid. It does not check these three things: the rendered schedule is a valid non-empty cron expression, the CronWorkflow's referenced template runs ai rag ingest, and the test fails when no scheduled ingest is rendered. This issue adds those checks to the existing test module.

Acceptance criteria

Requirement: Schedule is read from the rendered kustomization

The test SHALL read spec.schedule of the scheduled RAG ingest resource (CronWorkflow or CronJob) from the rendered k8s/devops kustomization and SHALL assert that it is a non-empty five-field cron expression.

Scenario: Valid schedule

  • WHEN The rendered kustomization holds the CronWorkflow rag-ingest with spec.schedule set to */3 * * * *
  • THEN The test passes and the asserted schedule is */3 * * * *

Requirement: Ingest command is checked through the template reference

The test SHALL resolve the workflowTemplateRef name of the CronWorkflow to the rendered WorkflowTemplate and SHALL assert that its container runs ai rag ingest as the args after the devops command.

Scenario: Command runs ai rag ingest

  • WHEN The WorkflowTemplate rag-ingest has container command [devops] and args [ai, rag, ingest]
  • THEN The assertion passes

Requirement: Wrong command fails

The test MUST fail when the container args of the template that the scheduled resource runs are not ai rag ingest.

Scenario: Other command

  • WHEN The helper that checks the args is called with a document whose args are [ai, rag, query]
  • THEN The helper raises an AssertionError whose message names the args

Requirement: Missing resource fails

The test MUST fail, and MUST NOT skip, when the rendered kustomization holds no CronWorkflow or CronJob that runs ai rag ingest.

Scenario: No scheduled ingest

  • WHEN The helper that selects the scheduled ingest is called with rendered documents that hold no CronWorkflow or CronJob
  • THEN The helper raises an AssertionError that says no scheduled RAG ingest resource exists

Requirement: Empty schedule fails

The test MUST fail when spec.schedule is missing, empty or not a five-field cron expression.

Scenario: Empty schedule

  • WHEN The helper that checks the schedule is called with a document whose spec.schedule is an empty string
  • THEN The helper raises an AssertionError whose message names spec.schedule

Existing Tool Considered

No alternatives check has run. kubectl kustomize renders the kustomization, and the test module already uses it (tests/commands/k8s/test_k8s_rag_ingest_manifests.py:31-40). PyYAML parses the output (tests/commands/k8s/test_k8s_rag_ingest_manifests.py:10). kubeconform checks schemas only. No existing tool asserts a cron schedule or the container args of a scheduled resource, so the change adds a few assertions and small helpers to the existing test module and needs no new dependency. The cost is about 40 lines. It needs about 8,000 tokens to build and fix, and under one hour.

Key questions

  • Does k8s/devops/cronworkflow-rag-ingest.yaml define the scheduled ingest that runs ai rag ingest, so that this test can be written now?: Yes. The CronWorkflow rag-ingest has spec.schedule: "*/3 * * * *" and concurrencyPolicy: Forbid. It references workflowTemplateRef rag-ingest. That WorkflowTemplate runs container command: [devops] with args: ["ai", "rag", "ingest"]. The kustomization lists both files. The body is out of date, and the blocker it names is gone. The test needs no dependency on another issue. [sources: k8s/devops/cronworkflow-rag-ingest.yaml:10, k8s/devops/cronworkflow-rag-ingest.yaml:13, k8s/devops/workflowtemplate-rag-ingest.yaml:40, k8s/devops/workflowtemplate-rag-ingest.yaml:41, k8s/devops/kustomization.yaml:9, k8s/devops/kustomization.yaml:10]
  • Does an existing test already cover part of this?: Partly. test_cronworkflow_schedule_follows_poll_interval pins the schedule to */3 * * * * by reading the YAML file directly. test_workflow_template_mutex_and_cronworkflow_concurrency_policy checks concurrencyPolicy. No test checks the ingest args, the link from the CronWorkflow to the template, the shape of the cron expression in the rendered output, or that the test fails when no scheduled ingest exists. The new tests cover those gaps in the same module. [sources: tests/commands/k8s/test_k8s_rag_ingest_manifests.py:109, tests/commands/k8s/test_k8s_rag_ingest_manifests.py:123]
  • Which resource kinds does the test accept as the scheduled ingest?: Accept a CronWorkflow or a CronJob that is not suspended. For a CronWorkflow, follow spec.workflowSpec.workflowTemplateRef.name to the rendered WorkflowTemplate and read the container args there. For a CronJob, read spec.jobTemplate.spec.template.spec.containers[*]. Both kinds use spec.schedule. The project has shipped the ingest as a CronWorkflow since feat(k8s): Add an Argo workflow to keep the RAG index current #1653. (best practice) [sources: k8s/devops/cronworkflow-rag-ingest.yaml:2, openspec/changes/archive/2026-11-08-1653-argo-workflow-rag-index/proposal.md:10]
    • Chosen: Accept CronWorkflow and CronJob, and follow the template reference. The test checks the behavior, a scheduled ingest, and matches the body's wording (CronJob) and the repository (CronWorkflow).
    • Rejected: Accept only CronJob. No CronJob runs the ingest, so the test would always fail.
    • Rejected: Accept only CronWorkflow. It ties the test to one kind. The CronJob path costs only a few lines.
  • How does the test get the rendered manifests?: Reuse the existing helper _rendered_devops_manifests(), which runs kubectl kustomize k8s/devops and parses the output with yaml.safe_load_all. The kustomization lists directories (crawl4ai, searxng, roadmap-service) as well as files, and the helper resolves them. The module's other tests already depend on it, so the new test adds no new requirement on the runner. (best practice) [sources: tests/commands/k8s/test_k8s_rag_ingest_manifests.py:31, k8s/devops/kustomization.yaml:11]
    • Chosen: Reuse _rendered_devops_manifests() (kubectl kustomize). It follows the project's precedent in the same module. It renders the real kustomization, including directory resources and any patches.
    • Rejected: Load the files in the resources list with a YAML loader. It duplicates the kustomization logic, must skip directory entries, and ignores patches or transformers.

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

None.

Activity

  1. added
    source/agent
    type/test
    scope/k8s
    status/new
    value/low
    effort/low
    on Nov 8, 2026
  2. devops-cli-service commented on Nov 8, 2026

    @devops-cli-service
    ContributorAuthor

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

    • Type: type/test. The test prefix of the title gives the type.
    • Scope: scope/k8s. The (k8s) scope of the title gives the scope.
    • Priority: P3-Low. The test cannot start until the change that adds the scheduled ingest lands.
    • Value: Low. The test guards a schedule and gives no direct change to users.
    • Effort: Low. One test reads the rendered kustomization and asserts two fields.
    • Related: test(k8s): Verify scheduled RAG ingest indexes each repository #3949, which asks for a different change. Both items test the scheduled RAG ingest, but #3949 verifies per-repository indexing and the candidate verifies the CronJob schedule and container args.
  3. added
    priority/p3-low
    on Nov 8, 2026
  4. devops-cli-service commented on Nov 9, 2026

    @devops-cli-service
    ContributorAuthor

    Refine cannot set this item to Ready at 6121d09. A bot opened the item, so a review of the issue and of the proposal must approve it first. The review found the defects below. A person edits the body to answer them. The next refine round looks at the item again only after a body edit.

    • false_premise at problem_statement: The plan says the scheduled ingest already exists and the blocker is gone. The issue says the test cannot be written until the change lands. Evidence: "The test cannot be written until the change that adds the scheduled ingest lands."
    • spec_delta_wrong at acceptance_criteria: The plan changes the issue's CronJob requirement to a CronWorkflow-or-CronJob requirement. The issue names a CronJob. Evidence: "The test SHALL read the spec.schedule field of the RAG ingest CronJob from the rendered k8s/devops kustomization and assert that it is a non-empty cron expression."
    • missing_path at problem_statement: The issue says the scheduled ingest does not exist yet. The plan names a manifest for it that no group creates. Evidence: "The scheduled ingest exists as the Argo CronWorkflow rag-ingest (k8s/devops/cronworkflow-rag-ingest.yaml)."
  5. added
    status/in-progress
    status/in-review
    and removed
    status/new
    status/in-progress
    on Nov 14, 2026
  6. removed
    status/in-review
    on Nov 14, 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

    effort/lowpriority/p3-lowscope/k8ssource/agenttype/testvalue/low

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions