You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Three elements the pipeline builder adds accept every evidence key #52
Three elements that PipelineBuilder adds by default accept every evidence key, so Evidence.filter() never removes a key from a pipeline built with the default settings.
SequenceElementEvidenceKeyFilter defines filter() rather than filter_evidence_key() (sequenceelement.py#L27-L34), so the base EvidenceKeyFilter.filter_evidence_key(), which returns True, answers for it (evidence_keyfilter.py).
SetHeaderElement does not override get_evidence_key_filter(), so it gets the base EvidenceKeyFilter from FlowElement (flowelement.py#L91-L101).
PipelineBuilder.build() adds the sequence element, the JSON bundler and the JavaScript builder unless add_javascript_builder is false, and the set header element unless use_setheader_properties is false (pipelinebuilder.py#L93-L127, #L156-L157). Evidence.filter() keeps a key when any element accepts it (evidence.py#L92-L109), so with the defaults it keeps every key, whatever the engines need.
What should happen instead
Each element accepts only the evidence it uses, so Evidence.filter() removes the keys no element needs.
Suggested fix
Rename filter() to filter_evidence_key() in SequenceElementEvidenceKeyFilter and JavaScriptBuilderEvidenceKeyFilter.
Give SetHeaderElement a filter for the evidence it reads, or none if it reads only element data.
Add a test that builds a pipeline with the default settings and an element that accepts one key, adds evidence it does not accept, and checks that process() removes it. Removing keys only works once Evidence.filter() no longer deletes from the dictionary it loops over, which #50 fixes.
Activity