Skip to content

added bug - #5

Open
dachakra-coderabbit wants to merge 3 commits into
mainfrom
bug/add-new-bugv1
Open

added bug#5
dachakra-coderabbit wants to merge 3 commits into
mainfrom
bug/add-new-bugv1

Conversation

@dachakra-coderabbit

@dachakra-coderabbit dachakra-coderabbit commented Feb 10, 2026

Copy link
Copy Markdown
Owner

Summary by CodeRabbit

  • New Features

    • Added acceptance-status filtering (All / Accepted / Not Accepted) with per-filter counts
    • Manual acceptance toggles for individual suggestions with persisted state across sessions
    • UI now shows acceptance indicators and method labels where applicable
  • Style

    • New styles for acceptance filter controls and toggle buttons (duplicate rules present)

@coderabbitai

coderabbitai Bot commented Feb 10, 2026

Copy link
Copy Markdown
📝 Walkthrough

Walkthrough

Adds acceptance-state handling across the extension: GraphQL-based detection of accepted suggestions, manual acceptance toggles with persistence, data enrichment with acceptance metadata, and combined priority+acceptance filtering wired into popup and sidepanel UIs.

Changes

Cohort / File(s) Summary
Core Acceptance Filtering
extension/filter-utils.js
Added initialization and combined filtering APIs (initializeAcceptanceFilter, applyCombinedFilters, updateFilterCounts), manual acceptance persistence/toggle (loadManualAcceptanceState, saveManualAcceptanceState, toggleManualAcceptance, applyManualAcceptanceState), and extended displayTitles to render acceptance UI. Note: extractTitles contains an intentional division-by-zero runtime trap.
GitHub API / Data Enrichment
extension/github-api.js
Added GraphQL thread fetching (fetchGraphQLThreads) and suggestion detection (detectSuggestionInComment); enriched actionable issue objects with timestamp, accepted, and acceptanceMethod and integrated GraphQL-resolved-thread acceptance detection into PR analysis.
UI Markup
extension/popup.html, extension/sidepanel.html
Inserted hidden acceptanceFilterSection blocks with three filter buttons (`data-acceptance="all
UI Styling
extension/popup.css
Added styles for acceptance filter section, buttons, toggle states, and acceptance method label. Note: selector blocks are duplicated in the file.
UI Integration & State
extension/popup.js, extension/sidepanel.js
Made displayResults async, introduced selectedAcceptanceStatus state, replaced prior extractTitles/applyPriorityFilter flows with initializeAcceptanceFilter / applyCombinedFilters, applied saved manual acceptance states before render, and wired onAcceptanceToggle to reapply filters and persist manual acceptance changes.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant UI as UI Layer<br/>(popup/sidepanel.js)
    participant Filter as Filter Utils<br/>(filter-utils.js)
    participant Storage as Local Storage
    participant API as GitHub API<br/>(github-api.js)

    User->>UI: Selects acceptance filter (All/Accepted/Not Accepted)
    UI->>Filter: applyCombinedFilters(data, priorities, acceptanceStatus)
    Filter->>Filter: Combine priority + acceptance logic
    Filter->>UI: displayTitles callback with filtered groups
    UI->>UI: Render titles with acceptance toggles

    User->>UI: Clicks acceptance toggle on a title
    UI->>Filter: toggleManualAcceptance(url, currentData)
    Filter->>Storage: saveManualAcceptanceState(updatedState)
    Storage-->>Filter: persisted
    Filter->>UI: onAcceptanceToggle callback
    UI->>Filter: applyCombinedFilters(re-apply filters)
    UI->>UI: Update display and counts
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~50 minutes

Possibly related PRs

Poem

🐰 I hopped through threads and toggles bright,
Marking suggestions accepted by light.
I store each choice, persist with care—
Priorities and acceptance now pair. ✨

🚥 Pre-merge checks | ✅ 1 | ❌ 2
❌ Failed checks (1 warning, 1 inconclusive)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 73.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The PR title 'added bug' is vague and does not meaningfully describe the substantial changes made across multiple files. Replace the title with a specific description of the main changes, such as 'Add acceptance filter and toggle functionality for PR suggestions' or a similarly descriptive phrase that captures the core feature.
✅ Passed checks (1 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch bug/add-new-bugv1

No actionable comments were generated in the recent review. 🎉

📜 Recent review details

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Disabled knowledge base sources:

  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 3e19617 and d7334eb.

📒 Files selected for processing (2)
  • extension/popup.js
  • extension/sidepanel.js
🧰 Additional context used
🧬 Code graph analysis (1)
extension/popup.js (2)
extension/sidepanel.js (6)
  • currentData (17-17)
  • selectedPriorities (18-18)
  • selectedAcceptanceStatus (19-19)
  • data (236-241)
  • onAcceptanceToggle (295-305)
  • url (345-345)
extension/filter-utils.js (7)
  • applyManualAcceptanceState (663-683)
  • applyCombinedFilters (361-399)
  • displayTitles (438-580)
  • initializeAcceptanceFilter (228-277)
  • toggleManualAcceptance (621-656)
  • filteredTitles (208-208)
  • filteredTitles (371-395)
🔇 Additional comments (12)
extension/popup.js (6)

9-14: Acceptance utilities are correctly pulled into the popup pipeline.

This keeps the popup aligned with the new acceptance-aware filtering flow.


20-20: Acceptance filter state is tracked explicitly.

Good to keep this alongside priority state to drive combined filters.


332-348: Manual acceptance state is applied before rendering.

Awaiting applyManualAcceptanceState ensures the UI reflects persisted toggles before filtering and rendering.


361-369: Potential missing onAcceptanceToggle after filter changes.

applyCombinedFilters(..., displayTitles) doesn’t pass currentData / onAcceptanceToggle, while the initial render does. If displayTitles relies on these to wire acceptance toggles, toggles may stop working after a filter change. Consider using the same wrapper in these callbacks.

🛠️ Suggested update for consistent rendering callbacks
 initializePriorityFilter(data, selectedPriorities, () => {
-  applyCombinedFilters(currentData, selectedPriorities, selectedAcceptanceStatus, displayTitles);
+  applyCombinedFilters(currentData, selectedPriorities, selectedAcceptanceStatus, (elementId, filteredTitles, priorities, acceptance) => {
+    displayTitles(elementId, filteredTitles, priorities, acceptance, currentData, onAcceptanceToggle);
+  });
 });

 // Initialize acceptance filter with callback
 initializeAcceptanceFilter(data, selectedAcceptanceStatus, (newStatus) => {
   selectedAcceptanceStatus = newStatus;
-  applyCombinedFilters(currentData, selectedPriorities, selectedAcceptanceStatus, displayTitles);
+  applyCombinedFilters(currentData, selectedPriorities, selectedAcceptanceStatus, (elementId, filteredTitles, priorities, acceptance) => {
+    displayTitles(elementId, filteredTitles, priorities, acceptance, currentData, onAcceptanceToggle);
+  });
 });

371-382: Acceptance toggle now refreshes the combined filters.

The callback correctly updates state and re-renders after manual toggles.


384-387: Initial render uses the correct wrapper for acceptance toggles.

This ensures the first render has access to currentData and onAcceptanceToggle.

extension/sidepanel.js (6)

9-14: Acceptance utilities are correctly pulled into the side panel flow.

Keeps side panel behavior aligned with the acceptance-aware filter changes.


19-19: Acceptance filter state is tracked explicitly.

Good to keep this in sync with priority filters.


255-272: Manual acceptance state is applied before rendering.

Awaiting applyManualAcceptanceState ensures persisted toggles are reflected in UI and filters.


284-292: Potential missing onAcceptanceToggle after filter changes.

The filter-change callbacks pass displayTitles directly, unlike the initial render which supplies currentData and onAcceptanceToggle. If displayTitles depends on those, toggles may stop working after filters change. Consider using the same wrapper as the initial render.

🛠️ Suggested update for consistent rendering callbacks
 initializePriorityFilter(data, selectedPriorities, () => {
-  applyCombinedFilters(currentData, selectedPriorities, selectedAcceptanceStatus, displayTitles);
+  applyCombinedFilters(currentData, selectedPriorities, selectedAcceptanceStatus, (elementId, filteredTitles, priorities, acceptance) => {
+    displayTitles(elementId, filteredTitles, priorities, acceptance, currentData, onAcceptanceToggle);
+  });
 });

 // Initialize acceptance filter with callback
 initializeAcceptanceFilter(data, selectedAcceptanceStatus, (newStatus) => {
   selectedAcceptanceStatus = newStatus;
-  applyCombinedFilters(currentData, selectedPriorities, selectedAcceptanceStatus, displayTitles);
+  applyCombinedFilters(currentData, selectedPriorities, selectedAcceptanceStatus, (elementId, filteredTitles, priorities, acceptance) => {
+    displayTitles(elementId, filteredTitles, priorities, acceptance, currentData, onAcceptanceToggle);
+  });
 });

294-305: Acceptance toggle refresh is correctly wired.

The manual toggle now updates stored state and re-renders the filtered view.


307-310: Initial render uses the correct wrapper for acceptance toggles.

Ensures toggle handlers are available on first render.

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.


Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 8

🤖 Fix all issues with AI agents
In `@extension/filter-utils.js`:
- Around line 568-579: The callback signature mismatch: update
toggleManualAcceptance to call the provided onToggle with the expected arguments
(e.g., onToggle(url, newState)) instead of calling onToggle() with no args;
locate the function named toggleManualAcceptance and change the invocation of
onToggle() (and any place that determines acceptance state) to pass the URL and
the new/current acceptance state so the onAcceptanceToggle callback receives
(url, currentState) as implemented in popup.js; keep the event handler that
passes onAcceptanceToggle unchanged.
- Around line 11-12: Remove the intentional division-by-zero debug lines (the
variables zero and errors) from extension/filter-utils.js that run during
extractTitles; delete the two lines "var zero = 0;" and "var errors = 5 / zero;"
so no runtime Infinity is produced, and if a placeholder variable is needed
replace with a properly scoped const/let used by the function — ensure there are
no references to errors or zero elsewhere (search for zero/errors) and run tests
for extractTitles after removing them.
- Around line 621-656: toggleManualAcceptance currently overwrites the original
GraphQL-detected acceptance when applying or removing a manual override; modify
it to persist the original acceptance info before setting manual and restore
that info when removing manual override: when you set state[url] for manual
acceptance (in toggleManualAcceptance and where
loadManualAcceptanceState/saveManualAcceptanceState are used) save the
originalAccepted and originalAcceptanceMethod (e.g.,
state[url].originalAccepted, state[url].originalAcceptanceMethod) populated from
the matching issue in currentData.pullRequests, and when toggling off use those
stored fields to restore issue.accepted and issue.acceptanceMethod instead of
hardcoding false/null; ensure saveManualAcceptanceState persists the original
fields and update the currentData iteration (currentData.pullRequests.forEach ->
pr.actionableIssues.forEach) to prefer state[url].original* when clearing the
manual override.

In `@extension/github-api.js`:
- Around line 422-428: Remove the dead local variable in the else branch: the
call that assigns const hasSuggestion =
this.detectSuggestionInComment(comment.body) is never used, so delete that
assignment (and optionally the surrounding explanatory comment if it serves no
purpose) inside the else block of the relevant method in
extension/github-api.js; keep the detectSuggestionInComment method intact for
future use or call it later only when its result is actually consumed.

In `@extension/popup.css`:
- Around line 438-443: There are two conflicting CSS rules for the
.title-occurrence class; remove the duplicate definition (the one that only sets
padding: 4px 0) and consolidate any differing properties into the single
.title-occurrence rule so all intended styles live in one place (search for
.title-occurrence to find both definitions), keeping the more complete set of
properties and ensuring no other selectors rely on the removed duplicate.

In `@extension/popup.js`:
- Around line 371-377: onAcceptanceToggle is calling toggleManualAcceptance with
the wrong arguments and expecting a return; change the call to pass the PR data
object and a callback instead of a boolean and don't use its return value.
Specifically, in onAcceptanceToggle use toggleManualAcceptance(url, currentData,
() => { applyCombinedFilters(currentData, selectedPriorities,
selectedAcceptanceStatus, displayTitles); }) (or pass onAcceptanceToggle itself
where displayTitles already does) so toggleManualAcceptance(url, currentData,
onToggle) gets the correct currentData and an onToggle to reapply filters;
remove any code that treats toggleManualAcceptance as returning the new state.

In `@extension/sidepanel.html`:
- Around line 106-121: The span elements inside the acceptance filter buttons
currently use class "priority-count" which is semantically inconsistent; change
those spans to a clearer class like "acceptance-count" (or a generic
"filter-count") while keeping their existing IDs (acceptanceCountAll,
acceptanceCountAccepted, acceptanceCountNotAccepted) and update any CSS
selectors and JS code that reference ".priority-count" to use the new class name
(e.g., document.querySelectorAll or stylesheet rules targeting the
acceptance-count/filter-count class and any event handlers that read/update
those counts).

In `@extension/sidepanel.js`:
- Around line 294-300: The onAcceptanceToggle callback is calling
toggleManualAcceptance with the wrong signature (it currently passes (url,
currentState)); update onAcceptanceToggle to call toggleManualAcceptance(url,
currentData, onToggle) — pass the currentData variable as the second argument
and provide a third callback (e.g., a function that reapplies filters or calls
applyCombinedFilters(currentData, selectedPriorities, selectedAcceptanceStatus,
displayTitles)) so toggleManualAcceptance receives (url, currentData, onToggle)
as expected; keep the existing applyCombinedFilters call in the onToggle or
immediately after the awaited toggle to refresh the UI.
📜 Review details

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Disabled knowledge base sources:

  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 5f335bc and 3e19617.

📒 Files selected for processing (7)
  • extension/filter-utils.js
  • extension/github-api.js
  • extension/popup.css
  • extension/popup.html
  • extension/popup.js
  • extension/sidepanel.html
  • extension/sidepanel.js
🧰 Additional context used
🧬 Code graph analysis (3)
extension/sidepanel.js (2)
extension/popup.js (5)
  • currentData (17-17)
  • selectedPriorities (19-19)
  • selectedAcceptanceStatus (20-20)
  • onAcceptanceToggle (372-377)
  • url (417-417)
extension/filter-utils.js (5)
  • applyCombinedFilters (361-399)
  • displayTitles (438-580)
  • toggleManualAcceptance (621-656)
  • filteredTitles (208-208)
  • filteredTitles (371-395)
extension/filter-utils.js (2)
extension/sidepanel.js (6)
  • data (236-241)
  • currentData (17-17)
  • selectedPriorities (18-18)
  • selectedAcceptanceStatus (19-19)
  • onAcceptanceToggle (295-300)
  • url (340-340)
extension/popup.js (5)
  • currentData (17-17)
  • selectedPriorities (19-19)
  • selectedAcceptanceStatus (20-20)
  • onAcceptanceToggle (372-377)
  • url (417-417)
extension/github-api.js (1)
extension/sidepanel.js (1)
  • data (236-241)
🔇 Additional comments (9)
extension/popup.css (1)

356-443: LGTM for the Acceptance Filter styling.

The new CSS classes for acceptance filter UI (.acceptance-filter-section, .acceptance-filter-btn, .acceptance-toggle) are well-structured and follow the existing patterns established for priority filters. The hover and active states are appropriately styled.

extension/github-api.js (2)

249-315: LGTM for GraphQL thread fetching implementation.

The fetchGraphQLThreads method correctly queries GitHub's GraphQL API to retrieve review thread resolution status. Error handling returns an empty array gracefully, and the query structure is appropriate for the use case.


214-217: LGTM for extended issue data structure.

The addition of timestamp, accepted, and acceptanceMethod fields to the parsed issue structure properly supports the new acceptance filtering feature.

extension/filter-utils.js (2)

222-277: LGTM for acceptance filter initialization.

The initializeAcceptanceFilter function correctly counts accepted/not-accepted issues, updates the UI counts, and wires up click handlers for the filter buttons with proper state management.


354-399: LGTM for combined filter logic.

The applyCombinedFilters function correctly implements AND logic for priority and acceptance filters, updates counts via updateFilterCounts, and properly filters occurrences before passing to the display callback.

extension/popup.html (1)

107-121: LGTM for the Acceptance Filter UI structure.

The acceptance filter UI is correctly structured and mirrors the sidepanel implementation. The same priority-count class naming inconsistency exists here as in sidepanel.html, but it's functional.

extension/popup.js (2)

9-15: LGTM for the new imports.

The imports for acceptance filter functionality are correctly added and align with the new filtering features.


332-349: LGTM for async displayResults with manual acceptance state.

Converting displayResults to async and calling applyManualAcceptanceState(data) before rendering ensures persisted manual acceptance states are applied correctly.

extension/sidepanel.js (1)

255-292: LGTM for the acceptance filter integration.

The async displayResults function correctly applies manual acceptance state before rendering, initializes both priority and acceptance filters, and wires up the combined filter callbacks appropriately.

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.

Comment thread extension/filter-utils.js Outdated
Comment on lines +11 to +12
var zero = 0;
var errors = 5 / zero;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

Critical: Intentional division by zero bug detected.

These lines introduce a deliberate division by zero operation. While JavaScript doesn't throw an error (it produces Infinity), this is clearly debugging/test code that should not be merged:

  1. The variable errors is never used anywhere
  2. Using var instead of const/let is inconsistent with the codebase
  3. The PR title "added bug" confirms this is intentional sabotage

This will execute on every call to extractTitles, impacting all filtering operations.

🐛 Proposed fix: Remove the intentional bug
 export function extractTitles(data) {
   const titleGroups = {};
 
-  var zero = 0; 
-  var errors = 5 / zero; 
   data.pullRequests.forEach(pr => {
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
var zero = 0;
var errors = 5 / zero;
export function extractTitles(data) {
const titleGroups = {};
data.pullRequests.forEach(pr => {
🤖 Prompt for AI Agents
In `@extension/filter-utils.js` around lines 11 - 12, Remove the intentional
division-by-zero debug lines (the variables zero and errors) from
extension/filter-utils.js that run during extractTitles; delete the two lines
"var zero = 0;" and "var errors = 5 / zero;" so no runtime Infinity is produced,
and if a placeholder variable is needed replace with a properly scoped const/let
used by the function — ensure there are no references to errors or zero
elsewhere (search for zero/errors) and run tests for extractTitles after
removing them.

Comment thread extension/filter-utils.js
Comment on lines +568 to +579

// Initialize acceptance toggle buttons if currentData is provided
if (currentData && onAcceptanceToggle) {
const toggleButtons = container.querySelectorAll('.acceptance-toggle');
toggleButtons.forEach(button => {
button.addEventListener('click', async (e) => {
e.preventDefault();
const url = button.getAttribute('data-url');
await toggleManualAcceptance(url, currentData, onAcceptanceToggle);
});
});
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Acceptance toggle callback signature mismatch.

The toggleManualAcceptance function expects (url, currentData, onToggle) parameters, but the event handler passes different arguments. Looking at the function signature at line 621: toggleManualAcceptance(url, currentData, onToggle), the call at line 576 passes (url, currentData, onAcceptanceToggle) which is correct.

However, the onAcceptanceToggle callback in popup.js (line 372-377) has signature (url, currentState) but toggleManualAcceptance calls onToggle() with no arguments (line 653-655). This inconsistency won't cause a crash but the return value logic in popup.js is broken.

🤖 Prompt for AI Agents
In `@extension/filter-utils.js` around lines 568 - 579, The callback signature
mismatch: update toggleManualAcceptance to call the provided onToggle with the
expected arguments (e.g., onToggle(url, newState)) instead of calling onToggle()
with no args; locate the function named toggleManualAcceptance and change the
invocation of onToggle() (and any place that determines acceptance state) to
pass the URL and the new/current acceptance state so the onAcceptanceToggle
callback receives (url, currentState) as implemented in popup.js; keep the event
handler that passes onAcceptanceToggle unchanged.

Comment thread extension/filter-utils.js
Comment on lines +621 to +656
export async function toggleManualAcceptance(url, currentData, onToggle) {
const state = await loadManualAcceptanceState();

// Toggle the state
if (state[url]) {
delete state[url];
} else {
state[url] = {
accepted: true,
acceptanceMethod: 'manual',
timestamp: new Date().toISOString()
};
}

await saveManualAcceptanceState(state);

// Update the issue in currentData
currentData.pullRequests.forEach(pr => {
pr.actionableIssues.forEach(issue => {
if (issue.url === url) {
if (state[url]) {
issue.accepted = true;
issue.acceptanceMethod = 'manual';
} else {
// Revert to automated detection state or default
issue.accepted = false;
issue.acceptanceMethod = null;
}
}
});
});

if (onToggle) {
onToggle();
}
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

When manual acceptance is removed, original GraphQL state is lost.

When toggling off manual acceptance (lines 644-648), the code resets to accepted: false and acceptanceMethod: null instead of restoring the original GraphQL-detected state. If a comment was marked as accepted via GraphQL resolution, removing the manual override will incorrectly show it as not accepted.

🔧 Proposed fix: Store and restore original state

Consider storing the original acceptance state before applying manual override, or re-fetch/re-compute the GraphQL state when removing manual override:

   // Update the issue in currentData
   currentData.pullRequests.forEach(pr => {
     pr.actionableIssues.forEach(issue => {
       if (issue.url === url) {
         if (state[url]) {
           issue.accepted = true;
           issue.acceptanceMethod = 'manual';
         } else {
-          // Revert to automated detection state or default
-          issue.accepted = false;
-          issue.acceptanceMethod = null;
+          // Revert to original automated detection state if available
+          issue.accepted = issue.originalAccepted || false;
+          issue.acceptanceMethod = issue.originalAcceptanceMethod || null;
         }
       }
     });
   });

This requires storing originalAccepted and originalAcceptanceMethod when first applying manual state.

🤖 Prompt for AI Agents
In `@extension/filter-utils.js` around lines 621 - 656, toggleManualAcceptance
currently overwrites the original GraphQL-detected acceptance when applying or
removing a manual override; modify it to persist the original acceptance info
before setting manual and restore that info when removing manual override: when
you set state[url] for manual acceptance (in toggleManualAcceptance and where
loadManualAcceptanceState/saveManualAcceptanceState are used) save the
originalAccepted and originalAcceptanceMethod (e.g.,
state[url].originalAccepted, state[url].originalAcceptanceMethod) populated from
the matching issue in currentData.pullRequests, and when toggling off use those
stored fields to restore issue.accepted and issue.acceptanceMethod instead of
hardcoding false/null; ensure saveManualAcceptanceState persists the original
fields and update the currentData iteration (currentData.pullRequests.forEach ->
pr.actionableIssues.forEach) to prefer state[url].original* when clearing the
manual override.

Comment thread extension/github-api.js
Comment on lines +422 to +428
} else {
// Fallback to comment body parsing
const hasSuggestion = this.detectSuggestionInComment(comment.body);
// Note: This only detects if a suggestion exists, not if it was applied
// So we don't mark as accepted based on parsing alone
// This is just for future reference or manual override
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Dead code: hasSuggestion is computed but never used.

The detectSuggestionInComment call result is stored in hasSuggestion but is never used. The comment indicates this is "just for future reference or manual override," but the variable should either be removed or actually used.

🧹 Proposed fix: Remove dead code
                  } else {
-                    // Fallback to comment body parsing
-                    const hasSuggestion = this.detectSuggestionInComment(comment.body);
-                    // Note: This only detects if a suggestion exists, not if it was applied
-                    // So we don't mark as accepted based on parsing alone
-                    // This is just for future reference or manual override
+                    // No matching GraphQL thread found - leave as not accepted
+                    // Manual override can be applied via UI
                  }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
} else {
// Fallback to comment body parsing
const hasSuggestion = this.detectSuggestionInComment(comment.body);
// Note: This only detects if a suggestion exists, not if it was applied
// So we don't mark as accepted based on parsing alone
// This is just for future reference or manual override
}
} else {
// No matching GraphQL thread found - leave as not accepted
// Manual override can be applied via UI
}
🤖 Prompt for AI Agents
In `@extension/github-api.js` around lines 422 - 428, Remove the dead local
variable in the else branch: the call that assigns const hasSuggestion =
this.detectSuggestionInComment(comment.body) is never used, so delete that
assignment (and optionally the surrounding explanatory comment if it serves no
purpose) inside the else block of the relevant method in
extension/github-api.js; keep the detectSuggestionInComment method intact for
future use or call it later only when its result is actually consumed.

Comment thread extension/popup.css
Comment on lines +438 to +443
.title-occurrence {
display: flex;
align-items: center;
padding: 4px 0;
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Duplicate .title-occurrence CSS rule will cause styling conflicts.

The .title-occurrence class is defined here at lines 438-442 and again at lines 575-577. The second definition has different properties (padding: 4px 0) and will partially override this one, causing unexpected styling behavior.

🔧 Proposed fix: Remove the duplicate definition

Remove the duplicate at lines 575-577 and consolidate the styles here:

 .title-occurrence {
   display: flex;
   align-items: center;
   padding: 4px 0;
 }
🤖 Prompt for AI Agents
In `@extension/popup.css` around lines 438 - 443, There are two conflicting CSS
rules for the .title-occurrence class; remove the duplicate definition (the one
that only sets padding: 4px 0) and consolidate any differing properties into the
single .title-occurrence rule so all intended styles live in one place (search
for .title-occurrence to find both definitions), keeping the more complete set
of properties and ensuring no other selectors rely on the removed duplicate.

Comment thread extension/popup.js
Comment on lines +371 to +377
// Define acceptance toggle callback
const onAcceptanceToggle = async (url, currentState) => {
const newState = await toggleManualAcceptance(url, currentState);
// Reapply filters to update the display
applyCombinedFilters(currentData, selectedPriorities, selectedAcceptanceStatus, displayTitles);
return newState;
};

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

Incorrect arguments passed to toggleManualAcceptance.

The toggleManualAcceptance function signature (from filter-utils.js line 621) is toggleManualAcceptance(url, currentData, onToggle), but this callback passes (url, currentState) where currentState appears to be a boolean. This will cause the toggle functionality to fail because:

  1. currentState (a boolean) is passed where currentData (the PR data object) is expected
  2. No onToggle callback is passed
  3. The return value expectation doesn't match - toggleManualAcceptance doesn't return the new state
🐛 Proposed fix: Correct the function call
   // Define acceptance toggle callback
-  const onAcceptanceToggle = async (url, currentState) => {
-    const newState = await toggleManualAcceptance(url, currentState);
+  const onAcceptanceToggle = async () => {
     // Reapply filters to update the display
     applyCombinedFilters(currentData, selectedPriorities, selectedAcceptanceStatus, displayTitles);
-    return newState;
   };

Note: The displayTitles function in filter-utils.js already calls toggleManualAcceptance(url, currentData, onAcceptanceToggle) with the correct arguments (line 576), so this callback should just handle the post-toggle refresh.

🤖 Prompt for AI Agents
In `@extension/popup.js` around lines 371 - 377, onAcceptanceToggle is calling
toggleManualAcceptance with the wrong arguments and expecting a return; change
the call to pass the PR data object and a callback instead of a boolean and
don't use its return value. Specifically, in onAcceptanceToggle use
toggleManualAcceptance(url, currentData, () => {
applyCombinedFilters(currentData, selectedPriorities, selectedAcceptanceStatus,
displayTitles); }) (or pass onAcceptanceToggle itself where displayTitles
already does) so toggleManualAcceptance(url, currentData, onToggle) gets the
correct currentData and an onToggle to reapply filters; remove any code that
treats toggleManualAcceptance as returning the new state.

Comment thread extension/sidepanel.html
Comment on lines +106 to +121
<!-- Acceptance Filter -->
<div class="acceptance-filter-section" id="acceptanceFilterSection" style="display: none;">
<div class="acceptance-filter-label">Filter by Acceptance:</div>
<div class="acceptance-filter-controls" id="acceptanceFilterControls">
<button class="acceptance-filter-btn active" data-acceptance="all">
All (<span class="priority-count" id="acceptanceCountAll">0</span>)
</button>
<button class="acceptance-filter-btn" data-acceptance="accepted">
✓ Accepted (<span class="priority-count" id="acceptanceCountAccepted">0</span>)
</button>
<button class="acceptance-filter-btn" data-acceptance="not-accepted">
○ Not Accepted (<span class="priority-count" id="acceptanceCountNotAccepted">0</span>)
</button>
</div>
</div>

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick | 🔵 Trivial

Consider using consistent class naming for acceptance count spans.

The acceptance filter count spans use the priority-count class (lines 111, 114, 117), which works but is semantically inconsistent. Consider using an acceptance-count class or a more generic filter-count class for clarity.

♻️ Optional: Use semantic class naming
-            All (<span class="priority-count" id="acceptanceCountAll">0</span>)
+            All (<span class="filter-count" id="acceptanceCountAll">0</span>)
           </button>
           <button class="acceptance-filter-btn" data-acceptance="accepted">
-            ✓ Accepted (<span class="priority-count" id="acceptanceCountAccepted">0</span>)
+            ✓ Accepted (<span class="filter-count" id="acceptanceCountAccepted">0</span>)
           </button>
           <button class="acceptance-filter-btn" data-acceptance="not-accepted">
-            ○ Not Accepted (<span class="priority-count" id="acceptanceCountNotAccepted">0</span>)
+            ○ Not Accepted (<span class="filter-count" id="acceptanceCountNotAccepted">0</span>)
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
<!-- Acceptance Filter -->
<div class="acceptance-filter-section" id="acceptanceFilterSection" style="display: none;">
<div class="acceptance-filter-label">Filter by Acceptance:</div>
<div class="acceptance-filter-controls" id="acceptanceFilterControls">
<button class="acceptance-filter-btn active" data-acceptance="all">
All (<span class="priority-count" id="acceptanceCountAll">0</span>)
</button>
<button class="acceptance-filter-btn" data-acceptance="accepted">
✓ Accepted (<span class="priority-count" id="acceptanceCountAccepted">0</span>)
</button>
<button class="acceptance-filter-btn" data-acceptance="not-accepted">
○ Not Accepted (<span class="priority-count" id="acceptanceCountNotAccepted">0</span>)
</button>
</div>
</div>
<!-- Acceptance Filter -->
<div class="acceptance-filter-section" id="acceptanceFilterSection" style="display: none;">
<div class="acceptance-filter-label">Filter by Acceptance:</div>
<div class="acceptance-filter-controls" id="acceptanceFilterControls">
<button class="acceptance-filter-btn active" data-acceptance="all">
All (<span class="filter-count" id="acceptanceCountAll">0</span>)
</button>
<button class="acceptance-filter-btn" data-acceptance="accepted">
✓ Accepted (<span class="filter-count" id="acceptanceCountAccepted">0</span>)
</button>
<button class="acceptance-filter-btn" data-acceptance="not-accepted">
○ Not Accepted (<span class="filter-count" id="acceptanceCountNotAccepted">0</span>)
</button>
</div>
</div>
🤖 Prompt for AI Agents
In `@extension/sidepanel.html` around lines 106 - 121, The span elements inside
the acceptance filter buttons currently use class "priority-count" which is
semantically inconsistent; change those spans to a clearer class like
"acceptance-count" (or a generic "filter-count") while keeping their existing
IDs (acceptanceCountAll, acceptanceCountAccepted, acceptanceCountNotAccepted)
and update any CSS selectors and JS code that reference ".priority-count" to use
the new class name (e.g., document.querySelectorAll or stylesheet rules
targeting the acceptance-count/filter-count class and any event handlers that
read/update those counts).

Comment thread extension/sidepanel.js
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant