Skip to content

[SPRINT-02-09] Add inventory-to-lvl1 route contract tests #96

@Gonza10V

Description

@Gonza10V

Parent sprint: #87
Depends on: #88, #89, #90, #91, #92, #93, #94
Recommended order: 9
Codex-ready: yes

Goal

Add contract tests proving that indexed inventory can actually satisfy current lvl1 route-selection and assembly-input discovery logic.

Background

BuildCompiler.assembly_lvl1() depends on several pieces lining up correctly:

  • _extract_design_parts(...) extracts the ordered design components;
  • _construct_plasmid_dict(...) finds indexed part plasmids;
  • _get_backbone(...) chooses a compatible backbone;
  • get_compatible_plasmids(...) validates fusion-site compatibility;
  • BsaI and ligase implementations are present;
  • Assembly(...) receives well-formed Plasmid objects.

When this fails today, the error may not clearly distinguish indexing failure, selector failure, missing reagent, missing backbone, or assembly failure.

Scope

Add tests that start from local fixture documents and stop before or at lvl1 assembly input creation. Suggested coverage:

  • complete local fixture resolves all required design parts;
  • each required part maps to at least one indexed plasmid;
  • compatible backbone is selected deterministically;
  • missing part fixture reports which design part cannot be satisfied;
  • missing backbone fixture reports no compatible backbone;
  • missing BsaI/ligase fixture reports missing reagent clearly;
  • _get_backbone() does not silently return (None, None) without a useful diagnostic.

Non-goals

Acceptance criteria

  • Complete fixture produces a deterministic set of compatible lvl1 input plasmids and a backbone.
  • Missing part failures identify the missing part display ID or identity.
  • Missing backbone failures identify expected compatibility constraints.
  • Missing reagent failures identify which reagent is absent.
  • Tests make it clear whether the failure is in indexing, selection, or assembly input preparation.

Verification

pytest -k "lvl1 and route"
pytest -k "backbone or compatible or plasmid_dict"
ruff check .

Codex implementation notes

  • Prefer tests around existing private helpers if public API is not ready yet.
  • If helper behavior is currently too implicit, add small diagnostic exceptions or return structures instead of bare (None, None).
  • Keep changes limited to making current route preparation testable and explainable.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions