Skip to content

docs: compute Storybook preview hosts the way Vercel truncates them - #615

Merged
alukach merged 2 commits into
mainfrom
docs/claude-md-preview-urls
Oct 2, 2026
Merged

alukach merged 2 commits into
mainfrom
docs/claude-md-preview-urls

Conversation

@alukach

@alukach alukach commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

CLAUDE.md told agents to build Storybook preview links as source-coop-ui-git-<branch>-radiantearth.vercel.app. Vercel caps a hostname label at 63 characters and truncates long branch names with a hash suffix, so for feat/github-immutable-repository-lookup (#614) the guessed host doesn't resolve; the real one is source-coop-ui-git-feat-github-immutable-re-82950d-radiantearth.vercel.app.

The Vercel bot comment carries the real host, but only after the PR is open — too late for the description written when it's created. So CLAUDE.md now gives a shell snippet that computes the host from the branch: <project>-git-<slug>-radiantearth when that fits in 63 characters, otherwise <project>-git-<slug> cut to 43 characters, then the first six hex characters of sha256("git-" + <raw branch> + <project>), then -radiantearth. It also says to check the links against the bot comment once the PR is open.

Testing

Compared the snippet's output with the source-coop-ui host in the Vercel bot comment on the last 40 PRs: 39 match. The one miss, #602, is from a fork, which Vercel names fork-<owner>-<branch>; the snippet doesn't handle forks. Ran the snippet as written under bash and zsh for a short branch and a long (truncated) one.

No UI, docs.source.coop or data-proxy ADR impact: this only changes contributor guidance in this repo.

🤖 Generated with Claude Code

Vercel truncates and hashes preview hostnames whose label passes 63 characters, so the URL template built from the branch name produced dead links for long branches (e.g. #614).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@vercel

vercel Bot commented Oct 1, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated
source-coop-ui Ready Ready Preview Oct 2, 2026 4:10am UTC
source-cooperative Ready Ready Preview Oct 2, 2026 4:10am UTC

Request Review

@claude

claude Bot commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @alukach's task in 22s —— View job


✅ No blocking issues — safe to merge.

The change only touches CLAUDE.md contributor guidance. I couldn't execute the new snippet in this sandbox, so I checked it by hand against the feat/github-immutable-repository-lookup example. The truncation arithmetic is right: 55 - 12 (radiantearth is 12 chars) keeps 43 chars, which gives a 62-char label. That matches the example host. The 6-char hash input (git-$b$p) is not something I could verify, which is why the "check against the Vercel bot comment" step matters.

Notes (advisory)

  • PR description is stale. CLAUDE.md requires the title and body to describe the branch as it stands. The body says the guidance "now says to copy the host from the Vercel bot comment". The second commit (e645394) instead adds a shell snippet that computes the host before the PR exists, and keeps the bot comment only as a verification step. The title ("take Storybook preview hosts from the Vercel bot comment") has the same problem. Suggest rewording, e.g. docs: compute Storybook preview hosts the way Vercel truncates them.
  • The snippet uses bash/zsh substring syntax (${l:0:N}) and shasum, which is fine for macOS and typical Linux. It is not POSIX sh.

Simplify (ponytail)

  • CLAUDE.md snippet: a 4-line hash-reimplementation of Vercel's truncation is fragile if Vercel changes its algorithm. The lazier option is to drop it and say "link the root until the bot comment appears, then edit". You then keep one source of truth, the bot's host. Keep the snippet only if pre-PR links matter.

Docs

Contributor guidance only, with no user-facing flow or ADR decision touched. The description's "No UI, docs.source.coop or data-proxy ADR impact" statement is sufficient.


💰 Estimated review cost: $0.12 · 0m22s · 6 turns

The Vercel bot comment only appears after the PR is opened, too late for the first description. Vercel's truncated label is <project>-git-<slug> cut to fit, then the first six hex chars of sha256("git-" + branch + project) and the team slug; the snippet reproduces it and matched 39 of the last 40 PRs (the miss is a fork, which Vercel prefixes with fork-<owner>-).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@alukach alukach changed the title docs: take Storybook preview hosts from the Vercel bot comment docs: compute Storybook preview hosts the way Vercel truncates them Oct 2, 2026
@alukach
alukach marked this pull request as ready for review October 2, 2026 17:56
@alukach
alukach merged commit 24ed063 into main Oct 2, 2026
10 checks passed
@alukach
alukach deleted the docs/claude-md-preview-urls branch October 2, 2026 17:56

This branch was successfully deployed

2 active deployments
Preview – source-cooperative — e645394a Deployed Oct 2, 2026 by vercel[bot]
Preview – source-coop-ui — e645394a Deployed Oct 2, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant