Skip to content

Create projects, and manage milestones from the UI and MCP - #148

Merged
imshashank merged 10 commits into
mainfrom
projects/create-and-milestones
Aug 7, 2026
Merged

imshashank merged 10 commits into
mainfrom
projects/create-and-milestones

Conversation

@imshashank

@imshashank imshashank commented Aug 7, 2026 •

Copy link
Copy Markdown
Contributor

No catchup SQL

Nothing in this branch touches the schema. milestone and project already
exist with every column used here, so there is no new file under
packages/db/catchup/ and nothing to apply before the code ships.

What was broken

/projects rendered a table and nothing else: a sweep of every button and
anchor inside <main> came back empty, so POST /api/projects worked and no
client ever called it. packages/core/src/work/milestone-service.ts had
create, update, delete, list and reorder, and apps/web/src/app/api had no
milestones directory at all, so milestones had no HTTP surface. The filter
menu offered "Milestone" and the display menu offered a Milestone column, both
of which could only ever match seed data because nothing could set
issue.milestoneId. And update-composer.tsx kept its text after a successful
post, so the next edit reposted the same update.

Backend first

Every rule below is enforced on the server. The client hides what the policy
forbids, and every test that matters proves the refusal against the route.

  • Five new handlers, each one parsing with a schema from @orbit/shared,
    calling a service, and publishing the actions the service returned:
    GET/POST /api/projects/[id]/milestones,
    POST /api/projects/[id]/milestones/reorder,
    PATCH/DELETE /api/milestones/[id].
  • Create takes its project from the path. A projectId in the body is
    ignored, and there is a test for it.
  • reorderMilestones parses its own input with milestoneOrderSchema from
    @orbit/shared, so the service is a gate on its own and not only the route.
    It already refused an order that does not cover exactly the milestones of the
    project; that is now reachable over HTTP and over MCP.
  • A milestone has to belong to the project the issue is on.
    assertMilestoneInTeam used to skip the project check whenever the patch did
    not also set projectId, so an issue on project A could take a milestone from
    a sibling project B on the same team, and an issue on no project could take a
    milestone at all. applyIssueUpdates now hands it the project the issue will
    actually be on, and the null case is refused.

MCP parity

Everything the UI gained goes through the same service function.

UI MCP
New project dialog create_project (already there)
Add, edit, delete a milestone create_milestone, update_milestone, delete_milestone (already there)
Move a milestone up or down reorder_milestones (new)
Milestone row on the issue panel milestone on update_issue (new)

reorder_milestones is readOnly: false, so a token holding only orbit.read
never sees it. It resolves each name against the project it names, then hands
the whole order to reorderMilestones.

UI

  • New project on the /projects header and on the empty state. Name,
    summary, target date and teams; the slug comes back from the server and the
    dialog follows it.
  • Milestones on the project overview: add, edit, delete, and move up or
    move down. Reorder posts the whole order, never a pair, so the server can
    check it covers the project. Move buttons are real buttons with labels, so
    the order is keyboard operable. Progress per milestone still comes from
    projectProgress.
  • Milestone row on the issue properties panel, under Project, on m.
    It reads the milestones of the project the issue is on through a query keyed
    by that project, and says "Pick a project first" when there is none.
  • Update composer remounts its editor after a successful post and refuses a
    submit while one is in flight.

Milestone deltas now invalidate the milestones query instead of the bootstrap
payload, which never carried milestones.

Tests, and the mutation that makes each one bite

Every test below was watched failing before the code existed, then the
production code was broken deliberately and confirmed RED, then restored.

Test Break that turns it red
issue-service.test.ts refuses a sibling project milestone drop the current.projectId argument to assertAssignableToTeam
issue-service.test.ts refuses a milestone with no project put projectId !== null back in assertMilestoneInTeam
milestone-service.test.ts refuses an order that is not ids drop milestoneOrderSchema.parse
milestones.test.ts ignores a body projectId spread the body after the path id
milestones.test.ts refuses a guest and a contributor (3 cases) drop assertCan(principal, 'milestone:manage')
milestones.test.ts refuses a member off the project teams drop assertProjectVisible from createMilestone
milestones.test.ts 422 on a malformed reorder body drop both the route parse and the service parse
route.test.ts refuses a contributor and a guest creating a project drop assertCan(principal, 'project:manage')
tools.test.ts reorder over MCP (3 cases) + discovery rename the reorder_milestones tool
tools.test.ts milestone on update_issue (3 cases) drop the args.milestone branch in buildIssuePatch
milestone-board.test.tsx sends the whole order (2 cases) send only the swapped pair
issue-properties.test.tsx reads the right project (3 cases) pass null instead of issue.projectId
update-composer.test.tsx empties the editor (2 cases) drop the key on the editor

The route tests seed a real workspace with @orbit/core/test-support, mock only
the session, and let the real resolveMembership read the role and teams out of
Postgres, so the refusals come from the server and not from a stub.

bun run verify exits 0.

Greptile Summary

The PR adds UI and HTTP support for project and milestone management, exposes milestone ordering and issue assignment through MCP, and refreshes milestone progress from current issue data.

  • Adds project creation and milestone management interfaces.
  • Adds validated milestone CRUD and reorder routes backed by core services.
  • Adds MCP milestone reordering and issue milestone assignment.
  • Fixes project-aware milestone assignment and clears successful update submissions.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Important Files Changed

Filename Overview
apps/web/src/features/projects/milestone-board.tsx Adds milestone creation, editing, deletion, ordering, and query-backed progress rendering; the prior stale-progress path is addressed.
apps/web/src/lib/realtime/delta-bridge.tsx Invalidates milestone queries when issue changes can affect their progress totals.
apps/web/src/app/api/projects/[id]/milestones/route.ts Adds validated list and create handlers while retaining the path as the authoritative project identifier.
apps/web/src/app/api/milestones/[id]/route.ts Adds shared-schema-validated milestone update and delete handlers.
packages/mcp-server/src/resolve.ts Resolves milestone identifiers before names and rejects ambiguous duplicate-name references.
packages/core/src/work/issue-service.ts Validates milestone assignment against the issue's resulting project rather than only an explicitly patched project.
packages/core/src/work/milestone-service.ts Adds validated milestone ordering and current progress aggregation for HTTP and UI consumers.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  UI[Project and issue UI] --> HTTP[Validated project and milestone routes]
  MCP[MCP tools] --> Core[Core project, milestone, and issue services]
  HTTP --> Core
  Core --> DB[(Database)]
  Core --> Events[Published actions]
  Events --> Cache[Query invalidation]
  Cache --> UI
Loading

Reviews (3): Last reviewed commit: "fix(issues): hide the milestone shortcut..." | Re-trigger Greptile

After review

Seven threads, five fixed and two answered.

  • Milestone counts went stale. They were server-rendered once and never
    refreshed. GET /api/projects/[id]/milestones now carries scope and
    completed from listMilestonesWithProgress, the board takes no progress
    prop at all, and an issue delta invalidates the milestones query along with
    everything else that counts issues.
  • A duplicate milestone name resolved to whichever came first over MCP.
    resolveMilestone matches an id first and refuses an ambiguous name with a
    conflict that names the candidate ids.
  • The milestone routes handed raw JSON to the services. They now parse
    first, with milestoneUpdateSchema and a new milestoneCreateBodySchema
    which is the create schema without projectId, so the path stays the only
    source of the project.
  • The m shortcut was registered even with no project to hang a milestone
    on.
    It is registered enabled: issue.projectId !== null, and the <Kbd>
    hint goes with it. The repository hint invariant test caught the hint half of
    that on CI before this branch was near merge, which is exactly what it is for.
  • A date only target date showed the previous day west of UTC, because
    new Date('2026-06-08') is UTC midnight. formatDay in
    apps/web/src/features/projects/dates.ts reads the digits and never builds a
    Date. The projects table and the project header carried the same bug and now
    share the fix.

