Skip to content

update: the automatic full-rebuild fallback bypasses the root-mismatch guard and can replace another repository's graph #906

Description

@tirth8205

Found in a read-only audit of v2.3.8. Verified against current main.

What happens

incremental_update refuses to reconcile a graph whose stored File nodes all live under a different root (code_review_graph/incremental.py:1372, the guard added for #889). The update tool does not always reach it.

code_review_graph/tools/build.py resolves an automatic diff base first, and when no usable anchor exists it sets full_rebuild = True and calls full_build() instead. full_build reconciles stale files with no root check, so a graph anchored to another repository is emptied and replaced rather than refused.

Reproduction

Build repository A into a shared data directory, then run an ordinary update for repository B with no usable stored SHA. The graph goes from holding only A/a.py to holding only B/b.py, with no mismatch error.

Why it matters

This is the same data-loss shape #889 fixed, reachable through the default path rather than an unusual spelling. The loss is regenerable graph data, never source files, which is why this is high and not critical.

Suggested fix

Apply the same guard before the fallback rebuild — a full build that is chosen automatically (rather than requested with --full) should refuse a graph anchored elsewhere, exactly as the incremental path does. An explicit full_rebuild=True from the user can keep its current wipe-and-rebuild behavior.

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

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions