Skip to content

Fix SVG Creative Display & Code Quality Improvements#13

Merged
aram356 merged 3 commits intomainfrom
bug/svg-display
Jan 23, 2026
Merged

Fix SVG Creative Display & Code Quality Improvements#13
aram356 merged 3 commits intomainfrom
bug/svg-display

Conversation

@aram356
Copy link
Copy Markdown
Contributor

@aram356 aram356 commented Jan 21, 2026

Resolves

Summary

  • Fixed SVG creatives not rendering correctly due to oversized caption text on tall banners (300x600)
  • Reduced CAPFONT calculation to cap at 16px instead of scaling too large
  • Removed overflow:hidden from SVG that was clipping content

Other Changes

Code Quality

  • Replaced runtime HashMap with compile-time phf_map! for SIZE_MAP (zero-cost initialization)
  • Consolidated duplicate build_openrtb_response functions into single implementation
  • Fixed side-effect mutation in .map() with idiomatic let-else pattern
  • Fixed unwrap() after is_none() check anti-pattern
  • Removed dead escape_html function
  • Renamed MAX_AREA_CPMMAX_AREA_BONUS for clarity

New Features

  • Added /_/sizes endpoint returning JSON with all standard ad sizes
  • Added decode_aps_price() function for base64 price decoding
  • Added standard_sizes() iterator for programmatic size access

Testing

  • Added Playwright E2E test suite for creative visibility
  • Added playwright job to GitHub Actions CI
  • Tests verify SVG creatives render correctly for 13 standard sizes

Documentation & Housekeeping

  • Updated README with sizes table, /_/sizes API docs, and test instructions
  • Added nodejs 24.12.0 to .tool-versions
  • Added Node/Playwright entries to .gitignore

Test plan

  • cargo test passes
  • Playwright E2E tests verify SVG visibility at all standard sizes
  • Visual inspection of 300x600 banner shows properly sized caption

steps:
- uses: actions/checkout@v4

- name: Configure SSH for git dependencies
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I was considering this for my docker build but thought we were going to make edge zero public. Are we holding off on that for any reason?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I am not against it. We can make Github repo open for now. Let's agree on this together.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'm for it!

@ChristianPavilonis
Copy link
Copy Markdown
Contributor

One thing we should consider doing is adding some info to the creatives.
For example we could add "✔︎ OpenRTB request signed" or "ℹ️ Mock APS creative" so we can demo and test easy without tailing.

@aram356
Copy link
Copy Markdown
Contributor Author

aram356 commented Jan 21, 2026

One thing we should consider doing is adding some info to the creatives. For example we could add "✔︎ OpenRTB request signed" or "ℹ️ Mock APS creative" so we can demo and test easy without tailing.

This is a good idea. Make it a ticket?

We can also add some more meta to HTML comments if it too much to display in a banner

Done: #14

@aram356 aram356 merged commit 847b03b into main Jan 23, 2026
3 checks passed
@aram356 aram356 deleted the bug/svg-display branch January 23, 2026 18:27
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.

Fix SVG Creative Display

2 participants