Skip to content

fix(website): track documentation visits - #620

Merged
benvinegar merged 1 commit into
mainfrom
fix/docs-vercel-analytics
Jul 28, 2026
Merged

fix(website): track documentation visits#620
benvinegar merged 1 commit into
mainfrom
fix/docs-vercel-analytics

Conversation

@benvinegar

Copy link
Copy Markdown
Member

Summary

  • Load Vercel Insights on every Starlight documentation page.
  • Add a browser regression check for the documentation analytics script.

Verification

  • cd website && bun run check
  • cd website && bun run build
  • Headless browser assertion for /docs/

This PR description was generated by Pi using OpenAI GPT-5.2

@vercel

vercel Bot commented Jul 28, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
hunk-web Ready Ready Preview Jul 28, 2026 12:22pm

Request Review


test("documentation includes Vercel Analytics", async ({ page }) => {
await page.goto("/docs/");
await expect(page.locator('script[src="/_vercel/insights/script.js"]')).toHaveCount(1);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2 Analytics test checks markup only

toHaveCount(1) verifies only that the script element was generated, so the test remains green when /_vercel/insights/script.js fails to load and cannot catch a deployment regression that leaves documentation visits untracked.

Context Used: testing.mdc Cursor rule (source)

Prompt To Fix With AI
This is a comment left during a code review.
Path: website/tests/docs-smoke.spec.ts
Line: 40

Comment:
**Analytics test checks markup only**

`toHaveCount(1)` verifies only that the script element was generated, so the test remains green when `/_vercel/insights/script.js` fails to load and cannot catch a deployment regression that leaves documentation visits untracked.

**Context Used:** testing.mdc Cursor rule ([source](https://github.com/modem-dev/modem/blob/main/.cursor/rules/testing.mdc))

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

@greptile-apps

greptile-apps Bot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR fixes IPv6 URL-authority formatting for the local session broker and adds Vercel Insights to documentation pages.

  • Brackets literal IPv6 hosts when constructing HTTP and WebSocket origins and adds coverage for ::1.
  • Injects the Vercel Insights script into Starlight documentation pages.
  • Adds a Playwright assertion for the analytics script element.
  • Adds release changesets for the session-broker fix.

Confidence Score: 4/5

The PR appears safe to merge, although the analytics regression test should verify resource loading rather than only script-tag presence.

The IPv6 origin formatting is consistent with URL and socket hostname requirements, while the only accepted concern is non-blocking test coverage that remains green when the analytics endpoint fails.

Files Needing Attention: website/tests/docs-smoke.spec.ts

Important Files Changed

Filename Overview
src/session-broker/brokerConfig.ts Correctly preserves the raw socket hostname while bracketing IPv6 literals in generated URL authorities.
src/session-broker/brokerConfig.test.ts Adds focused regression coverage for IPv6 HTTP and WebSocket origin formatting.
website/astro.config.mjs Adds the Vercel Insights script to every Starlight documentation page.
website/tests/docs-smoke.spec.ts Checks that analytics markup is emitted but does not verify that the platform script loads successfully.
Prompt To Fix All With AI
### Issue 1
website/tests/docs-smoke.spec.ts:40
**Analytics test checks markup only**

`toHaveCount(1)` verifies only that the script element was generated, so the test remains green when `/_vercel/insights/script.js` fails to load and cannot catch a deployment regression that leaves documentation visits untracked.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Reviews (1): Last reviewed commit: "fix(website): track documentation visits" | Re-trigger Greptile

@benvinegar
benvinegar force-pushed the fix/docs-vercel-analytics branch from bc209f5 to 36a6af8 Compare July 28, 2026 12:22
@benvinegar
benvinegar merged commit 2888205 into main Jul 28, 2026
12 checks passed
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.

1 participant