KaiPi77 opened a new issue, #9052:
URL: https://github.com/apache/devlake/issues/9052

   ### Search before asking
   
   - [x] I had searched in the 
[issues](https://github.com/apache/incubator-devlake/issues?q=is%3Aissue) and 
found no similar issues.
   
   
   ### What happened
   
   When a Jira connection is configured with multiple boards (scopes), 
`getIssueFieldMap()` in `backend/plugins/jira/tasks/epic_extractor.go` logs 
hundreds of false-positive warnings per pipeline run:
   
   [convertIssueChangelogs] filed name Time Spent is duplicated
   [convertIssueChangelogs] filed name Original Estimate is duplicated
   [convertIssueChangelogs] filed name Remaining Estimate is duplicated
   
   
   
   **Root cause:** The table `_tool_jira_issue_fields` stores fields per board. 
With 10 boards, the same field (identical field ID) appears 10 times. 
`getIssueFieldMap()` builds a name-based map and logs "duplicated" on the 
second occurrence — without checking whether the field ID is actually different.
   
   **SQL evidence from our instance (1 connection, 10 boards):**
   
   | Connection | True name duplicates (different field IDs) | Board duplicates 
(same ID, multiple boards) | Total |
   |---|---|---|---|
   | 3 | 1 | 852 | 853 |
   
   99.9% of warnings are false positives caused by board-level storage, not 
actual field name collisions.
   
   - DevLake version: v1.0.3-beta15 (also confirmed present in v1.0.3-beta10)
   - 1 Jira connection with 10 boards
   
   ### What do you expect to happen
   
   The warning should only be emitted when two fields with DIFFERENT field IDs 
share the same display name — i.e., a genuine name collision. Same field ID 
appearing multiple times (due to multi-board storage) should not trigger a 
warning.
   
   Proposed fix in `getIssueFieldMap()`:
   
   ```go
   // Current:
   if _, exists := fieldMap[field.Name]; exists {
       logger.Warn("filed name %s is duplicated", field.Name)
   }
   
   // Proposed:
   if existing, exists := fieldMap[field.Name]; exists {
       if existing.FieldId != field.FieldId {
           logger.Warn("field name %s is duplicated (IDs: %s, %s)", field.Name, 
existing.FieldId, field.FieldId)
       }
   }
   This would eliminate ~99.9% of false warnings while preserving the alert for 
genuine ambiguity.
   
   ### How to reproduce
   
   1. Create a Jira connection in DevLake
   2. Add multiple boards (≥2) as scopes to that connection
   3. Run a data collection (blueprint or manual trigger)
   4. Observe logs during convertIssueChangelogs task
   5. Every Jira field that exists on more than one board will produce a "filed 
name ... is duplicated" warning — multiplied by (number_of_boards - 1).
   
   ### Anything else
   
   - The log message contains a typo: "filed name" should be "field name" — 
could be fixed in the same PR.
   - The only genuine name collision in our instance is "Progress" (built-in 
progress field vs. customfield_36295 both named "Progress"). This is a real 
case where the warning is valuable.
   - An alternative fix: deduplicate _tool_jira_issue_fields by (connection_id, 
field_id) before building the map, ignoring the board dimension.
   - The warning has no functional impact on data import — it's purely log 
noise — but it degrades operator confidence and pollutes alerting systems.
   
   
   ### Version
   
   v1.0.3-beta15
   
   ### Are you willing to submit PR?
   
   - [x] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [x] I agree to follow this project's [Code of 
Conduct](https://www.apache.org/foundation/policies/conduct)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to