feat(import): support issue dependencies in linear CSV import - #1250
Open
SomSamantray wants to merge 3 commits into
Open
SomSamantray wants to merge 3 commits into
SomSamantray wants to merge 3 commits into
Conversation
Add optional Blocks and Blocked By columns to the Linear CSV importer so a backlog can be bootstrapped with its block graph already wired. References are resolved against the other issues in the same import file before anything is created, matching first on the row Id column and then on a case-insensitive title match. An unresolvable or ambiguous reference aborts the import before any issue is created, so a re-run never duplicates a half-imported backlog. After creation, the resolved pairs are emitted as issueRelationCreate mutations with a blocks type, swapping the ids for Blocked By references. Pairs are canonicalized and deduplicated so a dependency expressed in both columns is created once, and each relation result's success flag is checked before the import reports success. Co-authored-by: CommandCodeBot <noreply@commandcode.ai>
Address code-review findings on the CSV dependency import feature: - Resolve and validate dependency references before any workspace mutation (team/label/issue creation), so a malformed graph aborts cleanly. - Reject duplicate row Ids, self-references, and dependencies declared in both directions instead of silently collapsing or mis-binding them. - Check the createIssue success flag and created issue id, throwing when the API rejects an issue, so a partial graph is never reported as a successful import. - Add a shared rate-limit retry wrapper for issue and relation creation and read the created issue id synchronously instead of issuing a second GraphQL fetch per issue. - Cover Blocked By parsing and the new validation errors in unit tests. Co-authored-by: CommandCodeBot <noreply@commandcode.ai>
Co-authored-by: CommandCodeBot <noreply@commandcode.ai>
🦋 Changeset detectedLatest commit: fb0477f The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Linear CSV import can now carry issue dependencies. Add optional
BlocksandBlocked Bycolumns; each reference resolves to another issue in the same import file, and once every issue is created the links are wired asblocksrelations.A reference that cannot be resolved is a hard error, raised before any issue, team, or label is created. Self-references, dependencies declared in both directions, and duplicate row
Ids are rejected the same way. This keeps a re-run from ever duplicating a half-imported backlog, because a bad file never gets far enough to create anything.Design notes
Idcolumn, then on a case-insensitive title. A dependency expressed in both columns (row ABlocks=Bplus row BBlocked By=A) is deduplicated to a single relation.@linear/sdkalready exposescreateIssueRelationwith ablocksrelation type; no SDK change was needed.Validation
pnpm --filter './packages/import' testpasses 27 tests across 3 files (12 pre-existing plus new coverage for parsing, resolution, dedupe, and the validation errors). Typecheck and lint are clean.Unapplied review findings
CreatedIssueIds | undefinedunion threads an invariant guard through the creation loop, allocating a throwaway Map per issue on dependency-free imports. Suggested fix: hoist the branch so the Map is created once only when dependencies exist.error.typeis read untyped. Suggested fix: anonRetryhook plus type narrowing.success === falseabort, missing-id skip) is not exercised by any test;createRelationsis not exported and there is noLinearClientmock harness in the package.retryAfter/requestsResetAt. Suggested fix: honor the server reset hint when present.Review run:
20260903-091604-01e96716