fix(issues): handle null user on comments#44
fix(issues): handle null user on comments#44flipbit03 wants to merge 2 commits intoczottmann:mainfrom
Conversation
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>
742ac79 to
e4f47af
Compare
a42826d to
cbfa688
Compare
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>
cbfa688 to
a9c1c38
Compare
|
merged this on top of my main, and its working again! Thanks @flipbit03 |
|
@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 Right now it supports read operations and uses the same token file ( I’ve also added things I felt were missing, like a proper 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 😄 |
|
Closed my branch/PR since I don't plan on using |
Summary
1. Fix: handle null
comment.userin issue transformLinear issues can have comments where the
userfield isnull. 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 returnsuser: null.Previously,
doTransformIssueDataaccessedcomment.user.idandcomment.user.nameunconditionally, causing a crash:This made
linearis issues readunusable on any issue that had such comments.Changes:
comment.userindoTransformIssueData, matching the existing ternary pattern used for other nullable fields (assignee,project,cycle, etc.)useras optional in both theLinearIssue.commentstype andLinearCommentinterface inlinear-types.d.ts2. Add
preparescript to enable git-based installsWithout a
preparescript, installing linearis from a git ref fails becausedist/is gitignored and there's no build step during installation. This makes it impossible to install directly from a fork or branch.The
preparescript bootstraps the build by runningnpm install --ignore-scripts(to fetch all dependencies including TypeScript) followed bytsc. Thenpm_config_global=falseenv 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.Test plan
npm test— all 93 tests pass including 2 new onesnpm run build— compiles cleanlylinearis issues read <issue-with-github-synced-comments>— no longer crashesnpm pack+npm install -g— works end to end