Skip to content

fix(docs): stop Live Telemetry charts from growing endlessly + pin CDN script versions - #451

Merged
cobusgreyling merged 2 commits into
cobusgreyling:mainfrom
KhaiTrang1995:fix/docs-telemetry-perf-and-cdn-pin
Aug 3, 2026
Merged

fix(docs): stop Live Telemetry charts from growing endlessly + pin CDN script versions#451
cobusgreyling merged 2 commits into
cobusgreyling:mainfrom
KhaiTrang1995:fix/docs-telemetry-perf-and-cdn-pin

Conversation

@KhaiTrang1995

Copy link
Copy Markdown
Contributor

Summary

The three charts in the Dogfooding / Live Telemetry section
(https://cobusgreyling.github.io/loop-engineering/#telemetry) grew taller
forever, making the page feel like it never finished loading. Root cause:
each canvas sat directly inside a .card div with no explicit height.
Chart.js is configured with responsive: true + maintainAspectRatio: false, which resizes the canvas to fill its parent -- but since the
container's own height was determined by the canvas inside it, every
resize grew the container, which re-triggered Chart.js's ResizeObserver,
which grew the canvas again. Unbounded feedback loop.

Fixed by wrapping each canvas in a position: relative; height: 240px
container, so the container's size no longer depends on the canvas it
holds.

Also, while investigating:

  • Both third-party scripts on the page were unpinned (mermaid@11 floats
    across every 11.x release, and the Chart.js <script> tag had no
    version at all) -- any upstream release of either library can silently
    change or break the live page with zero corresponding commit here.
    Pinned both to the versions currently being served (mermaid 11.16.0,
    Chart.js 4.5.1).
  • renderTelemetry()'s cumulative-tokens calculation recomputed the full
    prefix sum from scratch for every point (O(n^2) over loop-run-log.md's
    entries) instead of carrying a running total. loop-run-log.md is
    appended to daily with nothing pruning it, so this cost compounds
    indefinitely. Replaced with an O(n) running total.

Test plan

  • Reproduced the growth bug with a headless-Chromium probe before fixing:
    canvas.height climbed from 2661px to 8152px over 5 seconds with zero
    user interaction, and body.scrollHeight grew on every scroll.
  • Re-ran the same probe after the fix: canvas.height holds steady
    indefinitely, and repeated scrolling no longer changes scrollHeight.
  • Verified the O(n) token-sum refactor produces identical output to the
    old O(n^2) version on a sample dataset.
  • Verified both pinned CDN URLs resolve (200 OK) and the page's inline
    script still passes node --check after the edits.

KhaiTrang1995 and others added 2 commits August 1, 2026 19:44
…he showcase page

Two independent reliability issues on the Dogfooding/Live Telemetry section
of docs/index.html (the GitHub Pages showcase):

1. Both third-party scripts were unpinned (`mermaid@11` floats across every
   11.x release, and the Chart.js <script> tag had no version at all) --
   any upstream release of either library can change or break rendering on
   the live page with zero corresponding commit in this repo, making a
   "why is the site broken" report unreproducible from git history alone.
   Pinned both to the versions currently being served (mermaid 11.16.0,
   Chart.js 4.5.1) so the page only changes when this repo changes it.

2. renderTelemetry()'s cumulative-tokens calculation was a nested loop
   (O(n^2) over loop-run-log.md's entries) recomputing the full prefix sum
   from scratch for every point instead of carrying a running total.
   loop-run-log.md's own format section documents pruning entries older
   than 30 days, but nothing in daily-triage.yml actually does that --
   the log only ever grows, so this cost compounds indefinitely.
   Replaced with an O(n) running total; verified identical output on a
   sample dataset.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…ntainer

Reproduced the user-reported "page keeps growing endlessly" bug with a
headless-Chromium probe: canvas.height climbed continuously even with zero
user interaction (2661px -> 8152px over 5s), and body.scrollHeight grew on
every scroll. This is Chart.js's well-known responsive-resize feedback
loop: `responsive: true` + `maintainAspectRatio: false` makes the canvas
resize to fill its container, but the three telemetry `.card` divs had no
explicit height -- their height was itself determined by the canvas inside
them. Every resize of the canvas grew the container, which re-triggered
Chart.js's ResizeObserver, which grew the canvas again, unbounded.

Fixed by wrapping each canvas in a `position: relative; height: 240px`
container, so the container's size no longer depends on the canvas it
holds. Re-ran the same probe after the fix: canvas.height holds steady at
240 indefinitely, and repeated scrolling no longer changes scrollHeight.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

Thanks @KhaiTrang1995 for contributing a docs improvement — visible, reviewable PRs like this grow the reference for everyone.

What happens next

  • Maintainer aims for same-day review on story, adopter, and scoped docs/example PRs (CONTRIBUTING.md).
  • good first issue PRs: comment on the linked issue so we can assign and close on merge.

More ways to help

— loop-engineering maintainers

@cobusgreyling cobusgreyling left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Solid root-cause fix for the Chart.js resize feedback loop (fixed-height wrapper), plus sensible CDN pins and the O(n) running total. LGTM.

@cobusgreyling
cobusgreyling merged commit 4963773 into cobusgreyling:main Aug 3, 2026
3 checks passed
@cobusgreyling

Copy link
Copy Markdown
Owner

Merged. Thanks @KhaiTrang1995 — Live Telemetry charts no longer unbounded-grow, CDN pins are locked, and the token sum is O(n).

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