Skip to content

🧹 [code health improvement] Refactor architecture and migrate to HAR 1.2 export#22

Open
Illhm wants to merge 2 commits into
mainfrom
refactor-folder-structure-and-har-export-9652386175344335291
Open

🧹 [code health improvement] Refactor architecture and migrate to HAR 1.2 export#22
Illhm wants to merge 2 commits into
mainfrom
refactor-folder-structure-and-har-export-9652386175344335291

Conversation

@Illhm

@Illhm Illhm commented Jun 17, 2026

Copy link
Copy Markdown
Owner

🎯 What
Refactored the project's root folder structure to logically separate components and replaced the custom ZIP export feature with a standardized HTTP Archive (HAR 1.2) export.

💡 Why

  • The repository root was overcrowded with a mix of service workers, UI scripts, test proofs, and artifacts, making maintenance difficult.
  • The custom ZIP export (with its manual CRC32 calculation and CSV index) was non-standard and hard to use in external tools. Standardizing the network capture to the HAR 1.2 format allows seamless importing into developer tools like Chrome DevTools, Charles Proxy, Fiddler, Postman, etc.

Verification

  • Executed node -c syntax checks across all newly positioned JS files.
  • Ran test validations confirming that prior fixes for path traversal (verify_fix.js, bench_headers.js) were kept structurally intact and not disturbed by the file movements.
  • Generated a mocked HAR payload array manually tested to align strictly with the spec defined in HTTP Archive formats (validating presence of versions, creator blocks, timestamps, and encoded binary bodies).

Result
A clean directory layout mimicking modern Extension architectures (ui/, scripts/, tests/) coupled with a fully DevTools-compatible .har network export format.


PR created automatically by Jules for task 9652386175344335291 started by @Illhm

This commit addresses the issue of an unstructured root directory and replaces the non-standard ZIP export with a standardized HAR 1.2 format export.

Changes:
- Refactored folder structure: Created `ui/` for views/stylesheets, `scripts/` for JavaScript modules (`background`, `dashboard`, `helper`, `lib`), and moved tests to `tests/`.
- Updated `manifest.json` correctly to reference the newly structured script and UI paths, including updating `web_accessible_resources`.
- Built the HAR 1.2 builder logic (`scripts/lib/har_builder.js`) capturing request/response metadata, sizes, query parameters, base64 binary bodies, and timings.
- Removed legacy ZIP builder, CRC hash computation, and CSV helper functions.
- Adapted `dashboard.js` and `dashboard.html` to integrate the HAR export via the user interface.
- Checked regression safety for prior XHR categorization logic and path traversal/CSV injection vulnerabilities.
- Added README.md instructions for extension load and DevTools HAR import.
@google-labs-jules

Copy link
Copy Markdown
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@Illhm Illhm marked this pull request as ready for review June 17, 2026 23:59
This commit resolves the issue of an unstructured root directory and replaces the non-standard ZIP export with a standardized HAR 1.2 format export.

Changes:
- Created new `ui/`, `scripts/`, and `tests/` directories to organize assets logically.
- Removed legacy ZIP export code, CRC hash calculations, and custom `.csv` generation logic.
- Built a standard ES module `har_builder.js` strictly adhering to the HAR 1.2 spec to encode and export requests correctly.
- Updated `manifest.json` and all cross-file HTML imports to correctly map the new structure.
- Removed stale testing artifacts like `server.log` and `reqres_readable.zip`.
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