Skip to content

[bug] missing_dependency_hash in CI only #2420

@kymckay

Description

@kymckay

Describe the bug

Upgrading to moon v2.0.4 we now see these failures in CI:

Error: task_runner::missing_dependency_hash
  
    × Encountered a missing hash for task events:build.schemas, which is a
    │ dependency of events:codegen.py.
    │ This either means the dependency hasn't ran, has failed, or there's a
    │ misconfiguration.
    │ 
    │ Try disabling the task's cache, or marking it as local.

Steps to reproduce

Here's our setup, those tasks:

  build.schemas:
    script: bash $projectRoot/scripts/build_schemas.sh
    inputs:
      - group: yaml-sources
      - file: scripts/build_schemas.sh
    outputs:
      - glob: "schemas/common/**/*.schema.json"
      - glob: "schemas/topics/**/*.schema.json"
    options:
      runFromWorkspaceRoot: true
  codegen.py:
    script: |
      mkdir -p $projectRoot/generated/python
      uv run datamodel-codegen \
        --input $projectRoot/schemas \
        --input-file-type jsonschema \
        --output $projectRoot/generated/python \
        --output-model-type pydantic_v2.BaseModel \
        --reuse-model \
        --use-standard-collections \
        --use-one-literal-as-default \
        --target-python-version 3.12 \
        --field-constraints \
        --no-treat-dot-as-module \
        --formatters ruff-format
    inputs:
      - glob: "schemas/**/*.schema.json"
    outputs:
      - glob: "generated/python/**/*"
    deps: [build.schemas]
    options:
      runFromWorkspaceRoot: true

We also run CI sharded, which is where this fails. It does not fail if I run the codegen.py task locally.

strategy:
  matrix:
    index: [0, 1, 2]
steps:
  - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
    with:
      fetch-depth: 0
      filter: tree:0
  - uses: ./.github/actions/setup-monorepo
  - name: Run CI
    env:
      BASE_SHA: ${{ github.event.pull_request.base.sha || '' }}
      HEAD_SHA: ${{ github.event.pull_request.head.sha || '' }}
      DEPOT_TOKEN: ${{ secrets.DEPOT_TOKEN }}
    run: |
      set -euo pipefail
      moon ci \
        --base "${BASE_SHA}" \
        --head "${HEAD_SHA}" \
        --downstream none \
        --upstream none \
        --job ${{ matrix.index }} --job-total 3

Expected behavior

CI should be running the task dependency and not reporting an issue.

Screenshots

Image

Environment

Our CI runs on Depot's Ubuntu images.

Additional context

The same setup works fine in version 1 of moon, Claude suggested this may be related to the cache: false setting on dependency tasks, but that isn't the case for this example so I suspect it's a bug of some sort.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions