fix Fabric authority import compatibility
Assistant: codex Assistant-Model: gpt-5.6-sol Assistant-Session: 01a053ff-1d6f-7fe2-ac1c-a6eb40a42a0c
This commit is contained in:
parent
903a2fb090
commit
cf40c7bb4e
5 changed files with 87 additions and 4 deletions
|
|
@ -23,7 +23,7 @@ class FabricGraphImport(Base, TimestampMixin):
|
|||
)
|
||||
source_repo_slug: Mapped[str] = mapped_column(String(100), nullable=False, index=True)
|
||||
source_url: Mapped[str | None] = mapped_column(Text, nullable=True)
|
||||
source_commit: Mapped[str | None] = mapped_column(String(80), nullable=True, index=True)
|
||||
source_commit: Mapped[str | None] = mapped_column(String(255), nullable=True, index=True)
|
||||
source_path: Mapped[str | None] = mapped_column(Text, nullable=True)
|
||||
api_version: Mapped[str | None] = mapped_column(String(100), nullable=True)
|
||||
schema_version: Mapped[str | None] = mapped_column(String(100), nullable=True, index=True)
|
||||
|
|
|
|||
|
|
@ -27,7 +27,10 @@ class FabricGraphSource(BaseModel):
|
|||
repo: str | None = None
|
||||
producer: str | None = None
|
||||
registry: str | None = None
|
||||
commit: str | None = None
|
||||
# Accepted-snapshot-set revisions include the algorithm and digest, for
|
||||
# example ``snapshot-set:sha256:<64 hex chars>``. They are intentionally
|
||||
# longer than a Git SHA but still bounded before persistence.
|
||||
commit: str | None = Field(default=None, max_length=255)
|
||||
path: str | None = None
|
||||
generation_reason: str | None = None
|
||||
|
||||
|
|
@ -98,6 +101,18 @@ class FabricGraphAccountingPayload(BaseModel):
|
|||
valid_until: str | None = None
|
||||
|
||||
|
||||
class FabricGraphDeploymentOverlayPayload(BaseModel):
|
||||
model_config = ConfigDict(extra="forbid")
|
||||
|
||||
deployment_environment: str | None = None
|
||||
deployment_scenario: str | None = None
|
||||
routing_authority: str | None = None
|
||||
access_zone: str | None = None
|
||||
policy_authority: str | None = None
|
||||
exposure_class: str | None = None
|
||||
route_evidence: dict[str, str | int | float | bool | None] = Field(default_factory=dict)
|
||||
|
||||
|
||||
class FabricGraphEvidencePayload(BaseModel):
|
||||
model_config = ConfigDict(extra="forbid")
|
||||
|
||||
|
|
@ -154,6 +169,7 @@ class FabricGraphNodePayload(BaseModel):
|
|||
containment: FabricGraphContainmentPayload | None = None
|
||||
ownership: FabricGraphOwnershipPayload | None = None
|
||||
accounting: FabricGraphAccountingPayload | None = None
|
||||
deployment_overlay: FabricGraphDeploymentOverlayPayload | None = None
|
||||
evidence: FabricGraphEvidencePayload | None = None
|
||||
canon_category: str | None = None
|
||||
canon_anchor: str | None = None
|
||||
|
|
@ -180,6 +196,7 @@ class FabricGraphEdgePayload(BaseModel):
|
|||
boundary: FabricGraphBoundaryPayload | None = None
|
||||
utility: FabricGraphUtilityPayload | None = None
|
||||
accounting: FabricGraphAccountingPayload | None = None
|
||||
deployment_overlay: FabricGraphDeploymentOverlayPayload | None = None
|
||||
evidence: FabricGraphEvidencePayload | None = None
|
||||
attributes: dict[str, Any] = Field(default_factory=dict)
|
||||
|
||||
|
|
|
|||
|
|
@ -324,7 +324,10 @@ async def _record_invalid_import(
|
|||
import_run = FabricGraphImport(
|
||||
source_repo_slug=source_repo_slug,
|
||||
source_url=source_url,
|
||||
source_commit=_source_value(payload, "commit"),
|
||||
# Invalid payloads are retained for diagnostics, but their
|
||||
# denormalized provenance must not make the rejection path fail.
|
||||
# The complete input remains available in ``graph_json``.
|
||||
source_commit=_bounded_source_value(payload, "commit", max_length=255),
|
||||
source_path=_source_value(payload, "path"),
|
||||
api_version=str(payload.get("apiVersion")) if payload.get("apiVersion") else None,
|
||||
export_kind=str(payload.get("kind")) if payload.get("kind") else None,
|
||||
|
|
@ -620,6 +623,13 @@ def _source_value(payload: dict[str, Any], field: str) -> str | None:
|
|||
return str(value) if value else None
|
||||
|
||||
|
||||
def _bounded_source_value(
|
||||
payload: dict[str, Any], field: str, *, max_length: int
|
||||
) -> str | None:
|
||||
value = _source_value(payload, field)
|
||||
return value[:max_length] if value is not None else None
|
||||
|
||||
|
||||
def _parse_datetime(value: Any) -> datetime | None:
|
||||
if not isinstance(value, str) or not value:
|
||||
return None
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue