Commit b299e266 authored by Sergio Gimenez's avatar Sergio Gimenez
Browse files

Remove x_federation-correaltion id and cleanup redundant docstrings

parent 523daa97
Loading
Loading
Loading
Loading
+3 −6
Original line number Diff line number Diff line
@@ -36,7 +36,6 @@ partner_ops = Table(
    Index("idx_partner_ops_status", "status"),
)

# fm_db.federation_agreements (RD §K.1 / PM §J.1).
federation_agreements = Table(
    "federation_agreements",
    metadata,
@@ -55,13 +54,12 @@ federation_agreements = Table(
    Index("idx_federation_agreements_status_validity", "status", "valid_from", "valid_until"),
)

# fm_db.routing_rules (RD §K.1 / PM §J.1).
routing_rules = Table(
    "routing_rules",
    metadata,
    Column("id", PGUUID(as_uuid=True), primary_key=True, server_default=func.gen_random_uuid()),
    Column("partner_op_id", PGUUID(as_uuid=True), ForeignKey("partner_ops.id"), nullable=False),
    Column("identifier_type", String(20), nullable=False),  # msisdn_prefix | ip_cidr
    Column("identifier_type", String(20), nullable=False),
    Column("value_range", String(50), nullable=False),
    Column("priority", Integer, nullable=False, server_default="100"),
    Column("is_active", Boolean, nullable=False, server_default=text("true")),
@@ -73,18 +71,17 @@ routing_rules = Table(
    Index("idx_routing_rules_active", "is_active", postgresql_where=text("is_active = true")),
)

# fm_db.federation_transactions (RD §K.1 / PM §J.1).
federation_transactions = Table(
    "federation_transactions",
    metadata,
    Column("id", PGUUID(as_uuid=True), primary_key=True, server_default=func.gen_random_uuid()),
    Column("partner_op_id", PGUUID(as_uuid=True), ForeignKey("partner_ops.id"), nullable=False),
    Column("agreement_id", PGUUID(as_uuid=True), ForeignKey("federation_agreements.id")),
    Column("direction", String(10), nullable=False),  # inbound | outbound
    Column("direction", String(10), nullable=False),
    Column("federation_operation_id", PGUUID(as_uuid=True)),
    Column("operation_id", PGUUID(as_uuid=True)),
    Column("correlation_id", PGUUID(as_uuid=True)),
    Column("federation_correlation_id", String(255), nullable=False),
    Column("federation_correlation_id", String(255)),
    Column("api_type", String(100), nullable=False),
    Column("status", String(20), nullable=False, server_default="pending"),
    Column("request_summary", JSONB, nullable=False),
+1 −2
Original line number Diff line number Diff line
@@ -9,8 +9,7 @@ from federation_manager.domain.models import FederationTransaction


class PostgresTransactionRepo:
    """Audit rows commit immediately: they must survive whatever happens on the partner call."""

    # commits per call: audit rows must survive whatever happens on the partner call
    def __init__(self, session: AsyncSession) -> None:
        self._session = session

+2 −14
Original line number Diff line number Diff line
from uuid import UUID

import httpx

from federation_manager.domain.errors import (
@@ -19,24 +17,14 @@ class HttpxEwbiClient:
        self._client = client
        self._token_provider = token_provider

    async def post(
        self,
        partner: PartnerOP,
        path: str,
        payload: dict[str, object],
        federation_correlation_id: UUID,
    ) -> EwbiResponse:
    async def post(self, partner: PartnerOP, path: str, payload: dict[str, object]) -> EwbiResponse:
        url = self._url(partner, path)
        token = await self._token_provider.token_for(partner, scope="fed-mgmt")

        try:
            response = await self._client.post(
                url,
                headers={
                    "Accept": "application/json",
                    "Authorization": f"Bearer {token}",
                    "X-Federation-Correlation-ID": str(federation_correlation_id),
                },
                headers={"Accept": "application/json", "Authorization": f"Bearer {token}"},
                json=payload,
            )
        except httpx.HTTPError:
+1 −3
Original line number Diff line number Diff line
@@ -11,7 +11,7 @@ from federation_manager.dependencies import get_outbound_federation_service

router = APIRouter(prefix="/internal/federation", tags=["internal-federation"])

# Keep in sync with domain.ewbi.EWBI_SERVICE_PATHS (guarded by a test).
# mirrors domain.ewbi.EWBI_SERVICE_PATHS; a test keeps them in sync
ApiType = Literal[
    "edge-cloud-deploy",
    "edge-cloud-scale",
@@ -25,8 +25,6 @@ _E164 = re_compile(r"^\+[1-9][0-9]{4,14}$")


class OutboundFederationRequest(BaseModel):
    """OEG -> FM hand-off body (RD §L.3)."""

    model_config = ConfigDict(extra="forbid")

    api_type: ApiType
+0 −2
Original line number Diff line number Diff line
@@ -14,8 +14,6 @@ def _utcnow() -> datetime:


class AgreementChecker:
    """Validate a federation agreement before any inbound or outbound request (REQ-FED-05)."""

    def __init__(
        self,
        agreement_repo: AgreementRepositoryPort,
Loading