fix(anonymize): one message and one next step when a source fails to load

A repository URL that could not be read produced a pile of messages:
"Does not exist or is not accessible", a "Repository not listed?" label,
two access notes, a private-content warning, an empty branch/commit grid
with "The commit SHA is not valid", a toast, and an enabled-looking
"Create anonymous link" whose reason pointed to the preview.

- Under the URL, one error block per case (malformed URL, missing or no
  access, organization restriction or SSO, already anonymized), naming
  the source and giving its fix: Manage GitHub access and Try again.
  The preview shows the same wording and actions; no toast.
- Drop "Repository not listed?". The landing picker gets a quiet
  "Don't see your repository? Manage GitHub access" link instead.
- New anonymizations hide branch/commit, auto-update and the other
  sections until the source loads. Edit mode keeps them editable.
- The publication warning shows only once a private source has loaded;
  the repository metadata now includes GitHub's `private` flag.
- The primary button is disabled until the source loads, with a short
  local reason, and the draft line waits for a loaded source.
- dev-mock: failing, slow, PR, gist and edit-mode fixtures.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Thomas DurieuxandClaude Opus 5.5 committed 2026-11-14 22:22:33 +00:00
1 parent 3fbf2cbad7
commit 1412de9d9f
11 files changed
+219 -138

No files matched your search

@@ -15,6 +15,7 @@ const RepositorySchema = new Schema({
default: "github",
},
hasPage: { type: Boolean, default: false },
private: Boolean,
pageSource: {
branch: { type: String },
path: String,
@@ -8,6 +8,8 @@ export interface IRepository {
size?: number;
defaultBranch?: string;
hasPage: boolean;
/** GitHub visibility, refreshed each time the metadata is fetched. */
private?: boolean;
pageSource?: {
branch: string;
path: string;
+3
View File
@@ -25,6 +25,7 @@ export class GitHubRepository {
repo: this.repo,
owner: this.owner,
hasPage: this._data.hasPage,
private: this._data.private,
pageSource: this._data.pageSource,
fullName: this.fullName,
defaultBranch: this._data.defaultBranch,
@@ -392,6 +393,7 @@ export async function getRepositoryFromGitHub(opt: {
model.size = r.size;
model.defaultBranch = r.default_branch;
model.hasPage = r.has_pages;
model.private = r.private;
if (pageSource) model.pageSource = pageSource;
return new GitHubRepository(model);
}
@@ -405,6 +407,7 @@ export async function getRepositoryFromGitHub(opt: {
size: r.size,
defaultBranch: r.default_branch,
hasPage: r.has_pages,
private: r.private,
...(pageSource ? { pageSource } : {}),
},
$setOnInsert: { externalId: "gh_" + r.id },