Skip to content

feat: add requireVerificationPassed to EnvironmentProgressionRule#991

Merged
adityachoudhari26 merged 8 commits intomainfrom
claude/issue-742-20260410-2146
Apr 15, 2026
Merged

feat: add requireVerificationPassed to EnvironmentProgressionRule#991
adityachoudhari26 merged 8 commits intomainfrom
claude/issue-742-20260410-2146

Conversation

@adityachoudhari26
Copy link
Copy Markdown
Member

@adityachoudhari26 adityachoudhari26 commented Apr 14, 2026

Fixes #742 by adding a new requireVerificationPassed flag to the EnvironmentProgressionRule. When enabled, jobs with a failed or running verification status are excluded from the success rate calculation, preventing progression to dependent environments when verification has not passed.

Generated with Claude Code

Summary by CodeRabbit

Release Notes

  • New Features

    • Added optional requireVerificationPassed setting to environment progression policies, allowing jobs to count toward success percentage only when verification has passed (defaults to false).
  • Documentation

    • Updated environment progression policy documentation with details on the new verification requirement option.

Fixes issue #742 by adding a new `requireVerificationPassed` flag to the
`EnvironmentProgressionRule`. When enabled, jobs with a failed or running
verification status are excluded from the success rate calculation, preventing
progression to dependent environments when verification has not passed.

Changes:
- Add `require_verification_passed` column to DB schema with migration
- Add `requireVerificationPassed` field to EnvironmentProgressionRule in all API schemas
- Update SQL query to compute aggregate job verification status inline
- Update ReleaseTargetJob struct and tracker to check verification status
- Add tests for the new verification-aware success tracking

Co-authored-by: Aditya Choudhari <adityachoudhari26@users.noreply.github.com>
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 14, 2026

Warning

Rate limit exceeded

@adityachoudhari26 has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 47 minutes and 4 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 47 minutes and 4 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: faae8111-82eb-4ad9-8119-826ce0758d32

📥 Commits

Reviewing files that changed from the base of the PR and between 183f03c and 985d0b1.

📒 Files selected for processing (1)
  • apps/workspace-engine/pkg/workspace/releasemanager/policy/evaluator/environmentprogression/jobtracker.go
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/issue-742-20260410-2146

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Apr 14, 2026

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
1 out of 2 committers have signed the CLA.

✅ adityachoudhari26
❌ github-actions[bot]
You have signed the CLA already but the status is still pending? Let us recheck it.

@adityachoudhari26 adityachoudhari26 marked this pull request as ready for review April 15, 2026 18:25
Copilot AI review requested due to automatic review settings April 15, 2026 18:25
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@apps/api/src/types/openapi.ts`:
- Around line 1413-1417: The OpenAPI-generated type marks
requireVerificationPassed as required but the server treats it as optional with
a default of false; update the OpenAPI source schema to make the property
optional (remove it from required[] or mark it with nullable/optional) for the
relevant schema that contains requireVerificationPassed, then regenerate the
TypeScript artifacts so the generated type (requireVerificationPassed) is
optional and clients won't be forced to send it.

In `@e2e/api/schema.ts`:
- Around line 1413-1417: The generated schema declares requireVerificationPassed
as a required boolean which breaks existing contracts; update the source OpenAPI
schema so requireVerificationPassed is optional (remove it from the property's
required list or omit it from the parent object's required array) or mark it as
not required/nullable in the schema, then regenerate the TypeScript types so the
generated symbol requireVerificationPassed becomes optional (e.g., boolean |
undefined or with a trailing ? in the interface) across the generated output.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: e94dd90b-13fc-433e-9907-cd896cc9fddd

📥 Commits

Reviewing files that changed from the base of the PR and between 230baf4 and 183f03c.

📒 Files selected for processing (33)
  • apps/api/openapi/openapi.json
  • apps/api/openapi/schemas/policies.jsonnet
  • apps/api/src/routes/v1/workspaces/policies.ts
  • apps/api/src/types/openapi.ts
  • apps/web/app/api/openapi.ts
  • apps/workspace-engine/oapi/openapi.json
  • apps/workspace-engine/oapi/spec/schemas/policy.jsonnet
  • apps/workspace-engine/pkg/db/convert.go
  • apps/workspace-engine/pkg/db/job_verification_metric.sql.go
  • apps/workspace-engine/pkg/db/models.go
  • apps/workspace-engine/pkg/db/policies.sql.go
  • apps/workspace-engine/pkg/db/queries/job_verification_metric.sql
  • apps/workspace-engine/pkg/db/queries/policies.sql
  • apps/workspace-engine/pkg/db/queries/schema.sql
  • apps/workspace-engine/pkg/oapi/oapi.gen.go
  • apps/workspace-engine/pkg/workspace/releasemanager/policy/evaluator/environmentprogression/environmentprogression.go
  • apps/workspace-engine/pkg/workspace/releasemanager/policy/evaluator/environmentprogression/getters.go
  • apps/workspace-engine/pkg/workspace/releasemanager/policy/evaluator/environmentprogression/jobtracker.go
  • apps/workspace-engine/pkg/workspace/releasemanager/policy/evaluator/environmentprogression/jobtracker_test.go
  • apps/workspace-engine/pkg/workspace/releasemanager/policy/evaluator/environmentprogression/mock_test.go
  • apps/workspace-engine/pkg/workspace/releasemanager/policy/evaluator/environmentprogression/passrate.go
  • apps/workspace-engine/pkg/workspace/releasemanager/policy/evaluator/environmentprogression/soaktime.go
  • apps/workspace-engine/pkg/workspace/releasemanager/policy/evaluator/gradualrollout/gradualrollout_test.go
  • apps/workspace-engine/svc/controllers/desiredrelease/policyeval/policyeval_test.go
  • apps/workspace-engine/svc/controllers/desiredrelease/reconcile_test.go
  • apps/workspace-engine/test/controllers/harness/mocks.go
  • docs/policies/environment-progression.mdx
  • e2e/api/schema.ts
  • packages/db/drizzle/0186_cooing_doomsday.sql
  • packages/db/drizzle/meta/0186_snapshot.json
  • packages/db/drizzle/meta/_journal.json
  • packages/db/src/schema/policy.ts
  • packages/workspace-engine-sdk/src/schema.ts

Comment on lines +1413 to +1417
/**
* @description If true, jobs must also have passed verification to count toward the success percentage
* @default false
*/
requireVerificationPassed: boolean;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Make requireVerificationPassed optional in the API contract.

Line 1417 defines requireVerificationPassed as required, but this feature is described and implemented as defaulting to false when omitted. Keeping it required here can break generated clients and conflicts with server-side defaulting behavior.

Suggested contract shape
-            requireVerificationPassed: boolean;
+            requireVerificationPassed?: boolean;

Since this file is generated, apply the fix in the OpenAPI source schema and regenerate artifacts.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@apps/api/src/types/openapi.ts` around lines 1413 - 1417, The
OpenAPI-generated type marks requireVerificationPassed as required but the
server treats it as optional with a default of false; update the OpenAPI source
schema to make the property optional (remove it from required[] or mark it with
nullable/optional) for the relevant schema that contains
requireVerificationPassed, then regenerate the TypeScript artifacts so the
generated type (requireVerificationPassed) is optional and clients won't be
forced to send it.

Comment thread e2e/api/schema.ts
Comment on lines +1413 to +1417
/**
* @description If true, jobs must also have passed verification to count toward the success percentage
* @default false
*/
requireVerificationPassed: boolean;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Make requireVerificationPassed optional to avoid a breaking contract.

Line 1417 declares this new field as required (requireVerificationPassed: boolean). For a default-false toggle, this forces all existing policy payloads/types to include it and creates an unnecessary breaking change. Please mark it optional in the source OpenAPI schema and regenerate.

Suggested generated output shape
-            requireVerificationPassed: boolean;
+            requireVerificationPassed?: boolean;
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
/**
* @description If true, jobs must also have passed verification to count toward the success percentage
* @default false
*/
requireVerificationPassed: boolean;
/**
* `@description` If true, jobs must also have passed verification to count toward the success percentage
* `@default` false
*/
requireVerificationPassed?: boolean;
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@e2e/api/schema.ts` around lines 1413 - 1417, The generated schema declares
requireVerificationPassed as a required boolean which breaks existing contracts;
update the source OpenAPI schema so requireVerificationPassed is optional
(remove it from the property's required list or omit it from the parent object's
required array) or mark it as not required/nullable in the schema, then
regenerate the TypeScript types so the generated symbol
requireVerificationPassed becomes optional (e.g., boolean | undefined or with a
trailing ? in the interface) across the generated output.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new requireVerificationPassed flag to EnvironmentProgressionRule so environment progression success-rate/soak-time calculations can ignore “successful” jobs whose verification hasn’t passed.

Changes:

  • Extends the policy schema/API/SDK types and docs to include requireVerificationPassed (default false).
  • Persists the flag in Postgres (Drizzle + sqlc schema/query updates) and returns/accepts it via API.
  • Updates the workspace-engine environment progression evaluator/job-tracker to optionally gate “success” by verification status, including new DB query + unit tests.

Reviewed changes

Copilot reviewed 32 out of 33 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
packages/workspace-engine-sdk/src/schema.ts SDK schema adds requireVerificationPassed on EnvironmentProgressionRule.
packages/db/src/schema/policy.ts Drizzle table adds require_verification_passed column w/ default.
packages/db/drizzle/meta/_journal.json Records new migration in Drizzle journal.
packages/db/drizzle/meta/0186_snapshot.json Drizzle snapshot updated to include new column.
packages/db/drizzle/0186_cooing_doomsday.sql Migration to add require_verification_passed column.
e2e/api/schema.ts E2E generated OpenAPI types include requireVerificationPassed.
docs/policies/environment-progression.mdx Documents new flag and updates examples/“How it works”.
apps/workspace-engine/test/controllers/harness/mocks.go Test harness getter adds GetVerificationStatusForJobs.
apps/workspace-engine/svc/controllers/desiredrelease/reconcile_test.go Mock updated to satisfy new getters interface.
apps/workspace-engine/svc/controllers/desiredrelease/policyeval/policyeval_test.go Mock updated to satisfy new getters interface.
apps/workspace-engine/pkg/workspace/releasemanager/policy/evaluator/gradualrollout/gradualrollout_test.go Mock updated to satisfy new getters interface.
apps/workspace-engine/pkg/workspace/releasemanager/policy/evaluator/environmentprogression/soaktime.go Tracker construction updated for new ctor parameter.
apps/workspace-engine/pkg/workspace/releasemanager/policy/evaluator/environmentprogression/passrate.go Tracker construction updated for new ctor parameter.
apps/workspace-engine/pkg/workspace/releasemanager/policy/evaluator/environmentprogression/mock_test.go Mock adds job verification status support.
apps/workspace-engine/pkg/workspace/releasemanager/policy/evaluator/environmentprogression/jobtracker_test.go Adds extensive tests covering verification-gated success.
apps/workspace-engine/pkg/workspace/releasemanager/policy/evaluator/environmentprogression/jobtracker.go Implements verification-aware success/soak-time tracking.
apps/workspace-engine/pkg/workspace/releasemanager/policy/evaluator/environmentprogression/getters.go Adds GetVerificationStatusForJobs + Postgres implementation.
apps/workspace-engine/pkg/workspace/releasemanager/policy/evaluator/environmentprogression/environmentprogression.go Wires rule flag into tracker construction.
apps/workspace-engine/pkg/oapi/oapi.gen.go Generated Go model includes RequireVerificationPassed.
apps/workspace-engine/pkg/db/queries/schema.sql Schema includes new column for env progression rule table.
apps/workspace-engine/pkg/db/queries/policies.sql Reads/writes require_verification_passed in policy rule queries.
apps/workspace-engine/pkg/db/queries/job_verification_metric.sql Adds batch query for metric + measurement statuses by job IDs.
apps/workspace-engine/pkg/db/policies.sql.go sqlc output updated for new column in env progression rules.
apps/workspace-engine/pkg/db/models.go sqlc model updated with RequireVerificationPassed.
apps/workspace-engine/pkg/db/job_verification_metric.sql.go sqlc output adds new batch query function/types.
apps/workspace-engine/pkg/db/convert.go Converts DB JSON rule payload into OAPI rule incl. new flag.
apps/workspace-engine/oapi/spec/schemas/policy.jsonnet Schema adds requireVerificationPassed property.
apps/workspace-engine/oapi/openapi.json Generated OpenAPI updated with new property.
apps/web/app/api/openapi.ts Web app generated OpenAPI types include new property.
apps/api/src/types/openapi.ts API generated OpenAPI types include new property.
apps/api/src/routes/v1/workspaces/policies.ts API persistence/response includes requireVerificationPassed.
apps/api/openapi/schemas/policies.jsonnet API OpenAPI schema adds new property.
apps/api/openapi/openapi.json API generated OpenAPI updated with new property.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +126 to +132
verificationStatuses, err := t.fetchVerificationStatuses(ctx, rows)
if err != nil {
span.AddEvent("GetVerificationStatusForJobs error",
trace.WithAttributes(attribute.String("error", err.Error())),
)
return t.jobs
}
Copy link

Copilot AI Apr 15, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When GetVerificationStatusForJobs returns an error, compute() returns early with an empty t.jobs. This causes downstream evaluation to report "No jobs found" and can block progression for the wrong reason. Consider still populating t.jobs (and jobsByStatus) and treating verification as not-passed/unknown for success calculations (or propagating the error up so the evaluator can surface an explicit failure message) instead of returning before iterating rows.

Copilot uses AI. Check for mistakes.
@adityachoudhari26 adityachoudhari26 merged commit 3dc45b6 into main Apr 15, 2026
4 of 5 checks passed
@adityachoudhari26 adityachoudhari26 deleted the claude/issue-742-20260410-2146 branch April 15, 2026 18:38
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.

Environment Progression should consider Verification Status for success rate calculation

3 participants