Skip to content

[SPRINT-02-10] Validate lvl1 Assembly SBOL artifacts and remove default JSON side effects #97

@Gonza10V

Description

@Gonza10V

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

Goal

Add tests and small fixes so lvl1 assembly produces valid, inspectable SBOL artifacts before protocol JSON conversion, and does not write default output files unless explicitly requested.

Background

BuildCompiler.assembly_lvl1() calls Assembly(...).run(), extends self.indexed_plasmids, then calls assembly_plan_RDF_to_JSON(product_doc). The JSON conversion writes output.json by default when no output path is supplied. For compiler-only and test workflows, default filesystem side effects make results hard to reproduce and can hide whether SBOL is valid before conversion.

src/buildcompiler/sbol2build.py has real assembly logic: digestion, ligation, activity creation, product implementations, and final document output. This issue should validate that behavior with canonical fixtures.

Scope

  • Add tests that run lvl1 assembly using the local canonical fixture.
  • Assert the returned products are canonical Plasmid objects or documented compatible objects.
  • Assert the final SBOL document contains:
    • assembly activity;
    • product ComponentDefinition;
    • product Implementation;
    • relevant usages/provenance where currently implemented.
  • Assert the final SBOL document can serialize and reload.
  • Assert the generated product can be re-indexed as inventory.
  • Change assembly_plan_RDF_to_JSON usage so assembly does not write output.json unless an output path is explicitly requested.
  • Add or update tests for in-memory JSON return behavior.

Non-goals

  • Do not rewrite the digestion/ligation algorithm.
  • Do not implement lvl2 assembly.
  • Do not run PUDU or Opentrons.
  • Do not require live SynBioHub.

Acceptance criteria

  • lvl1 assembly fixture test produces at least one product.
  • Assembly SBOL document serializes and reloads.
  • Product ComponentDefinition and Implementation are present after reload.
  • Generated product can be indexed again as a plasmid/product.
  • assembly_lvl1() or the JSON helper no longer writes output.json by default during tests.
  • In-memory JSON conversion remains available for protocol-adapter work.

Verification

pytest -k "assembly and sbol"
pytest -k "assembly_plan_RDF_to_JSON or output_json"
ruff check .

Codex implementation notes

  • Prefer adding an optional output_path argument or write_json=False flag over removing JSON support.
  • Validate SBOL before JSON conversion in tests.
  • Keep filesystem writes inside temporary directories when tests need them.
  • If SBOL validation APIs are brittle, at minimum test serialize/reload and object presence deterministically.

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