# Sprint Plan (1 Week)

## Sprint Objective

Deliver a production-safe Phase 1 skeleton where AI proposals can be generated, validated, stored, reviewed, and opened in Flow Builder draft mode, while preserving existing manual authoring and deterministic runtime behavior.

## Sprint Scope

1. Persistence and lifecycle baseline
2. Secure lifecycle APIs
3. Normalizer and validator v1
4. Minimal Flow Builder proposal integration
5. Telemetry and audit for proposal lifecycle

## Day-by-Day Plan

## Day 1 (Monday)

Focus:
1. Persistence verification
2. Lifecycle service scaffolding

Tasks:
1. Run migrations and rollback check in dev
2. Implement lifecycle transition service
3. Add transition guard tests

Completion Criteria:
1. Valid transition paths pass
2. Invalid transitions fail with deterministic errors

## Day 2 (Tuesday)

Focus:
1. API surface and security guards

Tasks:
1. Implement create/get/approve/reject endpoints
2. Add RBAC checks and feature-flag gating
3. Add API contract tests

Completion Criteria:
1. Unauthorized actions blocked
2. Feature-flag off path blocks API usage

## Day 3 (Wednesday)

Focus:
1. Normalizer implementation

Tasks:
1. Implement raw graph to canonical canvas mapping
2. Add enum and shape validation rules
3. Add compatibility test fixtures

Completion Criteria:
1. Canonical output accepted by current flow parsing path
2. Invalid payloads produce deterministic validation errors

## Day 4 (Thursday)

Focus:
1. Validator and policy gate integration

Tasks:
1. Graph structural checks
2. Policy checks for adapter allow-list and timeout bounds
3. Approval path enforcement based on validation outcome

Completion Criteria:
1. Validation fail blocks approval
2. Validation warnings do not auto-block unless policy says so

## Day 5 (Friday)

Focus:
1. UI integration hook and sprint stabilization

Tasks:
1. Implement open proposal into existing draft flow operation
2. Add telemetry events for lifecycle actions
3. Run regression tests for current manual flow path
4. Sprint demo and decision log

Completion Criteria:
1. Existing manual flow behavior remains unchanged
2. Proposal path is fully traceable via telemetry and events

## Sprint Deliverables

1. Working proposal lifecycle service and event tracking
2. Internal APIs with authz and feature flags
3. Normalizer and validator v1
4. Open proposal to draft flow integration
5. Regression report for current flow builder path

## Definition of Done

1. No runtime execution-path behavior change
2. Human approval required before publish path access
3. Unit plus integration tests pass
4. Regression checks for manual flow path pass
5. Lifecycle events and telemetry are emitted and queryable

## Sprint Demo Checklist

1. Create proposal from goal
2. Validate proposal with warnings/errors
3. Approve or reject proposal
4. Open approved proposal in existing Flow Builder draft
5. Confirm manual flow creation/publish still works
