Fix: RTR sets INVESTIGATION.INV_STATE_CASE_ID fallback - #985
Closed
ericnagel wants to merge 4 commits into
Closed
Conversation
Contributor
|
any reason to not merge this fix into rel-7.13? |
Contributor
Author
@ericbuckley not that I can think of. I'll retarget it. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix: Restore NULL behavior for missing investigation identifiers (STATE_CASE_ID bug)
Problem
PR #910 (June 22, 2026) inadvertently introduced a bug where contact investigations without real ODSE act_id rows were being assigned synthetic state case IDs derived from the investigation's local ID. This broke the expected MasterETL behavior where investigations without a real state case ID should have
INV_STATE_CASE_ID = NULL.Root Cause of PR #910 Bug
PR #910 added fallback logic to handle variable
act_id_seqpositions. While the Java transformer was improved to match identifiers bytype_cd(not fixed positions), the SQL stored procedure injected a synthetic STATE act_id row:This fallback was intended to handle edge cases but created fake identifiers for investigations like contacts that legitimately have no state case ID.
Solution
This PR removes the synthetic fallback behavior and restores the expected NULL handling through two complementary changes:
1. SQL Layer Fix (Stored Procedure)
Removed:
UNION ALLblockroot_extension_txtwithphc.local_idfor STATE rowsResult: Only real ODSE act_id rows are included in the JSON payload. Investigations without a real state case ID now correctly get
NULLinstead of a synthetic value.2. Java Layer Defensive Filter
Added a safety check to ignore any synthetic or non-meaningful rows (those with
act_id_seq <= 0):Testing
Added 8 new comprehensive unit tests covering missing scenarios, bringing total act_id transformation test coverage to 12 tests. Tests validate behavior for all combinations of identifier presence/absence and edge cases.
Test Coverage Matrix
testTransformActIdsExtractsByTypeCdRegardlessOfSequencetestTransformActIdsIgnoresSyntheticFallbackStateRowstestTransformActIdsLegacyCaseIdNullWhenNoLegacyRowtestTransformActIdsUsesLatestSequenceWhenMultipleLegacyRowsExisttestTransformActIdsEmptyArrayAllFieldsNulltestTransformActIdsStateNullWhenNoStateRowtestTransformActIdsCityNullWhenNoCityRowtestTransformActIdsMultipleStateRowsUsesHighestSequencetestTransformActIdsMultipleCityRowsUsesHighestSequencetestTransformActIdsBlankRootExtensionTxtIgnoredtestTransformActIdsAllTypesAbsentAllFieldsNulltestTransformActIdsMixedPresenceAndAbsenceBold rows = newly added tests
Impact
Related Issues
Additional Notes
N/A
Checklist