From 0e5abc9b8aee9401a9dc16de600e0e6ca8251884 Mon Sep 17 00:00:00 2001 From: barkz Date: Sat, 12 Sep 2026 08:56:39 -0500 Subject: [PATCH] fix: align the link-wrapped badges with the bare ones MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Pinning the badge images to 28px fixed three of the five. Two of them — release and license — are wrapped in links, and there the flex item is the , not the image. An inline image inside an anchor carries line-box leading, so those two items were 37.5px tall against the bare images' 30px (28px plus a debug outline), and they sat higher in the row. That 37.5px was also what set the line's cross size and stretched the bare images in the first place, so this was the root cause, not a second bug. Measured per element by outlining images and anchors in different colours and decoding the render: before images top 113.5 bottom 143.0 height 30.0 anchors top 110.0 bottom 147.0 height 37.5 after both top 110.0 bottom 139.5 height 30.0 The row zeroes its line-height, the anchors become flex boxes that hug their image, and the images are display: block so no baseline gap is left underneath. Tests: 1,108 -> 1,109. Co-Authored-By: Claude Opus 5 (1M context) --- .github/pages/template.html | 8 ++++++-- CLAUDE.md | 2 +- README.md | 2 +- docs/TESTING.md | 4 ++-- tests/test_pages_build.py | 20 +++++++++++++++++--- 5 files changed, 27 insertions(+), 9 deletions(-) diff --git a/.github/pages/template.html b/.github/pages/template.html index 8379663..23d890d 100644 --- a/.github/pages/template.html +++ b/.github/pages/template.html @@ -164,10 +164,14 @@ 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; } + /* line-height: 0 matters -- two of these badges are wrapped in links, and + an inline image inside an carries line-box leading, which made those + flex items 37.5px tall against the bare images' 28px */ + p.badges { margin: 1.5em 0 0; gap: 7px; line-height: 0; } + p.badges a { display: flex; flex: 0 0 auto; } /* 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; } + p.badges img { display: block; 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 7e2ac07..e079c00 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,108 tests, stdlib unittest — works with or without pytest) +# Run the full test suite (1,109 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 44f3f28..3333f45 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,108-test suite and what it covers | +| ✅ **[Testing](docs/TESTING.md)** | Running the 1,109-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 39c71c0..e26b391 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,108 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,109 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,108 tests pass. Here's what was added across the development passes: +All 1,109 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 b978e93..18cd321 100644 --- a/tests/test_pages_build.py +++ b/tests/test_pages_build.py @@ -290,10 +290,16 @@ class TestTemplate(unittest.TestCase): def setUp(self): self.css = (REPO_ROOT / ".github" / "pages" / "template.html").read_text() + def _rule(self, selector): + body = self.css[self.css.index(selector) + len(selector):] + return body[:body.index("}")] + 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) + rule = self._rule("p.badges img {") + for decl in ("display: block", "height: 28px", "width: auto", "flex: 0 0 auto"): + self.assertIn(decl, rule) def test_tagline_is_set_in_the_mono_face(self): rule = self.css[self.css.index('[align="center"] .banner + p {'):] @@ -308,9 +314,17 @@ def test_headings_and_table_headers_use_the_mono_face(self): rule = self.css[self.css.index(selector):] self.assertIn("font-family: var(--mono)", rule[:rule.index("}")], selector) + def test_badge_links_are_not_leaded(self): + # Two badges are wrapped in links. An inline image inside an carries + # line-box leading, which made those flex items 37.5px tall against the + # bare images' 28px -- the row's cross size, and the misalignment. + self.assertIn("line-height: 0", self._rule("p.badges {")) + anchor = self._rule("p.badges a {") + self.assertIn("display: flex", anchor) + self.assertIn("flex: 0 0 auto", anchor) + 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("}")]) + self.assertIn("align-items: center", self._rule("p.imgrow {")) class TestIcons(unittest.TestCase):