Skip to content

fix(issues): handle null user on comments#44

Closed
flipbit03 wants to merge 2 commits intoczottmann:mainfrom
flipbit03:fix/null-comment-user
Closed

fix(issues): handle null user on comments#44
flipbit03 wants to merge 2 commits intoczottmann:mainfrom
flipbit03:fix/null-comment-user

Conversation

@flipbit03
Copy link

@flipbit03 flipbit03 commented Feb 10, 2026

Summary

1. Fix: handle null comment.user in issue transform

Linear issues can have comments where the user field is null. This happens with automated or externally-synced comments — for example, comments created by the GitHub integration that mirror PR activity into Linear. These comments have no associated Linear user, so the API returns user: null.

Previously, doTransformIssueData accessed comment.user.id and comment.user.name unconditionally, causing a crash:

Cannot read properties of null (reading 'id')

This made linearis issues read unusable on any issue that had such comments.

Changes:

  • Add null check for comment.user in doTransformIssueData, matching the existing ternary pattern used for other nullable fields (assignee, project, cycle, etc.)
  • Mark user as optional in both the LinearIssue.comments type and LinearComment interface in linear-types.d.ts
  • Add unit test verifying both the null-user and present-user cases

2. Add prepare script to enable git-based installs

Without a prepare script, installing linearis from a git ref fails because dist/ is gitignored and there's no build step during installation. This makes it impossible to install directly from a fork or branch.

The prepare script bootstraps the build by running npm install --ignore-scripts (to fetch all dependencies including TypeScript) followed by tsc. The npm_config_global=false env var is needed because npm's git dep preparation inherits the global install context, which would otherwise cause the inner install to recurse into global node_modules.

Note: Direct npm install -g "github:user/linearis#ref" hits a tar extraction bug in npm 11 where the packed tarball is correct but extraction silently drops files. The workaround is a two-step install via npm pack. Here's a one liner if you want to use this fork while the PR itself cooks:

npm uninstall -g linearis \
  && cd /tmp \
  && npm pack "github:flipbit03/linearis#fix/null-comment-user" \
  && npm install -g /tmp/linearis-*.tgz \
  && rm linearis-*.tgz

Test plan

  • npm test — all 93 tests pass including 2 new ones
  • npm run build — compiles cleanly
  • linearis issues read <issue-with-github-synced-comments> — no longer crashes
  • Install from git fork via npm pack + npm install -g — works end to end

Automated/synced comments (e.g. GitHub integration) can have a null
`user` field. Add a null check matching the existing pattern used for
other optional fields (assignee, project, cycle, etc.) and mark the
`user` field as optional in both the LinearIssue comments type and the
LinearComment interface.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@flipbit03 flipbit03 force-pushed the fix/null-comment-user branch 2 times, most recently from 742ac79 to e4f47af Compare February 10, 2026 22:56
@flipbit03 flipbit03 force-pushed the fix/null-comment-user branch 4 times, most recently from a42826d to cbfa688 Compare February 10, 2026 23:05
npm doesn't install devDependencies in its git clone temp directory
before running lifecycle scripts, so `tsc` is unavailable. Use
`npx --yes --package typescript tsc` to self-bootstrap the build.

This enables `npm install -g github:user/linearis#ref`.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@flipbit03 flipbit03 force-pushed the fix/null-comment-user branch from cbfa688 to a9c1c38 Compare February 10, 2026 23:06
@nicwise
Copy link

nicwise commented Feb 12, 2026

merged this on top of my main, and its working again! Thanks @flipbit03

@flipbit03
Copy link
Author

flipbit03 commented Feb 13, 2026

@nicwise, glad to hear it helped!

I looked through the PRs and noticed mine is at least the third fixing the same issue, so things seem a bit quiet on the issue/PR tracker. Since this is an open-source project built to scratch the author’s own itch (which I totally respect), I decided to stop pushing and just build what I needed.

So I started lineark: https://github.com/flipbit03/lineark

Right now it supports read operations and uses the same token file (~/.linear_api_token), so if you already have a Personal API Token there for linearis, it should work out of the box.

I’ve also added things I felt were missing, like a proper whoami command to check which account is authenticated.

There’s a one-line installer in the README if you don’t want to install Rust, and it’s also published on Crates.io, so you can install it with cargo.

Looks like I’m scratching my own itch now too 😄

@flipbit03 flipbit03 closed this by deleting the head repository Feb 15, 2026
@flipbit03
Copy link
Author

flipbit03 commented Feb 15, 2026

Closed my branch/PR since I don't plan on using linearis anymore. Thanks, all.

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.

2 participants