linearis icon indicating copy to clipboard operation
linearis copied to clipboard

linearis milestone create fails

Open cjveo opened this issue 6 months ago • 2 comments

What happened?

linearis milestones create always fails with a GraphQL variable error, and linearis milestones update silently sends incorrect variables. The root cause is that graphql/mutations/project-milestones.graphql declares top-level scalar variables, but src/services/milestone-service.ts passes them wrapped as { input } — every other create/update mutation in the codebase uses the $input convention, so milestone-service.ts is correct and the .graphql file is the odd one out.

Expected behavior

linearis milestones create --project <uuid> "My Milestone" creates the milestone and returns the created object as JSON. linearis milestones update <ms-id> --name "new name" updates only the fields that were provided.

Steps to reproduce

linearis milestones create "My Milestone" --project <project-uuid>

Actual output

After `npm run generate`, the existing `client.request(CreateProjectMilestoneDocument, { input })` in `milestone-service.ts` becomes type-correct end-to-end, matching `createProject`, `createInitiative`, etc.

Suggested test addition (mirrors the `listMilestones` variable assertions):


it("passes input as a top-level GraphQL variable", async () => {
  const client = mockGqlClient({
    projectMilestoneCreate: {
      success: true,
      projectMilestone: { id: "ms-new", name: "v2.0", description: null, targetDate: null, sortOrder: 0 },
    },
  });
  const input = { projectId: "proj-1", name: "v2.0", description: "desc", targetDate: "2025-12-01" };
  await createMilestone(client, input);
  expect(client.request).toHaveBeenCalledWith(expect.anything(), { input });
});

Linearis version

2026.4.9

Node.js version

v22.22.2

Operating system

Linux

Authentication method

~/.linearis/token (linearis auth login)

Additional context

graphql/mutations/project-milestones.graphql is the only mutation file in the repo that declares top-level scalar variables rather than the $input: <Type>Input! shape used everywhere else. But src/services/milestone-service.ts calls the document with { input } — which is the convention every other service uses (createProject, createInitiative, createIssue, …):

Suggest: Align project-milestones.graphql with the rest of the codebase by taking a single $input argument.

# graphql/mutations/project-milestones.graphql (proposed)
mutation CreateProjectMilestone($input: ProjectMilestoneCreateInput!) {
  projectMilestoneCreate(input: $input) {
    success
    projectMilestone { ... }
  }
}

mutation UpdateProjectMilestone(
  $id: String!
  $input: ProjectMilestoneUpdateInput!
) {
  projectMilestoneUpdate(id: $id, input: $input) {
    success
    projectMilestone { ... }
  }
}

cjveo avatar May 19 '26 11:05 cjveo

LIN-152

linear[bot] avatar May 19 '26 11:05 linear[bot]

Thanks for reporting this — milestone create was failing because the mutation variables weren't wrapped in the $input shape Linear expects. Fixed in #238. It's now on the prerelease channel (npm i -g linearis@next, currently 2026.6.0-next.5) — would appreciate a quick confirmation that create works for you now. Planning to promote to stable soon (#231). Happy for any feedback!

iamfj avatar Jul 02 '26 11:07 iamfj