Some checks failed
- Integrate GPU scoring inline into reasoning/multi_path.py (auto-uses GPU when available) - Integrate GPU deduplication into multi_agent/consensus_engine.py - Add semantic_search() method to memory/semantic_graph.py with GPU acceleration - Integrate GPU training into self_improvement/training.py AutoTrainer - Fix all 758 ruff lint issues (whitespace, import sorting, unused imports, ambiguous vars, undefined names) - Fix all 40 mypy type errors across the codebase (no-any-return, union-attr, arg-type, etc.) - Fix deprecated ruff config keys (select/ignore -> [tool.ruff.lint]) - Add .dockerignore to exclude .venv/, tests/, docs/ from Docker builds - Add type hints and docstrings to verification/outcome.py - Fix E402 import ordering in witness_agent.py - Fix F821 undefined names in vector_pgvector.py and native.py - Fix E741 ambiguous variable names in reflective.py and recommender.py All 276 tests pass. 0 ruff errors. 0 mypy errors. Co-Authored-By: Nakamoto, S <defi@defi-oracle.io>
79 lines
2.9 KiB
Python
79 lines
2.9 KiB
Python
"""Manufacturing Proof Certificate schema: decision lineage, simulation proof, process, machine, risk."""
|
|
|
|
from typing import Any
|
|
|
|
from pydantic import BaseModel, Field
|
|
|
|
|
|
class MPCId(BaseModel):
|
|
"""Immutable MPC identifier: content-addressed or versioned."""
|
|
|
|
value: str = Field(..., description="Unique MPC id (e.g. hash or versioned id)")
|
|
version: int = Field(default=1, description="Certificate version")
|
|
|
|
def __str__(self) -> str:
|
|
return f"{self.value}@v{self.version}"
|
|
|
|
|
|
class DecisionLineageEntry(BaseModel):
|
|
"""Single entry in decision lineage."""
|
|
|
|
node_id: str = Field(..., description="DLT or decision node id")
|
|
family: str = Field(..., description="DLT family: INT, GEO, PHY, PROC, MACH")
|
|
evidence_ref: str | None = Field(default=None, description="Reference to evidence artifact")
|
|
outcome: str = Field(..., description="Outcome: pass, fail_closed, etc.")
|
|
|
|
|
|
class SimulationProof(BaseModel):
|
|
"""Binding simulation proof reference."""
|
|
|
|
proof_id: str = Field(..., description="Proof artifact id")
|
|
governing_equations: str | None = Field(default=None)
|
|
boundary_conditions_ref: str | None = Field(default=None)
|
|
safety_factor: float | None = Field(default=None)
|
|
failure_modes_covered: list[str] = Field(default_factory=list)
|
|
|
|
|
|
class ProcessJustification(BaseModel):
|
|
"""Process eligibility justification."""
|
|
|
|
process_type: str = Field(..., description="additive, subtractive, hybrid")
|
|
eligible: bool = Field(...)
|
|
checks_ref: str | None = Field(default=None)
|
|
tool_access: bool | None = None
|
|
thermal_distortion: bool | None = None
|
|
overhangs: bool | None = None
|
|
datum_survivability: bool | None = None
|
|
|
|
|
|
class MachineDeclaration(BaseModel):
|
|
"""Machine binding declaration."""
|
|
|
|
machine_id: str = Field(..., description="Bound machine id")
|
|
profile_ref: str | None = Field(default=None)
|
|
limits_ref: str | None = Field(default=None)
|
|
deviation_model_ref: str | None = Field(default=None)
|
|
|
|
|
|
class RiskRegisterEntry(BaseModel):
|
|
"""Single risk register entry."""
|
|
|
|
risk_id: str = Field(...)
|
|
description: str = Field(...)
|
|
severity: str = Field(..., description="e.g. low, medium, high")
|
|
mitigation_ref: str | None = Field(default=None)
|
|
|
|
|
|
class ManufacturingProofCertificate(BaseModel):
|
|
"""Manufacturing Proof Certificate: immutable, versioned; required for manufacturing execution."""
|
|
|
|
mpc_id: MPCId = Field(..., description="Certificate identifier")
|
|
decision_lineage: list[DecisionLineageEntry] = Field(default_factory=list)
|
|
simulation_proof: SimulationProof | None = Field(default=None)
|
|
process_justification: ProcessJustification | None = Field(default=None)
|
|
machine_declaration: MachineDeclaration | None = Field(default=None)
|
|
risk_register: list[RiskRegisterEntry] = Field(default_factory=list)
|
|
metadata: dict[str, Any] = Field(default_factory=dict)
|
|
|
|
model_config = {"frozen": True}
|