Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@Kartikayy007: Add syntax highlighting to code blocks in reports and fix and the Outdated section name #883

Merged
merged 4 commits into from
Apr 11, 2025

Conversation

DonggeLiu
Copy link
Collaborator

@DonggeLiu DonggeLiu commented Mar 17, 2025

Run experiment for #881 before merging, credit goes to @Kartikayy007.

@DonggeLiu
Copy link
Collaborator Author

/gcbrun exp -n ks -ag

@DonggeLiu
Copy link
Collaborator Author

DonggeLiu commented Mar 20, 2025

Ops it appears all trial pages are broken : )
Something wrong in report/templates/sample.html?

@DonggeLiu
Copy link
Collaborator Author

Ops it appears all trial pages are broken : ) Something wrong in report/templates/sample.html?

@Kartikayy007 In case you missed this, but please take your time : )

@DonggeLiu
Copy link
Collaborator Author

Running exp again to collect bug info.
The previous GKE job was deleted for some reasons.

@DonggeLiu
Copy link
Collaborator Author

/gcbrun exp -n ks -ag

DonggeLiu and others added 3 commits March 24, 2025 11:43
…dated section name (#881)

This PR enhances the report UI by adding syntax highlighting to both fuzz target code and build script code.
and the Outdated section name

Reference: GitHub PR #867 Comment
CC: @DonggeLiu

Features
Fuzz Target Code: Applies language-specific highlighting based on the benchmark YAML language field.
Build Scripts: Uses Bash syntax highlighting for all build scripts, also added line numbers for build script code.
Clean Display: Properly separates build script code from fixer prompts- Fixed Labeling: Corrects misleading "Fixer prompt" section that was previously showing build scripts.
Implementation Details
Added highlight.js library to base.html.
Enhanced Benchmark class with a language field and extraction from YAML files.
Updated Target class to separate build script code from fixer prompts.
Modified templates to apply appropriate syntax highlighting and correct section labeling.
added line numbers to build script code (used the same approach as for the fuzz target code)
Bug Fixes
Fixes issue where build scripts were incorrectly stored in the fixer_prompt field.
Fixes misleading UI section headings by properly labelling build scripts as "Build Script".
@DonggeLiu
Copy link
Collaborator Author

/gcbrun exp -n ks -ag

@Kartikayy007
Copy link
Contributor

Ops it appears all trial pages are broken : ) Something wrong in report/templates/sample.html?

@Kartikayy007 In case you missed this, but please take your time : )

Yup I missed that let me take a look around it

@Kartikayy007
Copy link
Contributor

Kartikayy007 commented Mar 24, 2025

@DonggeLiu Looking at the sample.html problem might be related to how the remove_trailing_empty_lines filter handles edge cases, or possibly missing variables in some samples.

I have some nits making the filter more robust to handle None values or Adding some is defined checks for variables like target.code and benchmark.language also Using default values with the |default() filter for properties that might be missing?

should I commit in this branch only or raise a new PR?

@DonggeLiu
Copy link
Collaborator Author

Seeing many errors like this:
image

should I commit in this branch only or raise a new PR?

I am unsure if GitHub allows you to directly push to this branch (exp-881).
But both are fine by me.

@Kartikayy007
Copy link
Contributor

Seeing many errors like this: image

should I commit in this branch only or raise a new PR?

I am unsure if GitHub allows you to directly push to this branch (exp-881). But both are fine by me.

Yes its not allowing ill raise another PR for this

@Kartikayy007 Kartikayy007 mentioned this pull request Mar 24, 2025
# Fix Sample Page Rendering Issues

## Problem
mentioned in #883 
Sample pages were failing to render with these errors:

![image](https://github.com/user-attachments/assets/fe9bf649-a25c-4047-9104-a5eeef7ecc47)


The template was using a filter called `splitlines` which wasn't
registered in the Jinja2 environment. Additionally, the template also
lacking robustness against undefined variables.

## Files Changed for #883 
1. `report/web.py` - Added missing filter and improved error handling
2. `report/templates/sample.html` - Added robustness checks 

## Changes Made
1. **Added missing filter:**
   - Implemented `_splitlines` method in `web.py`
   - Registered it with Jinja2 environment

2. **Improved template robustness:**
   - Added `is defined` checks for variables that might be missing
   - Added default values with `|default()` filter
   - Made `remove_trailing_empty_lines` filter handle edge cases better

3. **Enhanced error handling:**
   - Added detailed error logging with full traceback
   - Created fallback error pages when rendering fails
   - Provided better default values for missing data

These improvements should resolve all the sample page rendering issues.

---------

Co-authored-by: Dongge Liu <[email protected]>
@DonggeLiu
Copy link
Collaborator Author

/gcbrun exp -n ks -ag

@DonggeLiu
Copy link
Collaborator Author

Sorry that I just had a chance to go back to this @Kartikayy007.
I think your code works!
image

@Kartikayy007
Copy link
Contributor

Kartikayy007 commented Apr 11, 2025

Sorry that I just had a chance to go back to this @Kartikayy007.
I think your code works!
image

Thanks! :)

@DonggeLiu
Copy link
Collaborator Author

DonggeLiu commented Apr 11, 2025

Hi @oliverchang: @Kartikayy007 kindly brought us the syntax highlighting we wanted for awhile, and added a code block to show the LLM-generated build script.
He also applied for our GSoC project.

@DonggeLiu DonggeLiu merged commit 7001908 into main Apr 11, 2025
6 checks passed
@DonggeLiu DonggeLiu deleted the exp-881 branch April 11, 2025 06:14
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