fix(soc-opt): never-fail SOCNormalizeFromList — broad except + status fallback#919
Merged
Merged
Conversation
… fallback
Wrap main() in a single broad try/except so a hard failure in the engine
never aborts Foundation - Normalize Artifacts (and therefore Upon Trigger).
On exception, write SOCFramework.NormalizeStatus { status: 'fallback',
lifecycle, category, list_name, error, error_type }, log via demisto.error,
post a degraded war-room entry, and return_results cleanly. No more
return_error halting the playbook.
Artifacts stay unwritten on failure (safe degrade — downstream sees missing
keys rather than wrong keys) and Foundation - Dedup / Enrichment fall back
to their list-backed defaults from SOCOptimizationConfig_V3.
The 7 raises in helpers (load_list_section, _bands) are unchanged — now
caught by the new broad except rather than bubbling out of main(). Sits
cleanly on top of #916's per-(lifecycle, category) dedup wiring (its block
is preserved verbatim, nested inside the new try:).
Labels: version:patch
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.
What does this content do?
Adds a never-fail wrapper around
SOCNormalizeFromList.main(). A hard failure in the normalize engine (bad list payload, missing category, JSON parse error, etc.) used to callreturn_error, which halts Upon Trigger and aborts the whole Foundation chain. This change wraps the entire normalization pass in a broadtry/exceptand surfaces failure as a context flag + degraded war-room entry, whilereturn_resultscleanly so Upon Trigger keeps walking.Content type
Target pack
SOC Framework Core
soc-optimization-unifiedIntegration instances required
None — pure framework engine change.
Tested on tenant
Contrib tenant —
tools/check_contribution.pyran end-to-end (validate → preflight → lint → pack_prep → contracts → shadow_mode → prep_docs → upload). Upload step passed.What changed from the current version?
Scripts/SOCNormalizeFromList/SOCNormalizeFromList.py:main()in a single broadtry:/except Exception as e:block (# noqa: BLE001 — Upon Trigger contract requires broad catch).return_errorfrommain()— it's the line that was halting Upon Trigger on engine failure.SOCFramework.NormalizeStatuswith{ status: "fallback", lifecycle, category, list_name, error, error_type }, logs viademisto.error, posts a degraded war-room readable, andreturn_resultsso the playbook continues.raise ValueError(...)calls in helper functions (load_list_section,_bands) are unchanged — they're now caught by the new broad except rather than bubbling out ofmain().try:(same code, deeper indent).Net failure mode: artifacts stay unwritten on engine failure (safe degrade — downstream sees missing keys rather than wrong keys). Foundation - Dedup and Foundation - Enrichment fall back to their list-backed defaults from
SOCOptimizationConfig_V3.Shadow mode
Dependencies on other framework content
try:.SOCOptimizationConfig_V3defaults being present (already standard).Known issues or limitations
None. Same behavior as before on the happy path; degraded continuation on the unhappy path. Verified by
pack_prep+check_contribution(incl. contrib-tenant upload).