generated from coulomb/repo-seed
Replace the ad-hoc coordination-domain spine with the Repo Classification Standard: 14 market domains, classification columns on managed_repos, and workplans anchored by repo_id (topic_id optional). - Add Alembic migration d8e9f0a1b2c3 with data backfill and workstream→workplan rename - Add api/classification.py validation and register-from-classification tooling - Expose workplan-first REST/MCP surface with legacy workstream aliases - Add C-24 consistency rule and legacy domain frontmatter mapping - Update dashboard repos page with category/capability/stake filters - Update orientation docs; mark STATE-WP-0065 finished
95 lines
3.0 KiB
Python
95 lines
3.0 KiB
Python
import uuid
|
|
from datetime import datetime
|
|
|
|
from pydantic import AliasChoices, BaseModel, ConfigDict, Field, computed_field
|
|
|
|
from hub_core.schemas.capability import (
|
|
CapabilityRequestDispute,
|
|
CapabilityRequestStatusPatch,
|
|
CatalogCreate,
|
|
CatalogPatch,
|
|
CatalogRead,
|
|
)
|
|
|
|
|
|
# ---------------------------------------------------------------------------
|
|
# Capability Request schemas
|
|
# ---------------------------------------------------------------------------
|
|
|
|
class CapabilityRequestCreate(BaseModel):
|
|
title: str
|
|
description: str | None = None
|
|
capability_type: str
|
|
priority: str = "medium"
|
|
requesting_domain: str # slug, resolved to domain_id in router
|
|
requesting_agent: str
|
|
requesting_workplan_id: uuid.UUID | None = Field(
|
|
default=None,
|
|
validation_alias=AliasChoices("requesting_workplan_id", "requesting_workstream_id"),
|
|
)
|
|
blocking_task_id: uuid.UUID | None = None
|
|
|
|
|
|
class CapabilityRequestAccept(BaseModel):
|
|
fulfilling_agent: str
|
|
fulfilling_workplan_id: uuid.UUID | None = Field(
|
|
default=None,
|
|
validation_alias=AliasChoices("fulfilling_workplan_id", "fulfilling_workstream_id"),
|
|
)
|
|
|
|
|
|
class CapabilityRequestPatch(BaseModel):
|
|
catalog_entry_id: uuid.UUID | None = None
|
|
priority: str | None = None
|
|
blocking_task_id: uuid.UUID | None = None
|
|
fulfilling_workplan_id: uuid.UUID | None = Field(
|
|
default=None,
|
|
validation_alias=AliasChoices("fulfilling_workplan_id", "fulfilling_workstream_id"),
|
|
)
|
|
|
|
|
|
class CapabilityRequestReroute(BaseModel):
|
|
note: str
|
|
rerouted_by: str
|
|
domain: str | None = None # slug — used if catalog_entry_id not given
|
|
catalog_entry_id: uuid.UUID | None = None # preferred: re-derives domain
|
|
|
|
|
|
class CapabilityRequestRead(BaseModel):
|
|
model_config = ConfigDict(from_attributes=True)
|
|
|
|
id: uuid.UUID
|
|
title: str
|
|
description: str | None = None
|
|
capability_type: str
|
|
priority: str
|
|
status: str
|
|
requesting_domain_slug: str
|
|
requesting_agent: str
|
|
requesting_workplan_id: uuid.UUID | None = None
|
|
fulfilling_domain_slug: str | None = None
|
|
fulfilling_agent: str | None = None
|
|
fulfilling_workplan_id: uuid.UUID | None = None
|
|
blocking_task_id: uuid.UUID | None = None
|
|
catalog_entry_id: uuid.UUID | None = None
|
|
resolution_note: str | None = None
|
|
routing_note: str | None = None
|
|
dispute_reason: str | None = None
|
|
disputed_by: str | None = None
|
|
dispute_suggested_domain: str | None = None
|
|
disputed_at: datetime | None = None
|
|
accepted_at: datetime | None = None
|
|
completed_at: datetime | None = None
|
|
created_at: datetime
|
|
updated_at: datetime
|
|
|
|
@computed_field # type: ignore[prop-decorator]
|
|
@property
|
|
def requesting_workstream_id(self) -> uuid.UUID | None:
|
|
return self.requesting_workplan_id
|
|
|
|
@computed_field # type: ignore[prop-decorator]
|
|
@property
|
|
def fulfilling_workstream_id(self) -> uuid.UUID | None:
|
|
return self.fulfilling_workplan_id
|