Skip to content

Conversation

@muodov
Copy link
Member

@muodov muodov commented Oct 7, 2025

No description provided.

@muodov muodov requested a review from Copilot October 7, 2025 07:30
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Replaces LLM-based popup confirmation (llmMatch) with regex-based confirmation (regexMatch) for generating one-click autoconsent rules. Introduces a new required regexConfirmedPopups field in the manifest type while leaving legacy llm code commented out.

  • Swaps logic from llmMatch to regexMatch throughout rule generation and processing.
  • Updates type definitions to add regexConfirmedPopups and optionally retain a deprecated _llmConfirmedPopups field.
  • Leaves prior llm-related code commented out instead of removing it, increasing noise.

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
post-processing/generate-autoconsent-rules/types.js Adds regexConfirmedPopups field and renames llmConfirmedPopups to optional _llmConfirmedPopups.
post-processing/generate-autoconsent-rules/main.js Replaces llmMatch-based filtering with regexMatch and comments out former logic.
post-processing/generate-autoconsent-rules/generation.js Updates rule generation to use regexMatch; retains commented llm code and re-derives popup list.

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

// const llmConfirmedPopups = collectorResult.scrapedFrames.flatMap((frame) => frame.potentialPopups).filter((popup) => popup.llmMatch);
const regexConfirmedPopups = collectorResult.scrapedFrames.flatMap((frame) => frame.potentialPopups).filter((popup) => popup.regexMatch);
// if (llmConfirmedPopups.length > 1 || llmConfirmedPopups[0].rejectButtons.length > 1) {
if (regexConfirmedPopups.length > 1 || regexConfirmedPopups[0].rejectButtons.length > 1) {
Copy link

Copilot AI Oct 7, 2025

Choose a reason for hiding this comment

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

This block assumes regexConfirmedPopups is non-empty (accessing regexConfirmedPopups[0]) based on an earlier guard in the caller; add an explicit guard or an assertion here to make the dependency clear, and consider passing the already-filtered list from the caller instead of recomputing it to avoid duplicated logic.

Suggested change
if (regexConfirmedPopups.length > 1 || regexConfirmedPopups[0].rejectButtons.length > 1) {
if (regexConfirmedPopups.length > 1 || (regexConfirmedPopups.length > 0 && regexConfirmedPopups[0].rejectButtons.length > 1)) {

Copilot uses AI. Check for mistakes.
Comment on lines 151 to 164
// const llmConfirmedPopups = collectorResult.scrapedFrames.flatMap((frame) => frame.potentialPopups).filter((popup) => popup.llmMatch);
const regexConfirmedPopups = collectorResult.scrapedFrames.flatMap((frame) => frame.potentialPopups).filter((popup) => popup.regexMatch);

// shortcut if no popups with llmMatch
if (llmConfirmedPopups.length === 0) {
// if (llmConfirmedPopups.length === 0) {
if (regexConfirmedPopups.length === 0) {
return { newRuleFiles, updatedRuleFiles, keptCount: 0, reviewNotes: [], updatedExistingRules };
}

const matchingRules = findMatchingExistingRules(initialUrl, finalUrl, collectorResult, existingRules);
console.log(
`Detected ${llmConfirmedPopups.length} unhandled cookie popup(s) on ${finalUrl} (matched ${matchingRules.length} existing rules)`,
// `Detected ${llmConfirmedPopups.length} unhandled cookie popup(s) on ${finalUrl} (matched ${matchingRules.length} existing rules)`,
Copy link

Copilot AI Oct 7, 2025

Choose a reason for hiding this comment

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

Commented-out legacy llm* code increases noise; remove it or add a concise comment explaining when (or if) it will be reintroduced. Version control preserves history, so keeping multiple commented lines inline can hinder readability.

Copilot uses AI. Check for mistakes.
@muodov muodov force-pushed the test-regex-based-generation branch from 4d35c4e to 7dc59f6 Compare October 7, 2025 08:51
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