Files
xarmian bde15d45ca Rename Phases to Plans, clean up deprecated aliases (#71)
* Rename "Phases" to "Plans" and clean up deprecated phase aliases

Renames the default "Phases" collection to "Plans" across the full stack:
- DB migration renames existing collections in-place (name, slug, prefix PLAN, icon 🗺️)
- Removes all deprecated Phase* backward-compat aliases from models and store
- Removes --phase CLI flag (use --parent instead)
- Updates convention triggers: on-phase-start/complete → on-plan-start/complete
- Updates dashboard API: active_phases → active_plans, /phases-progress → /plans-progress
- Updates all frontend components, types, and documentation

Closes IDEA-124

* Fix CSRF cookie not being cleared on logout

The SessionAuth middleware was re-issuing a CSRF cookie before the
logout handler could clear it, resulting in two Set-Cookie headers.
Skip CSRF re-issue for /api/v1/auth/ paths since auth endpoints
manage their own CSRF cookies (login sets, logout clears).

* Fix migration issues found in Codex review

- P1: Move doc_type UPDATE from migration 024 into 025, which recreates
  the table with the new CHECK constraint first (SQLite enforces CHECK
  on UPDATE, so the old constraint would reject 'plan')
- P1: Add PostgreSQL migration 005 for the collection rename (phases →
  plans) — previously only existed on the SQLite path
- P2: Recreate FTS triggers, indexes, and rebuild FTS after the table
  swap in migration 025 (DROP TABLE drops associated objects in SQLite)

* Fix parent filter field name and sync .agents skill copy

Codex review round 2 findings:
- P1: Parent filter compared against `parent_id` (wrong) instead of
  `parent_link_id` — plan filtering in collection view was broken
- P1: .agents/skills/pad/SKILL.md still had old --phase flags and
  "Phases" references — synced from the updated .claude copy
- P2: Accept legacy 'phase' filter key for backward compat with
  existing saved views that serialized the old key name

* Fix PG migration JSONB casting and add slug collision guards

Codex PR review bot findings:
- P1: PostgreSQL REPLACE/LIKE don't work on JSONB columns — cast
  schema::text and fields::text before string ops, then back to ::jsonb
- P1: If a workspace already has a custom 'plans' collection, the
  rename hits UNIQUE(workspace_id, slug) — added NOT EXISTS guard
  to both SQLite and PostgreSQL migrations
2026-04-07 14:55:23 -04:00

34 lines
1.1 KiB
Go

package models
import "time"
// ProgressSnapshot stores a point-in-time snapshot of task progress
// for a workspace, used for burndown charts and velocity tracking.
type ProgressSnapshot struct {
ID string `json:"id"`
WorkspaceID string `json:"workspace_id"`
TotalTasks int `json:"total_tasks"`
DoneTasks int `json:"done_tasks"`
OpenTasks int `json:"open_tasks"`
InProgress int `json:"in_progress"`
Percentage float64 `json:"percentage"`
PlanData string `json:"phase_data"` // JSON array of per-plan snapshots (legacy DB column name: phase_data)
CreatedAt time.Time `json:"created_at"`
}
// PlanSnapshot is a single entry in the PlanData JSON array.
type PlanSnapshot struct {
Title string `json:"title"`
Done int `json:"done"`
Total int `json:"total"`
Percentage float64 `json:"percentage"`
Status string `json:"status"`
}
// SnapshotListParams controls filtering when listing snapshots.
type SnapshotListParams struct {
Since *time.Time
Until *time.Time
Limit int
}