Skip to content

view: compare mode can show stale or mixed results #2068

Closed

Description

@shunichironomura

Warning

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

  1. added
    bugSomething isn't working
    webviewThe experimental view (web/view, graphcal view, graphcal/viewModel)
    on Oct 14, 2026
  2. added a commit that references this issue on Oct 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingwebviewThe experimental view (web/view, graphcal view, graphcal/viewModel)

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions