Skip to content

fix(events): fill randomized slots with distinct activity IDs - #33

Open
mwg-bender[bot] wants to merge 5 commits into
devfrom
fix/22-unique-activity-ids
Open

mwg-bender[bot] wants to merge 5 commits into
devfrom
fix/22-unique-activity-ids

Conversation

@mwg-bender

@mwg-bender mwg-bender Bot commented Sep 22, 2026

Copy link
Copy Markdown

Summary

  • Draw only from games with unused activity IDs; repeated games remain allowed when Unique games only is off.
  • Keep existing draft and show an accessible error when filters cannot fill every slot; ignore orphan activities.
  • Preserve individual-slot rerolls and avoid exhausted pools when adding slots.
  • Add API generator and web handler regressions; document development checks.

Closes #22

Verification

.NET SDK 10.0.401; DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=1 because this runner lacks ICU. Commands use local .dotnet/dotnet and -p:NoWarn=NETSDK1188 to suppress invariant-mode locale warnings.

  • dotnet test MW-GC.EventManager.Tests/MW-GC.EventManager.Tests.csproj --no-restore --filter FullyQualifiedName~EventGeneratorTests: 5 passed, 0 failed.
  • dotnet test MW-GC.EventManager.Tests/MW-GC.EventManager.Tests.csproj --no-restore --filter FullyQualifiedName~SlotRerollTests: 22 passed, 0 failed.
  • dotnet build MW-GC.EventManager.slnx --no-restore: succeeded, 0 warnings, 0 errors.
  • git diff --check: clean.

Tests exercise production generator source and actual page handlers, not browser rendering or live Azure storage. No AGENTS.md, CONTRIBUTING.md, or docs directory existed on dev; README previously contained only the project title. Base dev is explicitly requested. No merge or deployment performed.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot review overview

🔵 Needs a closer look

Optimize repeated full-pool regrouping and scans that can make large requests quadratic.

Review effort: Lite
Findings: None

What changed in this PR

Updates randomized event generation to keep activity IDs distinct while preserving valid drafts, rerolls, and accessible errors.

Changes:

  • Handles exhausted and orphan activity pools.
  • Adds API and web regression tests.
  • Documents development checks.
File Summary
README.md Documents checks and selection behavior.
MW-GC.EventManager.Web/​Pages/​Events.razor Updates randomization, filtering, rerolls, and errors.
MW-GC.EventManager.Tests/​SlotRerollTests.cs Adds web-handler regression coverage.
MW-GC.EventManager.Tests/​MW-GC.EventManager.Tests.csproj Includes the production generator in tests.
MW-GC.EventManager.Tests/​EventGeneratorTests.cs Adds API generator regression coverage.
MW-GC.EventManager.API/​Services/​EventGenerator.cs Ensures distinct activity IDs during generation.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Exclude exhausted game pools, preserve drafts with a visible constraint error, and retain individual-slot reroll behavior. Add API and web regression coverage and document checks.

Closes #22

(cherry picked from commit 5070c6d)

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot review overview

🔵 Needs a closer look

Web generation can fail spuriously for satisfiable slot combinations due to greedy selection.

Review effort: Lite
Findings: None

The unique-games draw fixed each game to its first available activity and
failed whenever an early greedy pick stole the only activity a later game
could use, even when a valid assignment existed. Replace the greedy pass
with an augmenting-path (Kuhn's) bipartite matcher between games and
distinct activity IDs: randomize preference only, so earlier choices can
be reassigned and every game is considered before declaring failure.

Inject Random via an internal constructor for deterministic tests
(public parameterless ctor unchanged). Add xUnit regression tests
covering reassignment, games beyond an unmatchable initial subset,
multi-hop repair chains, and an exhaustive 512-graph feasibility oracle.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot review overview

🟡 Changes recommended

The web flow can reject valid unique-game assignments due to greedy selection.

Get a fresh assessment by requesting another Copilot review.

Review effort: Lite
Findings: 1 High severity

Open (1)

Comment thread MW-GC.EventManager.Web/Pages/Events.razor

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot review overview

🔵 Needs a closer look

Clear the stale generation error after successful selection mutations.

Review effort: Lite
Findings: None

Resolved since last review (1)

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot review overview

🟡 Changes recommended

Fix the critical web-handler issue that can silently drop slots when no activity is available.

Get a fresh assessment by requesting another Copilot review.

Review effort: Lite
Findings: 1 High severity

Open (1)

Comment thread MW-GC.EventManager.Web/Pages/Events.razor

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot review overview

🔵 Needs a closer look

Two moderate issues remain around validating stale game and activity selection callbacks.

Review effort: Lite
Findings: None

Resolved since last review (1)

This branch has not been deployed

No deployments
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