Skip to content

Reject CaseSensitive on predicate types that don't support it#627

Merged
saditya370 merged 1 commit into
mainfrom
fix/15041-validate-case-sensitivity-nil-types
Jul 15, 2026
Merged

Reject CaseSensitive on predicate types that don't support it#627
saditya370 merged 1 commit into
mainfrom
fix/15041-validate-case-sensitivity-nil-types

Conversation

@saditya370

Copy link
Copy Markdown
Contributor

Summary

FilterPredicate.validateCaseSensitivity() only rejected a CaseSensitive value when it was true. A false value on a predicate type that doesn't support case sensitivity (e.g. exists, matches) passed validation and was sent to the API, which ignores it and returns null. Any client that round-trips the response — like terraform-provider-opslevel — then sees the value it set silently disagree with the API, surfacing in Terraform as "Provider produced inconsistent result after apply".

This drops the && *filterPredicate.CaseSensitive clause so Validate() rejects any non-nil CaseSensitive (true or false) for these types. nil remains valid (handled by the existing early return).

Changes

  • filters.govalidateCaseSensitivity now rejects any non-nil CaseSensitive on knownNotCaseSensitiveTypes, with a comment explaining the API ignores/nulls the value. Error message unchanged.
  • filters_test.go — new table-driven TestFilterPredicateValidateCaseSensitivity exercising Validate() end to end: nil/true/false on a not-case-sensitive type (repository_ids + exists) and true/false on a case-sensitive type (language + equals).
  • .changes/unreleased/ — changie Bugfix entry.

Verification

  • New false-value test case fails before the code change and passes after.
  • go test -race ./...ok
  • gofumpt -d -e . → clean; golangci-lint run0 issues

Refs

  • OpsLevel support ticket #15041
  • terraform-provider-opslevel PR #659 (reviewer request to update validateCaseSensitivity to catch nil-returning cases)

@saditya370 saditya370 merged commit a0d3851 into main Jul 15, 2026
4 checks passed
@saditya370 saditya370 deleted the fix/15041-validate-case-sensitivity-nil-types branch July 15, 2026 04:11
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