Skip to content

Github diff too large for commited graphify-out content #3413

Closed

Description

@rudifus-ppy

I found useful to setup our .gitattributes file for 4 commited graphify files as:

graphify-out/graph.json merge=graphify
graphify-out/** linguist-generated
# Skip line-level diffing for the auto-regenerated graph artifacts: git treats each version as
# opaque binary for diff purposes instead of running the LCS algorithm over it. graph.json is
# pretty-printed and can show 1M+ changed lines between rebuilds (node ordering shifts), which
# blows past GitHub's diff-generation time budget - the PR /files and /compare endpoints then
# fail with HTTP 422 ("Sorry, this diff is taking too long to generate.") and the PR page/API
# silently report 0 changed files across the whole PR instead of surfacing the error.
# linguist-generated above only collapses the *rendered* diff in the UI; it still has to be
# computed first, so it alone does not fix this. The other three files here are smaller but
# regenerate the same way on every commit, so they get the same treatment pre-emptively.
graphify-out/graph.json -diff
graphify-out/manifest.json -diff
graphify-out/GRAPH_REPORT.md -diff
graphify-out/.graphify_labels.json -diff

though the GitHub's files changed tab shows 0 - as the diff got too large

Any solution how to setup Github diff properly - to ignore the graphify-out content?

Image

Activity

  1. SinghAman21 commented on Sep 13, 2026

    @SinghAman21
    Contributor

    try committing after 2-3 prompts to keep the git diff check under control.
    maybe you handed over a large task to agent which caused this huge change, could be one time thing as well ( just my speculation )

  2. dej-h commented on Sep 20, 2026

    @dej-h

    I ran into this in a repository where we commit the generated Graphify output.
    We first tried essentially the approach proposed here and in #3575: marking the generated files with -diff and linguist-generated. That did not reliably solve the GitHub PR totals problem for us. It changes how files are displayed, but still leaves the solution dependent on GitHub honoring those attributes while processing the generated text.
    We ended up replacing the individually tracked graph files with a deterministic ZIP snapshot.
    Our hook:

    • builds the graph from the exact staged Git index, so unrelated unstaged changes cannot leak into it;
    • validates the generated graph;
    • packages graph.json, graph.html, GRAPH_REPORT.md, and .graphify_labels.json into one deterministic ZIP;
    • stages only that ZIP;
    • restores the readable files after commits, checkouts, and merges for local and agent use.
      Git consequently treats the snapshot as a single binary file. In our verification, git show --numstat reports - - for it and the commit reports zero text insertions and deletions. This avoids generated graph lines contributing to PR totals without requiring any manual graph maintenance.
      The relevant history in our repository is:
    • 8870437: initial .gitattributes approach
    • 1287e2b: replacement with the deterministic binary snapshot
      I am happy to extract the implementation into a minimal reproduction or contribute an opt-in tracked snapshot mode. Would that fit as an extension of fix(export): give a committed output directory its diff attributes #3575, or would you prefer a separate feature proposal?
  3. andrebrait commented on Sep 30, 2026

    @andrebrait
    Contributor

    Yeah, I remember it being solved for a while, but now the number of modified lines is back on counting the graph ones.

    I am doing things slightly different so rather than using a post-commit hook I am actually using a pre-commit hook so every commit carries the changes made to the graph.

  4. added 2 commits that reference this issue on Oct 11, 2026
  5. safishamsi commented on Oct 11, 2026

    @safishamsi
    Member

    Fixed in 0.9.86 (now on PyPI) via #4319. Thanks @andrebrait!

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions