Skip to content

fix(itg): stabilize cycle hashing for BUG-028 - #304

Draft
sbalabanov wants to merge 1 commit into
mainfrom
sbalabanov/bug-028
Draft

fix(itg): stabilize cycle hashing for BUG-028#304
sbalabanov wants to merge 1 commit into
mainfrom
sbalabanov/bug-028

Conversation

@sbalabanov

@sbalabanov sbalabanov commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

Summary

Fix BUG-028 by making incremental graph hashing deterministic when invalidated targets contain dependency cycles.

Use case

A graph contains a cycle between //pkg:a and //pkg:b, with //pkg:root depending on the cycle. After a target changes, the old incremental update could traverse invalidated targets in Go map order and enter the cycle at a different target than a clean full recomputation. That produced different hashes for the same graph, leading to inconsistent incremental results and cache keys. This change hashes invalidated targets in canonical target-name order so both paths agree.

Test Plan

  • Run bazel test //core/itg/graph:go_default_test.
  • Property-based tests permute invalidation order for rooted and rootless cycles.

Revert Plan

Revert this PR.

Issues

BUG-028

Summary:
Intent:
- Make BUG-028 incremental cycle hashing independent of invalidation map iteration.
- Preserve the cycle entry points used by full graph recomputation.

Changes:
- Hash invalidated topological roots and root-unreachable cycles in canonical target-name order.
- Add property-based coverage over randomized invalidation insertion orders for rooted and rootless cycles.

---

<sub>Generated by the 🪄 [pr-create](https://sg.uberinternal.com/code.uber.internal/uber-code/devexp-agent-marketplace/-/blob/claude-code/plugins/dev/uber-dev/skills/pr-create/SKILL.md) skill in devexp-agent-marketplace</sub>
@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@sbalabanov
sbalabanov marked this pull request as ready for review August 26, 2026 18:32
@sbalabanov
sbalabanov requested review from a team as code owners August 26, 2026 18:32
@sbalabanov
sbalabanov marked this pull request as draft August 26, 2026 19:17
@sbalabanov

Copy link
Copy Markdown
Contributor Author

simplify description and describe a use case showing a bug it fixes

@sbalabanov

Copy link
Copy Markdown
Contributor Author

Updated the BUG-028 description to focus on deterministic incremental cycle hashing and added a concrete rooted-cycle invalidation use case showing how the previous behavior could differ from a full recomputation. Current HEAD: acb84d8e0e2a7c53e1dd4ddbdc17f539da043f22.

[addressed by agent]

Comment thread core/itg/graph/update_test.go
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants