Skip to content

[ISSUE-04] Add BuildCompiler API skeleton#71

Merged
Gonza10V merged 1 commit into
full_buildfrom
codex/add-buildcompiler-api-skeleton
May 5, 2026
Merged

[ISSUE-04] Add BuildCompiler API skeleton#71
Gonza10V merged 1 commit into
full_buildfrom
codex/add-buildcompiler-api-skeleton

Conversation

@Gonza10V
Copy link
Copy Markdown
Contributor

@Gonza10V Gonza10V commented May 5, 2026

Motivation

  • Provide a lightweight, clean-architecture public API entry point for BuildCompiler so callers can construct a compiler, plan, execute, and run a full-build without pulling heavy optional automation dependencies or implementing planner/executor logic yet.
  • Reserve a clear factory boundary for future SynBioHub collection loading/indexing while keeping construction testable and offline-friendly.

Description

  • Added src/buildcompiler/api/compiler.py with a BuildCompiler dataclass that is dependency-injected, stores inventory, sbol_document, planner, executor, adapters, and options, and exposes plan, execute, and full_build instance methods that either delegate to injected dependencies or raise NotImplementedError as an explicit placeholder.
  • Implemented BuildCompiler.from_synbiohub(...) as the only reserved SynBioHub factory boundary and made it raise NotImplementedError when actual non-empty collections loading is requested while remaining offline-friendly for empty/no-op calls.
  • Added a module-level convenience full_build(...) function that chooses the lightweight constructor path or the from_synbiohub(...) factory path based on presence of SynBioHub-related args and does not import optional automation modules.
  • Exported BuildCompiler and full_build from src/buildcompiler/api/__init__.py and added tests in tests/unit/api/test_compiler_api.py to cover imports, constructor injection, placeholder behavior, optional-dependency import guards, and delegation to injected fake planner/executor objects.

Testing

  • Verified import smoke with python -c "from buildcompiler.api import BuildCompiler, full_build" and python -c "from buildcompiler.api.options import BuildOptions; BuildOptions()", both succeeded.
  • Ran targeted unit tests with pytest tests/unit/api which passed, and pytest tests/unit/domain tests/unit/api which also passed.
  • Attempted uv run pytest tests/unit/api which failed in this environment due to a network-restricted fetch of the optional git dependency SBOLInventory used by the environment setup, so the uv-backed commands are blocked by network restrictions here.
  • Ran repository linter ruff check . which failed due to pre-existing repository-wide lint issues outside the scope of this API skeleton change (these are unrelated to the added API files).

Codex Task

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4b3298cea6

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +106 to +112
compiler = BuildCompiler(
inventory=inventory,
planner=planner,
executor=executor,
adapters=adapters,
options=compiler_options,
**kwargs,
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Forward sbol_document in module-level full_build

The module-level full_build(...) accepts an sbol_document argument, but in the lightweight constructor path it is never passed to BuildCompiler, so callers who provide sbol_document (without SynBioHub args) silently lose that input and run with compiler.sbol_document=None. This breaks dependency-injected flows where planner/executor expect the document to be present and makes the public API contract misleading.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@codex good catch, solve this issue

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Summary

  • Fixed the module-level full_build(...) lightweight path to correctly forward sbol_document into BuildCompiler(...), so callers don’t lose that injected input when SynBioHub args are not used.
  • Added a regression test that verifies sbol_document is preserved in the lightweight path by monkeypatching BuildCompiler.full_build and asserting the captured instance value matches the provided document.
  • Committed the fix on the current branch with commit message: Fix full_build forwarding of sbol_document.

Testing

  • pytest tests/unit/api/test_compiler_api.py

View task →

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@codex good catch, solve this issue

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Summary

  • Fixed the module-level full_build(...) lightweight path to forward sbol_document into BuildCompiler(...), preventing silent loss of caller-provided SBOL input when SynBioHub args are not used. src/buildcompiler/api/compiler.pyL105-L116
  • Added a regression test that monkeypatches BuildCompiler.full_build, invokes module-level full_build(...) with sbol_document, and asserts the constructed compiler preserves that exact object. tests/unit/api/test_compiler_api.pyL118-L132
  • Committed the changes on the current branch with commit message: Fix full_build forwarding of sbol_document (commit 5295347).

Testing

  • pytest tests/unit/api/test_compiler_api.py

View task →

@Gonza10V Gonza10V merged commit 123e984 into full_build May 5, 2026
0 of 14 checks passed
@Gonza10V Gonza10V deleted the codex/add-buildcompiler-api-skeleton branch May 5, 2026 20:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant