Skip to content

Expose task content hash to task processes#2504

Open
gabrielbryk wants to merge 2 commits into
moonrepo:masterfrom
gabrielbryk:feat/task-content-hash
Open

Expose task content hash to task processes#2504
gabrielbryk wants to merge 2 commits into
moonrepo:masterfrom
gabrielbryk:feat/task-content-hash

Conversation

@gabrielbryk

Copy link
Copy Markdown
Contributor

Summary

Expose MOON_TASK_CONTENT_HASH to task child processes.

This hash uses Moon’s task-local and toolchain hash material, but excludes upstream dependency task result hashes. Moon’s existing cache behavior remains unchanged and continues to use MOON_TASK_HASH for hydrate/archive/remote cache behavior.

This gives external command wrappers a Moon-native static key for runtime-observed cache experiments without requiring them to reimplement Moon’s task hashing logic.

Changes

  • Generate both the full task hash and task content hash during task hash generation
  • Preserve dependency edge identity in the content hash while excluding dependency result hash values
  • Inject MOON_TASK_CONTENT_HASH alongside MOON_TASK_HASH
  • Add tests for env injection and dep-hash exclusion behavior
  • Document the new env var in cache docs

@codspeed-hq

codspeed-hq Bot commented Apr 27, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

⚠️ Unknown Walltime execution environment detected

Using the Walltime instrument on standard Hosted Runners will lead to inconsistent data.

For the most accurate results, we recommend using CodSpeed Macro Runners: bare-metal machines fine-tuned for performance measurement consistency.

✅ 19 untouched benchmarks


Comparing gabrielbryk:feat/task-content-hash (3cdebcc) with master (d46c859)

Open in CodSpeed

@milesj

milesj commented May 14, 2026

Copy link
Copy Markdown
Collaborator

Going to land this in 2.3 #2516

We'll see if this kind of PR is still necessary.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants