-
Notifications
You must be signed in to change notification settings - Fork 0
Remove FXIOS-14327 [Clean up] Inactive tabs removal part 2 (final) #18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: qodo_combined_20260121_qodo_grep_cursor_copilot_1_base_remove_fxios-14327_clean_up_inactive_tabs_removal_part_2_final_pr230
Are you sure you want to change the base?
Conversation
Code Review by Qodo
1. MPL header removed in TabPanelAction.swift
|
| import Redux | ||
| import Common | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1. Mpl header removed in tabpanelaction.swift 📘 Rule violation ⛨ Security
• TabPanelAction.swift no longer begins with the required Mozilla Public License v2.0 header. • This violates the repository licensing requirement for all Swift source files and can create legal/compliance risk if merged. • Re-add the exact MPL v2.0 header block at the very top of the file before any imports.
Agent prompt
## Issue description
`TabPanelAction.swift` is missing the required MPL v2.0 header at the very top of the file.
## Issue Context
Compliance requires every `.swift` file to begin with the exact MPL v2.0 header block.
## Fix Focus Areas
- firefox-ios/Client/Frontend/Browser/Tabs/Action/TabPanelAction.swift[1-3]
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
| private func scrollToTab(_ scrollState: TabsPanelState.ScrollState) { | ||
| let section: Int = scrollState.isInactiveTabSection ? 0 : 1 | ||
| let indexPath = IndexPath(row: scrollState.toIndex, section: section) | ||
| let indexPath = IndexPath(row: scrollState.toIndex, section: 1) | ||
| // Piping this into main thread let the collection view finish its layout process | ||
| DispatchQueue.main.async { | ||
| guard !self.collectionView.indexPathsForFullyVisibleItems.contains(indexPath) else { return } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2. scrolltotab uses wrong section 📘 Rule violation ⛯ Reliability
• TabDisplayView.scrollToTab(_:) builds an IndexPath with section: 1 even though the diffable data source snapshot now appends only a single section. • This creates an out-of-range section index (boundary value error), causing scroll behavior to silently fail and increasing risk of future crashes if validation guards change. • Update scrollToTab(_:) to target the correct section index for the .tabs section (0).
Agent prompt
## Issue description
`TabDisplayView.scrollToTab(_:)` uses `section: 1`, but the diffable data source now only appends one section (`.tabs`). This is a boundary/indexing bug and can cause scrolling to silently fail.
## Issue Context
`TabDisplayDiffableDataSource.updateSnapshot` appends only `[.tabs]`, so the valid section indices are only `0`.
## Fix Focus Areas
- firefox-ios/Client/Frontend/Browser/Tabs/Views/TabDisplayView.swift[171-180]
- firefox-ios/Client/Frontend/Browser/Tabs/Views/TabDisplayDiffableDataSource.swift[17-25]
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
| guard !state.tabs.isEmpty else { return nil } | ||
|
|
||
| if case .scrollToSelectedTab(let shouldAnimate) = scrollBehavior { | ||
| if let selectedTabIndex = state.tabs.firstIndex(where: { $0.isSelected }) { | ||
| return ScrollState(toIndex: selectedTabIndex, isInactiveTabSection: false, withAnimation: shouldAnimate) | ||
| return ScrollState(toIndex: selectedTabIndex, withAnimation: shouldAnimate) | ||
| } else if !state.tabs.isEmpty { | ||
| // If the user switches between the normal and private tab panels, there's a chance this subset of tabs does | ||
| // not contain a selected tab. In that case, we should scroll to the bottom of the panel. | ||
| // Note: Could optimize further by scrolling to the most recent tab if we had `lastExecutedTime` in our model | ||
| return ScrollState(toIndex: state.tabs.count - 1, isInactiveTabSection: false, withAnimation: shouldAnimate) | ||
| return ScrollState(toIndex: state.tabs.count, withAnimation: shouldAnimate) | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
3. createtabscrollbehavior off-by-one index 📘 Rule violation ⛯ Reliability
• TabsPanelState.createTabScrollBehavior returns toIndex: state.tabs.count when no selected tab exists, which is one past the last valid index (count - 1). • This is a boundary value error that can produce invalid index paths for scrolling and cause silent failures or crashes depending on downstream handling. • Use state.tabs.count - 1 (or equivalent safe clamping) when scrolling to the last tab.
Agent prompt
## Issue description
`TabsPanelState.createTabScrollBehavior` returns `toIndex: state.tabs.count` when no selected tab exists, which is out of bounds for the `tabs` array.
## Issue Context
The returned `toIndex` is later used to build an `IndexPath(row: toIndex, ...)` for scrolling. The valid last row index is `state.tabs.count - 1`.
## Fix Focus Areas
- firefox-ios/Client/Frontend/Browser/Tabs/State/TabsPanelState.swift[134-151]
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
Benchmark PR from qodo-benchmark#230