• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

pantsbuild / pants / 29062390045

10 Jul 2026 01:26AM UTC coverage: 92.969% (-0.3%) from 93.222%
29062390045

push

github

web-flow
Fix: Defer `validate_resolved_files` in `hydrate_sources` to support … (#23465)

Fixes #23015

### Problem
`SingleSourceField`s that rely on target generation/codegen currently
fail to hydrate. This happens because `validate_resolved_files` is
called immediately after glob expansion, *before* the actual code
generation (`generate_sources`) takes place. Since `SingleSourceField`
strictly expects exactly 1 file, this premature validation fails because
the generated file doesn't exist yet.

### Solution
Refactored the execution order inside `hydrate_sources`
(`src/python/pants/engine/internals/graph.py`) to defer file validation:
- If codegen is not in use, the validation happens normally on the
initial `snapshot` as before.
- If codegen is enabled, the validation is skipped initially and only
called on `generated_sources.snapshot.files` after the
`generate_sources` await completes.

Also added the corresponding release note to `docs/notes/2.34.x.md`.

---------

Signed-off-by: Thiago Riemma Carbonera <thiagoriemma@gmail.com>

24 of 26 new or added lines in 2 files covered. (92.31%)

1 existing line in 1 file now uncovered.

94519 of 101667 relevant lines covered (92.97%)

3.69 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

92.78
/src/python/pants/engine/internals/graph.py


Source Not Available

STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc