Skip to content

feat(campaign): per-campaign event-injection rounds (part of #3)#36

Merged
PRATHAMESH75 merged 1 commit into
mainfrom
feat/3-configurable-inject-rounds
Jun 21, 2026
Merged

feat(campaign): per-campaign event-injection rounds (part of #3)#36
PRATHAMESH75 merged 1 commit into
mainfrom
feat/3-configurable-inject-rounds

Conversation

@PRATHAMESH75

Copy link
Copy Markdown
Owner

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

  • CampaignState gains scenario_b_inject_round / scenario_c_inject_round
    (default to the configured constants), persisted via to_dict / _load.
  • create_campaign accepts and range-validates the rounds
    (validate_inject_roundValueError → 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.

Tests

New test_campaign_inject_rounds.py (16 tests): validator range/coercion,
state defaults + custom round round-tripping, and create_campaign default /
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_campaign all hardcode three sims) plus frontend
work — left as a follow-up so this stays low-risk. Issue #3 stays open.

🤖 Generated with Claude Code

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>
@PRATHAMESH75 PRATHAMESH75 merged commit 36be651 into main Jun 21, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant