FEAT: Replace trial cloning with configurable trial populations#123
Draft
behnam-o wants to merge 1 commit into
Draft
FEAT: Replace trial cloning with configurable trial populations#123behnam-o wants to merge 1 commit into
behnam-o wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates RAMPART’s pytest @pytest.mark.trial semantics to stop cloning pytest items and instead supply trial population configuration through a dedicated trial_config fixture (with an optional --rampart-trials N CLI override). This avoids clone/xdist scheduling edge-cases while keeping population-style reporting.
Changes:
- Introduces an immutable
TrialConfigtype andtrial_configfixture, plus--rampart-trials Nto override population depth (n) without changing the declaredthreshold. - Removes collection-time trial cloning and replaces it with collection-time validation (including enforcing that trial-marked tests consume
trial_config). - Updates unit/integration/xdist tests and refreshes documentation/examples to reflect population execution being controlled by the test.
Reviewed changes
Copilot reviewed 22 out of 22 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| tests/unit/pytest_plugin/test_xdist_aggregation.py | Updates xdist aggregation tests to reflect “single pytest item that records multiple Results” populations. |
| tests/unit/pytest_plugin/test_trial.py | Adds unit tests for trial marker parsing/validation and CLI override resolution. |
| tests/unit/pytest_plugin/test_trial_integration.py | Adds subprocess/integration tests verifying fixture behavior and failure modes. |
| tests/unit/pytest_plugin/test_plugin.py | Removes cloning-related unit tests that no longer apply. |
| rampart/reporting/sink.py | Updates population_summary docstring to reflect multi-Result-per-test behavior. |
| rampart/pytest_plugin/plugin.py | Adds --rampart-trials, adds trial_config fixture, removes cloning logic, and enforces trial marker validation + fixture consumption. |
| rampart/pytest_plugin/_trial.py | New module implementing TrialConfig, CLI parsing helper, and marker/override resolution. |
| rampart/pytest_plugin/_session.py | Updates docstrings to clarify trial-spec paths are legacy/compatibility only. |
| rampart/pytest_plugin/init.py | Exposes TrialConfig on the public pytest plugin API. |
| pyproject.toml | Updates marker description to the new population/fixture semantics. |
| docs/usage/xdist.md | Updates xdist guidance to reflect that @trial no longer affects scheduling; adds --rampart-trials guidance. |
| docs/usage/pytest-integration.md | Updates marker semantics, adds trial_config fixture docs, updates examples and sample output. |
| docs/usage/configuration.md | Documents --rampart-trials N alongside other pytest options. |
| docs/usage/ci-integration.md | Updates CI guidance/examples to use trial_config and CLI override. |
| docs/usage/authoring-tests.md | Updates authoring guidance/examples to show trial_config usage in class-based tests. |
| docs/probes/behavioral.md | Updates probe example to execute a population via trial_config. |
| docs/glossary.md | Updates “Trial” definition to match population + trial_config semantics. |
| docs/getting-started/quickstart.md | Updates quickstart example/output to use trial_config and population execution pattern. |
| docs/getting-started/installation.md | Updates expected marker help output text. |
| docs/concepts/overview.md | Updates overview wording for trial marker semantics. |
| docs/attacks/xpia.md | Updates attack example to execute a population via trial_config. |
| docs/api/pytest-plugin.md | Adds _trial module docs entry (but currently misreferences TrialGroupResult). |
Comment on lines
+17
to
22
| ::: rampart.pytest_plugin._trial | ||
| options: | ||
| members: | ||
| - TrialConfig | ||
| - TrialGroupResult | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
[This change and #121 are related and will conflict with each other. will publish it after the other one is merged]
Summary
Replace pytest item cloning for
@pytest.mark.trialwith an explicittrial_configfixture.Tests now control population execution while RAMPART supplies:
--rampart-trials NCLI override for population sizetrial_configThis avoids clone-specific pytest and xdist behavior while preserving
population-level result reporting and legacy worker-payload compatibility.
Changes
TrialConfigpublic typetrial_configfixture--rampart-trials NoptionExample