Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/check-sibling-compat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ jobs:
python-version: ${{ env.PYTHON_VERSION }}
uv-version: ${{ env.UV_VERSION }}
cache-version: ${{ env.CACHE_VERSION }}
cache-enabled: "false"
cache-key-prefix: uv-sibling-compat
lock-file-path: 'omnibase_infra/**/uv.lock'
skip-install: 'true'
Expand Down
12 changes: 2 additions & 10 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -431,11 +431,7 @@ jobs:
cache-enabled: "false"
cache-key-prefix: uv-topic-drift
lock-file-path: 'omnibase_infra/**/uv.lock'
skip-install: 'true'

- name: Install omnibase_infra dependencies
working-directory: omnibase_infra
run: uv sync --no-cache
working-directory: omnibase_infra

- name: Check topic drift (cross-repo)
working-directory: omnibase_infra
Expand Down Expand Up @@ -504,11 +500,7 @@ jobs:
cache-enabled: "false"
cache-key-prefix: uv-handshake
lock-file-path: 'omnibase_infra/**/uv.lock'
skip-install: 'true'

- name: Install omnibase_infra dev dependencies
working-directory: omnibase_infra
run: uv sync --no-cache
working-directory: omnibase_infra

- name: Install sibling repos as editable (boundary pair deps)
working-directory: omnibase_infra
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/reusable-runtime-boot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ jobs:
with:
version: "0.6.14"
python-version: "3.12"
enable-cache: true
enable-cache: false

