Code review
AuraScore 79/100

High-Throughput Concurrency Review Specification

Audit multi-threaded code patches for race conditions, deadlocks, and shared-state synchronization issues.

Use this specification template when evaluating mission-critical pull requests that handle parallel processing or shared memory. It guides a deep code review targeting thread safety and lock contention.

Template

Role: Principal Distributed Systems Engineer with fifteen years of experience in thread safety, lock contention, and high-throughput actor systems.

Context

  • Target codebase repository: {{target_repository}}
  • Threading model in use: {{concurrency_model}}
  • Source code patch under review: {{critical_code_diff}}
  • Production target performance: {{throughput_target}}
  • Persistence and backing state layer: {{state_storage_engine}}

Task

Produce a concurrency review specification that inspects critical race conditions, deadlocks, and shared-state mutations to guarantee zero data corruption under peak load.

Method

  1. Trace all mutex acquisitions and released locks across the call graph in {{critical_code_diff}}.
  2. Evaluate re-entrancy risks and potential lock inversion scenarios between worker threads.
  3. Analyze memory visibility, cache coherence, and volatile reads against {{concurrency_model}}.
  4. Inspect atomic operations and compare-and-swap loops for livelock vulnerabilities.
  5. Audit interaction patterns with {{state_storage_engine}} for transaction isolation anomalies.
  6. Verify thread-safe lifecycle handling during graceful shutdown and context cancellation.
  7. Benchmark potential lock contention bottlenecks against the {{throughput_target}} benchmark.

Constraints

  • MUST specify exact line-level references for all identified race hazard vectors.
  • MUST NOT recommend coarse-grained global locks as acceptable remediation paths.
  • Include precise lock-ordering rules for multi-resource acquisitions.
  • Restrict recommendations to idioms native to {{concurrency_model}}.

Output format

  1. Concurrency Threat Matrix (Table: Component, Hazard Type, Risk Severity, Blast Radius)
  2. Synchronization Flow Analysis (Numbered step-by-step lock lifecycle evaluation)
  3. Remediation Code Specifications (Diff-style pseudocode with lock semantics)
  4. Performance Impact Summary (Max 250 words on {{throughput_target}} viability)

Self-review

  • Verified all lock paths identify potential deadlock inversion chains?
  • Confirmed state interactions with {{state_storage_engine}} account for non-repeatable reads?
  • Checked that line references directly correspond to {{critical_code_diff}}?
  • Ensured recommendations maintain lock-free invariants where applicable?
AuraScore breakdown
79/100Provisional
Instruction clarity15/15 · Strong

Explicit role, a named task, and discrete steps the model can follow.

Context architecture12/12 · Strong

Background, inputs and variables the model needs before it starts.

Constraint engineering8/12 · Adequate

Hard boundaries — what the model must and must not do.

Output specification6/14 · Thin

A named, field-level shape for the response.

Reasoning structure10/10 · Strong

Ordered work items that force analysis before an answer.

Model compatibility10/10 · Strong

Length and structure that travel across frontier models.

Token efficiency7/10 · Adequate

Signal density — instruction weight without padding.

Reusability7/7 · Strong

Documented variables so the scaffold adapts to new inputs.

Robustness3/5 · Adequate

Quality bar, assumptions and behaviour when inputs are thin.

Observed performance1/5 · Thin

How much real usage the template has behind it.

developers
developers-code-review
software-engineering-debugging
concurrency
thread-safety
code-review