feat(campaign): per-campaign event-injection rounds (part of #3)#36
Merged
Conversation
The competitive/crisis events were injected at globally-fixed rounds (Config.SENTIMENT_SCENARIO_B/C_INJECT_ROUND = 7/14). Expose them as per-campaign settings so a user can change the injection cadence before running, while defaults preserve the current 7/14 behavior. - CampaignState gains scenario_b/c_inject_round (default to the configured constants); persisted via to_dict/_load. - create_campaign accepts and range-validates the rounds (validate_inject_round raises ValueError -> API 400) before provisioning any simulation. - The parallel run loop schedules injection from the per-campaign rounds. - POST /campaign threads scenario_b/c_inject_round from the request body. Scope: this covers the injection-rounds half of #3. Configurable *scenario count* still requires restructuring the fixed A/B/C provisioning and is left for a follow-up. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
What
Makes the competitive/crisis event-injection rounds per-campaign settings
instead of globally-fixed constants (
SENTIMENT_SCENARIO_B/C_INJECT_ROUND=7/14).
Why
Part of #3 (Configurable scenario count & event-injection rounds). A user can
now change when events fire before running a campaign; defaults preserve the
current 7/14 behavior.
Changes
CampaignStategainsscenario_b_inject_round/scenario_c_inject_round(default to the configured constants), persisted via
to_dict/_load.create_campaignaccepts and range-validates the rounds(
validate_inject_round→ValueError→ API 400) before provisioningany simulation.
POST /campaignthreadsscenario_b/c_inject_roundfrom the request body.Tests
New
test_campaign_inject_rounds.py(16 tests): validator range/coercion,state defaults + custom round round-tripping, and
create_campaigndefault /custom / invalid paths (invalid rounds raise before provisioning). Full backend
suite: 116 passed.
Scope / follow-up
This is the injection-rounds half of #3. Configurable scenario count needs
restructuring the fixed A/B/C provisioning (
create_campaign,get_campaign_status,delete_campaignall hardcode three sims) plus frontendwork — left as a follow-up so this stays low-risk. Issue #3 stays open.
🤖 Generated with Claude Code