fix(jira): read issue type from issueTypes.task, not never-written issueTypes.default (MNG-1769) - #1530
Merged
Merged
Conversation
…sueTypes.default (MNG-1769)
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
nhopeatall
approved these changes
Aug 4, 2026
nhopeatall
left a comment
Collaborator
There was a problem hiding this comment.
Summary
APPROVE — a correct, complete, and well-tested fix for the issueTypes.default → issueTypes.task key mismatch. The runtime read is now the sole consumer, config flows through generically, and the frontend/backend/docs changes are consistent. Faithfully implements all five work-item steps (MNG-1769).
Verification
- Core fix is complete.
createWorkItemnow readsthis.config.issueTypes?.task ?? 'Task'. Grepped the whole tree —src/pm/jira/adapter.ts:210is the only runtime reader ofissueTypes.*; nothing else reads.default/.subtaskand nothing writes.default.getJiraConfig→JiraConfig.issueTypes(Record<string,string>) passes the key through unchanged, so a saved{ task: 'Story' }actually reaches the adapter. ManifestconfigFixtureand config-schema already usedtask. - Enriched error is sound.
enrichCreateIssueErrorguards thegetIssueTypesForProjectdiscovery call in its own try/catch and re-throws the original error on discovery failure.getIssueTypesForProjectexists and returns{name, subtask}[], so the!t.subtaskfilter is correct. Neither PM caller (friction/materialize.ts,alerting/_shared/materialize.ts) inspects the error type, so wrapping it in a newErroris safe. - Frontend narrowing is safe.
onMappingChange: (role: 'task', …)— the sole caller (jira/wizard.ts:319) dispatchesSET_JIRA_ISSUE_TYPEwhosekey: stringaccepts'task'.buildIntegrationConfigstill serializesissueTypesgenerically; a previously-savedsubtaskvalue hydrates and re-saves harmlessly, matching the documented behavior. - Tests. Ran
tests/unit/pm/jira/adapter.test.ts(72 ✓) andtests/unit/web/jira-issue-type-step.test.ts(7 ✓) locally; CI 7/7 green. Fixture correction + parity/fallback/regression/enriched-error coverage all present.
Minor (non-blocking, optional)
src/pm/jira/adapter.ts:274-281— the enriched message frames everycreateIssuefailure as an issue-type problem ("Map the Task role to one of these…"). For a non-issue-type 400 (e.g. a missing required field) that's slightly misleading, though the root cause is preserved viaOriginal error: …. Fine to leave as-is since the common failure mode is exactly the invalid-issue-type case this targets.
🕵️ claude-code · claude-opus-4-8 · run details
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
Fixes MNG-1769 — the JIRA wizard persists the operator's Task mapping under
issueTypes.task, butJiraPMProvider.createWorkItemreadissueTypes.default(a key nothing ever wrote), so every JIRA issue was hardcoded to type"Task", silently ignoring the operator's mapping. The adapter unit-test fixture itself useddefault, masking the bug in CI while the manifestconfigFixturealready usedtask.Same "wizard writes X → runtime reads Y" failure shape as MNG-1768; this PR mirrors its parity-guard approach.
Changes
src/pm/jira/adapter.ts) —createWorkItemnow readsthis.config.issueTypes?.task ?? 'Task'. The'Task'fallback is retained for configs that never set a mapping (backward compatible). Updated the block comment to document theissueTypes.taskcontract.src/pm/jira/adapter.ts) —createIssueis wrapped in try/catch. On failure, a best-effortgetIssueTypesForProject(projectKey)call re-throws an error naming the attempted issue type and the project's discovered non-subtask types. The diagnostic fetch is itself guarded so a discovery failure re-throws the original creation error unchanged.tests/unit/pm/jira/adapter.test.ts) — corrected the misleadingmockConfigfixture (default/subtask→task: 'Story'); updated the existing create test to assert the mapping is honored; added parity, fallback, regression (legacydefaultignored), and enriched-error tests.web/src/components/projects/pm-providers/jira/issue-type-step.tsx) — removed the unusedsubtaskwizard row (no consumer, no subtask-creation path); narrowedonMappingChangerole type to'task'. Updated the step test accordingly.src/integrations/README.md) — documented theissueTypes.taskcontract, the intentional non-reading ofdefault, the actionable-error behavior, and whysubtaskis not consumed.Behavior change
Projects that explicitly mapped Task to a non-
Tasktype were silently broken and now work. Projects with aTasktype and no mapping (or aTaskmapping) are unchanged — the fallback still yields'Task'. No migration needed (nothing ever wroteissueTypes.default). A previously-savedissueTypes.subtaskvalue stays in config, harmlessly unread.Testing
npx vitest run --project unit-core tests/unit/pm/jira/adapter.test.ts— 72 passingnpx vitest run tests/unit/web/jira-issue-type-step.test.ts tests/unit/web/pm-wizard-hooks.test.ts— passingnpx vitest run --project unit-core tests/unit/integrations/pm-conformance.test.ts— passing (configFixture already usestask)tests/unit/architecture-docs.test.ts— passing🤖 Generated with Claude Code
🕵️ claude-code · claude-opus-4-8 · run details