feat(state-hub): add Extension Points and Technical Debt tracking
New entity types (DB tables, API routers, Pydantic schemas, Alembic
migration a3f1c2d4e5b6):
- extension_points: ep_id, domain, title, ep_type, status, priority,
location, description, topic_id, workstream_id
- technical_debt: td_id, domain, title, debt_type, severity, status,
location, description, topic_id, workstream_id
MCP server: 6 new tools — register_extension_point, list_extension_points,
update_ep_status, register_technical_debt, list_technical_debt,
update_td_status (each write emits a progress_event)
Dashboard: two new pages (extensions.md, techdept.md) with KPI sidebar,
charts, urgent-items section, and filterable card lists. Both added to
nav in observablehq.config.js.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-27 07:29:51 +01:00
|
|
|
import enum
|
|
|
|
|
import uuid
|
|
|
|
|
|
2026-03-18 00:57:34 +01:00
|
|
|
from sqlalchemy import DateTime, Enum, ForeignKey, String, Text
|
feat(state-hub): add Extension Points and Technical Debt tracking
New entity types (DB tables, API routers, Pydantic schemas, Alembic
migration a3f1c2d4e5b6):
- extension_points: ep_id, domain, title, ep_type, status, priority,
location, description, topic_id, workstream_id
- technical_debt: td_id, domain, title, debt_type, severity, status,
location, description, topic_id, workstream_id
MCP server: 6 new tools — register_extension_point, list_extension_points,
update_ep_status, register_technical_debt, list_technical_debt,
update_td_status (each write emits a progress_event)
Dashboard: two new pages (extensions.md, techdept.md) with KPI sidebar,
charts, urgent-items section, and filterable card lists. Both added to
nav in observablehq.config.js.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-27 07:29:51 +01:00
|
|
|
from sqlalchemy.dialects.postgresql import UUID
|
|
|
|
|
from sqlalchemy.orm import Mapped, mapped_column, relationship
|
2026-03-18 00:57:34 +01:00
|
|
|
from sqlalchemy.sql import func
|
feat(state-hub): add Extension Points and Technical Debt tracking
New entity types (DB tables, API routers, Pydantic schemas, Alembic
migration a3f1c2d4e5b6):
- extension_points: ep_id, domain, title, ep_type, status, priority,
location, description, topic_id, workstream_id
- technical_debt: td_id, domain, title, debt_type, severity, status,
location, description, topic_id, workstream_id
MCP server: 6 new tools — register_extension_point, list_extension_points,
update_ep_status, register_technical_debt, list_technical_debt,
update_td_status (each write emits a progress_event)
Dashboard: two new pages (extensions.md, techdept.md) with KPI sidebar,
charts, urgent-items section, and filterable card lists. Both added to
nav in observablehq.config.js.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-27 07:29:51 +01:00
|
|
|
|
|
|
|
|
from api.models.base import Base, TimestampMixin, new_uuid
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class TDStatus(str, enum.Enum):
|
2026-03-18 00:57:34 +01:00
|
|
|
# Legacy general statuses
|
feat(state-hub): add Extension Points and Technical Debt tracking
New entity types (DB tables, API routers, Pydantic schemas, Alembic
migration a3f1c2d4e5b6):
- extension_points: ep_id, domain, title, ep_type, status, priority,
location, description, topic_id, workstream_id
- technical_debt: td_id, domain, title, debt_type, severity, status,
location, description, topic_id, workstream_id
MCP server: 6 new tools — register_extension_point, list_extension_points,
update_ep_status, register_technical_debt, list_technical_debt,
update_td_status (each write emits a progress_event)
Dashboard: two new pages (extensions.md, techdept.md) with KPI sidebar,
charts, urgent-items section, and filterable card lists. Both added to
nav in observablehq.config.js.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-27 07:29:51 +01:00
|
|
|
open = "open"
|
|
|
|
|
in_progress = "in_progress"
|
|
|
|
|
resolved = "resolved"
|
|
|
|
|
deferred = "deferred"
|
|
|
|
|
wont_fix = "wont_fix"
|
2026-03-18 00:57:34 +01:00
|
|
|
# Dashboard-improvement workflow steps
|
|
|
|
|
submitted = "submitted"
|
|
|
|
|
analyse = "analyse"
|
|
|
|
|
plan = "plan"
|
|
|
|
|
implement = "implement"
|
|
|
|
|
test = "test"
|
|
|
|
|
review = "review"
|
|
|
|
|
finished = "finished"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Ordered workflow steps for dashboard-improvement suggestions
|
|
|
|
|
SUGGESTION_STEPS = ["submitted", "analyse", "plan", "implement", "test", "review", "finished"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class TDNote(Base):
|
|
|
|
|
__tablename__ = "td_notes"
|
|
|
|
|
|
|
|
|
|
id: Mapped[uuid.UUID] = mapped_column(UUID(as_uuid=True), primary_key=True, default=new_uuid)
|
|
|
|
|
td_id: Mapped[uuid.UUID] = mapped_column(
|
|
|
|
|
UUID(as_uuid=True), ForeignKey("technical_debt.id", ondelete="CASCADE"),
|
|
|
|
|
nullable=False, index=True,
|
|
|
|
|
)
|
|
|
|
|
step: Mapped[str] = mapped_column(String(30), nullable=False)
|
|
|
|
|
author: Mapped[str | None] = mapped_column(String(100), nullable=True)
|
|
|
|
|
content: Mapped[str] = mapped_column(Text, nullable=False)
|
|
|
|
|
created_at: Mapped[DateTime] = mapped_column(
|
|
|
|
|
DateTime(timezone=True), server_default=func.now(), nullable=False
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
td: Mapped["TechnicalDebt"] = relationship("TechnicalDebt", back_populates="notes")
|
feat(state-hub): add Extension Points and Technical Debt tracking
New entity types (DB tables, API routers, Pydantic schemas, Alembic
migration a3f1c2d4e5b6):
- extension_points: ep_id, domain, title, ep_type, status, priority,
location, description, topic_id, workstream_id
- technical_debt: td_id, domain, title, debt_type, severity, status,
location, description, topic_id, workstream_id
MCP server: 6 new tools — register_extension_point, list_extension_points,
update_ep_status, register_technical_debt, list_technical_debt,
update_td_status (each write emits a progress_event)
Dashboard: two new pages (extensions.md, techdept.md) with KPI sidebar,
charts, urgent-items section, and filterable card lists. Both added to
nav in observablehq.config.js.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-27 07:29:51 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
class TechnicalDebt(Base, TimestampMixin):
|
|
|
|
|
__tablename__ = "technical_debt"
|
|
|
|
|
|
|
|
|
|
id: Mapped[uuid.UUID] = mapped_column(
|
|
|
|
|
UUID(as_uuid=True), primary_key=True, default=new_uuid
|
|
|
|
|
)
|
|
|
|
|
td_id: Mapped[str | None] = mapped_column(
|
|
|
|
|
String(30), nullable=True, unique=True, index=True
|
|
|
|
|
) # human-readable ref, e.g. TD-CUST-001
|
2026-03-02 23:39:17 +01:00
|
|
|
domain_id: Mapped[uuid.UUID] = mapped_column(
|
|
|
|
|
UUID(as_uuid=True),
|
|
|
|
|
ForeignKey("domains.id", ondelete="RESTRICT"),
|
|
|
|
|
nullable=False,
|
|
|
|
|
index=True,
|
|
|
|
|
)
|
feat(state-hub): add Extension Points and Technical Debt tracking
New entity types (DB tables, API routers, Pydantic schemas, Alembic
migration a3f1c2d4e5b6):
- extension_points: ep_id, domain, title, ep_type, status, priority,
location, description, topic_id, workstream_id
- technical_debt: td_id, domain, title, debt_type, severity, status,
location, description, topic_id, workstream_id
MCP server: 6 new tools — register_extension_point, list_extension_points,
update_ep_status, register_technical_debt, list_technical_debt,
update_td_status (each write emits a progress_event)
Dashboard: two new pages (extensions.md, techdept.md) with KPI sidebar,
charts, urgent-items section, and filterable card lists. Both added to
nav in observablehq.config.js.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-27 07:29:51 +01:00
|
|
|
title: Mapped[str] = mapped_column(String(255), nullable=False)
|
|
|
|
|
description: Mapped[str | None] = mapped_column(Text, nullable=True)
|
|
|
|
|
location: Mapped[str | None] = mapped_column(String(500), nullable=True)
|
|
|
|
|
debt_type: Mapped[str] = mapped_column(
|
|
|
|
|
String(50), nullable=False, default="other"
|
|
|
|
|
) # design | implementation | test | docs | dependencies | performance | security | other
|
|
|
|
|
severity: Mapped[str] = mapped_column(String(20), nullable=False, default="medium")
|
|
|
|
|
status: Mapped[TDStatus] = mapped_column(
|
|
|
|
|
Enum(TDStatus, name="tdstatus"), nullable=False, default=TDStatus.open
|
|
|
|
|
)
|
|
|
|
|
topic_id: Mapped[uuid.UUID | None] = mapped_column(
|
|
|
|
|
UUID(as_uuid=True), ForeignKey("topics.id", ondelete="SET NULL"), nullable=True
|
|
|
|
|
)
|
2026-06-22 13:52:13 +02:00
|
|
|
workplan_id: Mapped[uuid.UUID | None] = mapped_column(
|
2026-08-22 00:27:48 +02:00
|
|
|
UUID(as_uuid=True),
|
|
|
|
|
ForeignKey("workplans.id", ondelete="SET NULL", onupdate="CASCADE"),
|
|
|
|
|
nullable=True,
|
feat(state-hub): add Extension Points and Technical Debt tracking
New entity types (DB tables, API routers, Pydantic schemas, Alembic
migration a3f1c2d4e5b6):
- extension_points: ep_id, domain, title, ep_type, status, priority,
location, description, topic_id, workstream_id
- technical_debt: td_id, domain, title, debt_type, severity, status,
location, description, topic_id, workstream_id
MCP server: 6 new tools — register_extension_point, list_extension_points,
update_ep_status, register_technical_debt, list_technical_debt,
update_td_status (each write emits a progress_event)
Dashboard: two new pages (extensions.md, techdept.md) with KPI sidebar,
charts, urgent-items section, and filterable card lists. Both added to
nav in observablehq.config.js.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-27 07:29:51 +01:00
|
|
|
)
|
|
|
|
|
|
2026-03-02 23:39:17 +01:00
|
|
|
domain: Mapped["Domain"] = relationship("Domain", lazy="selectin") # noqa: F821
|
feat(state-hub): add Extension Points and Technical Debt tracking
New entity types (DB tables, API routers, Pydantic schemas, Alembic
migration a3f1c2d4e5b6):
- extension_points: ep_id, domain, title, ep_type, status, priority,
location, description, topic_id, workstream_id
- technical_debt: td_id, domain, title, debt_type, severity, status,
location, description, topic_id, workstream_id
MCP server: 6 new tools — register_extension_point, list_extension_points,
update_ep_status, register_technical_debt, list_technical_debt,
update_td_status (each write emits a progress_event)
Dashboard: two new pages (extensions.md, techdept.md) with KPI sidebar,
charts, urgent-items section, and filterable card lists. Both added to
nav in observablehq.config.js.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-27 07:29:51 +01:00
|
|
|
topic: Mapped["Topic"] = relationship("Topic", lazy="selectin") # noqa: F821
|
2026-06-22 13:52:13 +02:00
|
|
|
workplan: Mapped["Workplan"] = relationship("Workplan", lazy="selectin") # noqa: F821
|
2026-03-18 00:57:34 +01:00
|
|
|
notes: Mapped[list["TDNote"]] = relationship(
|
|
|
|
|
"TDNote", back_populates="td", lazy="selectin",
|
|
|
|
|
order_by="TDNote.created_at",
|
|
|
|
|
)
|
2026-03-02 23:39:17 +01:00
|
|
|
|
|
|
|
|
@property
|
|
|
|
|
def domain_slug(self) -> str:
|
|
|
|
|
return self.domain.slug if self.domain is not None else ""
|