Conversation
In pb_curate_disable_decayed_indicators, playbook_results holds
"decaying_model_meta" as an empty dict and only fills it when the
model named by curation_decaying_model is found and enabled. The
two statements that follow index ["attributes"] unconditionally,
so pointing the playbook at a missing or disabled model raises
KeyError: 'attributes' and both "model not found" else-branches
become unreachable.
Initialise the entry as {"attributes": []} so the not-found case
reaches its message. The matching-model branch reassigns the whole
dict, so the successful path is unchanged.
Applied to both notebooks of the pair to keep them in sync.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This branch has not been deployed
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.
BLUF
pb_curate_disable_decayed_indicatorscrashes withKeyError: 'attributes'whenevercuration_decaying_modelnames a model that is missing or disabled.playbook_results["decaying_model_meta"]is initialised as an empty dict but indexed["attributes"]unconditionally.{"attributes": []}.playbook.jsonchange: this is a bug fix, not a new playbook.What was wrong
The playbook-configuration cell sets up the results container with an empty entry:
The decaying-model cell only fills that entry inside a conditional — when the
model index contains a model whose name matches
curation_decaying_modelandwhose
enabledflag isTrue:Immediately afterwards, and again in the "Apply the model" block, the key is read
unconditionally:
Concrete impact
Point
curation_decaying_modelat a model that does not exist on the MISP server,or at one that exists but is disabled, and the cell dies on the first of those two
lines with
KeyError: 'attributes'instead of taking itselsebranch. The usergets a traceback rather than the intended message naming the model that could not
be found, and both
elsebranches — the very ones written to handle this case —are unreachable.
What this changes
The results container now declares the shape it is actually used with:
That is the whole change, applied identically to
pb_curate_disable_decayed_indicators.ipynbandpb_curate_disable_decayed_indicators-with_output.ipynbso the pair stays insync. The successful path is untouched: the matching-model branch still replaces
the entire dict,
attributeslist included. The stored outputs in the executednotebook cover the found path and needed no update.
How this was verified
The playbook-configuration cell and the decaying-model cell were extracted from
both notebooks and executed against a stub whose
decayingModel/index.jsonreturns an empty list, i.e. the "model not found" case. The
misp.search()callsits inside the guarded branch and never fires, so nothing contacts a server.
KeyError: 'attributes', in both notebooks.MISP decaying modle curation not found.followed byMISP decaying model curation not found.andFinished searching. Processed 0 attributes, decayed 0 attributes., in bothnotebooks.
Notebook and JSON structural validation across the repository still passes, so the
nbconvert workflow is unaffected.
Local verification
Output: