Skip to content

Comments

Add style-mining tooling, rule-based skip logic, and improved minification/debugging#21

Open
JJponce0913 wants to merge 27 commits intonathand8:masterfrom
JJponce0913:master
Open

Add style-mining tooling, rule-based skip logic, and improved minification/debugging#21
JJponce0913 wants to merge 27 commits intonathand8:masterfrom
JJponce0913:master

Conversation

@JJponce0913
Copy link
Collaborator

New style-mining scripts

  • Added extractStyle.py to:
    • Scan bug_reports/ and read minified_bug.html in each bug folder.
    • Extract JS style assignments (.style[...], .style.prop, setProperty(...)).
    • Aggregate per-folder and global counts into style_counts.json.
  • Added extractStyleAggregate.py to:
    • Group bug reports by unique combinations of (property, value) pairs.
    • Output combined statistics as style_counts_aggregate_firefox.json.

Config system: add rules support

  • Extended Config (src/lqc/config/config.py) to:
    • Load rules from the JSON config files.
    • Expose getRules().
  • Introduced FileConfig.getCustomTimestampBugReport(custom_folder) to:
    • Write bug reports into a custom subfolder (e.g., postSkip-bug-report-<timestamp>).
    • Preserve existing timestamp-based folder naming.
  • save_bug_report now:
    • Exits early when shouldSkip is True.
    • Otherwise saves into postSkip-bug-report-<timestamp> via getCustomTimestampBugReport.
    • Saves a pre-minified pickle of the run subject.
    • Saves the outcome of shouldSkip

Rule-based bug skipping and saving

  • Added rules section to config (e.g. config-initial.json) with:
    • Display-based rules like DispNone and DispTable.
  • Implemented pattern/style detection in src/lqc_selenium/runner.py:
    • check_pattern(...) matches sequences in <body>.
    • check_style(...) analyzes the makeStyleChanges() JS function for style assignments.
  • Implemented should_skip(file):
    • Tracks pattern_and_style, pattern_only, style_only, none.
    • Returns True if a rule’s pattern AND style match.
  • Integrated skipping into minify(...):
    • Writes the run subject to test_pre.html.
    • Skips minification when matched and passes shouldSkip to save_bug_report.

Minification bug fix and pipeline improvements

  • Added Manipulation class to wrap mutation functions + descriptions.
  • Improved RunSubject.removeElementById:
    • Finds a subtree by id, collects nested ids, strips styles safely.
  • Reworked MinifyStepFactory:
    • Uses Manipulation objects.
    • Ensures per-step deep copies.
    • Clean iteration flow across generators.

Minify debugging tool

  • Added minify_debug(...):
    • Saves the initial pickle.
    • Outputs all steps into testminify/.
    • Returns (run_subject, run_result, pickle_addr).
  • Added src/tooling/minifyTest.py:
    • Loads a saved pickle.
    • Replays + minifies it.
    • Can generate a new bug report.
  • Updated debugging_tools.js:
    • checkForBug() now performs a single style application and reload sequence.
    • Added printDifferences(...) for better logging.
  • Updated layout_tester.py:
    • run_test_using_js_diff_detect cleanly returns RunResultLayoutBug or RunResultCrash.
  • RunResultCrash.isBug() now always returns True.

Selenium driver and chrome variant fix

  • Added detectDriverPath(...) using shutil.which:
    • Handles missing paths gracefully.
  • Updated ChromeVariant:
    • Uses webdriver.Chrome + Service with quiet logging.
    • Applies --headless=new, --no-sandbox, --disable-dev-shm-usage.
  • Added Firefox driver support with geckodriver.exe.

Tooling / metadata updates

  • Updated .gitignore to ignore cache, logs, build output, and bug report folders.
  • Fixed urllib3 version to == 2.3.0.
  • Updated egg metadata such as Metadata-Version, dependencies, and entry points.

How to use

  • Standard fuzzer:
    • Automatically skips certain bugs per rule matching.
    • Only saves non-skipped reports.
  • Style analysis:
    • python extractStyle.py bug_reports
    • python extractStyleAggregate.py bug_reports
  • Replay a bug:
    • python src/tooling/minifyTest.py some_pickle.pkl -c ./config/config-initial.json

Notes / follow-ups

  • Rules are basic (pattern + style). Future work: full dynamic rule configurations.
  • Add further tooling:
    • Config flag to always save skipped bugs for debugging.
    • Config flag for a debug mode.
    • Argv for bug report folder address.

Introduces a Manipulation class for clearer minimization steps and improves the minification process with step-by-step HTML output for debugging. Updates bug report saving to include pickle addresses, adds more detailed logging and error handling in layout testing, and refines the minification and test runner logic for better traceability and reproducibility. Also updates .gitignore to exclude new debug and test output files.
Added transfer folder. Fixed the minification. Updated .gitignore to exclude /temp. Removed obsolete files and made minor updates to test and model scripts.
Introduces rule management via rules.json and src/lqc_selenium/rules.py, enabling rule addition and loading. Updates bug report logic to support custom timestamped folders when skipping, and refactors minification to check for specific patterns and style assignments. Minor code cleanups and disables verbose debug output in several modules.
Deleted multiple old bug report files and style count aggregates from the Transfer directory. Migrated select bug report cases to shouldSkip-bug-report paths and added new test HTML files. Updated src/lqc_selenium/rules.py and runner.py to reflect these changes.
Updated rules.json to redefine and expand display rules. Refactored runner.py to load and apply rules dynamically from JSON, improving rule matching logic.  Cleaned up and removed unused files. Minor config and bug report helper adjustments.
Copy link
Collaborator

@pavpanchekha pavpanchekha left a comment

Choose a reason for hiding this comment

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

I didn't finish reviewing but giving comments back now before I have to switch to another task. Maybe do a pass over the PR and remove the stuff that doesn't need to be committed.

JJponce0913 and others added 10 commits November 25, 2025 12:24
Introduces src/tooling/treeComparison.py for comparing HTML trees using BeautifulSoup, including node merging and tree walking utilities.
Implemented __str__ methods for ElementTree and StyleMap for improved readability. Updated treeComparison.py with enhanced debugging, sibling alignment, and more robust merging logic. Added checkPickle.py utility for inspecting pickled run_subject objects. Fixed default config path in runner.py.
Cleaned up .gitignore, deleted geckodriver.exe binaries, and various debugs.
Removed some more debug
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