Skip to content

Three elements the pipeline builder adds accept every evidence key #52

Closed

Description

@jwrosewell

Problem

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.

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

  1. Rename filter() to filter_evidence_key() in SequenceElementEvidenceKeyFilter and JavaScriptBuilderEvidenceKeyFilter.
  2. Give SetHeaderElement a filter for the evidence it reads, or none if it reads only element data.
  3. 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.

Checked at commit 081386d by reading the source.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions