You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
view: compare mode can show stale or mixed results #2068
This content was written by an AI agent and must be verified by a human developer. After human verification, this alert may be removed.
Found in the review of #2057, which adds the experimental view. It does not block that PR; #2059 fixed the findings that did. Paths refer to #2059's head.
Problem
Compare mode (#owner/repo@base...head/path) in web/view/src/githubHost.ts and web/view/src/github.ts:
A late load can overwrite a newer one's compare state.this.compare = await this.readBase(...) assigns before the load checks that it is still current. An older load's base can then stick, and diff marks appear although the URL has no compare. Found by reading the code.
A load can mix two commits. After reading the tree, files are fetched by branch name (?ref=). A push in between mixes the two commits.
Every base file is downloaded again, even a blob whose sha matches the head's. The base tree's truncated flag is not checked.
If the base does not compile, Compare.model() returns null and every node is shown as new.
If the base ref does not exist, the page says the repository was not found and asks to sign in, although the head loaded.
Proposed fix
Read results into local variables and publish them together after the freshness check.
Resolve both refs to commit SHAs first, and read trees and sources from those SHAs.
Fetch blobs by sha, and reuse the head's text for an identical blob.
Represent the base as absent | failed { message } | model.
Activity
View: GitHub host fixes (#2090 lane B) (#2107)