Two were answered rather than applied: moving the MCP milestone cases out of
tests/tools.test.ts would not land on a mirrored path either, since the
milestone tools live across three source files; and there is no rollback test
wrapper in this repository for apps/web to adopt, only the lane cloned
database every other database backed test already uses.

New tests for the round, each watched failing first:

Test Break that turns it red
route counts issues per milestone return zeroed counts from the list handler
board shows the counts the server sent n/a, it reads them straight off the payload
MCP refuses an ambiguous milestone name let pick match a name and take the first
formatDay names the same day in four zones go back to new Date(...).toLocaleDateString
the m shortcut is not advertised without a project drop enabled from the binding
the milestone row hides its hint without a project make shortcut="m" unconditional

reorderMilestones now parses its order with a schema from @orbit/shared
instead of trusting the caller, and assertMilestoneInTeam is handed the
project the issue will actually be on, so a milestone from a sibling
project on the same team, or a milestone on an issue with no project at
all, is refused rather than stored.
Five handlers, each one parsing with a schema from @orbit/shared and
calling straight into the milestone service: list and create under a
project, reorder under it, and patch and delete on a milestone. Create
takes its project from the path, so a projectId in the body is ignored.

Route tests seed a real workspace and prove the server refuses a guest,
a contributor and a member whose teams do not reach the project.
reorder_milestones resolves every name against the project it names and
hands the whole order to reorderMilestones, the same function the web
route calls. update_issue takes a milestone, resolved against the
project the patch leaves the issue on, so MCP can set what the issue
properties panel sets.
A milestone row reads the milestones of the project the issue is on
through a query of its own, keyed by that project, and patches
milestoneId through the same route as every other property. Milestone
deltas now invalidate that query rather than the bootstrap payload,
which never carried milestones.
Add, edit, delete and reorder, with move up and move down so the order
is keyboard operable. A move sends the whole order, which the server
checks covers exactly the milestones of the project, so a stale client
cannot half apply one. Progress per milestone still comes from the
server.
POST /api/projects already worked and nothing called it. A dialog on the
header, and on the empty state, posts a name, summary, target date and
teams, then follows the slug the server allocated. The button only shows
for a role that can manage projects, and a route test proves the server
refuses everyone else on its own.
The editor keeps whatever it was opened with when the value it is handed
goes back to a string it has already emitted, so clearing the body state
left the text on screen and the next edit reposted it. Remount the
editor on a successful post, and refuse a submit while one is in flight
or the body is empty.
@vercel

vercel Bot commented Aug 7, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
orbit Ready Ready Preview Aug 7, 2026 9:52am

Request Review

@github-actions github-actions Bot added documentation Docs, the README, or anything that explains Orbit tests Test coverage and test infrastructure area: web The Next.js app and its UI area: mcp The MCP server, its tools and its OAuth area: issues Issues, lists and boards labels Aug 7, 2026
@coderabbitai

coderabbitai Bot commented Aug 7, 2026 •

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The pull request adds milestone CRUD and reordering across core services, web APIs, React Query, realtime updates, project and issue interfaces, and MCP tools. It also adds authorized project creation and resets the update composer after successful posts.

Changes

Milestone and project workflow

Layer / File(s) Summary
Core milestone validation and ordering
packages/shared/src/validators/milestone.ts, packages/core/src/work/..., packages/core/tests/work/...
Milestone ordering now uses schema validation. Issue milestone assignments enforce project scope and effective project context.
Milestone APIs, client hooks, and realtime sync
apps/web/src/app/api/..., apps/web/src/lib/query/..., apps/web/src/lib/realtime/..., apps/web/tests/app/api/..., apps/web/tests/lib/realtime/...
The web app supports milestone listing, creation, updates, deletion, and reordering. Milestone actions invalidate the milestone query root.
Milestone board and issue assignment
apps/web/src/features/projects/..., apps/web/src/features/issues/..., apps/web/src/app/(app)/projects/..., apps/web/tests/features/..., docs/keyboard-shortcuts.md
The project page renders an editable milestone board. Issue properties support milestone selection, clearing, and the m shortcut.
Project creation and composer reset
apps/web/src/app/(app)/projects/page.tsx, apps/web/src/features/projects/..., apps/web/tests/app/api/projects/route.test.ts, apps/web/tests/features/projects/...
Authorized users can create projects with optional teams. The update composer remounts after a successful post.
MCP milestone resolution and reordering
packages/mcp-server/src/..., packages/mcp-server/tests/tools.test.ts, docs/mcp.md
MCP issue updates resolve milestone references, and reorder_milestones resolves and submits ordered milestone IDs with permission checks.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant MilestoneBoard
  participant ReactQuery
  participant MilestoneAPI
  participant CoreService
  User->>MilestoneBoard: Edit milestone
  MilestoneBoard->>ReactQuery: Submit mutation
  ReactQuery->>MilestoneAPI: Send PATCH request
  MilestoneAPI->>CoreService: Update milestone
  CoreService-->>MilestoneAPI: Return result and actions
  MilestoneAPI-->>ReactQuery: Return updated milestone
  ReactQuery-->>MilestoneBoard: Refresh milestone data
Loading

Possibly related PRs

  • Noveum/orbit#11: Introduced patterns extended here for issue properties, query schemas, realtime deltas, and React Query.
  • Noveum/orbit#88: Modified the shared project overview and milestone progress display.
  • Noveum/orbit#97: Shared milestone authorization, validation, and reordering code.

Suggested reviewers: pulkitxm

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly summarizes the primary changes: project creation and milestone management through the UI and MCP.
Description check ✅ Passed The description directly explains the project, milestone, API, MCP, validation, UI, and testing changes.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch projects/create-and-milestones

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Comment thread packages/mcp-server/src/resolve.ts Resolved

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 4

🧹 Nitpick comments (12)
packages/mcp-server/tests/tools.test.ts (2)

391-399: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Parse the MCP milestone payload with Zod.

milestonesOf casts an unvalidated protocol payload to MilestoneShape[]. Define a milestoneShapeSchema, infer MilestoneShape from it, and parse payload['milestones'] before returning the rows.

As per coding guidelines, validate every external input with Zod and use xSchema Zod schemas with inferred X types.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/mcp-server/tests/tools.test.ts` around lines 391 - 399, Update
milestonesOf to validate payload['milestones'] with a Zod milestoneShapeSchema
before returning it. Define milestoneShapeSchema for id, name, and projectId,
infer MilestoneShape from that schema, and replace the unchecked cast with
schema parsing while preserving the MilestoneShape[] return type.

Source: Coding guidelines


461-465: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Test assignment while changing to a different project.

Line 456 already assigns the issue to project. Line 463 passes the same project again. This cannot prove that milestone resolution uses the patch project instead of currentProjectId.

Add a test that moves an issue from one project to another and assigns a milestone that exists only on the target project.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/mcp-server/tests/tools.test.ts` around lines 461 - 465, Update the
test around the update_issue call to move the issue from its current project to
a different target project, then assign a milestone that exists only on that
target project. Ensure the request uses the target project and the assertions
verify both the project change and successful target-project milestone
assignment, proving resolution does not use currentProjectId.
packages/mcp-server/src/tools/scrum.ts (1)

503-507: 🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick win

Resolve the milestone references from one scoped list.

Each resolveMilestone call reads the full project milestone list. A 200-item request can perform 200 repeated visibility checks and database reads before reordering.

Load the project milestones once, or add a batch resolver that maps all references while preserving the current not-found error.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/mcp-server/src/tools/scrum.ts` around lines 503 - 507, Update the
milestone ordering flow around resolveMilestone to load the project’s scoped
milestone list once and resolve all input.milestones against it, preserving
input order and the existing not-found error behavior. Avoid calling
resolveMilestone repeatedly; reuse the existing project and principal scoping
rules when building the reference-to-ID mapping.
apps/web/src/features/projects/new-project-dialog.tsx (2)

200-203: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Make the Cancel path clear the draft like the other close paths.

setOpen(false) does not trigger onOpenChange, so reset() does not run when the user clicks Cancel. The trigger button calls reset() before it reopens the dialog, so the stale draft stays hidden today. Route Cancel through the same reset to keep both close paths identical.

♻️ Proposed refactor
-              <Button type="button" size="sm" variant="ghost" onClick={() => setOpen(false)}>
+              <Button
+                type="button"
+                size="sm"
+                variant="ghost"
+                onClick={() => {
+                  setOpen(false);
+                  reset();
+                }}
+              >
                 Cancel
               </Button>
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@apps/web/src/features/projects/new-project-dialog.tsx` around lines 200 -
203, Update the Cancel button in the DialogFooter to clear the draft before
closing by invoking the same reset behavior used by the dialog’s other close
paths, rather than calling only setOpen(false). Keep the dialog closed after
cancellation and ensure the existing reopen flow remains unchanged.

76-83: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Consider safeParse for the response shape.

createdSchema.parse throws a ZodError when the response shape is unexpected. That error reaches the catch block and messageOf renders it in new-project-error. The user then sees raw validation text instead of a product message. Use safeParse and show a fixed message when the shape does not match.

♻️ Proposed refactor
-      const { project } = createdSchema.parse(created);
+      const parsed = createdSchema.safeParse(created);
+      if (!parsed.success) {
+        setError('The server returned an unexpected response.');
+        return;
+      }
+      const { project } = parsed.data;
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@apps/web/src/features/projects/new-project-dialog.tsx` around lines 76 - 83,
Replace createdSchema.parse in the project-creation flow with safeParse, and
branch on its success result before using project.name or project.slug. When
validation fails, set a fixed product-facing error message through setError
instead of passing the ZodError to messageOf; preserve the existing success
navigation and caught-error handling for other failures.
apps/web/src/lib/query/keys.ts (1)

27-27: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Reuse MILESTONES_ROOT in the key factory.

Line 27 repeats the literal 'milestones', while docAccess on line 19 already builds its key from DOC_ROOT. Realtime invalidation on [MILESTONES_ROOT] depends on both strings staying equal. Declare the constant before queryKeys and reference it.

♻️ Proposed refactor
-  milestones: (projectId: string) => ['milestones', projectId] as const,
+  milestones: (projectId: string) => [MILESTONES_ROOT, projectId] as const,

Move the declaration above queryKeys:

export const MILESTONES_ROOT = 'milestones';

Also applies to: 43-43

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@apps/web/src/lib/query/keys.ts` at line 27, Declare and export
MILESTONES_ROOT before queryKeys, then update the milestones and any other
affected key factory entries to use this constant instead of the repeated
'milestones' literal, preserving the existing key shapes.
docs/keyboard-shortcuts.md (1)

78-78: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Use the ? dialog source for keyboard shortcut docs.

The m shortcut registration exists and matches this row. Avoid hand-maintaining parallel shortcut tables if the app generates them from the registry.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/keyboard-shortcuts.md` at line 78, Replace the manually maintained `m`
shortcut row in the keyboard shortcut documentation with the generated `?`
dialog source, using the existing shortcut registry as the authoritative source.
Ensure the displayed entry remains “m — Change milestone” and avoid maintaining
a parallel table.
apps/web/tests/features/projects/milestone-board.test.tsx (2)

6-9: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Use the @/ alias for the component under test.

Lines 6 to 8 use the @/ alias. Line 9 uses a relative path to the same src tree. Use @/features/projects/milestone-board.tsx for consistency.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@apps/web/tests/features/projects/milestone-board.test.tsx` around lines 6 -
9, Update the MilestoneBoard import in the milestone board test to use the
configured `@/features/projects/milestone-board.tsx` alias instead of the relative
path, keeping the other imports unchanged.

52-58: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Return the patched milestone from the PATCH stub.

The stub returns served[0] instead of the entry that matches the URL. The board ignores the response body today, so the tests pass. The stub still misrepresents the route contract and will hide a regression if the hook starts using the returned milestone.

♻️ Proposed change
     if (method === 'PATCH') {
       const patch = body as { name: string };
       served = served.map((entry) =>
         url.endsWith(entry.id) ? { ...entry, name: patch.name } : entry,
       );
-      return Promise.resolve(Response.json({ milestone: served[0] }));
+      const patched = served.find((entry) => url.endsWith(entry.id));
+      return Promise.resolve(Response.json({ milestone: patched }));
     }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@apps/web/tests/features/projects/milestone-board.test.tsx` around lines 52 -
58, Update the PATCH branch in the request stub to identify the milestone
matching the URL, apply the name change to that entry, and return that patched
milestone in the response instead of always returning served[0]. Preserve the
existing served collection update behavior.
apps/web/src/lib/query/use-milestones.ts (1)

123-134: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick win

Cancel in-flight milestone queries before the optimistic write.

onMutate writes the optimistic order without cancelling running queries. A refetch that started before the mutation can resolve afterwards and restore the old order. Make onMutate async and call cancelQueries first.

♻️ Proposed change
-    onMutate: (milestoneIds) => {
+    onMutate: async (milestoneIds) => {
       const key = queryKeys.milestones(projectId);
+      await client.cancelQueries({ queryKey: key });
       const previous = client.getQueryData<readonly Milestone[]>(key);
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@apps/web/src/lib/query/use-milestones.ts` around lines 123 - 134, Update the
onMutate handler in the milestone mutation to be async, await
client.cancelQueries for the milestones query key before reading previous data
or applying the optimistic setQueryData, and preserve the existing rollback
context and ordering logic.
apps/web/tests/features/issues/issue-properties.test.tsx (1)

23-24: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Avoid the {} as WorkspaceData spread in the fixture.

The spread on Line 24 casts an empty object to WorkspaceData. The compiler then accepts the literal even if WorkspaceData gains required fields, and the missing fields become undefined at runtime. Build the fixture as a fully typed literal, or add a shared workspaceFixture helper that the type checker validates.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@apps/web/tests/features/issues/issue-properties.test.tsx` around lines 23 -
24, Replace the `{} as WorkspaceData` spread in the `workspace` fixture with a
fully populated, type-checked `WorkspaceData` literal, or reuse a shared
`workspaceFixture` helper validated against `WorkspaceData`; ensure all required
fields are explicitly defined so newly required fields produce compile-time
errors.

Source: Coding guidelines

apps/web/src/features/projects/milestone-board.tsx (1)

211-221: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Consider a confirmation step before deleting a milestone.

onDelete calls the delete mutation immediately. A single click destroys a milestone with no undo path. Add a confirmation dialog, or add an undo action in the toast.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@apps/web/src/features/projects/milestone-board.tsx` around lines 211 - 221,
Update the milestone delete flow around the onDelete handler to require
confirmation before invoking the delete mutation. Add a confirmation dialog or
an undo action in the resulting toast, ensuring a single click on the milestone
delete Button no longer immediately destroys the milestone.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@apps/web/src/features/issues/issue-properties.tsx`:
- Around line 89-93: Update the milestone useHotkey registration to pass an
enabled condition based on issue.projectId, disabling it when no project exists.
Keep the shortcut active and advertised when the milestone PropertyMenu is
rendered.

In `@apps/web/src/features/projects/milestone-board.tsx`:
- Around line 33-40: Update formatDate to avoid parsing date-only values as UTC,
preserving the intended calendar day for milestone.targetDate across time zones.
Format the YYYY-MM-DD parts directly or construct the Date with local time
before calling toLocaleDateString; keep the existing “No target” behavior and
display format unchanged.

In `@apps/web/tests/app/api/projects/milestones.test.ts`:
- Around line 70-83: Update the shared setup around beforeAll and beforeEach to
use the repository’s rollback test database wrapper instead of calling
resetDatabase directly. Ensure workspace and project creation, along with each
test’s database writes, execute within the wrapper’s transaction lifecycle and
roll back after every test while preserving the existing published reset and
sign-in setup.

In `@packages/mcp-server/tests/tools.test.ts`:
- Line 401: Move the milestone tests from the `describe('milestones over mcp')`
block in `tools.test.ts` into separate files under `tests/tools/`, mirroring
their source modules: place issue milestone coverage with `src/tools/issues.ts`
tests and scrum milestone coverage with `src/tools/scrum.ts` tests. Preserve the
existing test behavior while removing the misplaced coverage from the monolithic
test file.

---

Nitpick comments:
In `@apps/web/src/features/projects/milestone-board.tsx`:
- Around line 211-221: Update the milestone delete flow around the onDelete
handler to require confirmation before invoking the delete mutation. Add a
confirmation dialog or an undo action in the resulting toast, ensuring a single
click on the milestone delete Button no longer immediately destroys the
milestone.

In `@apps/web/src/features/projects/new-project-dialog.tsx`:
- Around line 200-203: Update the Cancel button in the DialogFooter to clear the
draft before closing by invoking the same reset behavior used by the dialog’s
other close paths, rather than calling only setOpen(false). Keep the dialog
closed after cancellation and ensure the existing reopen flow remains unchanged.
- Around line 76-83: Replace createdSchema.parse in the project-creation flow
with safeParse, and branch on its success result before using project.name or
project.slug. When validation fails, set a fixed product-facing error message
through setError instead of passing the ZodError to messageOf; preserve the
existing success navigation and caught-error handling for other failures.

In `@apps/web/src/lib/query/keys.ts`:
- Line 27: Declare and export MILESTONES_ROOT before queryKeys, then update the
milestones and any other affected key factory entries to use this constant
instead of the repeated 'milestones' literal, preserving the existing key
shapes.

In `@apps/web/src/lib/query/use-milestones.ts`:
- Around line 123-134: Update the onMutate handler in the milestone mutation to
be async, await client.cancelQueries for the milestones query key before reading
previous data or applying the optimistic setQueryData, and preserve the existing
rollback context and ordering logic.

In `@apps/web/tests/features/issues/issue-properties.test.tsx`:
- Around line 23-24: Replace the `{} as WorkspaceData` spread in the `workspace`
fixture with a fully populated, type-checked `WorkspaceData` literal, or reuse a
shared `workspaceFixture` helper validated against `WorkspaceData`; ensure all
required fields are explicitly defined so newly required fields produce
compile-time errors.

In `@apps/web/tests/features/projects/milestone-board.test.tsx`:
- Around line 6-9: Update the MilestoneBoard import in the milestone board test
to use the configured `@/features/projects/milestone-board.tsx` alias instead of
the relative path, keeping the other imports unchanged.
- Around line 52-58: Update the PATCH branch in the request stub to identify the
milestone matching the URL, apply the name change to that entry, and return that
patched milestone in the response instead of always returning served[0].
Preserve the existing served collection update behavior.

In `@docs/keyboard-shortcuts.md`:
- Line 78: Replace the manually maintained `m` shortcut row in the keyboard
shortcut documentation with the generated `?` dialog source, using the existing
shortcut registry as the authoritative source. Ensure the displayed entry
remains “m — Change milestone” and avoid maintaining a parallel table.

In `@packages/mcp-server/src/tools/scrum.ts`:
- Around line 503-507: Update the milestone ordering flow around
resolveMilestone to load the project’s scoped milestone list once and resolve
all input.milestones against it, preserving input order and the existing
not-found error behavior. Avoid calling resolveMilestone repeatedly; reuse the
existing project and principal scoping rules when building the reference-to-ID
mapping.

In `@packages/mcp-server/tests/tools.test.ts`:
- Around line 391-399: Update milestonesOf to validate payload['milestones']
with a Zod milestoneShapeSchema before returning it. Define milestoneShapeSchema
for id, name, and projectId, infer MilestoneShape from that schema, and replace
the unchecked cast with schema parsing while preserving the MilestoneShape[]
return type.
- Around line 461-465: Update the test around the update_issue call to move the
issue from its current project to a different target project, then assign a
milestone that exists only on that target project. Ensure the request uses the
target project and the assertions verify both the project change and successful
target-project milestone assignment, proving resolution does not use
currentProjectId.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 63b951a3-ba3b-4ccf-93e4-f441de2f0d0c

📥 Commits

Reviewing files that changed from the base of the PR and between d3bda0c and daaba51.

📒 Files selected for processing (33)
  • apps/web/src/app/(app)/projects/[slug]/page.tsx
  • apps/web/src/app/(app)/projects/page.tsx
  • apps/web/src/app/api/milestones/[id]/route.ts
  • apps/web/src/app/api/projects/[id]/milestones/reorder/route.ts
  • apps/web/src/app/api/projects/[id]/milestones/route.ts
  • apps/web/src/features/issues/issue-properties.tsx
  • apps/web/src/features/projects/data.ts
  • apps/web/src/features/projects/milestone-board.tsx
  • apps/web/src/features/projects/new-project-dialog.tsx
  • apps/web/src/features/projects/update-composer.tsx
  • apps/web/src/lib/query/keys.ts
  • apps/web/src/lib/query/schemas.ts
  • apps/web/src/lib/query/use-issues.ts
  • apps/web/src/lib/query/use-milestones.ts
  • apps/web/src/lib/realtime/delta-bridge.tsx
  • apps/web/tests/app/api/projects/milestones.test.ts
  • apps/web/tests/app/api/projects/route.test.ts
  • apps/web/tests/features/issues/issue-properties.test.tsx
  • apps/web/tests/features/projects/milestone-board.test.tsx
  • apps/web/tests/features/projects/new-project-dialog.test.tsx
  • apps/web/tests/features/projects/update-composer.test.tsx
  • apps/web/tests/lib/realtime/delta-bridge.test.tsx
  • docs/keyboard-shortcuts.md
  • docs/mcp.md
  • packages/core/src/work/issue-service.ts
  • packages/core/src/work/milestone-service.ts
  • packages/core/tests/work/issue-service.test.ts
  • packages/core/tests/work/milestone-service.test.ts
  • packages/mcp-server/src/resolve.ts
  • packages/mcp-server/src/tools/issues.ts
  • packages/mcp-server/src/tools/scrum.ts
  • packages/mcp-server/tests/tools.test.ts
  • packages/shared/src/validators/milestone.ts

Comment thread packages/mcp-server/tests/tools.test.ts Resolved
…ored

Review found three things. The milestone list now carries scope and
completed from listMilestonesWithProgress, so the counts follow the
issues instead of freezing at whatever the page was rendered with, and
an issue delta refreshes them. resolveMilestone refuses a name two
milestones share rather than picking the first. The milestone routes
parse with schemas from @orbit/shared before the service does.

Two smaller ones: the m shortcut is only registered when the issue is on
a project, and a date only target date is formatted from its own digits,
so it no longer shows the previous day west of UTC. The projects table
and the project header carried that bug too and now share the fix.
The panel advertised m next to Milestone even when the issue is on no
project, where the menu is not rendered and the binding is registered
disabled. The repository hint invariant test catches exactly that, so
the hint now appears only alongside a menu that opens. The row moved
into its own component to stay inside the complexity budget.
@imshashank
imshashank merged commit 5ddbb49 into main Aug 7, 2026
11 checks passed
@imshashank
imshashank deleted the projects/create-and-milestones branch August 7, 2026 10:42
imshashank added a commit that referenced this pull request Aug 7, 2026
Keeps the milestone wiring #148 added and drops the standup wiring beside
it: reorderMilestones and resolveMilestone in the MCP scrum tools, the
milestones invalidation in the delta bridge, and the milestones query key,
all without bringing back STANDUP_ROOT or the standup board key.

This branch was successfully deployed

1 active deployment
Preview — 8fe5d28d Deployed Aug 7, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: issues Issues, lists and boards area: mcp The MCP server, its tools and its OAuth area: web The Next.js app and its UI documentation Docs, the README, or anything that explains Orbit tests Test coverage and test infrastructure

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant