Skip to content

fix(nb-41478): make shipped templates pass Validate, and check it in CI - #17

Open
Kankshit-02 wants to merge 1 commit into
mainfrom
fix/nb-41478-templates-pass-validate
Open

Kankshit-02 wants to merge 1 commit into
mainfrom
fix/nb-41478-templates-pass-validate

Conversation

@Kankshit-02

Copy link
Copy Markdown
Contributor

Description

Five pre-built templates failed Validate right after Use Template, with no edits. They now pass, and CI fails any template that is missing a required step value or uses a templated schedule. K8s Right-Sizing also stopped resizing the workload before approval.

Fixes nudgebee/nudgebee-enterprise#41478

Type of change

  • Bug fix
  • New feature
  • Breaking change

How Has This Been Tested?

  1. CI "Validate templates against schema" and "Run unit tests" are green. Delete integration_id from any ArgoCD step, or put {{ Inputs.x }} in a cron, and CI fails naming the template and step.
  2. After merge and the next template sync, on test: Use Template on ArgoCD Sync with Validation, SSL Certificate Monitor, Multi-Endpoint Health Check and K8s Right-Sizing with Approval. Fill the form, click Validate: "Automation validation succeeded" for each.
  3. K8s Right-Sizing: the form asks for Direction (down / up). Run it and reject in Slack: the workload's resources are unchanged. Approve: CPU and memory move 20% in the chosen direction.

Risks

Engineering detail: how each fix was checked against the engine
Check How
Required params table Dumped from tasks.NewInitializedTaskRegistry(): properties with Required and no Default (the engine fills defaults before its required check)
Templates pass the engine Ran model.ValidateWorkflow, ValidateDAG, ValidateTemplateSyntax, ValidateUnrenderedInputs and each task/hook InputSchema().Validate on all 51 files. Only remaining error: webhook integration_name, filled by the form
Transform scripts Rendered input with workflow.NewTemplateContext and ran data.TransformTask with sample inputs, including skipped checks (empty statuses)
Cron check Mirrors model.ValidateCronExpression: strips CRON_TZ=/TZ=, accepts 5 fields or @descriptor, rejects {{ }}
Right-sizing apply k8s.vertical_rightsize with only direction patches nothing (no cpu/memory rules), so change_pct: 20 is set on both

Fresh-context review found 4 issues in validate.py: a required-with-default false positive (k8s.pv_rightsize.kind), missing k8s.profile, TZ-prefix and @daily crons rejected, and a crash on non-dict params. All fixed and covered by tests.

🤖 Generated with Claude Code

Five templates failed the engine's Validate with no edits: ArgoCD Sync
missed integration_id on its argocd steps, SSL Monitor and Multi-Endpoint
Health used a templated cron the engine rejects at save, K8s Right-Sizing
missed direction, and two data.transform steps passed a map as input.

- ArgoCD Sync asks for the ArgoCD integration in the template form.
- SSL Monitor and Multi-Endpoint Health use a literal cron.
- K8s Right-Sizing no longer runs k8s.vertical_rightsize before approval
  (that task patches the workload); the approved step scales CPU and
  memory up or down by 20%, direction asked in the form.
- Multi-Endpoint Health and Scheduled Ping pass transform input as a JSON
  string and read it from `data`, the only name the engine exposes.
- validate.py checks each task's required params (from the engine's input
  schemas) and that schedule crons are literal; unit tests run in CI.

Fixes nudgebee/nudgebee-enterprise#41478

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants