Skip to content

Commit e406fbf

Browse files
bpamiriclaude
andauthored
fix(web/starlight): render top-level link-only sidebar entries as leaf links (#2182)
* test(cli): add dockerized sshd fixture for deploy SSH tests Two openssh-server containers (ports 22022/22023) plus lifecycle helpers. Deterministic test keypair committed to the repo for reproducibility; no production value. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * fix(web/starlight): render top-level link-only sidebar entries as leaf links The sidebar loader unconditionally wrapped every top-level entry as `{ label, collapsed, items }`, so any entry without an `items` array (or with an empty one) rendered as a collapsible group header with no children and discarded its `link`. Glossary hit this on the v4-0-0-snapshot sidebar: `{"label": "Glossary", "link": "/v4-0-0-snapshot/glossary/"}` rendered as an unclickable stub in the nav, even though the page built and was reachable by URL. Fix: when a top-level entry has a `link` and no children, pass it through as `{ label, link }` so Starlight renders it as a leaf. Groups with children continue to be wrapped as before. Verified against a clean develop build: Glossary now renders `<a href="/v4-0-0-snapshot/glossary/">` in the sidebar HTML. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 8d32b2c commit e406fbf

8 files changed

Lines changed: 70 additions & 5 deletions

File tree

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# SSH test fixture
2+
3+
Two openssh-server containers on host ports 22022 and 22023, user `deploy`
4+
with sudo and password auth disabled. Used by SshClientSpec (Task 6+) and
5+
SshPoolSpec (Task 9).
6+
7+
## Start / Stop
8+
9+
```bash
10+
bash tools/deploy-sshd-up.sh
11+
bash tools/deploy-sshd-down.sh
12+
```
13+
14+
`test_key` is a deterministic ed25519 keypair committed to the repo — it
15+
has NO production value and exists only for test reproducibility.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIED8dz5J/2zX6dKwp5Oqlp5wguhfg4lY0Pg91Z/tIa/h wheels-deploy-test
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
services:
2+
sshd1:
3+
image: linuxserver/openssh-server:latest
4+
environment:
5+
PUBLIC_KEY_FILE: /keys/authorized_keys
6+
USER_NAME: deploy
7+
SUDO_ACCESS: "true"
8+
PASSWORD_ACCESS: "false"
9+
volumes:
10+
- ./authorized_keys:/keys/authorized_keys:ro
11+
ports:
12+
- "22022:2222"
13+
14+
sshd2:
15+
image: linuxserver/openssh-server:latest
16+
environment:
17+
PUBLIC_KEY_FILE: /keys/authorized_keys
18+
USER_NAME: deploy
19+
SUDO_ACCESS: "true"
20+
PASSWORD_ACCESS: "false"
21+
volumes:
22+
- ./authorized_keys:/keys/authorized_keys:ro
23+
ports:
24+
- "22023:2222"
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
-----BEGIN OPENSSH PRIVATE KEY-----
2+
b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAAAMwAAAAtzc2gtZW
3+
QyNTUxOQAAACBA/Hc+Sf9s1+nSsKeTqpaecILoX4OJWND4PdWf7SGv4QAAAJim5WLOpuVi
4+
zgAAAAtzc2gtZWQyNTUxOQAAACBA/Hc+Sf9s1+nSsKeTqpaecILoX4OJWND4PdWf7SGv4Q
5+
AAAEA7Lvr2A4p8d/fupWxM/MobsLDDSUaaOpzvnX83Wb5ukED8dz5J/2zX6dKwp5Oqlp5w
6+
guhfg4lY0Pg91Z/tIa/hAAAAEndoZWVscy1kZXBsb3ktdGVzdAECAw==
7+
-----END OPENSSH PRIVATE KEY-----
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIED8dz5J/2zX6dKwp5Oqlp5wguhfg4lY0Pg91Z/tIa/h wheels-deploy-test

tools/deploy-sshd-down.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
FIX_DIR="$(cd "$(dirname "$0")/.." && pwd)/cli/lucli/tests/_fixtures/deploy/sshd"
4+
docker compose -f "$FIX_DIR/docker-compose.yml" down

tools/deploy-sshd-up.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
FIX_DIR="$(cd "$(dirname "$0")/.." && pwd)/cli/lucli/tests/_fixtures/deploy/sshd"
4+
docker compose -f "$FIX_DIR/docker-compose.yml" up -d
5+
sleep 5

web/sites/guides/astro.config.mjs

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,19 @@ function buildSidebarForVersion(version) {
4545
return {
4646
label: version.label,
4747
collapsed: version.collapsed,
48-
items: groups.map((g) => ({
49-
label: g.label,
50-
collapsed: version.collapsed,
51-
items: (g.items || []).map(normalizeItem).filter(Boolean),
52-
})),
48+
items: groups.map((g) => {
49+
// Top-level entry with a link and no children → render as a leaf link,
50+
// not a collapsible group. Without this, Starlight would wrap it as an
51+
// empty group and drop the link entirely (Glossary hit this bug).
52+
if (g.link && (!g.items || g.items.length === 0)) {
53+
return { label: g.label, link: g.link };
54+
}
55+
return {
56+
label: g.label,
57+
collapsed: version.collapsed,
58+
items: (g.items || []).map(normalizeItem).filter(Boolean),
59+
};
60+
}),
5361
};
5462
}
5563

0 commit comments

Comments
 (0)