Skip to content

Fix comment permalinks with version query#573

Open
ion-lion wants to merge 2 commits into
seed-hypermedia:mainfrom
ion-lion:fix/comment-version-permalink
Open

Fix comment permalinks with version query#573
ion-lion wants to merge 2 commits into
seed-hypermedia:mainfrom
ion-lion:fix/comment-version-permalink

Conversation

@ion-lion
Copy link
Copy Markdown
Collaborator

@ion-lion ion-lion commented May 7, 2026

Summary

Fixes #572.

Comment permalink URLs can include ?v=<comment-version-cid>. On /:comments/<author>/<commentId> routes, web should treat that v as the comment version, not as the target document version.

This PR:

  • detects comment permalink routes
  • keeps ?v out of the target document lookup so the document resolves normally
  • passes the query CID through as commentVersion
  • loads the comment via getComment(commentVersion || openCommentId)
  • adds a focused regression test for the route behavior

Verification

Reproduced before patch:

  • Base/parent: 063b70c39 fix(hmnet): import sqlite package for *sqlite.Stmt callbacks
  • Command:
    git checkout --detach HEAD^
    corepack pnpm --filter @shm/web test app/comment-permalink-route.test.ts
  • Result: failed as expected. The old behavior passed ?v=comment-version-cid as the document version:
    • expected version: null, latest: true
    • received version: "comment-version-cid", latest: false

Verified after patch:

  • Branch/head: fix/comment-version-permalink / ae883eb1f Add comment permalink route regression test
  • Command:
    git checkout fix/comment-version-permalink
    corepack pnpm --filter @shm/web test app/comment-permalink-route.test.ts
  • Result: passed.

Additional checks:

  • corepack pnpm --filter @shm/web exec prettier --check app/comment-permalink-route.test.ts
  • Result: passed.
  • git diff --check
  • Result: passed.

Limitations:

  • corepack pnpm install --frozen-lockfile reached a lifecycle failure building @sentry/profiling-node because make is missing in this environment. Enough JS dependencies were installed for the focused web Vitest target and Prettier check to run.

Repro URL

Broken before this change:

https://seedteamtalks.hyper.media/discussions/high-network-usage-in-activity-monitor/:comments/z6MkwRWdU6HY11Qzi9SQZrwSx3rxFw94ipYyiN7Dtbrcg2yU/z6GeWHYXTLa49x?v=bafy2bzacedjrx7zih3zlgvwhlvkpe3lmcvoa67ikvfrvfdqvf2ge4ky6nomhm

Works without ?v:

https://seedteamtalks.hyper.media/discussions/high-network-usage-in-activity-monitor/:comments/z6MkwRWdU6HY11Qzi9SQZrwSx3rxFw94ipYyiN7Dtbrcg2yU/z6GeWHYXTLa49x

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.

Comment permalink with ?v=<comment version CID> renders not found on web

1 participant