From e2c528052ff1a795d7abe2c6fbd77867b4caa878 Mon Sep 17 00:00:00 2001 From: barkz Date: Fri, 11 Sep 2026 21:53:38 -0500 Subject: [PATCH] fix: stop the flex row resizing the badges MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The badge strip is a flex row, and flex defaults to align-items: stretch. Replaced elements get stretched too, so the badges grew vertically while their widths stayed at the intrinsic value — the first three rendered 37.5px tall against a natural 28px. The widest badge could not follow: growing its height would have grown its width past the space left on the line, so it stayed at 28px and sat 7.5px shorter than its neighbours. Measured from a 2x render, decoding the PNG and reading the outline extents rather than eyeballing it: before 69.0x37.5 146.5x37.5 152.5x37.5 180.5x30.0 after 69.0x30.0 146.5x30.0 152.5x30.0 180.5x30.0 (30.0 is the 28px badge plus the 1px debug outline top and bottom.) Image rows no longer stretch their items, and badge images pin height: 28px with width: auto and flex: 0 0 auto — shields.io's own for-the-badge height, so every badge renders 1:1 with no scaling at all. Two tests guard the rules, since the failure was invisible in the markup and only showed up rendered. Tests: 1,100 -> 1,102. Co-Authored-By: Claude Opus 5 (1M context) --- .github/pages/template.html | 10 +++++++++- CLAUDE.md | 2 +- README.md | 2 +- docs/TESTING.md | 4 ++-- tests/test_pages_build.py | 16 ++++++++++++++++ 5 files changed, 29 insertions(+), 5 deletions(-) diff --git a/.github/pages/template.html b/.github/pages/template.html index 47fa185..80cdeda 100644 --- a/.github/pages/template.html +++ b/.github/pages/template.html @@ -140,12 +140,20 @@ [align="center"] .banner + p { font-family: var(--sans); font-size: 1.12rem; font-weight: 600; color: var(--ink); max-width: 42ch; } /* ---- image paragraphs: badges, screenshots, diagrams ---- */ - p.imgrow { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; max-width: none; } + p.imgrow { + display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; + /* never stretch: a flex line would resize replaced elements, and the + widest one then hits a width clamp and ends up shorter than the rest */ + align-items: center; max-width: none; + } p.banner { display: block; margin: 0 auto 26px; max-width: 640px; max-inline-size: 100%; } p.banner img { display: block; width: 100%; } p.badges { margin: 1.5em 0 0; gap: 7px; } + /* shields.io renders for-the-badge at 28px tall; pin it so every badge in + the row matches exactly, and keep flex out of their sizing */ + p.badges img { height: 28px; width: auto; flex: 0 0 auto; } /* screenshots get a terminal frame rather than a bare border */ p.shot { diff --git a/CLAUDE.md b/CLAUDE.md index 64fa765..c44e6c6 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -18,7 +18,7 @@ python3 install.py # --cli-only, --dev, --prefix, --verify, --uninstal # Pipe a single command (non-interactive; cli.py detects a non-tty stdin) echo '/search "q2 plan"' | python3 -m glean_code -# Run the full test suite (1,100 tests, stdlib unittest — works with or without pytest) +# Run the full test suite (1,102 tests, stdlib unittest — works with or without pytest) python3 -m pytest tests/ python3 -m unittest discover tests/ diff --git a/README.md b/README.md index b209707..63b9ba0 100644 --- a/README.md +++ b/README.md @@ -176,7 +176,7 @@ The full Glean Code REPL — slash commands, status bar, mock/live switching, se | 🔐 **[SSO / OAuth](docs/SSO_OAUTH.md)** · **[Secure tokens](docs/SECURE_TOKENS.md)** | Browser sign-in, secure refs, the masking matrix | | 🔌 **[MCP server](docs/MCP.md)** | Glean as native tools in Claude Code, Claude Desktop, Cursor | | 🏛️ **[Architecture](docs/ARCHITECTURE.md)** · **[REST paths](docs/REST_PATHS.md)** | Module map, request flow, endpoints, how to add a command | -| ✅ **[Testing](docs/TESTING.md)** | Running the 1,100-test suite and what it covers | +| ✅ **[Testing](docs/TESTING.md)** | Running the 1,102-test suite and what it covers | | 🛟 **[Support](SUPPORT.md)** · **[Changelog](CHANGELOG.md)** | How to report a bug · release history | > [!NOTE] diff --git a/docs/TESTING.md b/docs/TESTING.md index b38a615..17f2160 100644 --- a/docs/TESTING.md +++ b/docs/TESTING.md @@ -21,13 +21,13 @@ files, and they outrank the `Glean Code.app` launcher in `Cmd+Space`: export PYTHONPYCACHEPREFIX="$HOME/.cache/python" ``` -1,100 tests covering the client and every mock response, commands and dispatch, config, UI, auth, completion, help docs, the mock corpus, indexing-walk, scaffold, the installer, the MCP server, the flow mapper, the Pages site builder, and Glean Personal (text extraction, the index, the content graph, ranking explanations, local mode, and the local MCP tools). +1,102 tests covering the client and every mock response, commands and dispatch, config, UI, auth, completion, help docs, the mock corpus, indexing-walk, scaffold, the installer, the MCP server, the flow mapper, the Pages site builder, and Glean Personal (text extraction, the index, the content graph, ranking explanations, local mode, and the local MCP tools). ## Development notes Notes on the test suite added during development of glean-code-cli. -All 1,100 tests pass. Here's what was added across the development passes: +All 1,102 tests pass. Here's what was added across the development passes: `tests/test_commands_extended.py` (155 new tests) — covers all previously untested commands: diff --git a/tests/test_pages_build.py b/tests/test_pages_build.py index e0704e2..624a3e4 100644 --- a/tests/test_pages_build.py +++ b/tests/test_pages_build.py @@ -268,6 +268,22 @@ def test_no_unresolved_repo_relative_links_remain(self): self.assertNotIn('href="LICENSE"', page) +class TestTemplate(unittest.TestCase): + """Guards for stylesheet rules that a render bug traced back to.""" + + def setUp(self): + self.css = (REPO_ROOT / ".github" / "pages" / "template.html").read_text() + + def test_badge_height_is_pinned(self): + # Without an explicit height the flex line stretched the badges and the + # widest one, clamped by the space left, stayed shorter than the rest. + self.assertIn("p.badges img { height: 28px; width: auto; flex: 0 0 auto; }", self.css) + + def test_image_rows_do_not_stretch_their_items(self): + row = self.css[self.css.index("p.imgrow {"):] + self.assertIn("align-items: center", row[:row.index("}")]) + + class TestIcons(unittest.TestCase): """Browser icons are generated by .github/pages/make_icons.py."""