Skip to content

feat(gantt): turn the Roadmap view into a full Gantt view - #757

Merged
pikann merged 7 commits into
Paca-AI:masterfrom
officialasishkumar:feature/gantt-view
Nov 14, 2026
Merged

pikann merged 7 commits into
Paca-AI:masterfrom
officialasishkumar:feature/gantt-view

Conversation

@officialasishkumar

Copy link
Copy Markdown
Contributor

Summary

Turns the Roadmap view into a full Gantt view and renames it from "Roadmap" to "Gantt" (closes #748). It covers the four core items in the issue. The optional follow-ups (critical path, milestones, roll-up bars, cascade shifting, baselines, export) are not included.

1. Rename Roadmap → Gantt

  • Migration 000090 changes view_type roadmap → gantt and swaps the CHECK constraint. Views keep their config, position and personal overrides. A view still named "Roadmap" (the seeded name) is renamed "Gantt"; names people chose are left alone.
  • For one release the API accepts roadmap on create and update and stores it as gantt (NormalizeViewType). The alias is never persisted or returned.
  • The layout, component (gantt-view.tsx), seeded timeline view, new-view option and i18n keys are renamed in all 9 locales. The MCP view tools and types, Playwright specs/features and docs are updated too.

2. Dependency arrows

  • blocks links between two shown bars are drawn as arrows from the blocker's end to the blocked task's start.
  • When a blocked task starts on or before its blocker's due date, the arrow turns red, the bar is outlined, and its tooltip names the blocker.
  • A Dependency arrows view setting (gantt_dependencies: shown/hidden) hides them.
  • New endpoint GET /projects/{projectId}/task-links?link_type=blocks returns a project's links of one type with a cursor. This avoids one request per task. A link is listed only when the caller can read both of its tasks: the IAM task scope narrows the query, so scoped members don't learn about tasks outside their scope.
  • Link changes refresh the arrows through the task.link.* realtime events and the task detail's link mutations.

3. Drag to reschedule

  • Drag a bar to move it, or drag an end to change the start or due date. Changes snap to whole days and a live label shows the new range. Escape cancels.
  • The new dates show right away. If the save fails, the bar snaps back and an error toast appears. A success toast offers Undo.
  • The save is the regular PATCH /tasks/{id}, which the router already gates with tasks:write. So the change appears in the activity feed and reaches other clients in real time. Without edit permission the chart is read-only. Dragging a row still reorders or regroups it.
  • Moving a bar shifts only the dates the task has. Dragging an end of a single-date bar also fills in the missing date.

4. Zoom and navigation

  • Day / Week / Month / Quarter / Year zoom is stored per view as gantt_zoom. Like other view settings it is per user. The date in the middle of the chart stays put when you zoom.
  • A Today button jumps to the current date, and the chart opens centred on today. The task column stays pinned.

Implementation notes:

  • Dates are handled as whole UTC days (Paca stores them as UTC midnight) in a new gantt-scale.ts. It also holds the scale, bar, drag and arrow-routing logic. Bars now include the due date.
  • Arrows use bar positions measured in the DOM, so nested subtask rows that load later are included.
  • Gridlines are drawn once for all rows instead of once per row.
  • The saved task column width keeps its old storage key, so nobody's width resets.

Type of Change

  • Other (feature: Gantt view)

Checklist

  • The change is focused and scoped.
  • Related documentation is updated.
  • New structure or direction is explained clearly.
  • I avoided unnecessary detail or premature abstraction.

Testing

  • Go:
    • Unit tests cover the roadmap alias on create and update, normalising the Gantt config values, and their per-user overlay. The integration test checks that roadmap is accepted and returned as gantt.
    • Postgres tests for the link listing cover paging, deleted tasks, other projects, scoped and deny-all callers, and unmapped attributes.
    • New e2e tests: the migration (run twice, config kept, a table view named "Roadmap" left alone, the constraint rejecting roadmap) and the endpoint over HTTP (link types, paging, bad cursor, missing type, non-member).
    • The view/timeline/link e2e tests, TestRealMigrations_ApplyCleanlyFromScratch, the full unit suite, go vet and golangci-lint (0 issues) all pass.
  • Web:
    • gantt-scale.test.ts covers dates, zoom, units, range, scale cells, bars, drag snapping, reschedule updates, conflict detection and arrow routing.
    • gantt-view.test.tsx covers zoom persistence, bar scaling, moving and edge drags, optimistic display and undo, error rollback, click vs drag, Escape, read-only mode, and arrows and conflicts. Also new: pick-gantt-dependencies.test.ts and the realtime rule test.
    • tsc -b, biome check, the full vitest suite and vite build pass. One existing GitSettings test timed out once under machine load; it passes on its own.
  • MCP: lint, build and tests pass.
  • Playwright: the renamed specs and the new zoom/Today scenarios pass biome lint. I didn't run the full Playwright stack, since the e2e workflow is triggered manually.

Add GET /projects/{projectId}/task-links?link_type=blocks, which returns
one page of the project's links of a single type, oldest first, with the
same (created_at, id) cursor as the per-task listing. The Gantt view
draws its dependency arrows from it with one request instead of one per
task.

A link is listed only when both of its tasks are live and readable by
the caller: the task scope attached by scopedContext narrows a CTE of
visible tasks that both ends join against, so a scoped member never
learns about a task outside their scope and a link to a deleted task
never shows up. Items carry only the two task ids and the link type, not
a summary of either task. link_type is required and validated; page_size
defaults to 100 and is capped at 500.

The repository is covered against Postgres (paging, deleted tasks,
other projects, scoped and deny-all callers, unmapped attributes).

Signed-off-by: Asish Kumar <[email protected]>
The timeline layout becomes a Gantt chart, so its view_type is renamed
from "roadmap" to "gantt" (Paca-AI#748).

- Migration 000090 moves every roadmap view to gantt with its config,
  position and personal overrides intact, renames a view only while it
  still has the seeded name "Roadmap", and swaps the CHECK constraint.
- For one release the API still accepts "roadmap" on create and update
  and stores it as "gantt" (NormalizeViewType), so older clients and
  MCP servers keep working. The alias is unexported: it is never
  persisted or returned, and switches over ViewType need not list it.
- New projects are seeded with a "Gantt" timeline view.
- ViewConfig gains gantt_zoom (day, week, month, quarter or year) and
  gantt_dependencies (shown or hidden). Unknown values are dropped like
  an unknown subtask_mode, and both take part in the per-user merge and
  diff, so a zoom picked by one member stays theirs.

Tests cover the alias on create and update, the new config values and
their per-user overlay, and the migration against Postgres (run twice,
config kept, a table view named "Roadmap" left alone, the constraint
rejecting "roadmap" afterwards). The same e2e file exercises the task
link listing over HTTP: link types, paging, a deleted task, a bad cursor
and a caller outside the project.

Signed-off-by: Asish Kumar <[email protected]>
Rename the Roadmap layout to Gantt (component, layout, seeded view,
new-view option and i18n keys in all nine locales) and give it the core
Gantt features from Paca-AI#748:

- Zoom: a toolbar switches the scale between Day, Week, Month, Quarter
  and Year. The chosen zoom is saved to the user's view config
  (gantt_zoom) and the date in the middle of the chart stays put when
  the scale changes. "Today" scrolls back to the current date, and the
  chart opens centred on it. The header shows a coarse band (months or
  years) above one cell per step; gridlines are drawn once for all
  rows instead of per row.
- Dependency arrows: "blocks" links between two shown bars are drawn
  from the blocker's end to the blocked task's start. A blocked task
  that starts on or before its blocker's due date gets a red arrow, an
  outlined bar and a tooltip naming the blocker. Links come from the new
  project link listing; bars are measured in the DOM so nested rows that
  load later are included. A "Dependency arrows" view setting
  (gantt_dependencies) hides them, and a link change refreshes them
  through the realtime event and the task detail's link mutations.
- Drag to reschedule: people who can edit tasks drag a bar to move it
  or an end to change the start or due date. Changes snap to whole
  days, show the new range while dragging, and Escape cancels. The bar
  keeps its new dates until the saved task comes back (or snaps back
  with an error toast if the save fails), and a toast offers Undo. The
  save is the regular task update, so it lands in the activity feed and
  reaches other clients in real time. Without edit permission the chart
  is read-only. Dragging a row still reorders or regroups it.

Dates are handled as whole UTC days (how Paca stores them) in a new
gantt-scale module, which also holds the zoom, scale, bar, drag and
arrow-routing logic with its own tests. Bars now span the due date
inclusively. The saved task column width keeps its old storage key so
nobody loses it.

Signed-off-by: Asish Kumar <[email protected]>
create_view and update_view take viewType "gantt" for the timeline
layout, which was called "roadmap" before (Paca-AI#748). The API still accepts
"roadmap" for one release and stores it as "gantt".

Signed-off-by: Asish Kumar <[email protected]>
Update the interaction-view and timeline features and specs for the
Gantt layout name, view type and timeline subtitle, and add scenarios
for the Gantt toolbar: every zoom level is offered with Week selected,
a picked zoom is still selected after a reload, and "Today" is present.

Signed-off-by: Asish Kumar <[email protected]>
Describe the Gantt view (zoom, dependency arrows and conflicts, drag to
reschedule, undo, permissions and the roadmap alias) and its
gantt_zoom / gantt_dependencies config in the interaction views guide.
List GET /projects/{projectId}/task-links in the HTTP design, replace
roadmap with gantt in the view type references and the schema notes,
and update the roadmap entry for the timeline view.

Signed-off-by: Asish Kumar <[email protected]>

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Important

One interaction bug in the new edge-resize path, plus a note on the rename across a rolling deploy. Everything else in this large PR holds up: the migration, the alias, the scoped link listing and the Gantt geometry all match their tests and the surrounding conventions.

Reviewed changes

  • roadmap → gantt view type — the constant/ValidViewTypes change, the NormalizeViewType alias on create/update, the DTO, the seeded timeline view, MCP enum/types and the client ViewType/ViewLayout maps.
  • Migration 000090 — constraint swap, view_type rewrite, seeded-name rename, config preservation and idempotency.
  • GET /projects/{projectId}/task-links — required link_type, cursor paging, and the IAM-scoped visible CTE that lists a link only when both tasks are live and readable; handler/service/DTO, cached-service delegation.
  • gantt-scale.ts — UTC day arithmetic, zoom units/range/scales, bar clamping, drag snapping, reschedule payloads, block-violation test and arrow routing.
  • gantt-view.tsx — zoom + scroll centering, Today button, pointer drag for move/edges with optimistic spans, Escape cancel, undo toast and rollback, row drag/reorder preserved, DOM-measured dependency arrows, single-draw gridlines.
  • View settings / realtime / docs / e2e — gantt_dependencies setting with pickGanttDependencies, task.link.* invalidation of the project link listing, 9 locales, MCP CHANGELOG, API/architecture docs, renamed and new Playwright specs.

ℹ️ A rolling deploy can render Gantt views as tables until the bundle reloads

The write-side alias is handled, but the read path is not. Web and API ship as separate images (ghcr.io/paca-ai/paca-web), so they roll independently, and viewTypeToLayout falls through to "Table" for any unknown view_type. A new bundle that loads before the API migration renders old roadmap rows as tables, and an old bundle against the migrated API does the same with gantt rows — either way the Timeline silently degrades until a refresh. A one-release read alias (roadmap → Gantt) would make a web-first rollout harmless, since the only thing missing from the new bundle in that window is the task-links endpoint, which already fails soft (no arrows).

Technical details
# Read-path compatibility for the renamed view type

## Affected sites
- `apps/web/src/lib/interaction-api.ts:306-312` — `viewTypeToLayout` returns "Table" for "roadmap", so the previous API value is rendered as the Table layout.
- `apps/api/... migration 000090` runs at API startup; the Helm/compose web image can be rolled before or after it.
- `apps/web/src/lib/interaction-api.ts:1342-1366` — `listProjectTaskLinks` 404s against a pre-000090 API, and `ganttLinksQuery` just yields no data, so arrows are absent rather than erroring.

## Required outcome
- A new web bundle must keep rendering a `roadmap` row (and its subviews) as the Gantt layout for one release, mirroring the API's write-side alias.
- Optionally note the intended deploy order in the PR or docs so operators upgrade web first.

## Suggested approach (optional)
- Treat `"roadmap"` as a legacy read value alongside `"gantt"` in `viewTypeToLayout` (the API never returns it after 000090, so this only matters during the rollout window).
- No server change is needed; old web bundles cannot be fixed and will need a reload.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using deepseek-v4.1-flash-1017 (free via Pullfrog for OSS) | 𝕏

Unmounting the handle that holds pointer capture when the bar shrank below the handle threshold dropped the drag, so it never committed or reverted. Keep the handles for the task being dragged and add a regression test.

Signed-off-by: Asish Kumar <[email protected]>

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes

This run re-reviewed the one commit pushed since the prior review.

  • Edge-drag pointer capture — renderChartCell now keeps the resize handles mounted for the bar being dragged (isDragging || box.width >= MIN_RESIZABLE_PX), so the element holding implicit pointer capture survives a drag that shrinks the bar below 20px and pointerup still reaches endBarDrag to commit or revert.
  • Regression test — a new gantt-view.test.tsx case drags the start handle of a four-day bar at month zoom across one day (24px → 18px) and asserts the handle is still connected after the move and that the reschedule is saved.

Pullfrog  | View workflow run | Using deepseek-v4.1-flash-1017 (free via Pullfrog for OSS) | 𝕏

@pikann pikann left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thank you for the contribution! 🚀

@pikann
pikann merged commit 254dc11 into Paca-AI:master Nov 14, 2026
9 checks passed
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.

[Feature] Implement full Gantt view (rename Roadmap to Gantt)

2 participants