Skip to content

BCH-1145: Remove definition-level evidence-required from API contract#409

Merged
saltpy-cs merged 3 commits into
mainfrom
fix/BCH-1145
May 28, 2026
Merged

BCH-1145: Remove definition-level evidence-required from API contract#409
saltpy-cs merged 3 commits into
mainfrom
fix/BCH-1145

Conversation

@saltpy-cs
Copy link
Copy Markdown
Contributor

@saltpy-cs saltpy-cs commented May 28, 2026

Evidence requirements are modelled exclusively at step level (EvidenceRequirement[] per step). The definition-level field was duplicated and never used by step transition validation.

  • Remove EvidenceRequired from Create/Update request structs
  • Remove handler logic that copied the field onto the definition
  • Tag model field json:"-" to exclude from responses (DB column kept for migration safety)
  • Add integration tests asserting evidence_required is absent from Create and Update responses

Summary by CodeRabbit

  • Bug Fixes
    • Removed the deprecated evidence-required field from workflow definition create and update APIs.
    • Replaced evidence-required with a grace-period-days integer field for workflow definitions, documented as "Override global default if set."
    • Requests including the old evidence-required field will no longer return it in API responses.

Review Change Stack

Evidence requirements are modelled exclusively at step level
(EvidenceRequirement[] per step). The definition-level field was
duplicated and never used by step transition validation.

- Remove EvidenceRequired from Create/Update request structs
- Remove handler logic that copied the field onto the definition
- Tag model field json:"-" to exclude from responses (DB column kept
  for migration safety)
- Add integration tests asserting evidence_required is absent from
  Create and Update responses

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 28, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: b3d029a2-d41c-485d-8ce5-02382d0cb8e2

📥 Commits

Reviewing files that changed from the base of the PR and between 2a7b30f and 0dec5e2.

📒 Files selected for processing (1)
  • internal/api/handler/workflows/workflow_definition_integration_test.go

📝 Walkthrough

Walkthrough

This pull request removes the EvidenceRequired field from workflow definition API contracts, replacing it with GracePeriodDays in request structures. The field is hidden from JSON responses while remaining in the database for migration safety, and all API documentation is updated accordingly.

Changes

Remove EvidenceRequired from API contracts

Layer / File(s) Summary
Remove EvidenceRequired from request DTOs and handler mapping
internal/api/handler/workflows/workflow_definition.go
CreateWorkflowDefinitionRequest and UpdateWorkflowDefinitionRequest replace EvidenceRequired with GracePeriodDays (*int). Handler Create and Update methods stop setting EvidenceRequired and now set GracePeriodDays from the request when provided.
Hide EvidenceRequired from API serialization
internal/service/relational/workflows/workflow_definition.go
WorkflowDefinition struct changes EvidenceRequired JSON tag from json:"evidence_required" to json:"-", excluding it from API responses while preserving it in the database.
Verify EvidenceRequired is not in API responses
internal/api/handler/workflows/workflow_definition_integration_test.go
Integration tests remove EvidenceRequired from the success request payload and add dedicated subtests that send evidence-required in create and update requests, verifying the field is absent from response bodies.
Update generated API documentation
docs/docs.go, docs/swagger.json, docs/swagger.yaml
API documentation schemas remove evidence-required and evidence_required properties from CreateWorkflowDefinitionRequest, UpdateWorkflowDefinitionRequest, and WorkflowDefinition definitions, with grace-period-days integer properties replacing them across all three documentation formats.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Poem

🐰 A field bid farewell with grace,
Evidence Required leaves its place,
Grace-period-days takes the stage,
Hidden from views, safe in the page,
Tests confirm the API's new face! 🎉

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically describes the main change: removing the definition-level evidence-required field from the API contract, which aligns with the actual changeset across all modified files.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


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

Copy link
Copy Markdown

@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: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@internal/api/handler/workflows/workflow_definition_integration_test.go`:
- Around line 93-94: The test currently only asserts the JSON response map
variable data does not contain "evidence_required"; extend the check to also
assert the dashed variant "evidence-required" is absent by adding the same
pattern: _, hasField := data["evidence-required"]; assert.False(t, hasField,
...) next to the existing assertion that uses data["evidence_required"]. Apply
the same pair of assertions in the other duplicated test location (the similar
block around the later check) so both locations validate absence of both key
variants.
🪄 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: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: cfe47d67-72ee-40e1-81fc-a3fdca6dabb1

📥 Commits

Reviewing files that changed from the base of the PR and between 89e68ad and 2a7b30f.

📒 Files selected for processing (6)
  • docs/docs.go
  • docs/swagger.json
  • docs/swagger.yaml
  • internal/api/handler/workflows/workflow_definition.go
  • internal/api/handler/workflows/workflow_definition_integration_test.go
  • internal/service/relational/workflows/workflow_definition.go
💤 Files with no reviewable changes (4)
  • docs/docs.go
  • docs/swagger.json
  • internal/api/handler/workflows/workflow_definition.go
  • docs/swagger.yaml

Comment thread internal/api/handler/workflows/workflow_definition_integration_test.go Outdated
…onses

Add hyphen-form (evidence-required) assertions alongside the existing
underscore-form checks in the Create and Update integration tests to
fully enforce contract removal of the definition-level field.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@saltpy-cs saltpy-cs merged commit b771d5e into main May 28, 2026
5 checks passed
@saltpy-cs saltpy-cs deleted the fix/BCH-1145 branch May 28, 2026 09:26
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.

1 participant