Skip to content

Validate CodeCogs PNGs and prevent low-resolution fallbacks - #75

Merged
Divide-By-0 merged 1 commit into
masterfrom
stack/02-codecogs-dpi
Sep 29, 2026
Merged

Divide-By-0 merged 1 commit into
masterfrom
stack/02-codecogs-dpi

Conversation

@Divide-By-0

Copy link
Copy Markdown
Owner

CodeCogs error artwork can arrive as HTTP 200 and pass our fixed PNG-prefix checks, allowing a rejected dpi command to appear in an equation. Validate CodeCogs' structured PNG response and insert those exact bytes, including in Slides. Skip the low-resolution GIF and unavailable staging fallbacks while retaining their legacy de-render links. Keep 900-DPI PNG sizing unchanged.

Human intent

  • Investigate the two support reports and locate the reported equations in production logs.
  • Prevent visible dpi900 errors and improve CodeCogs output quality.
  • Reproduce before modifying code, demonstrate failing-before/passing-after regressions, and check existing behavior.

Evidence and validation

  • Production logs connect the reported cases failure to MathJax rejecting nested SVGs and then CodeCogs fallback. Base PR Fix MathJax rendering for multi-row cases #74 addresses the MathJax defect.
  • At unchanged base 9cb82d4, three new tests failed: HTTP 200 error artwork accepted, unvalidated responses accepted, and GIF/staging fallback attempted. An Inspector breakpoint confirmed Common marked the captured unknown-dpi PNG successful.
  • All 159 tests pass after the patch. Six focused tests cover real captured responses, fallback quality, original-source preservation in Docs/Sheets, and validated-byte insertion in Slides. Existing PR CI runs these tests.
  • Both sidebar builds pass; browser suite passes 40 settings / 256 PNG renders. Common type-check passes with --lib es2018,dom --skipLibCheck (the default configuration has existing DOM/type-library conflicts).
  • Live patched Common requests successfully rendered both supplied examples plus a colored inline fraction. Replaying the exact logged multiline source against immutable deployed Common v9 currently fails its editor-page warmup with HTTP 400; the patched JSON path succeeds (3733x1020 PNG).

The historical upstream trigger that mishandled a correctly braced DPI command remains unproven. Fixtures reproduce acceptance of the visible error artwork, not that upstream event. The exact angle example was not found in searched production logs. Host APIs are mocked in unit tests; this is not a live Google insertion test. No deployment performed.

Stacked on #74. Tracks AGENTS-250.

Base automatically changed from stack/01-cases-rendering to master September 29, 2026 01:33
@Divide-By-0
Divide-By-0 merged commit 81c0756 into master Sep 29, 2026
3 checks passed
@Divide-By-0
Divide-By-0 deleted the stack/02-codecogs-dpi branch September 29, 2026 01:33
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