Skip to content

Add workflow race condition simulation tests#9

Draft
Copilot wants to merge 2 commits intomainfrom
copilot/run-workflow-race-simulations
Draft

Add workflow race condition simulation tests#9
Copilot wants to merge 2 commits intomainfrom
copilot/run-workflow-race-simulations

Conversation

Copy link
Copy Markdown

Copilot AI commented Apr 15, 2026

The workflows community_ip_report.yml and false_positive_checker.yml have historically suffered from race conditions (RACE2, RACE5) when parallel runs concurrently write to shared files. No tests existed to verify that the fixes actually hold.

Changes

  • tests/test_race_simulations.py — 12 new tests across 4 classes simulating the documented race patterns:

TestRace2AppendOnly

Verifies that append-only writes prevent data loss vs. the old read-modify-write pattern. Includes a deterministic demonstration that RMW silently loses entries on conflict:

# Worker A and B both read the base state, then write back
overwrite_file(logfile, base_content_a + entry_a)  # Worker A
overwrite_file(logfile, base_content_b + entry_b)  # Worker B → entry_a is gone

TestRace5ResetReapplyAppendOnly

Simulates the git diff HEAD → /tmpreset --hard origin → re-apply loop for append-only log files. Covers single retry, dedup-on-retry (entry already on remote), and 5-attempt retry loops.

TestRace5ResetReapplyOverwrite

Simulates the backup/restore pattern for overwrite-semantics files (false_positive_report.md, false_positives_set.json) across the 5-attempt retry loop.

TestCombinedWorkflowRaceScenario

End-to-end: 2 and 5 parallel workers each operating in isolated directories against a shared in-memory "remote". Verifies no log entry or IP is lost after concurrent push/retry cycles.

Copilot AI and others added 2 commits April 15, 2026 18:44
Agent-Logs-Url: https://github.com/juergen2025sys/NETSHIELD/sessions/ed91b493-d8b5-4c75-89eb-97d9b0ed4f42

Co-authored-by: juergen2025sys <220786640+juergen2025sys@users.noreply.github.com>
Agent-Logs-Url: https://github.com/juergen2025sys/NETSHIELD/sessions/ed91b493-d8b5-4c75-89eb-97d9b0ed4f42

Co-authored-by: juergen2025sys <220786640+juergen2025sys@users.noreply.github.com>
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.

2 participants