Skip to content

[JIM-263] Jira migrator creates a new numbered custom field on every import run - #26237

Merged
as-op merged 4 commits into
devfrom
bug/jim-263-jira-migrator-creates-a-new-numbered-custom-field-on-every-import-run-instead-of-reusing-the-one-it-created-before
Oct 26, 2026
Merged

as-op merged 4 commits into
devfrom
bug/jim-263-jira-migrator-creates-a-new-numbered-custom-field-on-every-import-run-instead-of-reusing-the-one-it-created-before

Conversation

@as-op

@as-op as-op commented Oct 22, 2026

Copy link
Copy Markdown
Contributor

Ticket

https://community.openproject.org/wp/JIM-263

What are you trying to accomplish?

if the OP instance already has a custom field (e.g. "Story Points") with a different format (e.g. an integer one), but the imported Jira "Story Points" are of type float, the format filter drops it => migrator creates "Story Points (2)".
On the next import run, Story Points (2) is a compatible candidate but is not matched => Story Points (3) and so on,

What approach did you choose and why?

The solution is to look at the base name of existing custom fields without the number suffix, so "Story Points (2)" can be found by a Jira custom field "Story Points". Text based suffixes like "Story Points (archived)" are not considered.

Merge checklist

  • Added/updated tests

@github-actions

Copy link
Copy Markdown

Warning

Flaky specs

  • rspec ./spec/features/components/lookbook_accessibility_spec.rb[1:14:1]
🤖 Ask Copilot to investigate

Copy the prompt below into a new comment on this PR to delegate the investigation to GitHub Copilot. It will look into the flakiness and open a separate pull request with you as reviewer.

@copilot The following spec(s) are flaky in CI (first seen on PR #26237, linked for reference only):

- `rspec ./spec/features/components/lookbook_accessibility_spec.rb[1:14:1]`

Treat this as a standalone task, unrelated to PR #26237. Create a new branch from origin/dev and open a new pull request targeting dev — do not stack it on PR #26237 or reuse that branch.

Follow the playbook in docs/development/testing/handling-flaky-tests/README.md to find the root cause and fix the underlying race — do not skip, delete, or weaken the spec to make it pass; disabling is a last resort per the playbook, and only with a bug ticket. Verify the fix by running the spec(s) repeatedly (e.g. `script/bulk_run_rspec --run-count 10`).

If you cannot reproduce the flake or are not confident in a fix after reasonable investigation, do not fabricate a change or skip the spec to force CI green. Instead, leave the pull request in draft and document what you tried, the suspected cause, and any leads in its description, then assign @as-op to take over.

Once the fix is verified, title the PR after the spec(s) it fixes, and use the PR description to explain the root cause, how the change resolves it, and the before/after results. Label the PR `flaky-spec`, assign @as-op, and request a review from @as-op.
On every commit, set @as-op as the sole co-author with a `Co-authored-by:` trailer (use their GitHub no-reply email so it links to their account), so it is traceable who dispatched the fix.

@klappradla klappradla left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Neat ✨

I left some comments / questions here and there. One thing I think could be worth considering (also in the tests) is, that a field from Jira could already have a (<number>) suffix.

Plus - even though it's not necessarily related to the bug this is fixing - it would also make sense to align the candidate matching for the system fields that are mapped to custom fields (right now only resolution date) with the new logic and have it centralized in one module.

Comment thread app/workers/import/jira_create_project_job/custom_field_names.rb Outdated
Comment thread app/workers/import/jira_create_project_job/custom_field_names.rb Outdated
as-op and others added 3 commits October 26, 2026 12:48
Co-authored-by: Max Mulatz <max@bitcrowd.net>
…s-a-new-numbered-custom-field-on-every-import-run-instead-of-reusing-the-one-it-created-before' into bug/jim-263-jira-migrator-creates-a-new-numbered-custom-field-on-every-import-run-instead-of-reusing-the-one-it-created-before
@as-op
as-op merged commit 16ef7d8 into dev Oct 26, 2026
18 of 19 checks passed
@as-op
as-op deleted the bug/jim-263-jira-migrator-creates-a-new-numbered-custom-field-on-every-import-run-instead-of-reusing-the-one-it-created-before branch October 26, 2026 12:26
@github-actions github-actions Bot locked and limited conversation to collaborators Oct 26, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants