Files
5612375cba Feat/v0.13.0 (#270)
* feat(release): add release-manager feature flag (default off)

* feat(release): change classification + semver-bump derivation

* feat(release): readiness audit (changelog/version-ref/docs/migration/gate)

* feat(release): release-manager engine proposes a gated release

* feat(release): fail-closed release executor (bump, gate, publish)

* feat(release): CEO approve/reject release-proposal surface

* docs(release): document the gated release manager

* feat(memory): add org-memory feature flags (default off)

* feat(memory): add playbooks table + status enum + migration

* feat(memory): playbook service with auditor curation transitions

* feat(memory): playbooks RAG index plugin

* feat(memory): index a playbook into RAG on approval

* feat(memory): distill a high-signal lesson at task completion

* feat(memory): keep private journal reflections out of the shared RAG corpus

* feat(memory): draft_playbook verb + auditor curation verbs

* fix(ci): resolve mypy tests/ errors blocking the gate (UUID casts, annotations)

* feat(memory): auto-inject similar lessons/playbooks into the briefing

* feat(memory): auditor playbook review queue (api + panel)

* docs(memory): document the org-memory loop + playbook verbs

* fix(provisioning): idempotent pitch provisioning (reuse product/project by slug on re-approval)

* fix(memory): add chunks_playbooks to the chunk schema + isolate release route tests

- Migration 030's CHUNK_TABLES was missing chunks_playbooks, breaking the
  IndexType<->migration parity guard once the PLAYBOOKS index landed. The
  upgrade is ALTER ... IF EXISTS so adding it is safe on any DB shape.
- The release-route fixture's approve/reject paths call db.commit() (real
  behavior), so a held proposal outlived the per-test rollback and leaked
  into engine tests that read the global list_open_release_proposals().
  Tear down source=release_manager rows after each test.
- Make the gather_snapshot real-repo smoke version-agnostic (semver match)
  so it stops pinning the literal repo version.

* chore(release): 0.13.0

* ++

---------

Co-authored-by: Renn F <rennf93@users.noreply.github.com>
2026-06-26 01:43:08 +02:00

68 lines
2.4 KiB
Python

"""Add the playbooks table — curated, Auditor-approved reusable procedures.
A playbook records "here is how to do X" (vs a learning's "this happened"). An
agent drafts one (status=draft); the Auditor approves it (status=approved) and
only then is it embedded into the PLAYBOOKS RAG index. Orthogonal to the task
lifecycle. Status is a plain String column (the PlaybookStatus StrEnum carries
the valid values at the service layer), matching the pitches convention — so no
DB enum type and no enum-parity migration are needed.
Revision ID: 050_playbooks
Revises: 049_dep_update_project_cols
Create Date: 2026-06-25
"""
from __future__ import annotations
import sqlalchemy as sa
from alembic import op
revision = "050_playbooks"
down_revision = "049_dep_update_project_cols"
branch_labels = None
depends_on = None
def upgrade() -> None:
op.create_table(
"playbooks",
sa.Column("id", sa.UUID(as_uuid=True), primary_key=True, nullable=False),
sa.Column("title", sa.String(length=200), nullable=False),
sa.Column("slug", sa.String(length=80), nullable=False),
sa.Column("problem", sa.Text(), nullable=False),
sa.Column("procedure", sa.Text(), nullable=False),
sa.Column(
"tags", sa.JSON(), nullable=False, server_default=sa.text("'[]'::json")
),
sa.Column("team", sa.String(length=20), nullable=True),
sa.Column(
"scope", sa.String(length=20), nullable=False, server_default="org"
),
sa.Column(
"source_task_ids",
sa.JSON(),
nullable=False,
server_default=sa.text("'[]'::json"),
),
sa.Column(
"status", sa.String(length=20), nullable=False, server_default="draft"
),
sa.Column("created_by", sa.UUID(as_uuid=True), nullable=False),
sa.Column("approved_by", sa.UUID(as_uuid=True), nullable=True),
sa.Column(
"created_at",
sa.DateTime(timezone=True),
nullable=False,
server_default=sa.text("now()"),
),
sa.Column("approved_at", sa.DateTime(timezone=True), nullable=True),
)
op.create_index("ix_playbooks_slug", "playbooks", ["slug"], unique=True)
op.create_index("ix_playbooks_status", "playbooks", ["status"])
def downgrade() -> None:
op.drop_index("ix_playbooks_status", table_name="playbooks")
op.drop_index("ix_playbooks_slug", table_name="playbooks")
op.drop_table("playbooks")