Skip to content

feat(test-fill): enable phase-1-only pre-alloc generation#2720

Merged
marioevz merged 5 commits intoethereum:forks/amsterdamfrom
danceratopz:enable-fill-phase-1-only
Apr 22, 2026
Merged

feat(test-fill): enable phase-1-only pre-alloc generation#2720
marioevz merged 5 commits intoethereum:forks/amsterdamfrom
danceratopz:enable-fill-phase-1-only

Conversation

@danceratopz
Copy link
Copy Markdown
Member

@danceratopz danceratopz commented Apr 19, 2026

🗒️ Description

Splits the overloaded --generate-pre-alloc-groups flag so it now runs phase 1 only: populate the pre_alloc/ folder and stop. This enables splitting fixture generation across runners (phase 1 on one, phase 2 via --use-pre-alloc-groups on another) without requiring --generate-all-formats as a wrapper.

Changes:

  • fill.py: --generate-pre-alloc-groups alone creates a phase-1-only execution; --generate-all-formats remains the two-phase driver.
  • fill.py: new _validate_flag_combinations rejects --use-pre-alloc-groups combined with --generate-pre-alloc-groups or --clean up-front with a click.UsageError, instead of failing later with a FileNotFoundError from _load_pre_alloc_groups_from_folder.
  • Justfile: bench-gas switched to --generate-all-formats since --generate-pre-alloc-groups no longer two-phases.
  • Docs: refreshed filling_tests_command_line.md and blockchain_test_engine_x.md to match the new semantics.
  • Tests: cover the new phase-1-only path and both rejection paths.

🔗 Related Issues or PRs

N/A.

✅ Checklist

  • All: Ran fast static checks to avoid unnecessary CI fails, see also Code Standards and Enabling Pre-commit Checks:
    just static
  • All: PR title adheres to the repo standard - it will be used as the squash commit message and should start type(scope):.
  • All: Considered updating the online docs in the ./docs/ directory.
  • All: Set appropriate labels for the changes (only maintainers can apply labels).

Cute Animal Picture

🐢

Re-order `FillCommand.create_executions` so that the execution plan
reflects the user's intent:

- `--use-pre-alloc-groups` now takes priority. The flag means pre-alloc
  groups already exist on disk from a previous run, so even alongside
  `--generate-all-formats` the run is single-phase.
- `--generate-pre-alloc-groups` without `--generate-all-formats` now
  runs phase 1 only; don't continue to phase 2.
- `--generate-all-formats` continues to trigger the full two-phase
  run.

Update `test_legacy_generate_pre_alloc_groups_still_works` to reflect
the new phase-1-only behaviour and add a test covering the
`--use-pre-alloc-groups` priority.
Add failing tests asserting that `FillCommand.create_executions` raises
`click.UsageError` when `--use-pre-alloc-groups` is combined with:

- `--generate-pre-alloc-groups`: the first asserts the groups already
  exist on disk, the second regenerates them: contradictory intents.
- `--clean`: `--clean` wipes the output directory that holds the
  pre-alloc groups the user is asserting exist.

Without a guard, `FillCommand.create_executions` silently returns a
single-phase plan and `FillingSession._load_pre_alloc_groups_from_folder`
then fails on a missing folder. Validation logic follows in the next
commit.
Add `_validate_flag_combinations` to `FillCommand.create_executions`
so contradictory flag pairs fail fast with `click.UsageError` instead
of silently falling through to a broken single-phase execution.

Rejected combinations:

- `--use-pre-alloc-groups` + `--generate-pre-alloc-groups`: the first
  asserts the groups already exist, the second regenerates them.
- `--use-pre-alloc-groups` + `--clean`: `--clean` wipes the output
  directory that holds the pre-alloc groups.

`--use-pre-alloc-groups` + `--generate-all-formats` remains valid and
single-phase, per the intent stated in 116e5093e83.
Swap `--generate-pre-alloc-groups` for `--generate-all-formats` in the
`bench-gas` recipe. After 116e5093e83, `--generate-pre-alloc-groups`
alone runs phase 1 only and produces no benchmark fixtures; the recipe
needs the full two-phase run to generate the `BlockchainEngineXFixture`
output it targets. Matches the flag used in `.github/configs/feature.yaml`.
Update documentation to reflect the phase-1-only behaviour of
`--generate-pre-alloc-groups` introduced in 116e5093e83:

- Remove the "Alternative approach" note in
  `filling_tests_command_line.md` that recommended
  `--generate-pre-alloc-groups` as a single-command replacement for
  `--generate-all-formats`: it now produces no fixtures.
- Reframe the `blockchain_test_engine_x.md` usage notes to describe
  the two-invocation workflow (`--generate-pre-alloc-groups` then
  `--use-pre-alloc-groups`) as the explicit alternative to the
  single-command `--generate-all-formats` path.
@danceratopz danceratopz added C-feat Category: an improvement or new feature A-test-fill Area: execution_testing.cli.pytest_commands.plugins.filler labels Apr 19, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 20, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 86.26%. Comparing base (e8f01a6) to head (c149eff).
⚠️ Report is 1 commits behind head on forks/amsterdam.

Additional details and impacted files
@@                 Coverage Diff                 @@
##           forks/amsterdam    #2720      +/-   ##
===================================================
+ Coverage            84.72%   86.26%   +1.53%     
===================================================
  Files                  524      599      +75     
  Lines                31117    37038    +5921     
  Branches              3036     3795     +759     
===================================================
+ Hits                 26365    31949    +5584     
- Misses                4181     4525     +344     
+ Partials               571      564       -7     
Flag Coverage Δ
unittests 86.26% <ø> (+1.53%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Copy Markdown
Member

@marioevz marioevz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@marioevz marioevz merged commit 8a85b54 into ethereum:forks/amsterdam Apr 22, 2026
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-test-fill Area: execution_testing.cli.pytest_commands.plugins.filler C-feat Category: an improvement or new feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants