Skip to content

[SPRINT-02-04] Add PullPolicy and remove hidden SynBioHub fallback from local mode #91

@Gonza10V

Description

@Gonza10V

Parent sprint: #87
Depends on: #88, #89, #90
Recommended order: 4
Codex-ready: yes

Goal

Introduce an explicit pull policy so local SBOL indexing and local design resolution do not silently call SynBioHub.

Background

abstract_translator.get_or_pull(doc, sbh, uri) currently pulls from SynBioHub whenever uri is missing from the document. That behavior is convenient for live SynBioHub mode but unsafe for local/offline debugging: a local test may pass because it secretly fetched missing objects, or fail in a way that looks like an indexing bug but is actually a network/pull issue.

Scope

Add a small policy enum or constants, for example:

class PullPolicy(Enum):
    NEVER = "never"
    MISSING_ONLY = "missing_only"
    ALWAYS_REFRESH = "always_refresh"

Then update resolution helpers so callers can choose behavior explicitly:

def get_or_pull(doc, sbh, uri, pull_policy=PullPolicy.MISSING_ONLY): ...

Local indexing and local tests should use PullPolicy.NEVER.

Requirements

  • PullPolicy.NEVER: return local object if present; if missing, raise or record a structured unresolved reference without network access.
  • PullPolicy.MISSING_ONLY: preserve current behavior where missing objects are pulled.
  • PullPolicy.ALWAYS_REFRESH: optional if easy; acceptable to add enum value and raise NotImplementedError if not needed yet, but document it.
  • Update BuildCompiler local entry point to use NEVER by default.
  • Keep current SynBioHub path behavior compatible by defaulting to MISSING_ONLY where appropriate.

Non-goals

  • Do not implement caching or remote synchronization.
  • Do not require SynBioHub credentials in local tests.
  • Do not change unrelated assembly/transformation behavior.

Acceptance criteria

  • Local mode has a clear way to prohibit SynBioHub pulls.
  • Existing live SynBioHub path can still pull missing objects.
  • Tests prove PullPolicy.NEVER does not call sbh.pull.
  • Missing local references are represented clearly in an exception, audit entry, or structured warning.
  • Documentation or docstrings explain when each policy should be used.

Verification

Run:

pytest -k "pull_policy or local or get_or_pull or index"
ruff check .

Codex implementation notes

  • Keep the policy simple.
  • Do not overfit to future architecture.
  • If changing get_or_pull has many call sites, preserve default behavior and only pass NEVER from local indexing/test paths.
  • Make failures precise: include the missing URI and current policy in the error/audit message.

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