- name: Install CLI dependencies (jq, curl)
if: inputs.mode == 'compose'
Expand Down
3 changes: 3 additions & 0 deletions docker/docker-compose.infra.yml
Original file line number Diff line number Diff line change
Expand Up @@ -774,6 +774,9 @@ services:
!!merge <<: *runtime-env
OTEL_SERVICE_NAME: omnimarket-projection-api
RUNTIME_PROFILE: projection-api
# Projection API serves materialized read models and has no runtime data
# volume for the rendered Bifrost delegation contract.
BIFROST_CONTRACT_PATH: ""
Comment thread
coderabbitai[bot] marked this conversation as resolved.
ports:
- "${PROJECTION_API_PORT:-3002}:3002"
healthcheck:
Expand Down
30 changes: 26 additions & 4 deletions src/omnibase_infra/runtime/render_bifrost_delegation_contract.py
Original file line number Diff line number Diff line change
Expand Up @@ -324,14 +324,30 @@ def _populate_backend_endpoints(
return populated


def _resolve_target_path(
*,
target_path: Path | None,
env: Mapping[str, str],
) -> Path | None:
if target_path is not None:
return target_path
configured_path = env.get("BIFROST_CONTRACT_PATH")
if configured_path is None:
return _DEFAULT_TARGET_PATH
stripped_path = configured_path.strip()
if not stripped_path:
return None
return Path(stripped_path)


def render_bifrost_delegation_contract(
*,
source_path: Path | None = None,
target_path: Path | None = None,
environ: Mapping[str, str] | None = None,
verify_endpoints: bool | None = None,
endpoint_probe: EndpointProbe | None = None,
) -> Path:
) -> Path | None:
"""Render the deployed Bifrost delegation contract and return its path."""
env = environ if environ is not None else os.environ
should_verify = (
Expand All @@ -342,9 +358,9 @@ def render_bifrost_delegation_contract(
probe = endpoint_probe or _probe_openai_model_endpoint
_source_env = env.get("BIFROST_SOURCE_CONTRACT_PATH", "").strip()
source = source_path or (Path(_source_env) if _source_env else _DEFAULT_SOURCE_PATH)
target = target_path or Path(
env.get("BIFROST_CONTRACT_PATH", str(_DEFAULT_TARGET_PATH))
)
target = _resolve_target_path(target_path=target_path, env=env)
if target is None:
return None

if not should_verify and _has_populated_endpoint(target):
_strip_render_hint_fields(target)
Expand Down Expand Up @@ -391,6 +407,12 @@ def render_bifrost_delegation_contract(

def main() -> int:
rendered = render_bifrost_delegation_contract()
if rendered is None:
sys.stdout.write(
"[entrypoint] Bifrost delegation contract rendering disabled: "
"BIFROST_CONTRACT_PATH is empty\n"
)
return 0
sys.stdout.write(f"[entrypoint] Bifrost delegation contract ready: {rendered}\n")
return 0

Expand Down
26 changes: 26 additions & 0 deletions tests/ci/test_ci_workflow_resilience.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,16 @@ def test_short_gates_can_disable_uv_cache_cleanup() -> None:
)
assert setup_step["with"]["cache-enabled"] == "false"

sibling_workflow = _load_yaml(
REPO_ROOT / ".github" / "workflows" / "check-sibling-compat.yml"
)
setup_step = next(
step
for step in sibling_workflow["jobs"]["sibling-compat"]["steps"]
if step.get("uses") == "./omnibase_infra/.github/actions/setup-python-uv"
)
assert setup_step["with"]["cache-enabled"] == "false"

docker_workflow = _load_yaml(DOCKER_BUILD_WORKFLOW)
docker_cache_step = next(
step
Expand All @@ -195,6 +205,22 @@ def test_short_gates_can_disable_uv_cache_cleanup() -> None:
assert docker_cache_step["uses"] == "actions/cache/restore@v5"


def test_cross_repo_ci_jobs_use_retrying_uv_install() -> None:
ci_workflow = _load_yaml(CI_WORKFLOW)
for job_name in ("topic-drift-check", "schema-handshake"):
steps = ci_workflow["jobs"][job_name]["steps"]
setup_step = next(
step
for step in steps
if step.get("uses") == "./omnibase_infra/.github/actions/setup-python-uv"
)

assert setup_step["with"]["cache-enabled"] == "false"
assert setup_step["with"]["working-directory"] == "omnibase_infra"
assert setup_step["with"].get("skip-install") != "true"
assert not any(step.get("run") == "uv sync --no-cache" for step in steps)


def test_setup_python_uv_retries_uv_sync_and_logs_transport_settings() -> None:
action = _load_yaml(SETUP_PYTHON_UV_ACTION)

Expand Down
8 changes: 8 additions & 0 deletions tests/ci/test_reusable_runtime_boot_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,14 @@ def test_boot_has_uv_setup_step(workflow: Workflow) -> None:
)


def test_boot_disables_uv_cache_cleanup(workflow: Workflow) -> None:
steps = _boot_steps(workflow)
setup_step = next(
s for s in steps if "astral-sh/setup-uv" in str(s.get("uses", ""))
)
assert setup_step["with"]["enable-cache"] is False


def test_boot_has_conditional_compose_bringup(workflow: Workflow) -> None:
steps = _boot_steps(workflow)
matched = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ async def test_discovery_marks_instance_surface_as_degraded(
projector: ProjectorShell,
reader: ProjectionReaderRegistration,
) -> None:
"""Discovery should explicitly mark post-Consul instance unavailability."""
"""Discovery should omit removed post-Consul instance fields."""
projection = _make_projection()

projection.last_applied_offset = _make_sequence(101).offset or 101
Expand All @@ -170,13 +170,11 @@ async def test_discovery_marks_instance_surface_as_degraded(

discovery = await service.get_discovery(limit=10, offset=0)

assert discovery.instance_discovery_status == "unavailable"
assert discovery.instance_discovery_message == (
"Service discovery not available (Consul removed)"
)
assert discovery.live_instances == []
assert not hasattr(discovery, "instance_discovery_status")
assert not hasattr(discovery, "instance_discovery_message")
assert not hasattr(discovery, "live_instances")
assert discovery.summary.total_nodes == 1
assert discovery.summary.active_nodes == 1
assert discovery.summary.healthy_instances == 0
assert discovery.summary.unhealthy_instances == 0
assert any(w.code == "NO_CONSUL_HANDLER" for w in discovery.warnings)
assert not hasattr(discovery.summary, "healthy_instances")
assert not hasattr(discovery.summary, "unhealthy_instances")
assert not any(w.code == "NO_CONSUL_HANDLER" for w in discovery.warnings)
8 changes: 4 additions & 4 deletions tests/integration/test_omnibase_spi_runtime_protocol_floor.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# SPDX-FileCopyrightText: 2025 OmniNode.ai Inc.
# SPDX-License-Identifier: MIT

"""Integration sentinel for the omnibase-spi 0.21.0 runtime protocol floor.
"""Integration sentinel for the omnibase-spi 0.22.0 runtime protocol floor.

OMN-10169 raises the dependency floor because runtime auto-wiring imports
``omnibase_spi.protocols.runtime``. The fallback compatibility matrix must
Expand Down Expand Up @@ -30,7 +30,7 @@ def _minimum_for(package: str, matrix: Sequence[VersionConstraint]) -> str:


@pytest.mark.integration
def test_omnibase_spi_runtime_protocols_match_0210_floor() -> None:
def test_omnibase_spi_runtime_protocols_match_0220_floor() -> None:
"""The declared and fallback SPI floors both expose runtime protocols."""
from omnibase_spi.protocols.runtime.protocol_handler_ownership_query import (
ProtocolHandlerOwnershipQuery,
Expand All @@ -39,7 +39,7 @@ def test_omnibase_spi_runtime_protocols_match_0210_floor() -> None:
ProtocolHandlerResolver,
)

assert _minimum_for("omnibase_spi", VERSION_MATRIX) == "0.21.0"
assert _minimum_for("omnibase_spi", _FALLBACK_MATRIX) == "0.21.0"
assert _minimum_for("omnibase_spi", VERSION_MATRIX) == "0.22.0"
assert _minimum_for("omnibase_spi", _FALLBACK_MATRIX) == "0.22.0"
assert hasattr(ProtocolHandlerResolver, "__class_getitem__")
assert hasattr(ProtocolHandlerOwnershipQuery, "__class_getitem__")
15 changes: 15 additions & 0 deletions tests/unit/runtime/test_render_bifrost_delegation_contract.py
Original file line number Diff line number Diff line change
Expand Up @@ -354,3 +354,18 @@ def test_empty_bifrost_source_env_uses_resolved_default(tmp_path: Path) -> None:
assert rendered == target
loaded = yaml.safe_load(target.read_text(encoding="utf-8"))
assert loaded["backends"][0]["endpoint_url"] == _http_url("coder.local:8000")


@pytest.mark.unit
def test_empty_bifrost_contract_path_disables_render(tmp_path: Path) -> None:
source = _source_contract(tmp_path / "source.yaml", required=True)
rendered = render_bifrost_delegation_contract(
source_path=source,
environ={
"BIFROST_CONTRACT_PATH": "",
"BIFROST_VERIFY_ENDPOINTS": "1",
},
endpoint_probe=lambda _url, _model, _timeout: "should not run",
)

assert rendered is None
2 changes: 1 addition & 1 deletion uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading