Skip to content

feat: add --hash-debug flag for per-target hash component logging#8

Open
honnix wants to merge 2 commits into
mainfrom
feat/hash-debug
Open

feat: add --hash-debug flag for per-target hash component logging#8
honnix wants to merge 2 commits into
mainfrom
feat/hash-debug

Conversation

@honnix

@honnix honnix commented Jun 22, 2026

Copy link
Copy Markdown
Member

Summary

Adds a --hash-debug CLI flag that logs per-target hash component breakdown to stderr:

  • Source files: label, resolved absolute path, content hash (or NOT_FOUND/IS_DIR)
  • Rule inputs: parent rule → input label, config, input hash
  • Rules: name, class, skylark env hash, config, final hash

Motivation

We're debugging non-deterministic target hashes across CI agents in the data monorepo. The bazel query --output=proto output is byte-identical between agents, yet the hash-persister produces different hashes. This flag will let us diff the hash computation trace between two runs to pinpoint the diverging component.

Usage

bazel run @multitool//tools/hash-persister:cwd -- --hash-debug --query-backend=query --output=hashes.json <sha>

The output goes to stderr (via Go log package), so it can be redirected independently of the hash file.

🤖 Generated with Claude Code

honnix added 2 commits June 22, 2026 22:41
When --hash-debug is passed, logs each target's hash inputs to stderr:
- Source files: label, absolute path, and content hash
- Rules: each rule input's label and hash, then the rule's final hash
  with its class, skylark env hash, and configuration

This enables diagnosing non-deterministic hashes across CI agents by
comparing the debug output from two runs on the same commit.
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.

1 participant