Skip to content

[docs] Track the logo kit and make it reproducible - #1468

Merged
manugarg merged 8 commits into
mainfrom
logo-kit
Sep 7, 2026
Merged

manugarg merged 8 commits into
mainfrom
logo-kit

Conversation

@manugarg

@manugarg manugarg commented Sep 6, 2026 •

Copy link
Copy Markdown
Contributor

Until now the logo existed in the repo only as rendered output under docs/static.
The geometry that generates it lived outside version control, which is why the icon
fix in #1466 had to be made by hand-editing a rendered SVG rather than changing a
parameter and rebuilding.

Layout

path contents
docs/brand/ the artwork — 17 SVG variants, PNG renders, the favicon set, PREVIEW.png, and the usage rules in README.md
tools/logogen/ build_logo.py and the weight-600 IBM Plex Sans instance it builds from

A generator under tools/ writing into docs/ matches what tools/gen_config_docs.sh
already does, and the tools/logogen/ subdirectory follows tools/genprotofacade/.

Named docs/brand rather than docs/logo to keep it distinct from docs/static/logo,
which holds the published copies the site actually serves. Hugo publishes only
content/ and static/, so docs/brand is not picked up by the site build or the
gh-pages tree.

The kit is reproducible

pip install fonttools cairosvg pillow numpy
python3 tools/logogen/build_logo.py --verify

Building into a clean directory reproduces all 42 generated files in docs/brand
byte-for-byte
, every PNG and the ICO included. The two files that are not generated,
and are safe to hand-edit, are README.md and PREVIEW.png.

--out and --font default relative to the script rather than the caller's cwd, so that
command rebuilds docs/brand in place from anywhere in the tree.

What --verify checks

It exits non-zero on failure. Confirmed working by reintroducing the #1466 defect —
setting ICON_POST_TOP back to 141 is caught three independent ways:

- ICON_POST_TOP is 141; 144 is the value that clears the dish at stroke 14
- pre-fix icon post survives in cloudprober-icon{,-ondark,-white,-mono}.svg
- icon post breaks the dish surface in 84 columns

That last one rasterises the dish and the mount separately and compares them column by
column, so it measures the defect rather than pattern-matching a known-bad constant. It
also checks that no SVG carries live text or a font dependency, that all four
favicon.ico planes are true renders at their own size rather than upsamples, and that
apple-touch-icon.png is 180×180 and opaque.

Superseded scripts

The kit originally came with mark.py and build_final.py. Those were helpers only — no
main, no file writing, no rasterisation — and carried absolute /home/claude paths from
the sandbox they were written in, so they could not run anywhere else. build_logo.py
supersedes both and they are removed rather than left as a trap.

One correction to #1466

That PR justified repacking favicon.ico by saying the kit ships a 16×16-only .ico.
That was measured on a superseded copy of the kit and is wrong: the kit's .ico has all
four 16/32/48/64 planes and is byte-identical to the repacked file. The shipped asset is
correct and unaffected — only the stated reason was wrong.

Verification

  • All 42 generated files reproduce byte-for-byte from a clean build.
  • The artwork is byte-identical to the copies under docs/static, across all 14
    published assets.
  • --verify passes on the committed tree and fails on a deliberately regressed one.
  • No /home/claude paths remain anywhere in the tree.

IBM Plex Sans is SIL OFL 1.1; the wordmark is outlined, so the reserved-font-name clause
does not apply to the artwork and no output file carries a font dependency.

Until now the logo existed in the repo only as rendered output under
docs/static. The geometry that generates it lived outside version control,
which is why the recent icon fix had to be made by hand-editing a rendered
SVG rather than changing a parameter and rebuilding.

The kit splits along what each part is for:

  docs/brand/     the artwork -- all 17 SVG variants, the PNG renders, the
                  favicon set, PREVIEW.png, and the usage rules in README.md
  tools/logogen/  mark.py (mark and icon geometry), build_final.py (wordmark
                  outlining and lockup layout) and the weight-600 IBM Plex
                  Sans instance they build from

A generator under tools/ writing into docs/ matches what tools/gen_config_docs.sh
already does, and the tools/logogen/ subdirectory follows tools/genprotofacade/.

Named docs/brand rather than docs/logo to keep it distinct from
docs/static/logo, which holds the published copies the site actually serves.
Hugo publishes only content/ and static/, so docs/brand is not picked up by
the site build or the gh-pages tree.

Two fixes to build_final.py, which carried absolute paths from the sandbox it
was written in and could not run anywhere else:

  sys.path.insert(0,'/home/claude/final')      -> the script's own directory
  FONT="/home/claude/fonts/IBMPlexSans-600.ttf" -> alongside the script

The README claimed build_final.py "produces every file from the mark geometry
plus the font". It does not: the module is helpers only -- horizontal(),
stacked(), frame(), recolor(), square() -- with no main, no file writing and
no rasterisation, because the driver that called them was never exported.
That section now says so plainly and tells the reader to keep mark.py in step
with any hand-edit, so the geometry and the artwork do not drift. The driver
is still to come.

The artwork here is byte-identical to the copies under docs/static, verified
across all 13 published assets, and mark.py's FAV geometry carries the y1=144
mast fix that shipped in #1466.
Replaces mark.py and build_final.py with build_logo.py, a single
self-contained generator. The previous two files were helpers with no driver:
no main, no file writing, no rasterisation, plus absolute paths from the
sandbox they were written in. build_logo.py supersedes both, so they go.

It builds the whole kit -- 17 SVGs, the PNG renders, the favicon set,
favicon.ico, the apple-touch and maskable icons, the social card and the web
manifest -- from the geometry constants at the top of the file plus the font.

Verified reproducible: building into a clean directory reproduces all 42
generated files in docs/brand byte-for-byte, including every PNG and the ICO.
Only site.webmanifest changes in this commit, reformatted by the generator's
json.dump; it is semantically identical to what it replaces. README.md and
PREVIEW.png are the two files here that are not generated.

The --out and --font defaults are anchored to the script's own location rather
than the caller's cwd, so `python3 tools/logogen/build_logo.py` rebuilds
docs/brand in place from anywhere in the tree.

--verify guards the invariants that are easy to break, and exits non-zero when
one fails. Confirmed by reintroducing the #1466 defect: setting ICON_POST_TOP
back to 141 is caught three independent ways -- the constant itself, the stale
y1="141" surviving in all four icon SVGs, and a rasterised column-by-column
measurement finding the post breaking the dish surface in 84 columns. It also
checks that no SVG carries live text or a font dependency, that all four
favicon.ico planes are true renders at their own size rather than upsamples,
and that apple-touch-icon.png is 180x180 and opaque.

Both READMEs now describe the real workflow, including which docs/static file
each artwork file publishes to, since rebuilding docs/brand does not by itself
change anything the site serves.
@manugarg manugarg changed the title [docs] Track the logo kit and its geometry in the repo [docs] Track the logo kit and make it reproducible Sep 7, 2026
Blocking:

Untrack tools/logogen/__pycache__. The two .pyc files were bytecode of
mark.py and build_final.py -- the helper scripts the previous commit removed
-- and embedded absolute source paths from the machine that compiled them,
which contradicts this branch's own claim that no absolute paths remain. They
were produced by an import check while those files still existed, swept in by
`git add tools/logogen`, and not carried out by the later deletion.

.gitignore's scheme is "ignore everything, unignore anything with an
extension" (* / !*.* / !*/), so *.pyc was unignored by default and nothing
would have stopped this recurring. Added explicit __pycache__/ and *.pyc
rules at the end, where they take precedence, and confirmed via
git check-ignore. No bytecode remains tracked anywhere in the repo.

Minor:

- --instance-from with the default --font wrote over the tracked
  IBMPlexSans-600.ttf, so the documented command silently rewrote a committed
  file. It now refuses unless --font names an explicit target. Anchoring
  --font to the script directory in the previous commit is what made this
  reachable; before that it landed in the caller's cwd.

- Dropped the fixed /tmp scratch paths (_at, _mk, _og, _v, _t), which broke on
  Windows and let concurrent runs clobber each other. cairosvg returns PNG
  bytes when write_to is omitted, so these now go through io.BytesIO and no
  scratch file is created at all.

- verify()'s docstring described running against an extracted archive, a mode
  that does not exist because --verify always rebuilds first. It now describes
  what the function actually does.

- The live-text check in build() was an assert, stripped under python -O. It
  is now an explicit raise. Confirmed the build still passes under -O.

Re-verified after all of the above: a clean build still reproduces all 42
generated files byte-for-byte, --verify passes, and reintroducing
ICON_POST_TOP=141 is still caught six ways including the 84-column dish
measurement, exiting non-zero.

Also corrects the count used in the branch's earlier message: docs/brand
publishes 14 assets into docs/static, not 13. The earlier figure omitted
favicon.ico. All 14 verified byte-identical.
@manugarg

manugarg commented Sep 7, 2026

Copy link
Copy Markdown
Contributor Author

All five addressed, plus the -O nit. Pushed as 2300a4c.

1 — __pycache__ (blocking). Correct on every point, including the diagnosis. Untracked both .pyc files and added explicit __pycache__/ and *.pyc rules at the end of .gitignore, where they take precedence over !*.*. Confirmed with git check-ignore, and no bytecode remains tracked anywhere in the repo.

For the record on how they got in: they're bytecode from an import check I ran against build_final.py while it still existed, swept in by git add tools/logogen, and the later deletion of the sources didn't carry them out. So the branch was shipping compiled copies of the exact files it claimed to have removed, with absolute paths embedded, against its own "no absolute paths" claim.

2 — --instance-from. Real, and worth noting I introduced it: anchoring --font to the script directory is what made the default point at the tracked font. Before that it landed in the caller's cwd, which was merely useless rather than destructive. It now refuses unless --font names an explicit target:

$ python3 tools/logogen/build_logo.py --instance-from Variable.ttf
--instance-from needs an explicit --font to write to; it would otherwise
overwrite the tracked tools/logogen/IBMPlexSans-600.ttf.
Pass e.g. --font /tmp/IBMPlexSans-600.ttf, and copy it into place yourself
once you are happy with it.

Exits 1, and I checked the tracked font's hash is unchanged afterwards. An explicit --font still proceeds.

3 — /tmp scratch files. Removed rather than relocated: cairosvg.svg2png returns PNG bytes when write_to is omitted, so these go through io.BytesIO and no scratch file is created. That covers both the Windows path and the concurrency clobber without a tempdir to clean up.

4 — verify() docstring. Rewritten to describe what it does. It does read only from disk, so it would work on any tree laid out like the build output; the docstring now says that while making clear --verify rebuilds first.

5 — Count. You're right, 14. My 13 came from an earlier check that omitted favicon.ico. Fixed in the PR body; all 14 verified byte-identical.

Nit — assert under -O. Cheap enough to just fix: now an explicit raise. Confirmed the build passes under python -O.

Nit — trailing newlines. Agreed, leaving as is.

Re-verified after all of it: clean build reproduces all 42 generated files byte-for-byte, --verify passes, and reintroducing ICON_POST_TOP=141 is still caught six ways including the 84-column dish measurement, exiting non-zero.

Comment thread tools/logogen/build_logo.py Fixed
Comment thread tools/logogen/build_logo.py Fixed
Comment thread tools/logogen/build_logo.py Fixed
Comment thread tools/logogen/build_logo.py Fixed
Nine of the thirteen open findings, all fixed in code rather than suppressed.
Output is unchanged: a clean rebuild still reproduces all 42 generated files
byte-for-byte, --verify passes, and the ICON_POST_TOP=141 regression is still
caught with the same 84-column measurement.

python:S6729 x4 -- np.where() with only a condition is np.nonzero(). Swapped,
and lifted the repeated column slices into locals while there, which is what
made the comprehension unreadable in the first place.

python:S1192 x3 -- "cloudprober-icon.svg", "cloudprober-icon-white.svg" and
"image/png" were repeated across the SVG table, the raster steps and the
verifier. Now ICON_SVG, ICON_WHITE_SVG and PNG_MIME.

python:S3776 -- verify() had a cognitive complexity of 26 against a limit of
15. Split into _check_svg_text, _check_post_clears_dish, _check_ico and
_check_apple_touch, each returning its own failures; verify() now just
concatenates them. Also gives each check a docstring saying why it exists,
and makes the SVG walk sorted so a failure list is deterministic.

python:S125 -- flagged the trailing comment on INK_CENTROID as commented-out
code. It was a false positive with a real cause: "measured, not eyeballed;
mass is low-left" happens to parse as valid Python, since "mass is low-left"
is "mass is (low - left)". Reworded so it no longer parses, which is cheaper
than carrying a suppression for it.

Also closes python:S1481 and the ten python:S5443 /tmp findings, which the
previous commit had already fixed.

Left open: four pythonsecurity:S8707 on --out reaching the filesystem.
Comment thread tools/logogen/build_logo.py Fixed
The four pythonsecurity:S8707 findings on tools/logogen/build_logo.py are
false positives. The rule flags CLI arguments reaching the filesystem, and
targets agent-executed code handling untrusted input. build_logo.py is a
developer build tool run by hand from a checkout: --out is the operator's own
choice of output directory, and every filename joined onto it is a hardcoded
literal -- the all_svgs() keys, "site.webmanifest", ICON_SVG, and the svg/png/
favicon subdirectory names. Nothing untrusted is ever concatenated into a
path, so there is no traversal to defend against; the only thing --out
controls is where the tool writes, which is what the flag is for.

Suppressed narrowly, by rule and by file, rather than excluding tools/ from
analysis, so anything else added there is still scanned.

Also drops e2 from the multicriteria list, which named a criterion that was
never defined -- pre-existing, and harmless, but it makes the list read as if
a rule went missing.
The plain relative path did not take effect -- the analysis still reported
the four pythonsecurity:S8707 issues. Both working entries in this file use a
leading ** glob, so use the same form. Only one build_logo.py exists in the
repo, so this stays as narrow as the path did.
The suppression added for pythonsecurity:S8707 had no effect, and neither the
plain path nor a ** glob for resourceKey changed that. The resourceKey was
never the problem: the property name was.

Sonar's key is sonar.issue.ignore.multicriteria, singular. This file has used
the plural sonar.issues.ignore.multicriteria since it was written, and Sonar
silently ignores unknown properties, so the whole block has been dead config.
That means e1 (go:S1313|1186|1192|3776 in tests) and e3 (secrets:S6652 in
tests) have never suppressed anything either.

Worth noting why this was not obvious: querying the API for go:S1192 shows 7
issues and none in _test.go files, which looks like e1 working. It is not --
**/*_test.go is in sonar.exclusions and sonar.test.inclusions, so those files
are scoped as test code and were never going to raise it.

Renamed all seven occurrences. The two pre-existing entries will now do what
they were written to do, which can only remove findings, never add them.

Per Sonar's docs this exclusion covers vulnerabilities, so e4 should now take
effect on the four S8707 findings.
With the issue-ignore property fixed, the quality gate is down to one failing
condition: new_coverage 0.0% against an 80% threshold.

No test can fix that. The project sets sonar.go.coverage.reportPaths and
nothing else -- there is no sonar.python.coverage.reportPaths -- so Python
coverage is never reported to Sonar at all, and any new .py file reads as 0%
and fails the gate. The existing Python under probes/external/serverutils/py
escapes it only by not being new code.

build_logo.py is a developer build tool that is not part of the shipped
binary, which is the same rationale already applied to **/cmd/*.go and
examples/** in this list. Excluded by directory rather than by a wider
tools/**/*.py so that anything else added under tools/ still has to make its
own case.

Note this is a coverage exclusion, not an analysis exclusion: the file is
still fully scanned for bugs, smells and vulnerabilities.
@manugarg
manugarg merged commit cd060e1 into main Sep 7, 2026
13 checks passed
@manugarg
manugarg deleted the logo-kit branch September 7, 2026 00:58
manugarg added a commit that referenced this pull request Sep 7, 2026
* [web] Adopt the new logo on cloudprober's built-in web pages

The status page, /alerts, /logs, /config-* and the artifacts browser
still had no favicon at all and a monospace "Cloudprober" text header,
predating the brand kit added in #1468.

Copy favicon.ico and the horizontal and icon SVGs from docs/brand into
web/static, where the existing //go:embed static/* already picks them
up. Add resources.HeadLinks(), which emits the stylesheet plus the
favicon links, and wire it into all three page shells (web/resources,
probestatus, artifacts) so they no longer each spell out the CSS link.
Those shells also gain a <title>, which none of them had.

The header becomes the horizontal lockup at 170px, linking to
cloudprober.org. The Github link next to it is dropped -- it crowded the
wordmark, and the site it points to is one click from the logo. The grey
header bar goes too: it existed to make the monospace text read as a
title bar, and around a lockup that already carries a cap height of
clear space in its own viewBox it was just padding a second time, with
the <hr/> below already doing the separating.

Finally, replace the fixed <br><br><br><br> under the floated info block
with a clear:both div, matching what the artifacts page already did. The
hard-coded count silently broke the moment a line was added to the block
and let the next heading ride up alongside the links.

* [web] Give each page its own title, and guard the brand asset copies

Follow-up to the previous commit, from review.

The shared <title> I added was the literal "Cloudprober" on every page,
so two open tabs -- /alerts and /logs, say -- became indistinguishable.
Before that commit there was no <title> at all and browsers fell back to
the URL, which at least told them apart. Add resources.PageTitle(), which
puts the page's own path first ("/alerts - Cloudprober") so the tellable
part survives tab truncation, and use it in all three shells. The status
page path comes from config, so it is escaped.

Add TestBrandAssetsMatchBrandKit, comparing the three assets in
web/static against their docs/brand sources through the embedded
filesystem. They are //go:embed-ed, so a copy someone forgot to refresh
would otherwise ship the old logo in the binary with nothing to catch it
-- the existing tests only assert the files are served and parse as SVG.

Drop probestatus's LinkPrefix template field, dead since the previous
commit replaced its only use, {{.LinkPrefix}}static/cloudprober.css,
with {{.HeadLinks}}.

---------

Co-authored-by: manugarg <[email protected]>
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