microsoft / microsoft/vscode-pull-request-github

Permalinks in feature branches on forks should fallback to upstream main for unmodified lines

オープン
#7,983 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

feature-request
主要言語
TypeScript
スター
2.6k
フォーク
796
平均マージ
1日 4時間
マージ済み PR(30日)
46

説明

Problem

Referencing prior fix in PR #1816: Permalinks generated from feature branches on forks do not fallback to upstream main, even for lines that are completely unmodified. This harms canonical link-sharing because:

  1. Links to feature branches break when the branch is deleted (common after PR merge)
  2. Recipients may not have access to fork repositories
  3. The same code exists in upstream main but the link doesn't redirect there

Current Behavior

When creating a permalink from a feature branch on a fork:

  • The link points to: fork/repo/blob/feature-branch/file.ext#L123
  • No fallback occurs even if line 123 is identical in upstream main
  • Link becomes invalid after branch deletion

Proposed Enhancement

Extend the permalink generation logic to:

  1. Check if the referenced lines exist unchanged in upstream main
  2. If unchanged, generate permalink to upstream main instead
  3. Fall back to checking other long-lived branches if not in main
  4. Only use feature branch permalink if code is actually modified

main here be substituted for any default branches, or custom list thereof user can config for reference in order of prefernce
ie main/master/release-5/release-4 whereby main is preferred, but if snippet only exists in a release branch, not main, release branch in upstream is still preferred vs fork link, since it affects ability to paste into upstream github and getting content previews.

ie. https://github.com/microsoft/vscode-pull-request-github/blob/45d42a8efb0d9ba5bbf9810dcb78ba865004f67c/build/filters.js#L14

vs

https://github.com/fork/vscode-pull-request-github/blob/45d42a8efb0d9ba5bbf9810dcb78ba865004f67c/build/filters.js#L14

Context Summary

Aspect Current State Proposed State
Fork feature branch (unchanged code) Links to fork/branch Links to upstream/main
Fork feature branch (changed code) Links to fork/branch Links to fork/branch
After branch deletion Link breaks Link still works
Accessibility Fork access required Public upstream access

Benefits

  • More resilient permalink sharing
  • Better canonical link behavior
  • Reduced broken links after PR merges
  • Improved accessibility for external collaborators

This would make permalinks more useful for documentation, issue references, and knowledge sharing.

related: https://github.com/microsoft/vscode-pull-request-github/issues/1781

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

まず permalink 関連のロジックと、issue で言及されている build/filters.js の例を確認し、その後、fork と feature branch のリンクを対象とするテストを見つけてください。upstream のデフォルトブランチまたは設定済みブランチの優先順位を定義し、変更されていない行では upstream リンクが使用され、変更された行では fork リンクが維持されることを検証してください。issue では既存のテストもエントリーポイントも名前が挙げられていません。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
github, typescript, vscode
領域
developer-experience, devtools
issue の種類
機能追加
難易度
5/5
見積もり時間
1週間以上
活発さ
停滞
明瞭さ
説明が足りない
初心者へのやさしさ
30/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。