Skip to content
Draft
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
Empty file removed application
Empty file.
8 changes: 4 additions & 4 deletions docs/02-architecture/generated/module-dependency-map.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"summary": {
"scanned_modules": 1947,
"total_internal_imports": 7697,
"total_internal_imports": 7698,
"layer_edges": 13,
"cross_layer_group_edges": 60,
"cross_layer_group_edges_total": 330,
"violations": 0,
"source_fingerprint": "b95d700be542d6171fe3d5e1dff5df0d020d8352626bdaf7c63638f61c4fbbe9"
"source_fingerprint": "65812f7c9b0d268bdf97a7966535ffae61d04808363fa1d00a86f6736980fba2"
},
"layer_edges": [
{
Expand All @@ -18,7 +18,7 @@
{
"source": "application",
"target": "domain",
"imports": 1154,
"imports": 1155,
"allowed": true
},
{
Expand Down Expand Up @@ -122,7 +122,7 @@
{
"source": "application.services",
"target": "domain.control_plane",
"imports": 75
"imports": 76
},
{
"source": "application.composite",
Expand Down
8 changes: 4 additions & 4 deletions docs/02-architecture/generated/module-dependency-map.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
## Summary

- Scanned modules: `1947`
- Internal import edges (raw): `7697`
- Internal import edges (raw): `7698`
- Aggregated layer edges: `13`
- Layer policy violations: `0`
- Cross-layer module-group edges (total): `330`
Expand All @@ -22,7 +22,7 @@ flowchart LR
composition[composition]
interfaces[interfaces]
application -->|1319 OK| application
application -->|1154 OK| domain
application -->|1155 OK| domain
composition -->|287 OK| application
composition -->|689 OK| composition
composition -->|445 OK| domain
Expand All @@ -41,7 +41,7 @@ flowchart LR
| From | To | Imports | Policy |
| ---------------- | ---------------- | ------: | ------- |
| `application` | `application` | 1319 | allowed |
| `application` | `domain` | 1154 | allowed |
| `application` | `domain` | 1155 | allowed |
| `composition` | `application` | 287 | allowed |
| `composition` | `composition` | 689 | allowed |
| `composition` | `domain` | 445 | allowed |
Expand All @@ -64,7 +64,7 @@ flowchart LR
| `infrastructure.adapters` | `domain.ports` | 88 |
| `application.pipelines` | `domain.types` | 82 |
| `application.core` | `domain.ports` | 78 |
| `application.services` | `domain.control_plane` | 75 |
| `application.services` | `domain.control_plane` | 76 |
| `application.composite` | `domain.ports` | 74 |
| `application.services` | `domain.ports` | 73 |
| `infrastructure.storage` | `domain.types` | 69 |
Expand Down
Empty file removed domain
Empty file.
Binary file not shown.
Binary file not shown.
11 changes: 5 additions & 6 deletions src/bioetl/application/pipelines/chembl/target_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,7 @@ def project_component_xrefs(cls, xrefs: list[JsonDict]) -> dict[str, str]:
)

return {
column: cls.pipe_or_unknown(values)
for column, values in buckets.items()
column: cls.pipe_or_unknown(values) for column, values in buckets.items()
}

@classmethod
Expand Down Expand Up @@ -178,7 +177,9 @@ def synonym_target_field(syn_type: object) -> str | None:
if normalized_type == "EC_NUMBER":
return "target_ec_numbers"

if normalized_type == "GENE_SYMBOL" or normalized_type.startswith("GENE_SYMBOL_"):
if normalized_type == "GENE_SYMBOL" or normalized_type.startswith(
"GENE_SYMBOL_"
):
return "target_gene_synonyms"

return None
Expand Down Expand Up @@ -266,9 +267,7 @@ def project_component_synonyms(
"target_gene_synonyms": cls.pipe_or_unknown(
buckets["target_gene_synonyms"]
),
"target_ec_numbers": cls.pipe_or_unknown(
buckets["target_ec_numbers"]
),
"target_ec_numbers": cls.pipe_or_unknown(buckets["target_ec_numbers"]),
}


Expand Down
16 changes: 4 additions & 12 deletions src/bioetl/application/pipelines/chembl/target_transformer.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,7 @@ def _extract_business_data(
# Extract primary component_id (first element) for enricher join key
component_ids = flattened_components.get("component_ids")
primary_component_id = component_ids[0] if component_ids else None
projected_synonyms = SynonymHelper.project_component_synonyms(
target_components
)
projected_synonyms = SynonymHelper.project_component_synonyms(target_components)
component_xrefs = XrefHelper.collect_component_xrefs(target_components)
xref_projection = XrefHelper.project_component_xrefs(component_xrefs)

Expand Down Expand Up @@ -163,15 +161,9 @@ def _extract_business_data(
if component_xrefs
else None,
"target_xref_pdb_ids": xref_projection["target_xref_pdb_ids"],
"target_xref_go_component": xref_projection[
"target_xref_go_component"
],
"target_xref_go_function": xref_projection[
"target_xref_go_function"
],
"target_xref_go_process": xref_projection[
"target_xref_go_process"
],
"target_xref_go_component": xref_projection["target_xref_go_component"],
"target_xref_go_function": xref_projection["target_xref_go_function"],
"target_xref_go_process": xref_projection["target_xref_go_process"],
"target_xref_reactome_ids": xref_projection["target_xref_reactome_ids"],
# Flattened components
**serialized_flattened_components,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,14 @@ async def _write_delete_impl(
request: _DeltaWriteRequest,
) -> None:
"""Write data in delete mode (overwrite table)."""
policy = getattr(
host,
"_merge_resilience_policy",
DEFAULT_SILVER_MERGE_POLICY,
) or DEFAULT_SILVER_MERGE_POLICY
policy = (
getattr(
host,
"_merge_resilience_policy",
DEFAULT_SILVER_MERGE_POLICY,
)
or DEFAULT_SILVER_MERGE_POLICY
)
await _write_plain_delta_request(
load_module=host._load_silver_writer_module,
request=request,
Expand All @@ -122,11 +125,14 @@ async def _write_append_impl(
request: _DeltaWriteRequest,
) -> None:
"""Write data in append mode."""
policy = getattr(
host,
"_merge_resilience_policy",
DEFAULT_SILVER_MERGE_POLICY,
) or DEFAULT_SILVER_MERGE_POLICY
policy = (
getattr(
host,
"_merge_resilience_policy",
DEFAULT_SILVER_MERGE_POLICY,
)
or DEFAULT_SILVER_MERGE_POLICY
)
await _write_plain_delta_request(
load_module=host._load_silver_writer_module,
request=request,
Expand Down
2 changes: 1 addition & 1 deletion src/memory/validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
from typing import Any

from memory.notes import (
NOTE_READ_TIMEOUT_SECONDS,
extract_markdown_headings,
normalize_text_key,
parse_markdown_note,
parse_markdown_note_metadata,
NOTE_READ_TIMEOUT_SECONDS,
)
from memory.resources import (
CATALOG_DIR,
Expand Down
2 changes: 0 additions & 2 deletions tests/architecture/test_adapter_contracts.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,11 @@
import shutil
import subprocess
from concurrent.futures import ThreadPoolExecutor
from importlib import import_module
from pathlib import Path
from unittest.mock import AsyncMock, MagicMock

import pytest

from bioetl.domain.ports import FilterableDataSourcePort

ADAPTER_MIXIN_CANONICAL_FILES = frozenset(
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,9 @@ def _run_command_with_stdout_file(
start_time = time.time() # Reset for kill timeout
if killed and (time.time() - start_time > kill_timeout):
process.terminate()
raise OSError(f"Command timed out after {timeout}s and failed to terminate: {' '.join(command)}")
raise OSError(
f"Command timed out after {timeout}s and failed to terminate: {' '.join(command)}"
)
time.sleep(poll_interval)

completed = subprocess.CompletedProcess(
Expand Down
8 changes: 4 additions & 4 deletions tests/architecture/test_composite_dq_externalization.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,10 +113,10 @@ def test_external_composite_dq_bundle_is_not_threshold_only(
f"Composite DQ config must declare non-empty required_fields: {external_path}"
)
assert (
isinstance(field_validations, list)
and field_validations
or isinstance(cross_field_validations, list)
and cross_field_validations
(isinstance(field_validations, list)
and field_validations)
or (isinstance(cross_field_validations, list)
and cross_field_validations)
), (
"Composite DQ config must declare field or cross-field validation "
f"bundles: {external_path}"
Expand Down
16 changes: 7 additions & 9 deletions tests/architecture/test_deprecation_warnings.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@ def test_deprecation_warning_ignores_are_not_hidden_in_test_modules() -> None:

def test_runner_assembly_has_no_deprecated_fsm_bootstrap_warning() -> None:
"""Composite runner assembly should require explicit FSM helper injection."""
source = (ROOT / Path(
"src/bioetl/composition/bootstrap/runtime/runner_assembly.py"
)).read_text(encoding="utf-8")
source = (
ROOT / Path("src/bioetl/composition/bootstrap/runtime/runner_assembly.py")
).read_text(encoding="utf-8")
assert (
"Creating CompositePipelineRunner without fsm_state_helper is deprecated"
not in source
Expand All @@ -66,14 +66,12 @@ def test_runner_assembly_has_no_deprecated_fsm_bootstrap_warning() -> None:

def test_composite_application_services_do_not_reintroduce_legacy_aliases() -> None:
"""Composite application helpers should expose canonical service names only."""
fsm_source = (ROOT / Path("src/bioetl/application/composite/fsm_helper.py")).read_text(
encoding="utf-8"
)
fsm_source = (
ROOT / Path("src/bioetl/application/composite/fsm_helper.py")
).read_text(encoding="utf-8")
dedup_source = (
ROOT / Path("src/bioetl/application/composite/deduplication.py")
).read_text(
encoding="utf-8"
)
).read_text(encoding="utf-8")

assert "class FSMStateHelper(" not in fsm_source
assert '"FSMStateHelper"' not in fsm_source
Expand Down
2 changes: 1 addition & 1 deletion tests/helpers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
"assert_check_artifacts_passes_for_fresh_outputs",
"assert_cli_succeeded",
"assert_process_succeeded",
"assert_router_python_command",
"assert_repeated_core_output_bytes_are_stable",
"assert_router_python_command",
"assert_written_core_artifacts_are_deterministic",
"repo_root",
"run_main_in_process",
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/_consolidation_suite_support.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def patch_quarantine_adapter_for_cached_fixture_replay(
) -> None:
"""Avoid quarantine-delta side effects during cached fixture replays."""

async def _write_many_without_delta(self, records): # noqa: ANN001
async def _write_many_without_delta(self, records):
stored = getattr(self, "_test_quarantine_records", [])
stored.extend([self._normalize_record(record) for record in records])
self._test_quarantine_records = stored
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/ci/reproducibility_contract_support.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def __init__(self) -> None:
self._items: dict[str, list[object]] = {}

def append(self, entry: object) -> None:
manifest_id = getattr(entry, "manifest_id")
manifest_id = entry.manifest_id
self._items.setdefault(manifest_id, []).append(entry)

def list_entries(self, manifest_id: str) -> tuple[object, ...]:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,19 @@ def _stable_manifest_payload(payload: dict) -> dict:
"replay_capability": payload.get("replay_capability"),
"launch_context": {
key: payload.get("launch_context", {}).get(key)
for key in ("exact_replay", "execution_context", "required_persistence_profile")
for key in (
"exact_replay",
"execution_context",
"required_persistence_profile",
)
},
"runtime_config": {
key: payload.get("runtime_config", {}).get(key)
for key in ("exact_replay", "execution_context", "required_persistence_profile")
for key in (
"exact_replay",
"execution_context",
"required_persistence_profile",
)
},
"code_provenance": {
"contract_ref": payload["code_provenance"]["contract_ref"],
Expand Down Expand Up @@ -65,8 +73,15 @@ async def test_consolidation_determinism_replay_guard(
tmp_path: Path,
monkeypatch: pytest.MonkeyPatch,
) -> None:
first_manifest, second_manifest, first_effective, second_effective, first_run_id, second_run_id = (
await run_tracked_fixture_replay_pair(tmp_path=tmp_path, monkeypatch=monkeypatch)
(
first_manifest,
second_manifest,
first_effective,
second_effective,
first_run_id,
second_run_id,
) = await run_tracked_fixture_replay_pair(
tmp_path=tmp_path, monkeypatch=monkeypatch
)

assert first_manifest["run_id"] != second_manifest["run_id"]
Expand All @@ -76,7 +91,10 @@ async def test_consolidation_determinism_replay_guard(

assert first_manifest["replay_capability"] == "exact_replay_supported"
assert second_manifest["replay_capability"] == "exact_replay_supported"
assert first_manifest["execution_fingerprint"] == second_manifest["execution_fingerprint"]
assert (
first_manifest["execution_fingerprint"]
== second_manifest["execution_fingerprint"]
)
assert first_manifest["launch_context"]["exact_replay"] is True
assert second_manifest["launch_context"]["exact_replay"] is True

Expand All @@ -98,9 +116,9 @@ async def test_consolidation_determinism_replay_guard(
first_manifest["code_provenance"]["dq_contract_compatibility_hash"]
== second_manifest["code_provenance"]["dq_contract_compatibility_hash"]
)
assert _canonical_manifest_fingerprint(first_manifest) == _canonical_manifest_fingerprint(
second_manifest
)
assert _canonical_manifest_fingerprint(
first_manifest
) == _canonical_manifest_fingerprint(second_manifest)
assert first_effective["artifact_id"] == second_effective["artifact_id"]

evidence_dir = tmp_path / "reports" / "reproducibility"
Expand Down
Loading
Loading