Skip to content

fix(cases): resolve option_ref in closure validator and return 400 fr…#2576

Merged
jordan-umusu merged 1 commit intomainfrom
fix/cases-update-closure-with-dropdown-refs
Apr 30, 2026
Merged

fix(cases): resolve option_ref in closure validator and return 400 fr…#2576
jordan-umusu merged 1 commit intomainfrom
fix/cases-update-closure-with-dropdown-refs

Conversation

@jordan-umusu
Copy link
Copy Markdown
Collaborator

@jordan-umusu jordan-umusu commented Apr 28, 2026

Problem

core.cases.update_case returned HTTP 500 when a workflow closed a case and supplied required dropdowns by definition_ref/option_ref in the same payload.

Two issues:

  1. The closure-requirements validator resolved definition_ref but not option_ref, so it wrote option_id=None into the merged map and falsely flagged the
    dropdown as missing.
  2. update_case_simple didn't catch TracecatValidationError, so it bubbled to the global handler as a 500 instead of a 4xx.

Solution

  • Resolve option_refoption_id inside the validator before merging.
  • Catch TracecatValidationError in update_case_simple and return 400, matching the file's existing convention for validation failures.
  • Add a regression test that closes a case using definition_ref + option_ref for a required-on-closure dropdown.

Summary by cubic

Fix case closure validation to accept dropdown refs and return clear 400 errors for invalid closure data. You can now close a case by sending definition_ref + option_ref for required dropdowns.

  • Bug Fixes
    • Resolve option_ref to option ID when validating required dropdowns on close.
    • Map TracecatValidationError to HTTP 400 in update_case_simple.
    • Add unit test to verify closing with dropdown refs satisfies closure requirements.

Written for commit aa4dd29. Summary will update on new commits. Review in cubic

@jordan-umusu jordan-umusu temporarily deployed to internal-registry-ci April 28, 2026 22:41 — with GitHub Actions Inactive
@jordan-umusu jordan-umusu temporarily deployed to internal-registry-ci April 28, 2026 22:41 — with GitHub Actions Inactive
@jordan-umusu jordan-umusu marked this pull request as ready for review April 28, 2026 22:42
@zeropath-ai
Copy link
Copy Markdown

zeropath-ai Bot commented Apr 28, 2026

No security or compliance issues detected. Reviewed everything up to aa4dd29.

Security Overview
Detected Code Changes
Change Type Relevant files
Enhancement ► tests/unit/test_cases_service.py
    Add test for closing a case with required dropdowns
► tracecat/cases/internal_router.py
    Handle TracecatValidationError in update_case_simple
► tracecat/cases/service.py
    Update _validate_closure_requirements to handle option_ref for dropdowns
    Fetch option_id from option_ref if not directly provided

Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

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

No issues found across 3 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

@jordan-umusu jordan-umusu added fix Bug fix cases Case management improvements and changes labels Apr 28, 2026
@jordan-umusu jordan-umusu requested a review from daryllimyt April 28, 2026 22:49
@jordan-umusu jordan-umusu merged commit 9788a66 into main Apr 30, 2026
17 checks passed
@jordan-umusu jordan-umusu deleted the fix/cases-update-closure-with-dropdown-refs branch April 30, 2026 00:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cases Case management improvements and changes fix Bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants