Skip to content

Conversation

Copy link

Copilot AI commented Jan 4, 2026

The compilation progress bar and download functionality appeared broken because SSE events were silently ignored due to incorrect parsing logic.

Root Cause

Client-side code attempted to extract both event: and data: from the same line, but SSE format specifies them on separate lines:

// Before: tried to parse both from one line
const data = JSON.parse(line.slice(6));
const eventType = line.match(/event: (\w+[\w:]*)/)?.[1]; // always undefined

// After: track event type across lines
let currentEventType = '';
if (line.startsWith('event: ')) {
    currentEventType = line.slice(7).trim();
} else if (line.startsWith('data: ')) {
    const data = JSON.parse(line.slice(6));
    handleEvent(currentEventType, data);
}

Changes

Client (public/index.html)

  • Fixed SSE parser to handle multi-line event format
  • Added handlers for transformation:complete and compilation:complete events
  • Corrected field reference from data.transformation to data.name

Server (worker/worker.ts)

  • Added cache lookup before streaming compilation for diff comparison support
  • Store compilation results in gzip-compressed cache after successful compilation
  • Include previousVersion data in result events

Result

Progress bar now updates in real-time, all transformation events display correctly, and download functionality works.

Before: Events ignored, UI appeared frozen
Before

After: Full event pipeline with transformation completion feedback
After

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • sparrow.cloudflare.com
    • Triggering command: /usr/local/bin/node /usr/local/bin/node --no-warnings --experimental-vm-modules /home/REDACTED/work/adblock-compiler/adblock-compiler/node_modules/wrangler/wrangler-dist/cli.js dev --port 8787 (dns block)
  • workers.cloudflare.com
    • Triggering command: /usr/local/bin/node /usr/local/bin/node --no-warnings --experimental-vm-modules /home/REDACTED/work/adblock-compiler/adblock-compiler/node_modules/wrangler/wrangler-dist/cli.js dev --port 8787 (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

After compiling a list on the website, how does a user get their list? When you click compile filter list, nothing happens. Shouldn't the progress bar show realtime compilation, and then present the user with a compiled list to download?


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Co-authored-by: jaypatrick <1800595+jaypatrick@users.noreply.github.com>
@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Jan 4, 2026

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
✅ Deployment successful!
View logs
adblock-compiler 24de342 Jan 04 2026, 02:44 AM

Copilot AI changed the title [WIP] Fix progress bar and list download functionality Fix SSE event parsing preventing progress bar updates and download functionality Jan 4, 2026
Copilot AI requested a review from jaypatrick January 4, 2026 02:47
@jaypatrick jaypatrick marked this pull request as ready for review January 4, 2026 02:49
@jaypatrick jaypatrick merged commit 6827490 into master Jan 4, 2026
8 checks passed
@jaypatrick jaypatrick deleted the copilot/fix-progress-bar-compilation branch January 4, 2026 02:49
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.

2 participants