Skip to content

A persistently failing file makes every incremental update a full rebuild (identity-version loop) #944

Description

@merlincat11

Split out of #939 review. Reachable on main today for C++; #939 would have extended it to Java/C#.

Problem

full_build refuses to record cpp_identity_version when any C++ file failed to parse,
because a failed file keeps its old-format edges:

if not cpp_errors:
    store.set_metadata(_CPP_IDENTITY_METADATA_KEY, CPP_IDENTITY_VERSION)

incremental_update then sees a stale identity version and triggers full_build. If the
file fails every time — genuinely malformed, unreadable, or hitting a parser bug — the
marker is never recorded and every incremental update becomes a full rebuild,
indefinitely.

Reproduction

Simulated a Java file that always raises during parse, using the #939 branch (same logic,
extended to Java/C#):

inherits_identity_version after failed build: None
  update 1: identity_rebuild = True
  update 2: identity_rebuild = True
  update 3: identity_rebuild = True

Substituting a C++ file reproduces the same loop against main.

Why it matters

The guard is correct in intent — marking the version current while a file retains stale
edges would mean never retrying it. But the current shape converts one bad file into a
permanent, repo-wide performance cliff, and it is silent apart from an INFO log.

Possible directions

  • Record the version and track the specific failed files, so only those are retried
    rather than rebuilding everything.
  • Record the version after a rebuild attempt regardless, accepting that a permanently
    unparseable file keeps stale edges (it has no valid edges to offer anyway).
  • Bound retries, e.g. attempt the identity rebuild once and record the attempt.

Worth fixing for C++ and any future identity version together, so the mechanism has one
agreed behaviour.

Activity

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

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions