Skip to content

feat(web): order dashboard specs by created_at, newest first#30

Merged
protonspy merged 3 commits into
mainfrom
feat/sort-specs-by-created-at
Jun 9, 2026
Merged

feat(web): order dashboard specs by created_at, newest first#30
protonspy merged 3 commits into
mainfrom
feat/sort-specs-by-created-at

Conversation

@protonspy

Copy link
Copy Markdown
Owner

What

The web dashboard's spec list was ordered alphabetically by feature name. Order it by spec.json created_at descending instead, so the most recently created spec sits at the top of the panel.

All three surfaces (API GET /api/overview, TUI, CLI) go through session.LoadOverview, so they stay consistent — the change lives in one place.

Why

created_at is the true creation instant, stamped once at csdd spec init (time.Now().UTC().Format("2006-01-02T15:04:05Z")) and never rewritten. It is an RFC3339 UTC string (always …Z, fixed width), so a lexical string compare is chronological — no parsing needed. Filesystem mtime was rejected as a source: it means "last modified", changes on every edit, and is reset by git clone/checkout.

How

In LoadOverview, after building the spec cards, sort.Slice by CreatedAt descending. Equal created_at — and unreadable specs, whose created_at is empty (sorts last) — fall back to feature-name ascending for a stable, total order.

Tests

  • TestOverviewSpecsSortedByCreatedAtDesc — three specs whose dates diverge from alphabetical order (alpha=Jan, beta=Jun, gamma=Mar → beta, gamma, alpha); catches any regression to name-sorting.
  • TestOverviewSpecsCreatedAtTieBreaksByName — equal-created_at tie and the empty/unreadable case in one fixture.
  • Existing TestOverview updated to assert newest-first ordering.

code-reviewer ran: no Blockers (APPROVE WITH NITS).

Verification

- go test -race ./internal/session/   ✅  83.8% coverage
- go test -race ./... (pre-push gate)  ✅  all packages green
- go vet ./internal/session/           ✅
- gofmt -l (touched files)             ✅  clean
- make build → ./csdd                  ✅

🤖 Generated with Claude Code

protonspy and others added 3 commits June 8, 2026 18:49
The web overview listed specs alphabetically by feature name. Order them
by spec.json created_at descending instead, so the most recently created
spec sits at the top of the panel.

created_at is an RFC3339 UTC string (always …Z, written once at `spec
init`), so a lexical compare is chronological. Equal created_at — and
unreadable specs, whose created_at is empty — fall back to feature name
ascending for a stable, total order. All three surfaces (API, TUI, CLI)
go through LoadOverview, so they stay consistent.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@protonspy protonspy merged commit a30ef05 into main Jun 9, 2026
3 checks passed
@protonspy protonspy deleted the feat/sort-specs-by-created-at branch June 9, 2026 01:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant